teleren/devto huggingface dataset:
Understanding Kubernetes: part 16 – Useful tools - part 2
Tags: kubernetes, devops, docker, beginners
Published: 2020-05-01 12:12:57

---
title: Understanding Kubernetes: part 16 – Useful tools - part 2
published: true
description: Serie of sketchnotes about Kubernetes. Explaining in a visual way Kubernetes principles.
tags: Kubernetes, DevOps, Docker, beginners
series: Understanding Kubernetes in sketchnotes
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/kllsrftbqjj54f92iwyl.jpg
---

Understanding Kubernetes can be difficult or time-consuming. In order to spread knowledges about Cloud technologies I started to create sketchnotes about Kubernetes. I think it could be a good way, more visual, to explain Kubernetes (and others technologies).

We continue the serie of Sketchnotes about Kubernetes, with some useful tools to know.
In this second part we will see: k9s, k3s and skaffold.

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

If you are interested, I published all the sketchnotes on Kubernetes (and new ones!) to make a "book" of 120 pages: ["Understanding Kubernetes in a visual way"](https://gumroad.com/aurelievache#uCxcr).

As usual, if you like theses sketchnotes, you can follow me, and tell me what do you think. I will publish others sketchs shortly :-).
Hero section design
Tags: codepen, uiuxdesign, webdesign, graphicdesigner
Published: 2020-05-01 12:12:54

Spring is here, so let's play with some interesting colors. We have decided to make simple but powerful hero, which you can later use to make amazing websites. 

Color Palettes we used to make this hero is from https://colorhunt.co/. They have amazing color palettes and you can use them for making great things. For this purpose, we used this two palettes: Color Palette 179350 and Color Palette 180405. 

We will show you some photos and give you the link to our codepen profile where you can find cool things and use them. Enjoy! 

Here is the link: https://codepen.io/blackdot.

