teleren/devto huggingface dataset:
How To Establish Better Governance
Tags: cloud, cloudnative, kubernetes, devops
Published: 2020-11-05 14:13:14

Who Owns This Workload?
Recently, one of our Site Reliability Engineers (SRE) noticed a workload running in our cluster which he hasn’t seen before. The workload was consuming some resources and the SRE wanted to apply some updates to the cluster but was not sure who owns the workload, and doesn’t know if his updates would have an impact on it or not. The SRE reached out to the development team on Slack concerning the Workload to see if anyone knew anything about this new workload. It was late in the day, and it took some time to get a reply. Many people did not know about this new workload, or who owns it, or what part of the system it belonged to. Some of us even wondered if this could be a malicious application. Should we terminate it and remove it right away? What if it is part of the new feature we launched a few days ago?

Eventually, we figured out that it was part of a prototype that an engineer was working on with someone from the business team to experiment with a new feature. But what if this was some malicious application? Or it was causing an issue in production and we needed to reach the owner of this service? Many critical hours would’ve passed without reaching a resolution. In such a distributed and decentralized environment and as your teams continue to grow, it becomes challenging to know everything and ensure everyone is a good citizen. So what should we do?

How To Establish Better Governance And Avoid This Problem?
If we mandate it that each new service or every change made to production should be reviewed by the SRE team, we will certainly slow the development team and slow the pace of innovation. Also, the manual review does not guarantee the detection of all violations. Therefore, the solution is to establish a governance framework and automate its process as much as possible in order for us to have the opportunity to scale.

There are three key elements that should be defined in order to establish good governance around the issue we faced. These elements are “targets”, “policies”, and “triggers”, as we explained in “Kubernetes Governance 101”. The target in this case would be all workloads in our cluster. We should apply the policy to all types of workloads: ReplicaSets, StatefulSets, Jobs, DaemonSets, etc. The policy would be to enforce that each workload has an “owner” label with the email of the engineer responsible for it. For the trigger, we thought initially that it is enough to run this once a day to find out who was violating this policy.

How To Setup A Custom Advisor In Magalix
Magalix offers KubeAdvisor which allows us to write custom policies using Rego - a declarative policy language that is open source and part of the Open Policy Agent project. This allows us to rely on a widely used framework and community-supported tools to make policy as code.


To Read More: https://hubs.ly/H0zlMVs0
Faking GitHub Contributions
Published: 2020-11-05 14:12:41

NOTES: This post is a joke.
And, I haven't gone through GitHub's specifications in detail, so this may not be the best way to do it.

----------------

Imagine.
Suppose you've been diligently working on Contributions every day on GitHub.

Unfortunately, you're busy with something else that day and you forget to color in your Contributions graph.
You can't help but wonder if you can't find a way to color in the blank graph.
(As an image, here's what I'm imagining below; October 30 is left blank.)

