teleren/devto huggingface dataset:
Difference between Load Testing and Stress Testing
Tags: performance, testing, load, stress
Published: 2020-01-03 16:34:25

If you are working on performance engineering, you use the following terms frequently: load testing and stress testing. Most of us think that the objective of load and stress testing are almost the same, but it is not. Let me explain it with a simple example.

# New Year; New Beginning

Hitting gym in a new year? First, we warm up, then work out in a treadmill and then tries small weight dumbbells. If they are comfortable in lifting more weight, then they proceed. Assume than you are able comfortable in lifting 30lbs (one set), then your capacity is 30lbs. Period.

Similarly, think of you as a server and weight as the load (number of requests/hits/users/transactions per second). 

**Load Testing** helps to study the system's behavior under the normal load. During load testing, defined number of users will be injected gradually and the performance will be measured (typically response time). 

![Difference between Load Testing and Stress Testing](https://media.giphy.com/media/N3WRZ7KswksrC/source.gif)


# Stress Testing

Now you are comfortable in lifting 30lbs, but your friend is challenging you that you cannot lift 35lbs. But you are confident and tries 35lbs. You feel okay after lifting 35lbs. Then he insists you to try 40lbs. But you give up after trying. 

From the above exercise you determine that your capacity is 30 lbs and but you can lift 35 lbs and you cannot go beyond that. Now, your breaking point is 35 lbs.

Similarly, in **Stress testing** you inject the load beyond the defined number of users step by step (or using any other patterns) and measures the breaking point of the system.

In load testing, you measure the response time, but in stress testing, you measure the breaking point and the other parameters such as response time, system resources etc. 

Breaking point could be anything, response time, system resources, throughout etc. 

You can checkout [my blog](https://qainsights.com) for more such articles.
GraphQL in 10 Minutes [Video]
Tags: graphql, beginners, tutorial, webdev
Published: 2020-01-03 16:31:06

[GraphQL](https://graphql.org/) is an API query language and runtime.

In the newest video on the [Bytesized Code YouTube channel](https://www.youtube.com/channel/UC046lFvJZhiwSRWsoH8SFjg), I'll explore what GraphQL is, why you would use it, and topics like:

- What is a GraphQL query?
- What is a GraphQL mutation?
- What is a GraphQL resolver?

{% youtube HWE1zlhQiT8 %}

If you enjoyed the video, give it a thumbs-up, and [subscribe to our channel](https://www.youtube.com/channel/UC046lFvJZhiwSRWsoH8SFjg?sub_confirmation=1) for more web dev content every week. We also have a newsletter where we send out what's new and cool in the web development world, every Tuesday – [join here](https://www.bytesized.xyz/newsletter)!
Class vs Pure vs Functional Components in React 
Tags: codenewbie, react
Published: 2020-01-03 16:30:15


When first learning React and looking through source code on the Internet, I found myself slightly confused by the different types of components. Although one could go about only using class components throughout his or her application, pure and functional components can come in handy and allow for more clarity/organization within an application. Let's get into the differences between the three components.

**Class components**

Class components are the go-to components in React. They can be used exclusively throughout an entire application, and are the components that are most frequently used. Here is an example of a very simple class component.

```react
   import React from 'react'
 
   class App extends React.Component {
     render() {
      return <div></div>
      }
   }
 
   export default App

```

**Pure components**

So what exactly are pure components? As the name suggests, the concept of a pure component is very similar to that of a pure function. In a pure function, if you put in the same input "x" number of times, you will get the same output "x" number of times. Putting in the same input will always lead to the same output in a pure function. Similarily, if a pure component is given the same state and props, it will always behave in the same way. A pure component does not have access to `shouldComponentUpdate`. What this means is that there is an automatic, shallow comparison of old and new props and state. Pure components are written pretty much the same way as class components with a minor tweak. 

```react
   import React, { PureComponent } from 'react'
 
   class App extends PureComponent {
     render() {
       return <div></div>
     }
   }
 
   export default App
```

**Functional components**

Functional components come in handy when you know that you don't need to include state or lifecycle methods in your component. Class components automatically check for lifecycle methods, and if you don't need to utilize them, you can simply use functional components. Because there are no lifecycle methods, `render` is not used. Functional components are a good option when all you want do is display something in your component and not include logic. They can take in props from parent components and re-render based on changes in props in the parent components. Functional components can also re-render if their parent components re-render. A functional component returns JSX and can be written like this:

```react
   import React from 'react'
 
   const App = props => {
     return (
       <div>{props.message}</div>
     )
   }
 
   export default App
```
grep command [ Linux tips ]
Tags: linux, beginners, bash
Published: 2020-01-03 16:24:39

---
title:grep command [ Linux tips ]

published: true  

description: Basics about the grep command

tags: linux, beginner, bash 

cover_image: "https://cdn.pixabay.com/photo/2014/02/22/21/21/glasses-272399_960_720.jpg"


series: Linux tips
---


Grep command can be used to filter or search text from files or input streams.

Basic usage,
	   
`grep “text_to_search” fileToSearch`

In here the “text_to_search” can be a plain string or a regular expression. 

###Example 1

Assume that we need to find whether the text “user login failed” has appeared in a log file. Then we can use the grep command like below.

`grep “user login failed” logFile.txt`

After running the above line grep will print the lines of text which includes the text “user login failed”.

Another very useful way we can use grep command is to filter out input streams like the output of another command (or another grep command). 

###Example 2

Let’s say you want to find out whether a file is there in a folder which contains like 1000 other files. We can simply use the grep command to find out that like below.

`ls | grep “file_name_to_find” `

In here the ‘|’ (pipe) will send the output of the `ls` command as an input to the `grep` command(but it’s not a `grep` specific operator).

So these are the most common ways we can use grep to make our lives easier and it has limitless usages but grep has many more options too. Below are some of the options we can use.

-n : prints the line number
-o : prints only the matching part of the text
-c : prints the number of matches

###Example 3

If we want to know how many files have the name as the file name in the above example we can simply use the -c option.

`ls | grep -c “file_name_to_find” `
Leaving IOS for Android
Tags: iphone, android, mobile, pixel
Published: 2020-01-02 06:26:21

# I made a decision to leave IOS 

I have spent the last 10 years in a love/hate relationship with Apple. I’ve given them a lot of my hard earned cash through iPhones, macs and various accessories but I’ve made the decision to leave the iPhone behind.

I really like Apple products in the way that they are designed exceptionally well and everything *just works*.

Recently though, I’ve not wanted to upgrade my iPhone 7 for the last 4 years because none of their latest products excite me. But also I feel like I am locked in or held prisoner by Apple. I’ve invested so heavily in their infrastructure that I can’t step outside for fear of losing out.

Little things over the years have become annoyances like the way Apple treats its customers, the way they fail to adopt standards like USB-C, or the way their stuff just doesn’t play well with other devices.

I am quite stubborn and made a similar decision over 5 years ago when I closed my Facebook account. The external pressure begging me to stay part of the club ends up pushing me away further. So, when I’ve made my decision that’s it.

I ordered a Google Pixel 4 XL yesterday and have taken the biggest tech leap in my phone ownership. I’m excited in a way that waiting for the latest Apple phone never made me.

Change is good right?
Docker CMD vs ENTRYPOINT
Tags: docker, devops
Published: 2020-01-03 16:07:58

TL;DR

`CMD` allows you to define the *default* command with params when the image gets executed in a container. 
`ENTRYPOINT` allows you to specify a command or script that needs to be executed. 
Both can be used in conjunction to get them to specify the Entrypoint and default arguments. 

This is a quick summary of the difference between CMD and ENTRYPOINT and to know when to use what. 

In essence, when you execute:

```
   docker run ubuntu
```

The docker container would run and exit immediately. This due to the fact that containers are expected to die out soon as it's done with what it's supposed to do. For instance, running the above command will execute `bash` and immediately exit. 

But, if you do the following:

```
   docker run -it ubuntu top
```

This would result in the container running the `top` command on the container and it will wait for us to exit the program so that it would exit.

So, in general, the container's lifespan is only until the task it's assigned to run completes. 

### CMD

The CMD command in docker, basically allows us to execute a command. Defining this at the end of the Dockerfile allows us to create an image that will execute that given command whenever the image is invoked. 


```Dockerfile

FROM alpine

CMD ["sleep", "10"]
    
```

This script would literally halt the container for 10 seconds before it exits.

We still have the ability to override the CMD command by specifying a command on the URL.

```
   docker run name-of-the-image-built sleep 1 
```

### ENTRYPOINT

Entrypoint basically executes a command / script anything that you would specify and passes trough whatever that you specify in the docker run command.

```
FROM alpine

ENTRYPOINT ["sleep"]

```

When you build and run this Dockerfile, it will basically fail. 

```
  docker run alpine-with-entry-point 
```

Because the sleep command expects 1 argument. So to get this to work, you would run:

```
  docker run alpine-with-entry-point 10
```

Doing the above is essentially equal to saying `sleep 10` when the image gets run.

The downside with an Entrypoint is, that if your command needs an argument like in the example above, you need to specify it always. Not having would result in the container crashing with an error. To overcome this we can do the following:

```Dockerfile

FROM alpine

ENTRYPOINT ["sleep"]

CMD ["10"]

```

This would essentially make sure that 10 gets passed into the sleep command as a default argument if nothing is passed. Avoiding any crashes due to missing args.

Most of the content I have written about here are  my notes from following the docker course I came across on [youtube](https://www.youtube.com/watch?v=zJ6WbK9zFpI&t=3032s)
Use `trap` to catch signals - Linux Tips
Tags: bash, linux, ubuntu
Published: 2020-01-03 16:02:44


Say we have a `test.sh` file, the content is:

```bash
$ cat test.sh
#!/usr/bin/env bash
echo "Pid: $$"
#
# catch signal #10 and do echo
trap 'echo "Caught signal user1"; exit' 10
while /bin/true ; do
  sleep 5
done
```

You can see inside we use `$$` to print out the process pid, then use `trap` command to catch signal #10 then echo some messsages out.

Let's run it:

```bash
$ bash test.sh
Pid: 16195

```

Now let's open another terminal window, use `kill` command to send #10 signal (SIGUSR1) to this pid. (BTW, if you are not familiar with `kill` command, `kill` doesn't mean actually kill the process, you can treat it as a "send-signal" command in this case)
```bash
$ kill -10 16195
```

Now in the first window you can see:
```
Caught signal user1
```

Which means we caught the #10 signal.

P.S. to see all signal numbers, use `kill -l` or `trap -l`
```bash
$ kill -l
 1) SIGHUP  2) SIGINT  3) SIGQUIT  4) SIGILL  5) SIGTRAP
 6) SIGABRT 7) SIGBUS  8) SIGFPE   9) SIGKILL 10) SIGUSR1
...
```
CodePen of this week #2
Tags: codepen, weekly, webdev, javascript
Published: 2020-01-03 16:01:19

This week, I discovered this. 
It's unique on its own, untraditional use of radio buttons. but I don't know it feels good to me.

### Rhyme of the week
#### it's made with just CSS, nothing more nothing less.

{% codepen https://codepen.io/co0kie/pen/oNgjoBz %}
Design Systems con ReactJS y Storybook
Tags: react, javascript, storybook, designsystems
Published: 2020-01-03 15:02:12

Documentar y probar tus componentes de React de forma aislada utilizando Storybook.

![Storybook React](https://cdn-images-1.medium.com/max/4276/1*a4s-rq6LnhDmCNGreCSvdQ.png)*Storybook React*

**tl;dr:** En esta entrada, aprenderemos cómo configurar toda la infraestructura necesaria para construir un sistema de diseño de componentes reutilizables en React, utilizando Storybook.*

Comencemos por entender que un sistema de diseño es una serie de componentes que se pueden reutilizar en diferentes combinaciones. Los sistemas de diseño te permiten gestionar el diseño. Si vamos a a [designsystemsrepo.com](http://designsystemsrepo.com) podrá ver los sistemas de diseño utilizados por algunas de las compañías más grandes y las marcas más sólidas, como Priceline, Apple, IBM, WeWork, GitHub e incluso el gobierno de los EE. UU.

Los sistemas de diseño pueden ser un importante multiplicador de la productividad en cualquier proyecto o empresa de tamaño mediano a grande, ya que podemos documentar nuestros componentes a medida que los desarrollamos, garantizando una apariencia y sensación coherente en todas las pantallas, y teniendo un flujo de trabajo continuo entre diseñadores y desarrolladores.

{% youtube guteTaeLoys %}

A lo largo de este video, construiremos progresivamente un sistema de diseño muy simple que contiene un solo botón, pero mostraré varias de las funciones que Storybook puede ofrecer para mejorar nuestra experiencia de desarrollado y la velocidad del proyecto.

Aprendermos a configurar los StoryBook utilizados en la producción por todos, desde Lonely Planet hasta Uber, pero al mismo tiempo, lo mantendremos lo más simple posible, para que podamos reutilizar estas API para nuestras necesidades futuras.

¡Espero que esto haya sido útil y/o te haya hecho aprender algo nuevo!
Using Try/Catch to Suppress Aborted Download Errors
Tags: coldfusion, cfml
Published: 2020-01-03 15:45:40

After upgrading some projects to ColdFusion 2016, we started encountering errors in the logs that were related to client-aborted downloads.

> *java.io.IOException: An established connection was aborted by the software in your host machine.*

After determining that it wasn't a server problem (ColdFusion, IIS, WAF, etc), we added some try/catch logic to suppress the error from showing up in our logs.

Here's some sample [CFML code](https://gist.github.com/JamoCA/52c17718ab6a4e047994c6bf3f7dd1f4) that we've been using.  *(DISCLAIMER: We don't use or recommend CFContent on projects that use very large files, take a long time to generate or require streaming.)*

{% gist https://gist.github.com/JamoCA/52c17718ab6a4e047994c6bf3f7dd1f4 %}
Exploring How lit-html Works: Introduction
Tags: javascript, typescript, webcomponents, devjournal
Published: 2020-01-03 14:58:20

In this series, How lit-html works, I will _explore_ (not explain) internal implementation of [lit-html](https://lit-html.polymer-project.org/).

Before diving into actual code, it will be good to see overview of the contents of `/src` directory.

|Name|Description|
|---|---|
|directives/|In this directory, built-in directives are defined.|
|lib/|In this directory, actual internal logics are implemented.|
|polyfills/template_polyfill.ts|As written in the comment in the file, it is defined that a lightweight <template> polyfill that supports minimum features to cover lit-html use cases. |
|test/|In this directory, files to test lit-html features.|
|env.d.ts|Interfaces of `ShadyCSS`, `ShadyDOM`, and `Window` are defined.|
|lit-html.ts|This is the main file, in which `html` and `svg` functions are defined.|

From the next post, I will cover each directory and file so that we can understand what happens inside the library.
TravelPeri – Introducing a new web app that I built to find bucket-list attractions in each
country!
Tags: travel, react, webdev
Published: 2020-01-03 14:42:32



If you're looking for concise, clear-cut lists of top-tourist attractions that should be in your bucket-list when visiting a particular country - TravelPeri is for you! Navigate through various countries seamlessly using our pannable map or search bar.

What sets TravelPeri apart from other such alternatives is the ability to view travel-times/distance to each of the listed attractions on request if location permissions are allowed.

This web app is ideal for people with less time on their hands for research or just for quick reference while on the move - so keep us Bookmarked!

Below is an in detail break down of the app functionality:

1.Use the pannable map or search bar to select a country of your choice.

2.The user will be presented with a list of the top-tourist attractions/destinations in that particular country. Links to Google map coordinates and TripAdvisor Reviews for each attraction will be displayed on the information card.

3.Press the "Show nearest attractions" button to sort the list of attractions by travel time/ETA. If you are on the country page you're currently located in, the sort will take place based on your current location while for other countries you will be prompted to enter a city/locality from which the sort needs to happen.

Product Link: https://www.travelperi.com/
To read more on TravelPeri head over to our FAQ: https://www.travelperi.com/FAQ
Our Product Hunt Launch: https://www.producthunt.com/posts/travelperi
Is it time for a new job in 2021?
Tags: career
Published: 2020-01-03 14:32:14

1) Are you excited to go to work every day or every other day?

2) Do you and your immediate peers respect each other?

3) Do you really like your head technical leaders?  "Yes I learn a lot from them and they are really helpful and respectful".

4) Are your daily stand ups a way to solve impediments? "Yes we always focus on solving problems and do not feel embarrassed when due dates are missed".

5) Do you feel a nice collaborative environment? "Yes they listen to me and try to understand", "I feel my ideas really matter".

6) Are you satisfied with your current salary? "Yes, they pay me fairly for this sector and my skill level".

7) Are you only working on legacy stuff? "Well yes, but they promised us three years ago, we'd be going to the latest/greatest, we start next month".

Be honest with yourself by reaching deep to answer the questions above.  Your job is never utopia as you know, but if it is hellish, your health is at stake. Is your health worth donating?

Going into 2021 make sure you 1) Save your health and 2) Get paid for what you are really worth.
Daily Challenge #153 - Horse Race Gamble
Tags: challenge
Published: 2020-01-03 14:30:19

---
title: Daily Challenge #153 - Horse Race Gamble
published: true
series: Daily Challenge
description: How many possible combinations of winners are there at the horse race?
tags: challenge
---
###Setup
Your friend likes to go to the horse races and gamble on which horses will finish first, second, and third place. Unfortunately, he doesn't know how many horses will be entering until he gets to the track. 

Write a function that will take any number of horses as its only argument. This function must return the total number of different combinations of winners for the gold, silver, and bronze medals. 

For example, if there are 15 horses, there are 2730 possible unique combinations of winners. If the number of horses is 3 or less, return the input value. If the number of horses is not an integer, return `undefined`. 

###Examples
horses(15), 2730, true)
horses(2.5), undefined, false)

