teleren/devto huggingface dataset:
Understanding Kubernetes: part 13 – Quality of Service
Tags: kubernetes, devops, docker, beginners
Published: 2020-04-26 17:07:39

---
title: Understanding Kubernetes: part 13 – Quality of Service
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/vd2pu4i202v7suoilvy8.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, we will talk about Pods's QoS classes.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vd2pu4i202v7suoilvy8.jpg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2tiltv0r22we3ypj9s3h.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 :-).
VSCode Command Line Interface
Published: 2020-04-26 16:50:06

{% youtube uKCiAA4AJcI %}

Just when I thought VSCode can't surprise me anymore, it came out of the closet with something awesome & shocked me again. Did you folks know VSCode offers a Command Line Interface (CLI) that lets you do a bunch of amazing VSCode stuff right inside your terminal. 

Before we go into details, let's first activate this CLI.

## ⚙️ Setting Up the CLI

Open your VSCode. Press <kbd>⌘command</kbd> + <kbd>⇧shift</kbd> + <kbd>p</kbd> to open the Command Palette. Once it's open, search for *shell command* & then select the option: `Shell Command: Install 'code' command in PATH`

![Activating VSCode CLI](https://i.imgur.com/wFEAfkN.png)

When you are done, you will see a confirmation message at the bottom right corner of your VSCode & that's it. You have activated the CLI. 🙌🏻

## 🚀 Code CLI

As the name suggests, every Code CLI command will start with **code**. For instance, if you want to get your VSCode version, you can just type `code -v`.

![Code CLI](https://i.imgur.com/8CsfbOx.png)

You can also open any folder in VSCode by just typing `code .` in any terminal & then pressing <kbd>enter</kbd> 

![VSCode launch](https://i.imgur.com/7PrJ6mV.gif)

Code CLI also allows you to open any file of your project from your terminal. Just write `code -r filename` in the terminal & you are good to go. 

![Code CLI open file](https://i.imgur.com/Avm9HS6.gif)

We have added `-r` to reuse the existing window instead of opening a new one. You can also use the command `code -d filename1 filename2` to compare to files with each other. ⚡️

These are just the tip of the iceberg. You can see all of the options that this CLI provides by writing  `code --help`  in the terminal.

![Code CLI help](https://i.imgur.com/2Ou5bk1.png)

That's it for today's, folks! If you like this piece, please hit the like button, and if you have a question, just drop it down in the comments section below. 🙌🏻
Node app as a service
Tags: node, linux, pi
Published: 2020-04-26 16:49:00

Recently I deployed a node application to a raspberry pi that i had laying around.  There was surprisingly sparse documentation on how to start the app as a service so that when the ssh connection was shut down the app would still run.

First I wrote a small script and placed in in the pi users home directory:

### ~/startup (chmod 755) ###

> export NODE_OPTIONS="--max-old-space-size=2048"
> export PATH=$PATH:/path/to/node/bin (and whatever else you want on path)
> npm run prod 

Test the file by executing it:

>   sh ~/startup 

At this point the app was up and running.  Its important to not move on until the startup script is working. 

What I then wanted to do was to be able to run this as a service like:

>   sudo service myservice start

The following is that code which I then placed in /etc/systemd/system/:

> ## /etc/systemd/system/myservice.service

> [Unit]
> Description=myservice

> [Service]
> ExecStart=**/home/pi/startup**
> Restart=on-failure
> RestartSec=60s
> User=pi
> Group=nogroup
> WorkingDirectory=**/path/to/app**
> RestartSec=30000ms

> [Install]
> WantedBy=multi-user.target

Many of the above properties are not mandatory.  The key is the ExecStart which references the startup file we created.  Finally, I wanted the service to start on boot which is done via:

> sudo systemctl enable myservice

The service can be start, stopped and monitored with:
> sudo service myservice start
> sudo service myservice stop
> sudo service myservice status

It took me a while to get this to work but once I found the pieces it was very easy.
Instagram Login page 📸🖼️
Tags: tutorial, html, css, javascript
Published: 2020-04-26 16:37:10

---
title: Instagram Login page 📸🖼️
published: true
tags: tutorial, HTML, CSS, JavaScript
---


Hey dear coding people hope you all doing well ✌️🤘. Today I have learned how to make Instagram login page with HTML, CSS and little bit of JavaScript 🍁. This is an amazing project ❤️ try it 🤩😍💋


{% codepen https://codepen.io/atulcodex/pen/VoWRVP %}
I decided to create my own Node.js router/http-server, performance and devops-aimed. What should I consider?
Tags: javascript, devops, discuss, node
Published: 2020-04-26 16:16:26

I decided to create yet another "express-killer" (work already in progress) pet project.
Of course, not NIH syndrome: I'm going to make it Express middleware-compatible.
Target is to make it fast as hell in its core and modern tooling integration-aimed without losing friendliness and already known experience.
What should I consider?

What I already keep in mind:
- blazing-fast generic router package, which can be mounted over both Koa and Express. Better than common trie solutions - I've inspected popular ones and I know parts of code that can be done in a more efficient way by adding the "compile" step. I'm also going to try WASM router implementation, but unsure whether interop will degrade the performance. Routes will be [path-to-regexp](https://github.com/pillarjs/path-to-regexp)-compatible (like Express), with the ability to define regex paths with the lowest priority order.
- separation of endpoints and middlewares, while keeping in mind that endpoints can end the request (like "if not authorized, redirect to home"), and integration with documentation extractors like Swagger (or any other generic solution).
- simple integration possibility with modern APMs like New Relic, Prometheus, and other popular ones. Not full integration at the first step, but the ability to extract nice metrics (like per-path) in the core.
- built-in `forever` or other Cluster and auto-reload package; also, support of [sticky-session](https://github.com/indutny/sticky-session)
- СSP declarative configuration and tracing ID out-of-the-box (middleware call-style, but working differently inside)
- profiling-friendly - middlewares will be not in a stack, instead, they will have a flat call structure and this will allow a profiler to show separate calls instead of call stacks.
- some kind of Dependency Injection solution - still thinking on it, not a lot of ideas, however.
- Node 14-tuned - if something is improving performance on 14, but breaks or degrades 10 or 12, this is good. Not expecting to release before 14 go to LTS.

Just to clear things out - I'm team-/tech-lead/architect working on frontends and backends-for-frontends in large scale projects (~10k pages per second served on a current one) with 8+ years of experience, this is not a newbie post - I'm really struggling to hear pains in modern solutions.
Which technologies do you use in your daily job?
Tags: watercooler, technology
Published: 2020-04-26 16:14:10

We have the so many choices in our job as software developers. 

Which technologies do you use in your daily job and which ones would you like to work with more?

![tech](https://media.giphy.com/media/CTX0ivSQbI78A/giphy.gif)
Checkinstall
Tags: packaging, linux
Published: 2023-01-06 01:26:40

---
title: Checkinstall
published: true
date: 2020-04-26 16:11:30 UTC
tags: Packaging,Linux
canonical_url: https://brandonrozek.com/blog/checkinstall/
---

To create a quick and dirty Debian or RPM package, check out `checkinstall`! Be forewarned though that this isn’t the recommended way of creating packages. This post on [AskUbuntu](https://askubuntu.com/questions/1138384/why-is-checkinstall-no-longer-being-maintained) gives good reasons for why. Though if it is between running a `make install` or running this utility, I would consider running `checkinstall` instead.

This program works by tracking all the files installed by a `make install` equivalent. This makes it easy to remove later on.

To install on a debian based distribution,

```
sudo apt install checkinstall

```

Then you can go to the directory that you normally `make install` and instead run the following to make a Debian package.

```
sudo checkinstall -D --install=no --nodoc

```

It will ask you to fill in various metadata such as name and author, and then it will create a package you can install!

To install,

```
sudo dpkg -i filename.deb

```

You can later remove it with apt.

```
sudo apt remove package_name

```

If the application does not use `make install`, then you can add extra arguments to denote its equivalent

```
sudo checkinstall -D --install=no --nodoc ./customInstallScript

```

Arguments to `checkinstall`

| Flag | Description |
| --- | --- |
| `-D` | Create a Debian package |
| `-R` | Create a RPM package |
| `-S` | Create a Slackware package |
| `--install=no` | Don’t install package |
| `--nodoc` | Do not include documentation filesq |
Day One - Twilio Hackathon
Tags: twiliohackathon
Published: 2020-04-26 15:19:33

[Comment]: Woo, hopping into the game late (aka starting today) but ready to grind out some hackathon code!

#### What I built:
Ya know, I'm not quite sure yet

#### Category Submission: 
Either gonna go for the API category or the communication category

#### Demo Link:
None yet

#### Link to Code:
https://github.com/Huppdo/TwilioHackathon

#### How I built it (what's the stack? did I run into issues or discover something new along the way?)
I know I'm gonna be using some form of python with probably a web frontend. My IDEs of choice are any of the JetBrains ones, so I'll be using PyCharm Professional and WebStorm, hosted on an AWS RHEL EC2 instance
Guessing filetypes in python
Tags: python
Published: 2020-04-26 15:18:57

---
title: Guessing filetypes in python
published: True
description: Litte python script to automate mime type guessing
tags: python
---

## Where this idea came from?

If you want to build an application to automatically organize your files, the best approach is to automate the mime type guessing, because manually creating list of file types is counter-productive, at least you have to create generic groups, like multimedia, images, docs, etc, each group will have their subgroups defined by the app, for example:

    Audio: ['mp3', 'wma', 'm4a'] 
    Image: ['jpg', 'png', 'svg']


## This article will change, because I am still building it
But the initial code is here:

```python
import mimetypes
import os

for f in os.listdir('.'):
    filetype, _ = mimetypes.guess_type(f)
    filetype = str(filetype).split('/')[0]
    if not filetype == "None":
        print(f'{f} {filetype}')
```

The `mimetypes.guess_type()` returns a tuple, so you can manipulate the result to fit your needs.

Later I discovered that mimetypes is not enough, see [here](https://medium.com/@ajrbyers/file-mime-types-in-django-ee9531f3035b) then I installed

    pip3 install python-magic

Then I figured out this soution:

``` python
import magic
from pathlib import Path
target = Path.home() / 'music'

def file_path_mime(file_path):
    mime = magic.from_file(file_path, mime=True)
    return mime

# The check_in_memory_mime function works for Django 
# file uploads pulled directly from request.FILES on POST.
def check_in_memory_mime(in_memory_file):
    mime = magic.from_buffer(in_memory_file.read(), mime=True)
    return mime

for f in target.iterdir():
    if f.is_file():
        filetype = file_path_mime(str(f.resolve()))
        print(f'{f.name} {filetype}')
```

## The initial file organizer, still with a generic file organization

It enters you "Downloads" folder and creates a folder for each file extension on it, like `zip_files`. Then it will get all files from this type and put them into the folder.

``` python
from pathlib import Path

downloads = Path.home() / 'Downloads/'

for f in downloads.iterdir():
    if f.is_file():
        name, ext = f.name, f.suffix[1:]
        p = Path(downloads) / f'{ext}_files'
        p.mkdir(parents=True, exist_ok=True)
        Path(f).rename(p / f'{f.name}')
```
## Improvements
If you have any idea to better combine these two codes in a very pyctonic way, feel free to suggest new versions, you can maybe share your oun version of these ideas. 

All of this started after reading [this](https://dev.to/aletisunil/python-script-for-sorting-files-p5i/comments) article.
NTP sunucusundan zaman bilgisi çekebilme
Tags: python, ntp, time
Published: 2020-04-26 15:01:50

Herhangi bir ekstra paket gerektirmeksizin uzak bir NTP sunucusundan zaman bilgisini çekmek için aşağıdaki gibi bir kod yazmanız yeterli olmaktadır.

Aşağıdaki örnekte ulakbim.gov.tr ntp2 sunucusundan zaman bilgisi çekilmektedir.

```python
#!/usr/bin/env python
from socket import AF_INET, SOCK_DGRAM
import sys, socket
import struct, time
 
def getNTPTime(host = "ntp2.ulakbim.gov.tr"):
        port = 123
        buf = 1024
        address = (host,port)
        msg = '\x1b' + 47 * '\0'
 
        TIME1970 = 2208988800 # 1970-01-01 00:00:00
        client = socket.socket( AF_INET, SOCK_DGRAM)
        client.sendto(msg.encode('utf-8'), address)
        msg, address = client.recvfrom( buf )
 
        t = struct.unpack( "!12I", msg )[10]
        t -= TIME1970
        return time.ctime(t).replace("  "," ")
 
if __name__ == "__main__":
        print(getNTPTime())
```
Your Error Messages Deserve Some Love
Tags: ux, writing, tips
Published: 2020-04-26 14:59:06

---
canonical_url: https://www.nidup.io/blog/write-engaging-error-messages
---

I recently attended a compelling presentation. 😍

In our distributed company, English is a second or third language for most of the teammates. We have a dedicated English teacher. Camille runs training and workshops to help us to improve.

Camille recently worked on our products' error messages with our product management team.

The first goal was to ensure the correctness of these messages.

She pushed the exercise at a far more advanced level.

**Error messages**

When running into an error message, the experience is, most of the time, frustrating.

Something unexpected happened, and it breaks your productivity flow. You now have to understand why this piece of software does not work the way it's supposed to. You have to figure out what to do to be able to move on. And you have more interesting to do.

**An error message has to be crystal clear**

Each message has to guide the user and must be self-explanatory, concise, and accurate.

When we write error messages, the temptation is high to detail as much as possible. What happened, what are the business rules. We should focus on helping the user to work around the issue and to move on.

Error messages don't have to be boring or impersonal. An error message is a way to engage with your users. It can be user friendly, using "you" and "we" pronouns creates a more human feeling.

For instance:

> "Cannot remove this attribute used as a variant axis in a family variant."


> "You cannot remove this attribute because it is used as a variant axis in a family variant."

Our messages have to be consistent across your whole application. We can adapt their content depending on the user persona we're talking too. But keeping a consistent tone of voice is essential.

Another good practice is to write them positively and to avoid negative sentences.

For instance:

> "This value should not be blank."

> "This value is required."

Conciliate these pieces of advice can be challenging, what to do when in doubt?

> "The Platinium rule, if you're not sure, the rule overriding all the others, is your message has to be crystal clear." (Camille B.)

**Error messages are a critical part of the User eXperience**

Looking at most of the software I use, error messages appear to me as a second class citizen of the UX.

We can fix this in our industry. We can improve. We can craft great error messages. We can make them more engaging and as enjoyable as success messages.

**Last words**

Dear Camille, thank you! For pointing out this problem, for evangelizing and training our teams. Write great error messages is a step forward to deliver a more engaging experience to our users. 🦄

*I formerly published the [Your Error Messages Deserve Some Love](https://www.nidup.io/blog/write-engaging-error-messages) story on my blog; it gathers short stories about product management, software engineering, and work organization. 📝*
Why Companies Need to Rethink Their Communication Strategy for Remote Teams Infographic
Published: 2020-04-26 14:40:35

Today’s business world is extremely overwhelmed with the constant introduction of new communication tools, channels, and platforms – each promising to heighten employee productivity and operational efficiency. The ultimate challenge lies with the companies who need to cherry-pick the right communication tools (ignoring the others) based on relevance, objectivity, and desired business results.

The sheer availability and expansion of communication platforms and collaboration options sometimes add to more chaos than clarity. After all, hyper-connectivity doesn’t always lead to the right direction and the most sought-after solution. Especially, breaking through all the clutters created by easily-available and fragmented communication channels becomes the most crucial thing to do, especially in a business scenario when your remote employees need to take faster and efficient decisions based on accurate and timely information.

In this particular infographic, we will talk about why companies need to execute a strategic, secure, and streamlined communication strategy when it comes to their remote teams. While emails, text messages, and phone calls are still prevalent, some of the field-forces are using social media and open chat platforms. Not only these public communication platforms are highly fragmented, but they also lack alignment with the business goals most of the time. On top of that, they involve higher chances of a data breach, data loss, and theft as different employees tend to use different messaging platforms to communicate with the team as per convenience and familiarity. At the same time, it also leads to unnecessary and unchecked data overages due to uninhibited access to a number of chat platforms across the internet.



Original Post - [Communication Strategy for Remote Teams](https://blog.scalefusion.com/why-companies-need-to-rethink-their-communication-strategy-for-remote-teams/)
April 26 — Daily CodeNewbie Check-in Thread
Tags: codenewbie, checkin, beginners, discuss
Published: 2020-04-26 14:23:54

---
title: April 26 — Daily CodeNewbie Check-in Thread
published: true
description: A daily thread to ask questions, share progress, and stay accountable!
tags: codenewbie, checkin, beginners, discuss
series: Daily Checkin
---

You are encouraged to use this daily thread to:
- Ask for help (all questions encouraged)
- Explore topics you’re curious about
- Share something you’ve written or read
- Celebrate your wins
- Stay accountable to your goals
- Support your fellow programmers

Happy Coding!

---

_Interested in joining the twice-weekly live [#CodeNewbie Twitter chats](https://twitter.com/search?q=codenewbie)?  You can find us [on Twitter](https://twitter.com/search?q=codenewbie) each Wednesday at 9pm ET (1am GMT on Thursday) and Sunday at 2pm ET (6pm GMT)!_
Spring Boot : Actuator
Tags: java, springboot
Published: 2020-04-26 14:20:28

Use for monitor and manage running application.

Enable by adding dependency below.

```xml
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
```

## Using HTTP endpoint

* `/actuator/health`
  * Return status of running application
* `/actuator/info`
  * Usually return blank but we can customize it in application.properties.
  * `@project.version@` refer to version tag in pom.xml
```
info.app.version=@project.version@
info.app.name=Hello World
```

## Using JMX 

* This option is disable by default but we can enable by set `spring.jmx.enabled` to `true`
* Data will be exposed under `org.springframework.boot` domain.
Mapping on the javascript objects
Tags: javascript, webdev, Objects
Published: 2020-04-26 14:18:05

Yeah!! You read the tile right. Mapping on the javacsript array are simple. We can use the Map function to loop over the array. But if you want loop over the objects in js then it is quite different than the array.
consider this example
```javascript
let obj = {
name:'Samar',
surname:'Deshpande',
roll_no:55
}
```
now if you write 
```javascript
obj.map((value,key)=>{
<!-- Your code goes here! -->
});
```

You will get an error because the map function will only work on the array and not on the objects. So there is one hack, we have to convert object into array and then loop over it. Yeah so we can do it in this way(i will be referring to react code.)
```javascript
import React from "react";
import "./styles.css";

export default function App() {
  let obj = {
    name: "Samar",
    surname: "Deshpande",
    roll_no: 45
  };

  return (
    <div className="App">
      {Object.keys(obj).map((value, key) => {
        return (
          <div>
            <p>
              {value} : {obj[value]}
            </p>
          </div>
        );
      })}
    </div>
  );
}
```
 output will be:
name : Samar
surname : Deshpande
roll_no : 45


So as you see we have used 'Object.keys(obj)'. This is ES function that will return us an array of the keys in javascript object.For More Info on Object .keys please refer 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys'.
So now Object.keys(obj)  will return us an array and now we can map it over using .map function in js. But there are quite few things to keep in mind.
1) If you want to access the key of an object you use 'value'(for this example)
2) If you want to access the the value of an object use 'obj[value]' (in this case).
3) Never you map directly on objects. You will always get error

In this way you can map over the objects in Js.
If you have any suggestions you can comment here or write me at
'samdeshpande.sd@gmail.com'.

Happy Coding!!!!
Dynamic array in angular 8
Tags: angular8, dynamicarray
Published: 2020-04-26 14:09:32

i am working with dyanmic array.. i have a model class .. this i have assign ass array.. but when i bind getting error like ngFor can only iterate array.. Cant identify where i went wrong.. can anybody help me?
 Model.ts
export class AddDriver {
  constructor(
    public additionalDriverId: string,
    public additionalDriverName: string,
    public IDNumber: string,
    public dob: NgbDate,
    public age: string,
    public gender: string,
    public licenseIssuedDate: NgbDate,
    public licenseExpiryDate: NgbDate,
    public issuedCountry: string,
    public nationality: string,
    public relationship: string
  ) {}
}
 component.ts
addDriverArray: Array<AddDriver> = [];
  newDynamic: any = [];
 this.newDynamic = [{
        additionalDriverId: '', additionalDriverName: '', IDNumber: '', dob: '', age: '', gender: '', licenseIssuedDate: '', licenseExpiryDate: '', issuedCountry: '',
        nationality: '', relationship: ''
      }];
      this.addDriverArray.push(this.newDynamic);