teleren/devto huggingface dataset:
Exception Handling (python)
Published: 2020-12-15 18:56:28

When an error occurs, or exception as we call it, Python will normally stop and generate an error message. Exceptions are events that are used to modify the flow of control through a program when the error occurs. Exceptions allow programmers to jump an exception handler in a single step, abandoning all function calls.
Exception handling is solved in three procedures given below:

1)Try - The try block lets you test a block of code for errors.

2)Except - The except block lets you handle an error.

3)Finally - The finally block lets you execute code, regardless of the result of try & except block.

Try Block :
These exceptions can be handled using the try statement. If the Python program contains suspicious code that may throw the exception, we must place that code in the try block. The try block must be followed with the except statement, which contains a block of code that will be executed if there is some exception in the try block.

Example :
The try block will generate an exception, because x is not defined:

try:
  print(x)
except:
  print("An exception occurred")

Since the try block raises an error, the except block will be executed. Without the try block, the program will crash and raise an error:

print(x)

Except :
You can define as many exception blocks as you want, e.g. if you want to execute a special block of code for a special kind of error. Python provides the flexibility not to specify the name of exception with the exception statement.

Example :
Print one message if the try block raises a NameError and another for other errors:

try:
  print(x)
except NameError:
  print("Variable x is not defined")
except:
  print("Something else went wrong")

Finally :
The finally block, if specified, will be executed regardless if the try block raises an error or not. Python provides a keyword finally, which is always executed after try and except blocks. The finally block always executes after normal termination of try block or after try block terminates due to some exception.

try:
  print(x)
except:
  print("Something went wrong")
finally:
  print("The 'try except' is finished")

Example :
Try to open and write to a file that is not writable

try:
  f = open("demofile.txt")
  f.write("Lorum Ipsum")
except:
  print("Something went wrong when writing to the file")
finally:
  f.close()
¿Que es Gatsby?
Tags: gatsby
Published: 2020-12-15 18:52:58

Gatsby es un framework open source muy rápido, tando en desarrollo como en producción. Integra tecnologías como React, GraphQL y diferentes fuentes de información como Firebase, Wordpress o Sanity. Es veloz porque compila la aplicación mientras estamos en desarrollo, para que el sitio en producción obtenga todos los beneficios de las SPA.

 Una de las cosas más interesantes de este framework son los plugins. Esto es código de Gatsby que escribió alguien más de la comunidad para que nosotros podamos configurar nuestra aplicación lo más ágil y rápido posible.

Acá les dejo el proyecto de ecommerce que realice en el curso de desarrollo de Aplicaciones web con Gatsby JS

https://ps-nicoposa.netlify.app/
Day 7 of JavaScriptmas - Count Vowel Consonant Solution
Tags: scrimba, 24daysofjavascriptmas, javascript
Published: 2020-12-15 18:52:50

Day 7 is counting the sum of vowels and consonant in a single string. A vowel will value of 1 and consonant will give value of 2. 

For example, `abcde` will give value of 8.
`a=1, b=2, c=2, d=2, e=1` so `1+2+2+2+1` is 8. 

This is the JavaScript solution
```javascript
function countVowelConsonant(str) {
    let strArray = str.split('');
    let vowels = ['a','i','u','e','o'];
    
    let result = strArray.reduce((total, letter) => {
         return vowels.includes(letter) ? total + 1 : total + 2;   
    }, 0);
    
    return result;
}

```
Day 6 of JavaScriptmas - Sort By Length Solution
Tags: scrimba, javascript, 24daysofjavascriptmas
Published: 2020-12-15 18:51:02

Day 6 is how to sort an array that has different length of value. 
This is helpful to sort name based on length of the name in the array by using `sort` method. 

For instance an array `['Samuel','Jon','Karra','Hery']` sorted into `['Jon','Hery','Karra','Samuel']`

This is JavaScript solution
```javascript
function sortByLength(strs) {
    return strs.sort((a,b) => a.length - b.length);
}
```
Day 5 of JavaScriptmas - Reverse String Solution
Tags: scrimba, 24daysofjavascriptmas, javascript
Published: 2020-12-15 18:49:56

Day 5 is Reverse string. The classic problem to reverse string. 

For instance string 'Hello' reversed into 'olleH'.
Since a string can be `split` into array, we can reverse the arrangement of array with `reverse` and concat the array with `join` to reverse it back into single string.

