teleren/devto huggingface dataset:
Daily Challenge #197 - Population Growth
Tags: challenge
Published: 2020-02-28 13:30:19

---
title: Daily Challenge #197 - Population Growth
published: true
series: Daily Challenge
description: How many years will it take for a population to grow?
tags: challenge
---
###Setup
Implement a function to calculate the growth of a population of people. The function should be able to take several parameters, including `p0`(starting population), `percent`, `aug`(inhabitants coming or leaving each year), and `p`(population to surpass). This function should output n(number of years needed to get a population of `p`).

Don't forget to convert the percent parameter as a percentage in the body of your function: if the parameter percent is 2 you have to convert it to 0.02.

###Example
In our example, the population is p0 = 1000 at the beginning of a year. The population regularly increases by 2 percent per year and moreover 50 new inhabitants per year come to live in the town. 

How many years need to pass for the town to see its population greater or equal to p = 1200 inhabitants?

<pre>
At the end of the first year there will be: 
1000 + 1000 * 0.02 + 50 => 1070 inhabitants

At the end of the 2nd year there will be: 
1070 + 1070 * 0.02 + 50 => 1141 inhabitants (number of inhabitants is an integer)

At the end of the 3rd year there will be:
1141 + 1141 * 0.02 + 50 => 1213

It will need 3 entire years.</pre>