{% codepen https://codepen.io/blackdot/pen/LYpzYaw %}
What was your win this week?
Tags: discuss, weeklyretro
Published: 2020-05-01 12:10:45

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

👋👋👋👋

Looking back on your week -- what was something you're proud of?

All wins count -- big or small 🎉

Examples of 'wins' include:

- Getting a promotion!
- Starting a new project
- Fixing a tricky bug
- Finishing a puzzle...or whatever else that may spark joy 😄

![parakeet-jigsaw-puzzle](https://media.giphy.com/media/FLxXxBxkzqInu/giphy.gif)

Happy Friday!
Daily Developer Jokes - Friday, May 1, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-05-01 12:00:06

---
title: "Daily Developer Jokes - Friday, May 1, 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%20May%201%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/5e125896e0846.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 was the developer unhappy at their job?

___A:___ They wanted arrays.
 -->
Your Own Gravatar.com
Tags: go, gravatar, jira
Published: 2020-05-01 11:06:40

### The Problem

After a a few years of running Jira as a pool of federated servers, management decided to let us consolidate into a Jira Datacenter cluster. We provisioned extremely beefy VMs, allocated huge disks and got a dedicated Postgres cluster. Projects were imported, attachments migrated and we were pretty pleased with ourselves until the user feedback started: we hadn't imported the user's custom avatars correctly and rapid boards looked like hot garbage. 

![Broken Jira avatars](https://dev-to-uploads.s3.amazonaws.com/i/cwp4gg5yqfy6qkh506q0.png)

The [vendor's instructions](https://confluence.atlassian.com/jirakb/custom-avatars-missing-after-upgrade-or-migration-of-jira-server-224395280.html) are geared toward moving whole instances from one platform to another, which didn't fit our model of merging multiple Jiras together. After some deliberation we decided to try hosting avatars on an independent server.


### Hosting your own Gravatar server

After experiments with the API, and a discussion about making changes directly in the database we decided to try using a custom avatar server. After a surprisingly frustrating day trying to get [Libravatar](https://www.libravatar.org/) on RHEL7, we settled on the comparatively simpler  Go project [intravatar](https://github.com/bertbaron/intravatar). Intravatar offers [binaries](https://github.com/bertbaron/intravatar/releases) that work beautifully right out of the box, but we made a few simple changes to accommodate our MitM SSL and Internet proxying. Now that we have a place to serve them from, let's get avatars!


### Grabbing Jira avatars

Jira stores avatar files under `$JIRA_HOME/data/avatars` in the format of $ID_$name, so we used the REST API to associate usernames and avatar files. The below bash script will get a list of users from the Jira database, parse details from the user endpoint and scrape the instance's avatar URL to get a file.

```
#!/usr/bin/bash

# Database connection string is intentionally vague.
psql -tc "select lower_user_name from cwd_user;" | while read USER
do
	curl -snk "https://$OLD-JIRA/rest/api/2/user?username=$USER" | jq .avatarUrls | grep 48 | grep -q $OLD-JIRA && (
		# Get old avatar
		FILE=$(curl -snk "https://$OLD-JIRA/rest/api/2/user?username=$USER" | jq ."emailAddress" | tr -d '"' | tr -d "\n" | md5sum - | awk '{ print $1 }')
		URL=$(curl -snk  "https://$OLD-JIRA/rest/api/2/user?username=$USER" | jq .avatarUrls | grep 48 | awk -F"\"" '{ print $4 }')

		echo "$URL" | grep gravatar && (
			curl -snk $URL > $FILE
		)

		echo "$URL" | grep gravatar || (
			curl -snk > $FILE
		)
	)
done
```

My team <3s [Bert Baron](https://github.com/bertbaron) and [intravatar](https://github.com/bertbaron/intravatar)
Post Makers - Week 7
Tags: jobhunt, quarantine, covid19, junior
Published: 2020-05-01 10:59:42

Happy Friday everyone!

It's raining, we are stuck inside but for some reason i'm more upbeat than I was last week. I actually managed to get a couple of application rejections, but they were quite personal responses with some feedback - strange that this would make me happy, but it's nice to know someone actually read the applications, and took the time to respond.

2 weeks ago I changed my tactic after speaking to some peers. Before I would basically write a novel of my journey, findings and thoughts of programming, and my CV was 3 pages of every success I have ever achieved! It took a good friend to say "would you read it?" for me to have that penny drop moment.... So now i have a slick 1 page tech CV, which details facts that can then be elaborated on in interviews. I am now in the school of "drop nuggets in the CV you want them to ask you about, and invite you for an interview" kind of thought. Cover letters are now trimmed too, rarely more than 2/3 of a page (before they could be 2+....).

I have been carrying on with the React Covid project, and deep into the world of Chart.js. I just love the data and viewing it in different formats. It's also a very interesting way to spot trends and project what is around the corner for the Covid 19 crisis, but I wont get too deep into that on here, positivity is key!

This weekend I am going to go back over some old JavaScript projects and upgrade them to ES6, the more React i do, the more i see the value of this ES^ over ES5 (which we primarily used at Makers).

Anyway same as always, stay safe and positive!

David
How to base64 encode an image in javascript
Tags: base64, image, tip, javascript
Published: 2020-05-01 10:54:28

---
title: How to base64 encode an image in javascript
published: true
description: You will learn how you can encode an image as a base64 string in client side js, it can even be used in the browser console.
tags: base64, image, tip, javascript
---
A few days ago I was looking for a way to quickly put an image as a string to send it in a message. I remembered that it was possible to use base64 for that but I did not remember the exact procedure.

I had to get bits from different stackoverflow answers to get it working. I decided to write this article to save you a few minutes.

```javascript
function imgToBase64(img) {
  const canvas = document.createElement('canvas');
  const ctx = canvas.getContext('2d');
  canvas.width = img.width;
  canvas.height = img.height;

  // I think this won't work inside the function from the console
  img.crossOrigin = 'anonymous';

  ctx.drawImage(img, 0, 0);

  return canvas.toDataURL();
}
```

Let's try it:

1. Here is a beautiful [photo](https://unsplash.com/photos/Tf6oEb01AsI) of [Xochimilco](https://en.wikipedia.org/wiki/Xochimilco), in Mexico City, Mexico taken by Jeremy Lishner on Unsplash. You can follow the link, if you want, but I included the image so you don't have to leave this page.

![Photo by Jeremy Lishner on Unsplash](https://dev-to-uploads.s3.amazonaws.com/i/e9mjs0bave9abnd2xh54.jpg)

2. Open the console (Ctrl + Shift + I).
3. Paste the code. We will have `imgToBase64` available as a function.
3. Click the pick icon on the top left (Ctrl + Shift + C) and select the image. Now you will have a reference to the DOMElement with `$0`.
4. Type `copy(imgToBase64($0))`. Now you have the image string in the clipboard, ready to paste somewhere else.

Sometimes you get an error `SecurityError: The operation is insecure.`, this is related to the `crossOrigin` attribute, you can manually change the value to anonymous `$0.crossOrigin = 'anonymous'` and repeat step 4.

**Tip:** You can test the base64 image string you just created by pasting it in the url of a browser tab. Like this:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/a9yuy45i0942meqg9vqq.png)

That's it... I hope you find it useful.
Automating git push with just a single bash command
Tags: git, bash, linux, devops
Published: 2020-05-01 10:18:43

Say you are working on a project or learning something or doing challenge like #100daysofcode and you are only person who is committing files to the github repository. Wouldn't it be great if we could make whole git process automated instead of typing every time same git commands to push file on to github repository. 

We can do a simple hack to automate the whole process with just one bash command. Yes! you heard it right. One bash command can push entire repository from you local machine to github.

So lets start by writing a simple bash script and save it on your home directory with git-push.sh

```
echo "Enter your message"
read message
git add .
git commit -m"${message}"
if [ -n "$(git status - porcelain)" ];
then
 echo "IT IS CLEAN"
else
 git status
 echo "Pushing data to remote server!!!"
 git push -u origin master
fi
```

Basically it is taking all the file from your folder and pushing it to the github. If condition checks it the files are already push or not. If it would have been already pushed then it will just return else it will push the files to the github repository.

Now, we will make this file an executable file by changing the permission using chmod command.

 ``` chmod +x git-push.sh ```
or
 ``` chmod 755 git-push.sh ```
Once the script is executable we will need to copy it to a directory that in our system expects to contain executable scripts and code. On most systems we will have a choice between two directories. If we are the only user of our system you can copy our script to either /usr/bin or /usr/local/bin. If you share your system with other people it's best to copy your script to /usr/local/bin. You will most likely need super-user privileges to copy our script to either of these directories so most likely we need to use the sudo command.
```
sudo cp git-push.sh /usr/bin/git-push.sh
sudo cp git-push.sh /usr/local/bin
```
This will make our script accessible globally so that we can use it from anywhere and anytime we want.

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

Moreover, if you want to make push scheduled over particular time you can use crontab job scheduler to do so.
is-thirteen in Go
Tags: showdev, go, javascript, thirteen
Published: 2020-05-01 10:17:28

---
title: "is-thirteen in Go"
published: true
description: A Golang module to check if a number or a string is 13
tags: ["showdev", "go", "javascript", "thirteen"]
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/d5oskx7733k0xfjs8r0l.png
---

As COVID-19 lockdown is still going on, Labor Day is another indoor day just like how it has been for the last month. I'm surprised I even remember what day it is. To make myself feel less useless and bored, I decided to write a useless (?) Go module port called [is-thirteen](https://github.com/stanleynguyen/is-thirteen) from [its original JS version](https://github.com/jezen/is-thirteen) . With its extensive API, you can:

### Check whether a number is 13

```go
...
	is.Number(13).Thirteen()               // true
	is.Number(12.8).Roughly.Thirteen()     // true
	is.Number(6).Within(10).Of.Thirteen()  // true
	is.Number(2007).YearOfBirth.Thirteen() // true

	// check your math skillz
	is.Number(4).Plus(5).Thirteen()     // false
	is.Number(12).Plus(1).Thirteen()    // true
	is.Number(4).Minus(12).Thirteen()   // false
	is.Number(14).Minus(1).Thirteen()   // true
	is.Number(1).Times(8).Thirteen()    // false
	is.Number(26).Divides(2).Thirteen() // true
...
```

or 

### Check whether a string is 13

```go
...
	// check your spelling and chemistry skillz
	is.String("tHirTeEn").Thirteen()              // true
	is.String("nethtire").AnagramOf.Thirteen()    // true
	is.String("neetriht").Backwards.Thirteen()    // true
	is.String("aLumInUm").AtomicNumber.Thirteen() // true
...
```

[is-thirteen](https://github.com/stanleynguyen/is-thirteen) is stable with 98% test coverage. Check it out over on [Github](https://github.com/stanleynguyen/is-thirteen)!
Understanding the concepts of Webpack
Tags: beginners, javascript, webpack, react
Published: 2020-05-01 10:13:31

The webpack is a package of static modules for modern JavaScript applications. When processing the application, the webpack generates a graph that maps each module and its dependencies and generates one or more packages. In other words, it joins the JavaScript files (and also other formats like CSS, JS, SASS, JPG, SVG, PNG …) of your application (be it your files or external dependencies) in one file (to more than one), in an optimized way. The files are unified in the right order, without duplication and can be minified to reduce the size.

### **Core Concepts**
**Entry:** Entry point that indicates which module the webpack should use to start the construction of the internal dependency graph. When defining an entry point, the webpack will find all dependencies and import.

**Output:** The output property defines the name and location of the package generated by the webpack. The default directory is ./dist and the .dist/main.js file

**Loaders:** By default the webpack only understands JavaScript files, so that it can understand other types of files we must use Loaders which are modules that can be installed separately allowing the webpack to convert these files into modules.

**Plugins:** The plugins serve to perform a variety of tasks such as package optimization, asset management and injection of environment variables.

**Mode:** In the mode attribute, the webpack execution mode is defined as production, development or none.

In web applications, we commonly have many modules with dependencies.

### **Configuartion File Example**

```javascript
const path = require('path');

module.exports = {
  mode: 'development',
  entry: './frontent/main.js',
  output: {
    path: path.resolve(_dirname, 'public', 'assets', 'js'),
    filename: 'bundle.js'
  },
  module: {
    rules [{
      exclude: /node_modules/,
      test: /\.js$/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['@babel/env']
        }
      }
    }]
  },
  devtool: 'source-map'
}
```

### **Benefits of Webpack**

Webpack gives you control over how to treat different assets it encounters. For example, you can decide to inline assets to your JavaScript bundles to avoid requests. Webpack also allows you to use techniques like CSS Modules to couple styling with components, and to avoid issues of standard CSS styling.

### **How do Webpack works?**

Webpack is a command-line tool to create bundles of assets (code and files). Webpack doesn't run on the server or the browser. Webpack takes all your JavaScript files and any other assets and transforms them into one huge file. This big file can then be sent by the server to a client's browser.

That's all for now folks. Happy coding day!
Best Practices For Automation in Testing
Tags: automationintesting, automationtesting
Published: 2020-05-01 09:38:45

There are a great deal of reasons with respect to why automation testing is gainful, and by utilizing these accepted procedures in your automated testing you can guarantee that your testing is effective and you get the most extreme quantifiable profit (ROI). Robotized testing will abbreviate your advancement cycles, keep away from lumbering redundant errands and help improve programming quality yet how would you begin? These accepted procedures are an effective establishment to begin improving your product quality. 

Thorough testing is critical to the accomplishment of a software item. In the event that your product doesn't work appropriately, odds are solid that the vast majority won't purchase or use it… in any event not for long. Be that as it may, testing to discover abandons – or bugs – is tedious, costly, regularly dull, and subject to human blunder. <a href="https://www.testingxperts.com/blog/test-automation-guide">Automation in testing</a>, in which Quality Assurance groups use programming tools to run point by point, monotonous, and information serious tests consequently, assists groups with improving programming quality and takes advantage of their constantly constrained testing assets. Test Automation tools, for example, TestComplete and TestLeft assist groups with testing quicker, permits them to test significantly more code, improves test exactness, and opens up QA designs so they can concentrate on tests that require manual consideration and their interesting human abilities. 

Utilize these top tips to guarantee that your product testing is effective and you get the most extreme rate of return (ROI): 

Choose what Test Cases to Automate 

Test Early and Test Often 

Select the Right Automated Testing Tool 

Separation your Automated Testing Efforts 

Make Good, Quality Test Data 

Make Automated Tests that are Resistant to Changes in the UI
How to convert a Java List to int []
Tags: java, todayilearned, howto
Published: 2020-05-01 09:12:08

---
title: How to convert a Java List to int []
published: true
date: 2020-05-01 09:09:31 UTC
tags: Java,TodayILearned,HowTo
canonical_url: https://10xlearner.com/2020/05/01/how-to-convert-a-java-list-to-int/
---

Hello ! I’m Xavier Jouvenot and in this small post, I am going to explain how to convert a Java `List<Integer>` to `int []`.

_Self promotion_: You can find other articles on Android development on my [website](www.10xlearner.com) 😉

## Solution

For the people who only want the solution, to quickly copy-paste it in there code, here it is 😉

```
List<Integer> my_list = new ArrayList<Integer>(); // create the list
// some code to fill the list...
int [] my_array = my_list.stream().mapToInt(i->i).toArray(); //convert the list into a int[]

```

#Explanation

If you read this, it may be that you want to understand how the previous solution achieve the goal of transforming the `List<Integer>` into a `int []`, and this is what I am going to try to explain. 🙂

First of all, we take the filled list and we call the method [stream](https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html#stream--), which is going to convert our `List` into a `Stream`. A `Stream` is "A sequence of elements supporting sequential and parallel aggregate operations.", as defined by the documentation. And with this class, we are one step closer from the type we want.

Then, we call the function [mapToInt](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#mapToInt-java.util.function.ToIntFunction-) from the `Stream` class. This method returns a `IntStream` containing the result of the operations passed in parameter, and since we are telling it to not change the value of the element (`i` stays `i`), all this function does is to convert the `Stream` into a `IntStream`.

Finally, we call the method [toArray](https://docs.oracle.com/javase/8/docs/api/java/util/stream/IntStream.html#toArray--) of the class `IntStream`. This method convert the `IntStream` to a `int []`, which is exactly what we aimed for. 🙂

* * *

Thank you all for reading this article,And until my next article, have a splendid day 😉

## Interesting links

- [List::stream documentation](https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html#stream--)
- [Stream::mapToInt documentation](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#mapToInt-java.util.function.ToIntFunction-)
- [IntStream::toArray documentation](https://docs.oracle.com/javase/8/docs/api/java/util/stream/IntStream.html#toArray--)
- [10xlearner website](www.10xlearner.com)
Build a table of schedule using HTML5 table
Tags: html
Published: 2020-05-01 08:56:10

Lessons learned while building [Wine Festival Schedule](https://heggy231.github.io/chingu-webdev-speedrun-challenge/frontend/wine-fest-schedule/) using HTML5 table element.

* When adding table heading (`<th>`) there is no need to add `<td>` element.  This was confusing to me since any table data needs to be wrapped inside of `<td>` inside of table.  But there is an exception for table heading `<thead>`. I can think of `<th>` acting as `<td>` in `<thead>`.

```html
<table>
    <thead>
      <tr>
        <th>Company Name</th>
        <th>Number of Items to Ship</th>
        <th>Next Action</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Adam's Greenworks</td>
        <td>14</td>
        <td>Package Items</td>
      </tr>
```

* To stretch a cell across the entire table, use `colspan`

  ![column head spanning](https://dev-to-uploads.s3.amazonaws.com/i/c658c2n04hzu72xrfvb8.png)

```html
<thead>
  <tr>
    <th colspan="2"><h1>Wine Festival Schedule</h1></th>
  </tr>
  <tr>
    <th><h2>Time</h2></th>
    <th><h2>Event</h2></th>
  </tr>
``` 

* Overall structure of table:

```html
<table>
  <thead>
    <tr>
      <th></th>
    </tr>
  </thead>

  <tbody>
   <tr>
     <td></td>
   </tr>
  </tbody>
</table>
```
validate error using joi
Tags: node, express, help, joi
Published: 2020-05-01 08:19:04

---
title: validate error using joi
published: true
description: validate error, object empty
tags: nodejs, expressjs, help, joi
---


Hi all

I'm having trouble validating using JOI, please correct my code. where was my mistake


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

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