![Contributions image](https://github.com/shinshin86/timemachine-joke-20201031/raw/main/images/before.png)

## Tampering with AuthorDate and CommitDate in Git's Commit History

I didn't check GitHub's specs in detail, but I assume the GitHub Contributions refer to Git's commit time.
In this article, we're going to try to falsify the original Contributions by setting up a new repository and falsifying the commit time in that repository.

I'll describe the procedure in the following paragraphs.

#### 1. Creating a new repository on GitHub
#### 2. Clone the repository locally.
#### 3. Make a commit (whatever it is content)
#### 4. Tampering with AuthorDate and CommitDate in Git

Here's the actual command I typed.

```bash
GIT_COMMITTER_DATE="Fri Oct 30 12:30:27 2020 +0900" git commit --amend --date="Fri Oct 30 12:30:27 2020 +0900"
```

`GIT_COMMITTER_DATE="Fri Oct 30 12:30:27 2020 +0900"` is `CommitDate` rewritten into the specified time.

Also, `--date="Fri Oct 30 12:30:27 2020 +0900"` is `AuthorDate` rewritten into the specified time.

In this case, the same time is specified in both cases.

#### 5. Check AuthorDate and CommitDate have been changed.
When you run this command, you'll see that AuthorDate and CommitDate have been changed.

```bash
git log -1 --pretty=fuller
```

#### 6. Push to a remote repository on GitHub
In the image below, you can see that the contributions that didn't really exist have been added.

![Contributions image 2](https://github.com/shinshin86/timemachine-joke-20201031/raw/main/images/after.png)

Here is the actual repository where this work was done.

[shinshin86/timemachine-joke-20201031](https://github.com/shinshin86/timemachine-joke-20201031)

## Epilogue
The day I did this was Halloween.
I wanted to do some kind of prank-like (trick-or-treating-inspired) joke, so I challenged myself to do it.

It's just a joke!
So it's best not to do it in a real work :)
Code Smell 17 - Global Functions
Tags: codenewbie, development, tutorial
Published: 2020-11-05 13:48:27

*Discouraged by Object-Oriented Programmings, Many mixed languages support it. And developers abuse them.*

> TL;DR: Global function bring a lot of coupling. Don't use them.

# Problems

- Coupling

- Readability

- Maintainability

- Testability

# Solutions

- Wrap the function in a context object.

# Examples

- External Resources Access, Database access, Time and Operating System resources.

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/4713b63031ad073d46701b7b4c81b028)
```php
<?

class Employee {
    function taxesPayedUntilToday() {
        return database()->select(
            "SELECT TAXES FROM EMPLOYEE".
            " WHERE ID = " . $this->id() .
            " AND DATE < " . currentDate());
    }
}
```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/74d9534ee563afc1fdf766b90115fb10)
```php
<?

final class EmployeeTaxesCalculator {
    function taxesPayedUntilToday($context) {
        return $context->SelectTaxesForEmployeeUntil(
            $this->ssn,
            $context->currentDate());
    }
}
```

# Detection

Many modern languages avoid them. For the permissive ones, scope rules can be applied and automatically checked.

# Tags

- Global

# Conclusion

Structured programming considers global functions **harmful**. Yet, we can observe some bad practices cross paradigm boundaries.

# Relations

- Singleton and Classes are global points of access.

{% post https://dev.to/mcsee/singleton-the-root-of-all-evil-50bh %}

# More Info

- [Wikipedia](https://en.wikipedia.org/wiki/Global_variable)

# Credits

Photo by <a href="https://unsplash.com/@picoftasty">Mae Mu</a> on <a href="https://unsplash.com/s/photos/spaghetti">Unsplash</a>

* * *

> The road to programming hell is paved with global variables.

_Steve McConnell_

{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}

*Last update: 2021/06/26*
Angular Routing Crash Course
Tags: angular, webdev, typescript, javascript
Published: 2020-11-05 13:23:24

## So what is routing?
In web development routing, refers to splitting the application into different areas based on the URL, that is derived from the current browser.

### Why do you need routing?
* To separate the app into different areas
* To keep our app in a clean state
* Protect areas of our app, based on certain rules

👩🍳 Recipe
1) Generate a new angular application using the CLI, passing the --routing flag.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kxdrymadiln6791h9mwe.png)
 The --routing flag sets up our routing module, and equally imports it to the app.module.
2) Open your newly created app, and navigate to app.component.html. Add the bottom of the file, you should see the router-outlet directive.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/32vh50k3aob1odl3bow7.png)
 The router-outled directive displays our routed components
On top of the router-outlet directive, we will add a bootstrap navbar, to ease navigation. You can get it here 
https://getbootstrap.com/docs/4.5/components/navbar/
3) Now go ahead and generate the following components using the CLI, home, about us, contact, not-found
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ab4vqvawh477virk5aum.png)
4) Go to the app-routing.module file, inside it, you will find a routes array. This array will contain our route definitions

![app-routing.module.ts - house-renting-app - Visual Studio Code 11_5_2020 12_49_20 AM](https://dev-to-uploads.s3.amazonaws.com/i/xlvvm56rmzz686gw2mq8.png)
5) Insert the following code into the routes array, and also import each respective component.

 
![app-routing.module.ts - house-renting-app - Visual Studio Code 11_5_2020 9_21_43 AM](https://dev-to-uploads.s3.amazonaws.com/i/kt50ugv8z98vuzuwyx8w.png)

 The route array basically contains objects.
 * The path defines what text should be added to the URL.
 * The component defines which component should be displayed for that particular route.
 * The path containing the empty string,'' defines the route, as the default route.
 * The path containing '**', serves as a wildcard route, which is used to redirect the user to a defined component if the current URL is invalid.

6) Now, in the app.component.html we will remove the href attribute and replace it with the routerLink directive. We now map the routerLink directive to our defined paths.