There is JavaScript solution
```javascript
function reverseAString(str) {
    return str.split('').reverse().join('');
}
```
Day 4 of JavaScriptmas - Century From Year Solution
Tags: scrimba, 24daysofjavascriptmas, javascript
Published: 2020-12-15 18:48:19

Day 4 is to calculate a century based on the value of year.

For instance year 1700 will be 17 centuries. And 1905 will be 20 centuries. 

There is JavaScript solution
```javascript 
function centuryFromYear(num) {
    
    let modulo = (num % 100 === 0) ? 0 : 1;
    let centuries = Math.floor(num / 100);
    
    return modulo + centuries;
}
```
Day 3 of JavaScriptmas - Chunky Monkey Solution
Tags: scrimba, 24daysofjavascriptmas, javascript
Published: 2020-12-15 18:46:24

Day 3 is how to split single array based on the size we provide. 

for instance single array with 4 value `[a,b,c,d]`. 
We split it into 2 size `[[a,b],[c,d]]`. 

so the new array should be has 2 array inside. 

There is JavaScript solution
```javascript

function chunkyMonkey(values, size) {
    let newArray = [];
    let index = 0;
    
    while(index < values.length) {
        newArray.push(values.slice(index, index += size));
    }
    
    return newArray;
}

```
Day 2 of JavaScriptmas - Deposit Profit Solution
Tags: scrimba, 24daysofjavascriptmas, javascript
Published: 2020-12-15 18:43:58

Day 2 challenge is calculate the money on the bank. Each year the money increases with same growth rate. 

For instance, $100 deposit with $20 growth rate. How many year the money will be about $170 in the bank?

At year 0: $100
At year 1: $120
At year 2: $144
At year 3: $172.8

So there is the JavaScript solution
```javascript
function depositProfit(deposit, rate, threshold) {
    
    // initial yearCount 0
    // deposit year 0
    // 
    // loop while threshold >= deposit
    //      rate = deposit * 20/100
    //      deposit += rate
    //      initial year += 1
    // return year
    // 
    
    let yearCount = 0;
    let depositCount = deposit;
    
    while(threshold >= depositCount) {
        let rateCount = depositCount * (rate/100);
        depositCount += rateCount;
        yearCount += 1;
    } 
    return yearCount;
}

```
Day 1 of JavaScriptmas - Candies Solution
Tags: scrimba, 24daysofjavascriptmas, javascript
Published: 2020-12-15 18:41:19

The 1st challenge is to count how many candies of each child gonna be get if someone has X candies.

for instance, if granpa have 10 candies and there are 3 grandchildren. 
How many each child going to be get candy?
So 10/3 is 3.33. In general, each child has 3 candies. 
Total candies for children will be 3*3 is 9.

So there is JavaScript the solution
```javascript
function candies(children, candy) {
    let eaten = Math.floor(candy/children);
    return children * eaten;
}
```
#Day 12: BFS and DFS, Complexity
Tags: 100daysofcode
Published: 2020-12-15 18:38:24

Since I was not at all confident in finding the complexity og my programs, I practiced these type of questions from https://medium.com/@manishsundriyal/overview-time-space-complexity-f973513b701e .
This is really nice. I solved all of them correctly except the recursive Fibonacci series.

Also, I came across Swap Nodes problem on HackerRank. As I had completely no idea how to solve it, I looked in the Discussion section for some help. There I read someone's comment saying that it can be easily solved using BFS.
This term was new for me, so I studied what BFS and DFS actually is. I'll try to solve this question tomorrow.
栗原vs井上ライブファイトの見方
Published: 2020-12-15 18:17:28

メインイベントでは、井上拓真に対してOPBFバンタム級タイトルタイトルを守る栗原圭太が登場します。

栗原vs井上ライブ: https://kuriharavsinoue.live/go/

栗原は2019年11月のスクプラセルドポンピタクとの最後の戦いでOPBFバンタム級タイトルを獲得しました。今では2021年1月に栗原は井上と戦います。

栗原の伝記
栗原は日本のプロボクサーです。彼は1993年12月1日に東京で生まれました。彼は日本のボクシングの最大のスターです。彼のポジションは日本で3位、世界ランキングは12位です。

