teleren/devto huggingface dataset:
You are the Victim
Tags: impact, webdev, productivity, change
Published: 2020-05-28 15:40:41

Often times, when we look at our actions or behavior, or someone calls us out on something, we go through a justification process that involves some version of the following statement: "I'm not hurting anyone."

That statement is a warning sign just like a code smell. When you hear yourself make that statement, it's time for some introspection. This sentence is the poster-child of justification. The very need to say this to ourselves or others implies the real truth of the matter: you are doing something you know is wrong and defending your actions through justification.

It is easy to justify our behavior through the viewpoint that there is no victim. But the reality is that there IS a victim….YOU. You are the victim of your behavior.

The effects of this are serious in their psychological effects. As you engage in any behavior you know you shouldn't, you damage your relationship with yourself. This damage comes slowly and insidiously, but inevitably.

As we act against our moral code, justification or no, we become frustrated with ourselves, and our inability to control our own behavior. We begin to say "why can't I just….", "why can't I just not eat too many desserts", "why can't I just focus on work", "why can't I stop myself from losing my temper", "why can't I control my drinking". Whatever it is, we begin to see ourselves as broken. This is the beginning of the danger zone.

![image](https://cdn-images-1.medium.com/max/800/0*H6QBw9Hjemg_ne2k?)

Photos by [Derek Howard](https://is-tracking-link-api-prod.appspot.com/api/v1/click/6721392399089664/~Tokens.Link~)

In order to combat the feeling of brokenness, we may seek out those who "accept" our behavior. These "friends" are in the same place, looking for someone to validate their own behavior.

Good friends accept who you are without accepting all your behavior. Even with new friends who validate your behavior, that feeling of brokenness persists. We then try to hide from that feeling, which usually leads to even more extreme behavior, and can even lead to addiction.

What is the solution then? Integrity and self-control. Learning to be the same person when you're alone as when you're around others that you respect and look up to. Yes, you should forgive yourself when your behavior isn't what you want, and keep working on it.

It doesn't matter what the behavior is either. Whatever it is, if you act against your internal moral code, you will suffer the consequences. So how do you know if you are doing something like this? Simple. When do you reply "I'm not hurting anyone"? There's the thing you need to work on.

So what are you doing that "isn't hurting anyone"? 

Happy Coding!

Enjoy this discussion? Sign up for our newsletter [here](https://thinkster.io/?previewmodal=signup
https://thinkster.io).

Visit Us: [thinkster.io](https://thinkster.io?utm_source=devto&utm_medium=blog&utm_term=youarethevictim&utm_content=&utm_campaign=blog) | Facebook: @gothinkster | Twitter: @GoThinkster
Enabling Mouse Middle Click Emulation in Linux
Tags: linux
Published: 2020-06-14 12:26:05

What i mean about "**Middle Click Emulation**"? Hmm, this is like a feature that allow you to emulate a middle click when pressing left and right buttons simultaneously, really good if you hate/have broken mouse wheel click.

As i remember some Linux like "*Linux Mint*" enable it by default, but if you try on your current Linux OS and it doesn't work then follow these step to enable.

## Prerequisite

- `xinput` installed, i.e. if you are on Debian you can install it with *apt* package manager when don't have it, `apt-get install xinput`.

## Steps

1.) Find your mouse device **ID**

``` bash
xinput
```
In my case the ***mouse ID*** are **_8_**

![xinput output](https://dev-to-uploads.s3.amazonaws.com/i/xmfkagk4lshdzjvduno3.png)

2.) Find mouse "emulate" props ID

``` bash
xinput list-props 8
```

In result above we've found props ID for **Emulate Middle Click** is **265** and they still have a **0** value.

![xinput-list-props](https://dev-to-uploads.s3.amazonaws.com/i/ns325bam8tqf9fc6u6fq.png)

3.) To enable it lets change the **Emulate Middle Click** value to **1**

``` bash
xinput set-prop 8 265 1
```

![xinput-set-prop](https://dev-to-uploads.s3.amazonaws.com/i/vlplw1arvgruoabqjg8q.png)

Thats all, you can place the last command `xinput set-prop 8 265 1` to `$HOME/.profile` or `$HOME/.bashrc` file for persistent changes after reboot.

---

UPDATE: Recently i use GNOME desktop environment and use Wayland session, the `xinput`'s result keep showing me some virtual devices like this

![Wayland xinput result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/33j5ag7ukrasxa1n65jp.png) 

... and of course make the tutorial above is meaningless, then the solution here is just paste the command below:

```
gsettings set org.gnome.desktop.peripherals.mouse middle-click-emulation true
```

Reference:

[libinput-force-middle-click-emulation](https://github.com/gaul/libinput-force-middle-click-emulation)
The Scale Cube
Tags: scalability, microservices
Published: 2020-06-14 12:21:02

---
title: The Scale Cube
published: true
description: 
tags:   scalability #microservice 
//cover_image: https://direct_url_to_image.jpg
---

The Art of Scalability (Addison-Wesley, 2015) talks about  Scale Cube. Here is an adaptation of the concept in the context of messaging. 

X axis scaling is having more than one message flow to process messages. That is, having more instances of the flow running. 

Y axis scaling is having one message flow for each kind of message. Say one flow for one country. 

Z axis scaling is splitting the message into smaller parts say instead of having both order and customer in the same message, have a separate order message, and a customer message.
Navigating to a specific section/div with unique ID of a page in vue/quasar
Tags: beginners, vue
Published: 2020-06-14 12:20:49

#scrollBehavior
This will help you seamlessly navigate to a section with a specific ID, on an SPA.
Simply include the code in the image to your router.js or main.js or app.js , wherever your vueRouter middleware was used.

###Explaining the lines of code
line-21: This is the scrollBehavior function, which takes in three ( 3 ) arguments.
a. The 'to' which specifies the next routing page 
b. The 'from' which specifies the previous routing page
c. The 'savedPosition' which specifies the position of the screen observer of the 'from' before moving to the 'to'. This is useful, assuming the user clicks on back or forward button.

line-22: This is an if statement which if it's truthy, evaluates the block of code beneath it. 
NB: since you would probably configure you link to the specified page as "localhost:8080/main/profile/georgeIkwegbu#ilovevueandquasar" 
then the '.hash' detects that the 'to' routing page contains a hashed parameter, and hence evaluates the if statement in line-22

line-23 and line-24: This returns the selector with the value of the hashed parameter ( i.e the unique ID found in the url )

line-27: This is used to detect the previous position of the 'from' page, assuming the user clicks back or forward.

line-30: This returns a default x-axis value of 0-px and y-axis of 0-px, meaning if there are no hashed parameter in the url ( both on the 'to' and 'from' then a next page on the router will be positioned on the top-left view of the viewport.
SwiftUI navigation link
Tags: swift, ios
Published: 2020-06-14 12:16:01

In part 2 we created a view with a list of products using MVVM and observables.
Now, let's build a view to display the product details, and to navigate to this new screen we are going to use a navigation link.

*https://developer.apple.com/documentation/swiftui/navigationlink*

### Update the model

Our model will need additional properties to display product detail, here's how it look like now:

```swift
struct Product : Identifiable {
    //MARK: - Properties
    
    var id = UUID()
    var description: String
    var detail: String
    var price: Double
}

extension Product {
    
    //MARK: - Default initialization
    init() {
        self.description = "New product"
        self.detail = "Detailed information"
        self.price = 999.99
    }
}
```

### New screen

The new screen will display the product model properties.
It's just a simple list of data:

```swift
struct ProductDetailView: View {
    
    let description: String
    let detail: String
    let price: Double
    
    var body: some View {
        List {
            HStack {
                VStack {
                    Text("Description:")
                }
                VStack {
                    Text(description)
                }
            }
            
            HStack {
                VStack {
                    Text("Detail:")
                }
                VStack {
                    Text(detail)
                }
            }
            
            HStack {
                VStack {
                    Text("Price:")
                }
                VStack {
                    Text(String(price))
                }
            }
            
        }
        .navigationBarTitle("Product detail")
    }
}
```

Notice that I declared these properties in this screen:

```swift
    let description: String
    let detail: String
    let price: Double
```

This means that when we call this view, we need to send the values for these properties in order to display them in the screen.

### The navigation link

The navigation link is what will enable us the open the new screen by tapping a product that is displayed in the first list.

We need to place this navigation link for each product that will be displayed in the list. This means, inside the foreach loop:

* Before navigation link:
```swift
ForEach(viewModel.productList) { product in
    Text("Description: " + product.description)
}
```

* After navigation link
```swift
ForEach(viewModel.productList) { product in
    NavigationLink(product.description, destination:      ProductDetailView(description: product.description, detail:      product.detail, price: product.price))
}
```

### Final result

Alright, after completing these changes our navigation to the new screen should be ready.

You can download the updated version and play the result for yourself: [Github](https://github.com/rfa1989/SwiftUIMVVM-GreatProducts/releases/tag/v1.2.0)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/u0r4ow7lu4byj3q2k4lt.gif)
How To Make A .deb For Your Program
Tags: ubuntu, linux, c, bash
Published: 2020-06-14 12:15:15

**I** developed [mitpick](https://github.com/Mithil467/mitpick), a tool to capture the _terminal_ output screenshot, right from the terminal, and copy it to the clipboard. All you need to run is `mitpick`. I am just using mitpick as an example, and the reason that I explored deb packaging in the first place.

Let's get straight into how I packaged it into a `.deb` file.

You'll need a folder to store all contents of the package. Let's call this folder `mitpick_1.0-1` (package-name). This folder is like the `root` of the target system.

Binary files or executables go into the `bin` folder.
```bash
mkdir mitpick_1.0-1/usr/local/bin -p
cp <executable_path> mitpick_1.0-1/usr/local/bin
```
The `-p` flag takes care that the directory is made with all parent directories as well. Otherwise, the command gives error _no such file or directory exists_.
Other resource files go into the `share` folder. Like in my case, I needed an external bash file as well.
```bash
mkdir mitpick_1.0-1/usr/local/share/mitpick -p
cp <resource_file> mitpick_1.0-1/usr/local/share/mitpick
```

Lastly, you need to make a text file called `control` which includes all metadata information about the package.

```bash
mkdir mitpick_1.0-1/DEBIAN
nano mitpick_1.0-1/DEBIAN/control
```
```javascript
Package: mitpick
Version: 1.0-1
Architecture: amd64
Depends: xdotool, xclip
Maintainer: Mithil Poojary mithil467@gmail.com
Description: mitpick
 When you need to screenshot your terminal, just run this
 small program!
```
Each line in the description should start with a single space.
Read about metadata options [here](https://www.debian.org/doc/debian-policy/ch-controlfields.html).
Lastly, you need to package it.
```bash
dpkg-deb --build mitpick_1.0-1

dpkg-deb: building package 'mitpick' in 'mitpick_1.0-1.deb'.
```
Now you can install it:
```bash
sudo apt install ./mitpick_1.0-1.deb
```

That is all for this guide 💖.

#### Motivation to make mitpick

I have assignments which involve taking screenshots (a lot of them) of the terminal output for certain commands. The screenshot tools work just fine, but it is really tedious to perform those 4-5 clicks. Mitpick captures the screenshot of the terminal and copies it to the clipboard. All I need to do is execute `mitpick`, and boom, the screenshot is taken and copied to the clipboard to be pasted onto your google doc. It is not that good with the boundaries of the terminal and is in no means a perfect tool.

| Cover pic - screenshot of [cool-retro-term](https://github.com/Swordfish90/cool-retro-term) on my PC
Base Class for Akita Entities
Tags: typescript, akita, angular
Published: 2020-06-14 11:56:45

If you are using Akita for state management, this article might be helpful to you.

```ts
// BaseEntityService.ts
import { Observable } from 'rxjs';
import { BaseQuery } from './BaseQuery';
import { EntityStore, EntityState } from '@datorama/akita';
import { tap, delay } from 'rxjs/operators';

export abstract class BaseEntityService<TParams, TView, TResult> {

    constructor(
        protected query: BaseQuery<TView, TParams>,
        protected entityStore: EntityStore<EntityState<TView>, TView>
        ) {
    }

    protected abstract getFromApi(params: TParams): Observable<TResult>;
    protected abstract getFromStore(params: TParams): Observable<TResult>;

    protected selectFromStore(params: TParams): Observable<TView> {
        return this.query.selectData(params).pipe(
            delay(1), // if removed, ui will not update with current data
        )
    }

    get(params: TParams): Observable<TResult> {
        return this.toggleLoading(
            () => {
                if (!this.query.hasData(params))
                    return this.getFromApi(params);
                else
                    return this.getFromStore(params);
            }
        );
    }

    private toggleLoading<TResult>(o: () => Observable<TResult>) {
        this.entityStore.setLoading(true);
        return o().pipe(
            tap((x) => {
                this.entityStore.setLoading(false);
            })
        )
    }
}
```
`BaseEntityService` handles abstraction for getting data from api or store. It also implements custom setting of entity loading property via `toggleLoading`. 


```ts
// BaseQuery.ts
import { EntityState, QueryEntity } from "@datorama/akita";
import { filter } from 'rxjs/operators';

export abstract class BaseQuery<TView, TParams> extends QueryEntity<EntityState<TView>, TView> {
    selectData(params: TParams) {
        const key = JSON.stringify(params);
        return this.selectEntity(key).pipe(
            filter(x => !!x)
        )
    }

    selectDataNullable(params: TParams) {
        const key = JSON.stringify(params);
        return this.selectEntity(key);
    }

    hasData(params: TParams) {
        const key = JSON.stringify(params);
        return this.hasEntity(key);
    }
}
```

`BaseQuery` contains custom selection of existing store data. In our app, we use stringified parameters as keys.
The Best Kubernetes Tutorials 

Tags: kubernetes, docker, tutorial, devops
Published: 2020-06-14 12:11:31


We have been looking for the best Kubernetes tutorials out there and thought of sharing some of what we found interesting to get started with Kubernetes, 

Check full article here:  https://hubs.ly/H0qY2q-0

The Official Kubernetes.io Tutorials
It is more of a collection of the existing content on Kubernetes.io. It focuses more on introducing the general concepts and constructs of Kubernetes. But it doesn’t provide necessary lessons that build upon each other. Covered Topics.


	•	The Basics 
https://kubernetes.io/docs/tutorials/#basics
	•	Configuring Kubernetes 
https://kubernetes.io/docs/tutorials/#configuration
	•	Stateless Applications 
https://kubernetes.io/docs/tutorials/#stateless-applications


DigitalOcean Tutorials
It is a collection of articles that are nicely written and well organized. They are sometimes focused on Running Kubernetes on top of DigitalOcean however. But you are still going to learn a lot of Kubernetes basics that are applicable to any other infrastructure. Some of the notable topics are:


	•	An Introduction to Kubernetes 
https://www.digitalocean.com/community/tutorials/an-introduction-to-kubernetes
	•	An introduction to Kubernetes DNS Services 
https://www.digitalocean.com/community/tutorials/an-introduction-to-the-kubernetes-dns-service
	•	An introduction to Helm, the package manager for kuberenetes
https://www.digitalocean.com/community/tutorials/an-introduction-to-helm-the-package-manager-for-kubernetes 

Google Kubernetes Engine Tutorials
Google tutorials are mostly focused on specific use cases more than teaching you the basic Kubernetes concepts. Examples of such tutorials are: create a guestbook with Redis and PHP on GKE, or Using Persistent Disks with WordPress and MySQL. Google depends mainly on Kubernetes.io as the main source of knowledge about Kubernetes since Google engineers are most contributors to these tutorials. Main covered topics:

	•	Deploying Applications 
https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app
	•	Configuring cluster networking 
https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer
	•	Continuous Integration and delivery 
https://cloud.google.com/solutions/jenkins-on-kubernetes-engine-tutorial



Check the full article and clear indication and direction to the tutorials URL's: Here, https://hubs.ly/H0qY2q-0
Reservation mitigation application
Tags: opensource, reservation, socialdistancing, covid
Published: 2020-06-14 12:09:22

---
title: Reservation mitigation application
published: true
description: Presence Limitation Software
tags: opensource, reservation, socialdistancing, covid
//cover_image: https://direct_url_to_image.jpg
---

Now countries are coming out of lock-down, COVID-19 still imposes limitations on the way we come together.  And I see a lot of places in need of a reservation system.

*  At work, we can't be more than 20 persons in the landscape office, and the lab doesn't allow more than 4, meeting room 1 is limited to 6 and meeting room 2 limited to 9 persons at a time.
* In the hospital, a patient can't have more than 2 visitors at a time, less than 3 visits per week; the whole wing can't have more than 16 visitors at any moment.  At the geriatric wing where my dad lies, they work with a hand brew spreadsheet managed by one nurse.
* Restaurants and pubs require reserving a spot to keep the number of people under 1/8m²; when a reservation is canceled, another family of 5 can be allowed in.  Some are very inventive and [use an old traffic light].
* Hotels need to adapt their systems, too

It's a pity that everyone would have to invent this on their own.  So I went searching the web (open source, reservation, COVID, tools).  I bumped onto this [github overview].  I read through this [Singapore digital tools] overview.

But I couldn't find a tool to solve this very common and current problem.  Am I too optimistic, and can't this problem be generalized?  Or hasn't the need been urgent enough?  Something else?

I wonder... could we join efforts solving this?  The result is certainly something that's going to last.  Experts expect new viruses coming along, and for sure, COVID isn't dead yet.

[github overview]: https://github.com/soroushchehresa/awesome-coronavirus
[Singapore digital tools]: https://sgtechcentre.undp.org/content/sgtechcentre/en/home/digital-tools-for-covid-19.html
[use an old traffic light]: https://www.tvoost.be/nieuws/coronavirus-verkeerslicht-regelt-toegang-in-cafe-de-smoutpot-in-melsele-99763

In absence of something better, I start the [LimitYourPresence](https://gitlab.com/xtofl/limityourpresence) project on GitLab.  There, we can gather requirements, do some planning, ...  It's all very premature, but who knows... what grows out of this!
Daily Developer Jokes - Sunday, Jun 14, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-06-14 12:00:03

---
title: "Daily Developer Jokes - Sunday, Jun 14, 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=Sunday%2C%20Jun%2014%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/5e1259a186412.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 do developers use mechanical keyboards?

___A___: To strongly type their code.
 -->
Walking a tree (breadth first search)
Tags: javascript, beginners, algorithms
Published: 2020-06-14 11:56:44

# Intro

A short blog on how you can traverse a tree layer by layer. Breadth first search is an algorithm that does exactly this (also works for graphs, graph is a generalization of a tree)

## breadth first search

First, imagine a tree not as a regular tree, but as an a upside down tree (I was really confused about it, because the root is on the top and not at the bottom).

Let's take for example the following tree:

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

The idea is to traverse the tree layer by layer, in this case:

- first we visit the first layer, only one node here ''node 1''
- then the nodes at the second layer, ''node 2'', ''node 3'' and ''node 4''
- finally, the third layer ''node 5'', ''node 6'' and ''node 7''

## js implementation

What is needed for a breadth first implementation in a tree:

1. a queue
2. a tree

the algorithm in plain english:

```
1. initialize an empty queue
2. take the root from the tree
3. add to queue the root node
4. while there are nodes in the queue do:
5.      take/remove the first element of the queue
6.      process the data of the current node
7.      if current node has any children add them to queue
```

the algorithm in js:

```javascript
// a node looks like this
rootNode = {
    id: 1,
    data: 1,
    children: [secondNode, thirdNode, forthNode]
};

function breadthFirstSearch(rootNode) {
    let queue = [];
    queue.push(rootNode);

    while (queue.length !== 0) {
        // remove the first child in the queue
        currentNode = queue.shift();
        // do something cool with the data
        // printing them is also cool :)
        console.log(currentNode.data);

        currentChildren = currentNode.children;
        // id there are any children in the node 
        // add them at the end of the queue 
        if (currentChildren !== null) {
            for (const child of currentChildren) {
                queue.push(child);
            }
        }
    }
}
```