###Tests
horses(12)
horses(2)
horses(11)
horses(a)

Good luck!

***
_This [challenge](https://www.codewars.com/kata/563b8a23b554206f49000059) comes from tu6619 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!_
Ruby on Rails - list validators for a given model
Tags: ruby, rails
Published: 2020-01-03 14:28:34

You can easily list given model validators by calling `validators` method on the class name:

```ruby
User.validators # => array of validators
```

If you define presence validator on your `User` model:

```ruby
class User < ActiveRecord::Base
  validates :email, presence: true
end
```

you can access validator attributes the following way:

```ruby
email_presence_validator = User.validators.first
email_presence_validator.class # => ActiveRecord::Validations::PresenceValidator
email_presence_validator.attributes # => [:email]
email_presence_validator.options # => {}
```

The `options` method returns options like `:if` or `:unless` conditions that are passed to the validator definition as extra arguments. Experiment with other types of validations to see how it's working.

Thank you for reading! Follow me on [Twitter](https://twitter.com/pdabrowski6) to be up to date with the latest tips, articles, and videos about programming.
What's your JAMstack backend of choice?
Tags: javascript, serverless, jamstack
Published: 2020-01-03 14:23:21

---
title: What's your JAMstack backend of choice?
published: true
description: Which platform do you prefer for adding dynamic sections to your JAMstack powered sites?
tags: javascript, serverless, jamstack
---

I've tried both Airtable, Netlify, and clay.run for adding simple functions & database support to my JAMstack powered blog.

Was curious if there are other options out there. The less infrastructure setup the better.