出生名 : 栗原慶太

出生 : 1993-01-10

年龄 :  27

出生地 : Tokyo, 日本

身高 : 5′ 7½″/ 172cm

重量 : 118.0 lbs

量级 : 最轻量级

井上伝記
井上拓真は日本のプロボクサーです。彼は2018年から2019年までWBC暫定バンタム級タイトルを保持し、WBCバンタム級タイトルに一度失敗したことがあります。

出生名 : 井上拓真

出生地 : Zama, Kanagawa, 日本

出生 ; 1995-12-26

年龄 : 24

身高 : 5′ 4½″ / 164cm

重量 : 118.0 lbs

量级 : 最轻量级

栗原圭太vs井上琢磨？
日付 : 木曜日、1月14日

時間 : 12:00 AM ET

栗原は1月14日（木）に井上戦でOPBFバンタム級タイトルを守るためにリングに戻る。試合は午前12時から始まる。 ET。

栗原vs井上はどこで行われているのですか？
戦いは東京の後楽園ホールで上演されます。当局は、現在から1月までのCOVID-19ガイドラインに依存しますが、会場の2,005人の収容人数の一定の割合までチケットを販売することができます。
Why are interpersonal skills so important on software development teams?
Tags: webdev, career, devops, culture
Published: 2020-12-15 18:16:44

Eric Silverman, CEO and cofounder of FeaturePeek, discusses why interpersonal skills matter on software development teams and how having a Growth Mindset can set you up for success as a software engineer.

Eric's GitHub: https://github.com/eric-silverman

Learn more about FeaturePeek: https://featurepeek.com/
Learn more about the Mintbean developer community: https://mintbean.io/
Devs: what do you want to know about working as a designer? Answer for the chance to be featured on our podcast!
Tags: discuss, podcast
Published: 2020-12-15 18:13:37

---
title: Devs: what do you want to know about working as a designer? Answer for the chance to be featured on our podcast!
published: true
tags: discuss, podcast
---