###Tests
nbYear(1500, 5, 100, 5000)
nbYear(1500000, 2.5, 10000, 2000000)
nbYear(1500000, 0.25, 1000, 2000000)
***
_This [challenge](https://www.codewars.com/kata/563b662a59afc2b5120000c6) comes from g964 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!_
Find all files with a specific name and show their file size
Tags: beginners, tutorial, productivity, linux
Published: 2020-02-28 14:06:20

---
title: "Find all files with a specific name and show their file size"
description: "Find all files with a specific name and show their file size"
published: true
tags: ["Beginners", "Tutorial", "Productivity", "Linux"]
series: Shorties
---

## Problem

I updated my books worth reading and didn't know, if I already made some notes for any of them.

Therefore I need a command to search for a specific file name on my device and have a look at their file size. No need to search in the file content.

---

## Solution (Linux)

Thinking about the steps:

1. Find every file that has a specific pattern in its file name.
2. See the file's size.

```sh
find [location] -iname "[pattern]" -exec [command] {} \;
```

---

## Result

I search in my home folder (`/home/miku86`) for any files containing `pragmatic` (because of `Pragmatic Programmer`).

![result of search and file size](https://dev-to-uploads.s3.amazonaws.com/i/rfq5kjyd4xipxk89a2rk.png)

So there are two files, a pdf and a md.

---

## Explanation

`find`: use the find tool
`/home/miku86`: search in this directory
`-iname "*pragmatic*"`: search for `pragmatic`, can have some characters in front or behind `pragmatic`, case doesn't matter
`-exec du -sh {} \;`: run the tool to estimate the file size usage for every found file and return a summary in a human-readable format

---

### Further Reading

- [manpage: find](https://linux.die.net/man/1/find)
- [manpage: du](https://linux.die.net/man/1/du)
Ruby try-except alternative?
Tags: ruby, beginners
Published: 2020-02-27 22:37:23

Do you know the idea of try-catch or try-except?

This is used to handle errors that occur during the execution of a program. Errors can happen anytime, like file can't be opened or out of memory error.

Your program shouldn't crash if that happens, so the try-catch or try-except block is used.

## Try-except in other languages

The concept isn't unique to one programming language. Many programming language support this structure.

In <a href="https://docs.microsoft.com/en-us/cpp/cpp/try-throw-and-catch-statements-cpp">C++</a>, there's this code sequence, where try does the statements and catch handles the faults:

```java
try {
   // ...
} catch (...) {
   // ...
}
```

In Python, you can use <a href="https://pythonbasics.org/try-except/">try-except-finally</a>. Here try executes statements, except catches possible exceptions and finally always is run. So like this:

```python
try:
    # try block
except:  
    # catch exception
finally: 
    # will always get executed
```

## Ruby try-catch

But what about the <a href="https://ruby-lang.co/">Ruby</a> programming language?

Ruby is somewhat similar to Python, but it's different in a variety of ways.

Although I like the idea of try-except, Ruby doesn't have the traditional try-catch or try-except code block, instead it uses a begin-end sequence that works similarly:

```rb
begin
     some_code
rescue
     handle_error  
ensure 
    this_code_is_always_executed
end
```

Here is an example:

```rb
begin
    raise "Error"
rescue RuntimeError
    puts "Runtime error encountered and rescued."
end
```

Another example:

```rb
begin  # "try" block
    puts 'I am before the raise.'  
    raise 'An error has occured.' # optionally: `raise Exception, "message"`
    puts 'I am after the raise.'  # won't be executed
rescue # optionally: `rescue Exception => ex`
    puts 'I am rescued.'
ensure # will always get executed
    puts 'Always gets executed.'
end 
```
Builders Cards - component variations - for PX Partnership
Tags: codepen
Published: 2020-02-28 13:40:19

<p>These are some nice cards for navigating to other pages. If your website has 4 colors in the theme, it will work brilliantly.</p>

<p>Components for <a href="http://www.px-partnership.co.uk/" target="_blank">http://www.px-partnership.co.uk/</a></p>

{% codepen https://codepen.io/chris_tudor/pen/ExaMKLy %}
Currently I'm Thinking About Writing Currently
Tags: career
Published: 2020-02-28 13:27:12

Good morning, friends! Here's a brief message on clear and concise communication: currently, currently is one of the most overused words in our industry currently.

Tech recruiters are especially generous with this word.
* Currently we are seeking a developer with 31 years of Angular experience
* We are currently located in Annapolis
* Currently we build software at the moment

I hope you are laughing at the third example—it's my personal favorite offender.

Consider these alternatives:
* We seek a developer with 2 years of React experience, or experience in other libraries/frameworks and an interest in learning on the go.
* We are in Annapolis Junction (Marylanders may get this reference)
* We build software

Often _currently_ is a placeholder word, like _um_. It can be used for emphasis or to imply upcoming changes, such as, "We have no openings currently." It creates a weakness where you want to be communicating in an active voice. Did you notice the subtle, bonus difference between these two sentences?
* Currently we are seeking a developer
* We seek a developer

Which one is more affirming, more in command? 

If you don't find this advice helpful, or if you think that I'm gatekeeping, let me know in the comments.
Good programmers write code, great programmers face its consequences.
Tags: beginners, career, showdev, codequality
Published: 2020-02-28 13:23:40

It goes without saying that techies are highly opinionated about a lot of technical concepts or paradigms.


Wait! Am I strongly opinionated here?


Anyway, that is not the point of this write-up. 



Many people write "clean code",  "dirty code" or whatever that is called, forgetting that coding is all about trade-offs.


A lot of beginner software developers are too dogmatic about some concepts because their role models use them without considering the trade-offs such role models chose willingly.


Whenever you write code, whether it is meant to solve a technical problem or others, you have to expect its concequeences -- good or bad.

When you write clean code some other things suffer just like how some things suffer when you write "dirty code".


Some innocent coders, based on all they have read, think once you have written "clean code" everything is alright but we have learnt the hard way that there is always more to writing "clean" or "dirty" code (If there is anything like these).


There are consequences.


It is one thing to write code; it is another thing to face the consequences of whatever written.


In an attempt to face such consequences, a lot of great concepts have been provided.


Some provided DRY, WET, TDD or Clean Code to reduce the  consequences of the code written.


Many software developers have forgotten that our coded solutions also come with their own consequences.


The only code with no consequences, in programming context, is unwritten code.


So, software developers must always be on the look out for the consequences of the code written.


Good software engineers write code, great software engineers face its consequences.


[Meet me on twitter](www.twitter.com/codingnninja)
How To Navigate Blind Turns While Riding?
Tags: bikeriding, motorbike, ridingtips
Published: 2020-02-28 10:55:46

---
title: How To Navigate Blind Turns While Riding?
published: True
tags: bike-riding, motorbike, riding-tips
canonical_url: 
---

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

"You might think that you have become proficient in bike riding but you never know when you’re riding skills are put to test due to the constantly changing or unpredictable situations that can arise”, says Peter Salzano, a vet by profession and bike rider by choice. He has explored various parts of the world with his motorbike and his experience has taught him that roads are unpredictable. For someone who is new at bike riding must know how to navigate blind turns safely. Here are a few  tips to help beginners ride safely on the most dangerous roads.

According to him, a blind left-hand turn is a little easier to navigate than the right-hand one as you can see further around the road. There are a few things that a rider should ask himself while traversing on a road full of twists and turns. Does the road maintain a constant radius or all along or the radius decreases near the turn? Is there debris at the corner? Does the inclination remain the same? 

Every rider to instantly slow down whenever they suspect a narrow turn on the road so that they are able to maintain a wider line at the entrance of the turn. Doing this will help you adapt to a decreasing radius. Riding close to the inside line can be very dangerous especially if the turn seems to be tightening as you can be forced way wide at the corner’s exit.

Another thing you can do is to position yourself and your bike on the left-hand side of the road but more towards the center without hugging the dividing line so that you’re clear of oncoming traffic while leaning over. That would work as your escape plan in times of need. This goes for both left and right-hand turns.

Riding motorcycles is one of the most fun and exciting thing to do but safety should be the primary concern. Young riders be conscious and aware of the dangers that can be encountered while bike riding and [learn to tackle](https://www.peterjsalzano.com/2020/01/07/top-3-bike-maintenance-tips-by-peter-j-salzano/) them before setting out for adventures.
Neumorphic Boxes
Tags: codepen
Published: 2020-02-28 13:17:07

<p>The full article that inspired: <a href="https://uxdesign.cc/visual-trends-that-ui-designers-should-keep-an-eye-on-e622d9086310" target="_blank">https://uxdesign.cc/visual-trends-that-ui-designers-should-keep-an-eye-on-e622d9086310</a></p>

<p>More about neumorphism <a href="https://uxdesign.cc/neumorphism-in-user-interfaces-b47cef3bf3a6" target="_blank">https://uxdesign.cc/neumorphism-in-user-interfaces-b47cef3bf3a6</a></p>

{% codepen https://codepen.io/chris_tudor/pen/zYGvgZJ %}
Draggable Isometric Branding Mockup Free Scene from mockupcloud.com
Tags: codepen
Published: 2020-02-28 13:12:42

<p>Download the Free scene from 
<a href="https://www.mockupcloud.com/free/isometric-branding-mockup-free-scene" target="_blank">https://www.mockupcloud.com/free/isometric-branding-mockup-free-scene</a> </p>

<p>There are multiple layers, the shadow is a separate layer to blend with the background. Anything else is straightforward, having a draggable plugin that works with jQuery.</p>

{% codepen https://codepen.io/chris_tudor/pen/JjogvzL %}
Lessons for architectural design from Netflix
Tags: todayilearned, architecture, microservices
Published: 2020-02-28 13:03:12

*TL;DR notes from articles I read today.*

### [Adopting microservices at Netflix: lessons for architectural design](http://bit.ly/32wtU4X)

- Create a separate data store for each microservice and let the responsible team choose the DB that best suits the service. To keep different DBs in sync and consistent, add a master data management tool to find and fix inconsistencies in the background. 
- Use the immutable infrastructure principle to keep all code in a given microservice at a similar level of maturity and stability. So, if you need to add or rewrite code for a service, it is best to create a new microservice, iterate and test it until bug-free and efficient, and then merge back once it is as stable as the original.
- You want to introduce a new microservice, file or function to be easy, not dangerous. Do a separate build for each microservice, such that it can pull in component files from the repository at the appropriate revision level. This means careful checking before decommissioning old versions in the codebase as different microservices may pull similar files at different revision levels.
- Treat servers, especially those running customer-facing code, as stateless and interchangeable members of a group for easy scaling. Avoid ‘snowflake’ systems where you depend on individual servers for specialized functions. 

*[Full post here](http://bit.ly/32wtU4X), 7 mins read*

---

### [Forget monoliths versus microservices. Cognitive load is what matters](http://bit.ly/3adz609)

- As psychologist John Sweller describes it, cognitive load is the total mental effort in working memory. It can be intrinsic (aspects fundamental to the task), extraneous (relating to the environment the task is done in), and germane (aspects needing special attention for learning or higher performance).
- You should aim to minimize intrinsic load (with training, technologies, hiring, pair programming, etc.) and eliminate the extraneous load of boring or superfluous tasks to allow more space for germane cognitive load, or value-added thinking.
- Prevent a software system from growing beyond the cognitive load of the team responsible for it. Explicitly define platforms and components to reduce extraneous load too.
- Create well-defined interaction patterns among the team. Also, minimize inter-team dependencies. 
- Rather than small, cross-functional product or feature teams, build independent stream-aligned teams (based on a line of business, or market segment or specific geography, for example) that can analyze, test, build, release and monitor changes largely without affecting other teams. 
- Build the thinnest viable platform for each team, with the smallest set of APIs, documentation, and tools to accelerate their work.  

*[Full post here](http://bit.ly/3adz609), 9 mins read*

---

*[Get these notes directly in your inbox every weekday by signing up for my newsletter, in.snippets().](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
Daily Developer Jokes - Friday, Feb 28, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-02-28 13:00:25

---
title: "Daily Developer Jokes - Friday, Feb 28, 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=Friday%2C%20Feb%2028%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/5e1259ce87a7e.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:___ What did the Network Administrator say when they caught a nasty virus?

___A:___ It hurts when IP
 -->
Feb. 28, 2020: What did you learn this week?
Tags: weeklylearn, discuss, weeklyretro
Published: 2020-02-28 12:19:15

It's that time of the week again. So wonderful devs, what did you learn this week? It could be programming tips, career advice etc.

![Reading a book in windy conditions](https://media.giphy.com/media/fhAwk4DnqNgw8/giphy.gif)

Feel free to comment with what you learnt and/or reference your TIL post to give it some more exposure.

{%tag todayilearned %}

And remember, if something you learnt was a big win for you, then you know where to drop it as well.👇👇🏻👇🏼👇🏽👇🏾👇🏿

{% link https://dev.to/jess/what-was-your-win-this-week-2pl0 %}

![Little kid on Jeopardy answering a question correctly](https://media.giphy.com/media/2sXf9PbHcEdE1x059I/giphy.gif)
Rate my personal website
Tags: react, nextjs, showdev, javascript
Published: 2020-02-28 11:39:48

Hi guys,

I'm looking for feedback on my newly created personal website. 
You can find it here: https://website-thomas.thomasledoux1.now.sh. 
The source code can be found here: https://github.com/thomasledoux1/website-thomas

Quick preview: <img src="https://snipboard.io/JnUW1m.jpg"/>

It was created with NextJS, I wrote some custom animations, used React Hooks, used some illustrations from unDraw, lazy loading for the images, and other speed optimizations. 
It's currently lacking a resume section, this will be added in a later stage, I'll create it from scratch in HTML and provide a PDF download option for it. 

Any other suggestions/remarks are more than welcome!
If you have any questions about how I implemented something, I'll gladly elaborate :-).

Thank you!
Differences of concat() and spread operator
Published: 2020-02-28 11:38:40

#

I have gone through this confusion what is the difference between the array operations concat() and spread(...) operator. Both are doing the same function of adding elements to the array. I searched the internet and came with the ideas and loved to share with the world.

1. 'concat()' will add the elements at the end of the array while spread operator can be used to add elements at any part of the array.
![Code Example](https://dev-to-uploads.s3.amazonaws.com/i/vwxa6bya3jg55hp0pxe1.png)

2. While appending string to an array using spread operator has to be cautious as spread literally spread the string to letters and add it to the array. Concat() will add the string as a single word.
![Code Example 1](https://dev-to-uploads.s3.amazonaws.com/i/r3rhid28fu17gs0ql1i5.png)

3. When working with large arrays, spread will go out of memory and may throw error while concat can handle comparatively larger arrays.

4. Spread operator will get the value from a generator function while concat() will push the generator return to the array. This shows that the spread operator will iterate through the items and append the value to the array.
![Code Example 2](https://dev-to-uploads.s3.amazonaws.com/i/cacrv872c6kx4c7lxrzq.png)

5. Spread operator is efficient when used with single paramater as it iterates through the item check its type to split and insert in to the array. While concat() can used for multiple parameters that is to be inserted in to the array when directly append the given elements to the array.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ebiko29kjav4hhvnzjd8.png)

To state, it depends upon the problem which we solve decides what to use and how to use. There are many other differences also, but these that got my attention to write a blog. Thanks.
Pimping up your console.log output
Tags: consolelog, customisingconsolelog, javascript
Published: 2020-02-28 11:36:29

---
title: Pimping up your console.log output
published: true
description: 'By adding a custom method to console we can enjoy pimped up output without any hassle'
tags: console.log, customising console.log, javascript
---

With a bunch of `console.log` statements sometimes it's a bit hard to track which one is printing out in the console and even with `console.log('name of var ==>', var)` approach sometimes it's easy to get lost, so how about we will add our own custom method to `console` and pimp it up a bit with styles? 

Since we can do it with default `.log` method by doing:

```javascript
console.log('%cbanana','font-family:helvetica;color:white;font-weight:bold;font-size:3em')
```

And of course it is annoying to type all of these every time we want to console.log something, we are going to add our custom method to `console` and call it instead. 

First we will add a method to the `console` prototype and make it a function, taking the data to be printed out as an argument and returning the styled output:

```javascript
console.__proto__.me = (what)=>{return console.log(`%c${what}`, 'font-family:helvetica;color:white;font-weight:bold;font-size:3em')}
``` 

Now we can print stuff by doing:

```javascript
console.me('banana')
```

And the output would be this:

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

Hard to miss, huh? 

Cheers!
dotConnect for QuickBooks & SSIS Components for QuickBooks Now Support OAuth 2.0
Tags: quickbooks, ssis, dotconnect, oauth
Published: 2020-02-28 11:34:11

---
title: dotConnect for QuickBooks & SSIS Components for QuickBooks Now Support OAuth 2.0
published: true
description: Devart announced support of OAuth 2.0 authentication in dotConnect for QuickBooks 1.10 and SSIS Data Flow Components 1.12.
tags: QuickBooks, SSIS, dotConnect, OAuth
---

*Devart announced support of OAuth 2.0 authentication in dotConnect for QuickBooks 1.10 and SSIS Data Flow Components 1.12.*

Devart, a recognized vendor of professional database management software for developers and data connectivity solutions, introduced support of OAuth 2.0 authentication in [dotConnect for QuickBooks 1.10](https://www.devart.com/dotconnect/quickbooks/) and [SSIS Data Flow Components 1.12](https://www.devart.com/ssis/download.html). The old connection parameters like Access Token, Access Token Secret, Consumer Key, and Consumer Key Secret are no longer in use, thus they were removed from the products.

Connecting to QuickBooks using OAuth 2.0 requires a different set of connection parameters. Now users need to specify only Company Id and Refresh Token in their connection strings. Also, that can be automatically done at design time by clicking the Web Login button in the connection editors, signing in to QuickBooks, and selecting a company to connect to. 

**OAuth 2.0** is the industry-standard protocol for authorization. It enables a third-party application to obtain limited access to an HTTP service, either on behalf of a resource owner by orchestrating an approval interaction between the resource owner and the HTTP service, or by allowing the third-party application to obtain access on its own behalf. 

Learn more about the recent update at the vendor website — https://blog.devart.com/oauth-2-0-support-in-dotconnect-for-quickbooks-and-ssis-components-for-quickbooks.html

**About Devart**

Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects.
For additional information about Devart, visit https://www.devart.com/