![app.component.html - house-renting-app - Visual Studio Code 11_5_2020 11_29_05 AM](https://dev-to-uploads.s3.amazonaws.com/i/nwewpl6sbgoshy5szfjw.png)

Now, we can serve our application and test our various links.
Initially, we get routed to the HomeComponent, because we defined it, as the default path.

![HouseRentingApp - Mozilla Firefox 11_5_2020 2_10_50 PM](https://dev-to-uploads.s3.amazonaws.com/i/3gb18u1o3qrdybz2j8ga.png)

![HouseRentingApp - Mozilla Firefox 11_5_2020 2_11_07 PM](https://dev-to-uploads.s3.amazonaws.com/i/w4lic7pscd7uyt7mwlhr.png)
 

🎊🎉🍾Congratulations !!! You just learned the basics of routing in Angular. There is much more to routing in angular.
[Video] Security scanning within Gradle
Tags: java, android, security
Published: 2020-11-05 13:07:10

{% youtube tjfR35jDqxA %}

Check out the Snyk Gradle plugin. 

Scan your thirds party open source dependencies for security vulnerabilities direct from Gradle using the new Snyk Gradle plugin.

For more information check out:
- The [blog post](https://snyk.co/gradle-plugin) 

- The GitHub repo:

{% github snyk/gradle-plugin %}


- The [Gradle plugin portal](https://plugins.gradle.org/plugin/io.snyk.gradle.plugin.snykplugin) 

![Snyk plugging on the Gradle plugin portal](https://community.snyk.io/remoteimages/i/w6uzxpxglzh7dhvucief.png)
XinFin’s Tokens XDC Vs XDCE
Published: 2020-11-05 12:43:01

Are you confused about these two tokens of XinFin? Let’s clear the confusion!

The XDC token is the underlying utility token that powers XinFin’s Hybrid Blockchain. The XDC token acts as a settlement mechanism for DApps built on the XinFin Hybrid Blockchain.
XinFin has also launched an Ethereum token called XDCE that can be traded with XDC utility token at a 1:1 ratio. This gives the token holder flexibility to get benefit from the Ethereum Network’s various utilities DApps.

The ERC-20 token can be swapped for the XDC token at a ratio of 1:1. This swap can be facilitated on the AlphaEx exchange. AlphaEx.net is compatible with all decentralized exchanges and has a presence in liquidity markets and supports XDC liquidity.
So for better understanding, Here we are differentiating the both token: XDC vs XDCE


XDCE Trading on Exchanges
Bilaxy- Trading Pair: XDCE-ETH
Fatbtc- Trading Pair: XDCE-USDT
HOTBIT- Trading Pair: XDCE-BTC, XDCE-USDT, XDCE-ETH
P2pb2b- Trading Pair: XDCE-BTC, XDCE-ETH, XDCE-USD
LATOKEN- Trading Pair: XDCE-USDT, XDCE-ETH, XDCE-BTC
Bancor- Trading Pair: XDCE-ETH
IDEX- Trading Pair: XDCE-ETH


XDC Trading on Exchanges
ALPHAEX- Trading Pair: XDC-XDCE, XDC-ETH, XDC-XRP, XDC-BTC, XDC-USDT, XDC-USDC
STEX- Trading pair: XDC-USDT
HomiEx- Trading pair: XDC-USDT
MERCATOX- Trading Pair: XDC-ETH, XDC-BTC, XDC-USDC
Buyucoin- Trading pair: XDC-USDT, XDC-INR
INDODAX- Trading Pair: XDC-IDR
WBF Exchange- Trading Pair: XDC-DUSD
BITRUE Exchange- Trading Pair: XDC-USDT, XDC-XRP.

Institutional Custodian support for XDCE
Coinbase, BitGo and Copper

Institutional Custodian support for XDC
Copper,
On Chain Custodian

XDCE supporting Wallets
METAMASK, MyEtherWallet, Eidoo Wallet, Lumi Wallet, Trust Wallet, SafePal, Enjin Wallet, Ledger nano s and X

XDC supporting Wallets
XDC Wallet Android Application, XDC web wallet, XinPay Wallet, GuardaWallet, Ledger nano s and X (Coming Soon)

XDCE staking option
Hotbit
Bancor

XDC Staking option
Masternode Staking
AlphaEx Staking(Currently unavailable)

Original article source: https://vinn9686.medium.com/xinfins-tokens-xdc-vs-xdce-38bbd97100fb
findIndex method: JavaScript array
Tags: codenewbie, tutorial, javascript, array
Published: 2020-11-05 12:30:33

JavaScript methods are actions that can be performed on objects. Today, let us understand how the findIndex() method works. This method was added to the array.prototype() in the JavaScript ES6. The prototype constructor allows you to add new properties and methods to the Array() object.

#Table of Contents
* [Syntax & Explanation](#section1)
* [Example Code](#section2)
* [Browser Support](#section3)

#<span id = "section1">Syntax and explanation</span>
The findIndex() method returns the index of the first element in array that satisfies the given testing function. If no element of the array satisfies the testing condition, it returns -1.

The syntax of the findIndex() method is as follows
```
findIndex(testfunc(currentValue, index, arr), thisValue)
```

The above findIndex() method takes two arguments:
A. testfunc
B. thisValue

##A. testFunc
The testFunc() is a function that is used to execute a condition on each element of the array until the function returns true, indicating that the element satisfying the condition was found.

The testFn() takes three arguments:
* currentValue: This indicates the current element in the array being processed.
* index: Indicates the index of the current element being processed.
* arr: This is the array that the findIndex() was called upon.

##B. thisValue
It is an optional argument that is passed to the function and used as its "this" value. If it is empty, the value "undefined" will be passed as its "this" value. In JavaScript, "this" keyword refers to the object it belongs to.

The findIndex() executes testFunc() for every element of the array and if true is returned by the testFunc(), findIndex() returns the index of that element and does not check for the rest of the array elements

#<span id = "section2">Example Code</span>
The following example uses findIndex() method to find the first occurrence of a prime number in a given array.
```
function isPrime(element, index, array) {
  var start = 2;
  while (start <= Math.sqrt(element)) {
    if (element % start < 1) {
      return false;
    } else {
      start++;
    }
  }
  return element > 1;
}

console.log([4, 6, 16, 32].findIndex(isPrime));
//Output: -1, not found
console.log([4, 7, 6, 12].findIndex(isPrime));
//Output:  1 (array[1] is 7)
```

#<span id = "section3">Browser Support</span>
* Google Chrome 45.0 and above
* Mozilla Firefox 25.0 and above
* Microsoft Edge 12.0 and above
* Internet Explorer does not Support findIndex() method
* Safari 7.1 and above
* Opera 32 and above
S1E16: Startups - Exploring what works and a better future
Published: 2020-11-18 00:39:05

---
title: S1E16: Startups - Exploring what works and a better future
published: true
date: 2020-11-05 13:00:00 UTC
tags: 
canonical_url: https://anchor.fm/xrseapod/episodes/S1E16-Startups---Exploring-what-works-and-a-better-future-eluql6
---

Startups empower our communities and drive innovation. But what is a startup and what makes one successful? Our guest, [Elizabeth Scallon](https://www.linkedin.com/in/elizabethscallon/) of Alexa Startup and Funds, spills the tea on startup best practices, investment advice as well as diversity and inclusion as the competitive edge. Join us in this episode of XRSEAPOD. Subscribe and hope that Kirby, Vinay and Steven don't have to go through another Springstein reference from Nirav...

--- Send in a voice message: https://anchor.fm/xrseapod/message
A list of Great Python Projects for Beginners
Tags: python, beginners, codenewbie, replit
Published: 2020-11-05 12:49:40

# Beginner Python Projects

So you have learned the basics of Python programming but you are looking for projects that will test and expand upon what you have learned. 

Here is a list of project tutorials that will get you on the road to building your own Python projects in no time. 

Find the links to all the tutorials [here](https://beginnerpythonprojects.com/)

- Your first Python Game: Mad Libs
- A Guessing Game with Python
- Rock, Paper, Scissors
- Your first two-player Game: Tic, Tac, Toe
- Juggling with PyGame
- Crawl Wikipedia Pages with Python
- Web scraping with BeautifulSoup
- Web scraping with Selenium
- An Alarm Clock with Python GUI
- Data Science with Python
- Analyze Survey Data
- Your first web-app with Django
- Hangman Game 
- Basic Calculator GUI
- Memory Puzzle Game
- Password Generator
- Text Adventure Game
- Snake Game in Python
- URL Shortening Service with Django
- Introduction to Machine Learning
- Predict Wine Quality with Machine Learning
- Bitcoin Price Notification App
- Dice Rolling Simulator
- Encoding & Decoding Messages
- Discord Bot with Python
- Secret Communication App: Hiding text in images

## More fun projects
You can find the links to all these tutorials at [beginnerpythonprojects.com](https://beginnerpythonprojects.com/).

## Real-world projects 
If you are looking for some real-world projects to work on, check out [DevProjects](https://www.codementor.io/python-projects). It's a free community where you can learn programming through building projects specifically designed to give you a real-world challenge. But not to worry, they have projects for all levels of programmers and you can discuss projects, review code, and learn from peers and mentors. 

We are adding more projects daily so please let me know in the comments if you know of any good Python projects for beginners that we can add to the list.

Happy Coding!
Javascript Promise
Tags: javascript
Published: 2020-11-05 12:30:20

Below here is a pseudo-code for javascript promise:
````
const myPromise = new Promise((resolve,reject) => {
if(condition is true){
resolve("Retrieve data from database");
}else{
reject("An error occured");
}
```
As in life promises, something happens when a promise is fulfilled. You can achieve that with these lines of codes.

```
/*
When the resolve parameter of the promise constructor is resolved (processed and returns true) we can use 'then' property of Promise class to fulfill our promise.
*/
myPromise.then(res => { 
// do something with res data
});

//Similarly

/*
When the resolve parameter of the promise constructor is rejected due to some  (processed and returns false) we can use 'catch' property of Promise class to fulfill our promise but this time catching the error.
*/

myPromise.catch(error => {
//do something when promise is not resolved or display error
}
```

Thanks for reading my first post on dev.
Reddit In Comics Style
Tags: css, discuss, meta
Published: 2020-11-05 12:22:12

Hello guys, as a follow up of my previous post almost an year ago https://dev.to/gochev/dev-to-in-web-comics-style-36ca which was to make this amazing webside https://dev.to in comics style (it is a bit outdated btw) I just tried with Reddit.

Again I am no CSS or frontend person I just love comics
And again the REDDIT css will be broken very soon because their selectors and CSS classes looks like this 

``.Y4MkVr6trrdypfZVUkpIA, ._2vkeRJojnV7cb9pMlPHy7d ``

So I guess they are server side randomly generated and they change from time to time.

Still I will enjoy it till I can.


I have used an extension Stylus for chrome to apply the additional CSS on top of the reddit.com default css.

The CSS I wrote can be found here 
https://gist.github.com/gochev/eccfab4b9038ff460a3eb1f9ca49c5b3

After applying it your reddit will look like this on small view:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rihgo0a5yr1m63jyxiqp.png)

Or like this in general 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gtqlqlilcth2t6ga9lxd.png)
 
The article read view looks like this : 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/d4k69wigbjqvdhiudod5.png)

I just hope reddit can make a new style since the old one is so so ugly. Even linkedin had an updated style since today.. cmon :) it's about time.


I hope someone can improve it and actually make it better. 
Right now there are only 2 important bits. One is the general borders change :
```css
    border: solid black !important;
    border-color: black !important;
    border-width: 3px 4px 3px 5px !important;
    border-radius: 30% 2% 162% 3%/9% 96% 2% 99% !important;
```

And another one for more article or more "boxed" shaped boxes 
```css
    border: solid black;
    border-color: black;
    border-width: 3px 3px 5px 5px;
```

And of course about the titles font:

```css
@font-face {
  font-family: 'Bangers';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/bangers/v12/FeVQS0BTqb0h60ACH55Q2A.woff2) format('woff2');
}

h3{
    font-family: Bangers !important;
    font-size:22px;
}
```

Well that's it folks I hope you enjoy it.
Completed Hactoberfest 2020 challenge !
Tags: hacktoberfest
Published: 2020-11-05 12:20:38

<!-- ✨This template is only meant to get your ideas going, so please feel free to write your own title, structure, and words! ✨ -->


### [Intro Heading]
<!-- If you are new to the DEV community, introduce yourself and share a bit about why you joined DEV and decided to participate in Hacktoberfest this year.  --> 
### Background

<!-- Are you brand new to open source? What about coding in general? Tell us about how you got here →

### Progress

<!-- Share a bit about where you’re at in your Hacktoberfest journey. What stage are you at? How has the process been?  -->

### Contributions

<!-- This is where you can list the contributions you made and explain why you chose the projects you did. Don’t forget to add links!  -->


### Reflections
<!-- Overall, how has your Hacktoberfest 2020 experience been? If you’re a first-timer, will you participate again? What have you learned? Have you made any interesting connections? What is your next step in open source?  -->