The [DevDiscuss Podcast](https://dev.to/devdiscuss) begins with an interview and ends with commentary from listeners — and we like to feature the actual _voices_ from our community!

> ### **This week's prompt: “As a developer, what do you want to know about working as a designer?”** 
  
For your chance to appear on an upcoming episode, answer the question above by:

- Calling our Google Voice at +1 (929)500-1513 and leave a message 📞

- Sending a voice memo to pod@dev.to 🎙

- OR, leaving a comment here (we'll read your response aloud for you) 🗣

_Please send in your recordings by TOMORROW Wednesday, December 16th at Midnight, ET (9 PM PT, 5 AM UTC)_

_**Voice recordings will be given priority placement**_ 😉 

---

Don't forget to check out the latest episode [here](https://dev.to/devdiscuss/s3-e5-improving-your-onboarding-for-early-career-devs)
What is IDaaS and Why Use One?
Tags: webdev, programming, security
Published: 2020-12-15 18:04:33

If you're reading this article, you might be interested to learn how to implement user management for your application, understanding the complete picture of how identity management services work. That's what we'll do in this article. You'll learn what is Identity as a Service (IDaaS), why to use such a service, what is Single Sign-On (SSO), and IDaaS platforms.

Let's dive in!

## What is an Identity Provider as a Service (IDaaS)?

### Manual user identity management

In order to get access to an application, back in the days, you would have to share your credentials such as your username and password with the application maintainers.

For a developer, user identity management is a complex feature to build and manage, especially security-wise. You'd be responsible if someone would gain access (hack) into the users' identities and use those for their purposes.

Let's go through a real-life scenario where your client has requested to implement the Login/Registration feature for the application you're building.

Inspired by the [dev.to](https://dev.to/) platform, as seen in the image below, your client wants to give the users an option to access the application using social accounts such as Twitter or GitHub.

![dev-to-login](https://dev-to-uploads.s3.amazonaws.com/i/d8j1u5p0nskmj5jfls60.png)

---

### Follow the article [here](https://www.webiny.com/blog/what-is-idaas-and-why-use-one?utm_source=Dev-to&utm_medium=webiny-blog&utm_campaign=webiny-cross-promotion-dec-15&utm_content=webiny-idaas-blog&utm_term=W00422) to read the below titles 🚀

#### Open Authentication and OpenID Connect protocols

#### Identity as a Service provider (IDaaS)

#### How does IDaaS actually work?

#### What is SSO?

#### The key benefits of SSO Login

#### Why should you use an IDaaS provider?

##### Customer Benefits of Using an IDaaS

##### Business Benefits of Using an IDaaS

#### What are the most popular IDaaS providers?

---

Now that you clearly understand Identity Providers and what they offer, you'll be able to decide if you want to use such a service and focus on building business value or continue using and maintaining a custom authentication solution. If you're interested in our future blog posts, [subscribe](https://landing.mailerlite.com/webforms/landing/g9f1i1) to our **newsletter** and you'll be notified when we have interesting topics to share!

---

Thanks for reading! My name is **Albiona** and I work as a developer relations engineer at [Webiny](https://www.webiny.com/?utm_source=Dev-to&utm_medium=webiny-site&utm_campaign=webiny-cross-promotion-dec-15&utm_content=webiny-website-dev-to&utm_term=W00423). I enjoy learning new tech and building communities around them = ) If you have questions or just want to say hi, reach out to me via [Twitter](https://twitter.com/albionaitoh).
How do you measure productivity?
Tags: productivity, analytics, performance, career
Published: 2020-12-15 17:58:49

Hey Dev community! Maxim here from the Merico team. We spend a ton of time thinking about engineering productivity: 
How to measure it? How to define it? How to improve it? 

All simple questions with tricky answers. I'd love to hear from you on what you have used in the past that has worked whether tools, metrics, or techniques! 

Hope to hear from you, and look forward to the conversation! 

Disclosure: On Thursday we are releasing a free version of our analytics product to give developers better insights and data into their own performance and productivity. We are on a mission to help people articulate their accomplishments to become better coders and achieve more in their careers!
Common CSS Methodologies and BEM
Tags: css, beginners, webdev
Published: 2020-12-15 17:41:41

When we code small sites it usually does not matter how we organize the styles. However, when it comes to larger, more complex projects, how you organize your code is the key to efficiency in at least these three ways: it affects how long it takes you to write code, how much of that code you’ll have to write and how much loading your browser will have to do.

##What is a CSS Methodology?

A CSS methodology is a set of guidelines for writing modular, reusable and scalable code.

##some of the common CSS Mythologies.

###Object-Oriented CSS (OOCSS)
In OOCSS the structure is separated from the skin. The methodology makes a clear distinction between content and its containers.

###Atomic CSS
In this method we define single-purpose class selectors for every reusable declaration. In other words create a class selector for every repeating CSS declaration. This allows ease in maintaining consistent code and not having to invent classes for components requiring a single CSS rule.

###Scalable and Modular Architecture for CSS
SMACSS works by dividing CSS into five categories – base, layout, module, state and theme – commonly split into separate files.SMACSS provides well-organised CSS code split logically across multiple files.

###BEM
BEM (Block, Element, Modifier) is a component-based approach to web development. The idea behind it is to divide the user interface into independent blocks. This makes interface development easy and fast even with a complex UI, and it allows reuse of existing code without copying and pasting.

Example of classes named with BEM convention below:

```CSS

/* Block component */
.btn {}

/* Element that depends upon the block */ 
.btn__price {}

/* Modifier that changes the style of the block */
.btn--orange {} 
.btn--big {}

```

The block component `.btn` is like a parent element. All of the child elements of this block should have a name like `.btn__price`, written with two underscores after the block element. Style is applied to the block element like 
`.btn--orange`, written with two hyphens after the block element.


##Why BEM ?

BEM is easier to understand than some some of the others above but still provides us the good architecture we want and with a recognizable terminology. Some advantages include:

1)If we want to make a new style of a component, we can easily see which modifiers and children already exist. 

2)We can quickly get an idea of which element depends on another (in the previous example we can see that .btn__price depends on .btn)

3)Provides Modularity ,Reusability and Structure.

4)BEM gives everyone on a project a declarative syntax that they can share so that they’re on the same page.
JS Quirk: Element IDs are global variables!
Tags: javascript
Published: 2020-12-15 17:32:31

Here's an interesting quirk I recently discovered:

<b>Any HTML element containing an id creates a global variable of the same name.<b>

Let's start with our HTML:
```html
<html>
  <head></head>
  <body>
    <h1 id="title">Hello World</h1>
  </body>
</html>
```

This is what we'll see in the console when we reference <code>window.title</code>:
<img src="https://res.cloudinary.com/dzynqn10l/image/upload/v1608051521/JS%20Bits/global-id-variable_mgvpqi.png">

There's some interesting behavior with this though. You can overwrite this variable as you'd expect:

<img src="https://res.cloudinary.com/dzynqn10l/image/upload/v1608051743/JS%20Bits/global-id-variable-overwrite_zgjihy.png">

But let's say we deleted our `<h1>` element and added another with the same id. Would this overwrite the global variable again?

<img src="https://res.cloudinary.com/dzynqn10l/image/upload/v1608052092/JS%20Bits/global-id-variable-overwrite-2_bkahsz.png">

It does not! 😮

That's probably a good thing since this would probably cause many a confused developer!

Although I couldn't locate the documentation for this quirk in the DOM specification, this behavior appears consistent across Chrome, Firefox, Edge, and Safari. Interesting!

----------
Check out more #JSBits at my blog, [jsbits-yo.com](http://jsbits-yo.com/). Or follow me on [Twitter](https://twitter.com/JS_Bits_Bill)!
Git, Git, Git: what the heck is Git?
Tags: git, github, merge
Published: 2020-12-15 17:25:09

I have to admit that when I was learning to code and my coach came with the term “control version”, it took a while until I grasped what he meant by that. Git came to my early life as a developer, and since that very moment, it is not very easy to get rid of it.

But what is Git and what is meant by control version? Well, the easiest way to describe it is like you have a very accurate record of your project at any time, and **not only local** -at your computer- **but also remote** -on services like GitHub or GitLab. 

So for example, let’s say you create a project from scratch, let’s say you are creating your portfolio page, and you are keeping a record of every single (important) step you are making. **This way you can accomplish several things: you can always take a look where you are, where you began, what you have done so far, share your code, import your code, etc**.

Git is much more than that but I think that it a very good definition to start with!

Once we understand the term control version, we should jump onto the “branches” culture.

We like working in a relatively organised way, right? In order to do it properly, developers work with branches. Let’s say you have your main branch, normally called **master**. The easiest approach could be to have in this branch the best and most recent version of our project. Imagine you create a branch called footer and then you create the footer and when you are done, you say: footer branch should be included in my main branch. This process is called merge.

Why is this approach so cool? Because **you can ask your friend Mario to create for example the header branch, your friend Luigi to create the main section branch, while you take care of your precious footer. And at the end of the day every one merges its branch into master**. 

This is also a very easy way to have a classical git merge conflict! But since this article was meant to talk about happy things, git conflicts will be addressed in another article.

All in all, Git is really cool, there are a couple of tutorials that are worth watching and will fast increase your value as a developer while you learn to master it. 

Ah, and if you messed it up a lot with Git, there is one page you should know: [https://ohshitgit.com/](https://ohshitgit.com/)

That’s all for today!
👽Xiami Unboxing: Mi band 5 (and comparison with Mi 4) | 2021
Tags: review, xiami, youtube
Published: 2020-12-15 17:24:33

⬇️I'm making a quick unboxing of Xiami Mi Band 5 and I compare with the previous model the Xiami Mi 4.
Both of the bands have a really good battery but they also come with some cons... Watch the video and learn more

💪More info: 
Xiaomi Mi Band 5 Smart Sports Fitness Watch, 1.1" 

Featuring a large 1.1" dynamic color display, approximately a 20% increase in screen size compared to the previous model, makes incoming calls, messages and alerts easier to see and ushers in a new era of dynamic dials.

-Display Type AMOLED
-Screen Resolution 126x29 pixels
-Battery Capacity 125 mAh
-Average Battery Life 14 days
-Sensors 
   Accelerometer
   PPG (Heart Rate)
   Three-axis gyro
   Vibration
-Bluetooth Yes
-Water Resistant 5ATM
-Compatible Devices/Operating Systems 
      Android 5.0 Lollipop
       iOS 10.3




----------------------------

👋Hello, I'm Eleftheria, an app developer, master student, freelancer, public speaker, and chocolate lover.

🥰If you liked this video please share

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](paypal.me/eleftheriabatsou) but If you can't that's ok too!


**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/elef_in_tech)