teleren/devto huggingface dataset:
How to set metric in OS moderated with NetworkManager
Tags: networkmanager, fedora, nmcli, metrics
Published: 2020-06-08 04:16:32

Sometimes we want to have several connections at the same time, one to the ethernet (wired lan) and one other to the wireless router, with two different gateways. In this documentation i describe how to make wireless connection prior to ethernet connection in each linux OS using NetworkManager service to moderate network connections. I've tested these instruction in fedora 31 already.

## List your connections

 ```
 [m.emami@home ~]$ nmcli connection 
 NAME        UUID                                  TYPE      DEVICE               
 sample1     a16d1a96-2833-4876-a6c2-************  vpn       wlp0s20f0u11 
 bevaght     f46ba9ff-1114-4e79-9c8a-************  wifi      wlp0s20f0u11
 eth1        7648e3eb-c03f-46e9-b24e-************  ethernet  enp2s0
 ```

## Edit the wireless connection

```
[m.emami@home ~]$ nmcli connection edit bevaght

===| nmcli interactive connection editor |===

Editing existing '802-11-wireless' connection: 'bevaght'

Type 'help' or '?' for available commands.
Type 'print' to show all the connection properties.
Type 'describe [<setting>.<prop>]' for detailed property description.

You may edit the following settings: connection, 802-11-wireless (wifi), 802-11-wireless-security (wifi-sec), 802-1x, ethtool, match, ipv4, ipv6, tc, proxy
nmcli> set ipv4.route-metric 10
nmcli> save
nmcli> quit
```

## Edit the ethernet connection

```
[m.emami@home ~]$ nmcli connection edit eth1

===| nmcli interactive connection editor |===

Editing existing '802-3-ethernet' connection: 'eth1'

Type 'help' or '?' for available commands.
Type 'print' to show all the connection properties.
Type 'describe [<setting>.<prop>]' for detailed property description.

You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, sriov, ethtool, match, ipv4, ipv6, tc, proxy
nmcli> set ipv4.route-metric 2000
nmcli> save
nmcli> quit
```

## Restart NetworkManager service

```
[m.emami@home ~]$ sudo systemctl restart NetworkManager
```

Congratulation! routes related to the WiFi connection (named `bevaght`) are prior to routes related to the Ethernet connection (named `eth1`)

```
[m.emami@home ~]$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    10     0        0 wlp0s20f0u11
0.0.0.0         192.168.1.1     0.0.0.0         UG    2000   0        0 enp2s0
```
Intro to useState Hook
Tags: javascript, react
Published: 2020-06-08 03:56:01


Hooks, introduced in React v16.8, are a welcome addition allowing the use of state in functional components. Prior to this React update, only class components could hold state. The [React docs](https://reactjs.org/docs/hooks-intro.html) state that it is not necessary to change all of your existing class components into functional components incorporating hooks. Rather, it is recommended, that moving forward, one begin to use Hooks in functional components and phase out class components.
Hooks cannot be used in class components.
Hooks do not remove any previous functionality, and as of now, there are no plans to replace anything with hooks.

<h2>useState Hook</h2>

The useState hook allows us to declare a state and update it in a functional component. To get started with the useState hook, import it from React. 

```import React, {useState} from 'react'```

Then, use useState to declare state within a functional component. 

``` const [statefulValue, functionToUpdateState] = useState(initialState) ```

The useState hook returns two things, a stateful value and a function to update that state. useState() can take in an argument of the initial state. 

The functionToUpdateState takes in an argument that becomes the new state. A re-render will occur once this function is invoked.
 
A functional component with the useState Hook may look like: 

``` 
const exampleFuncComp = () => {

   const [state, setState] = useState(initialState)


    setState(newStateValue)
//This will change the state to the value of the argument passed in. 
}
```



 <h3>Conclusion</h3>

There are many Hooks introduced in React 16.8. To learn more about them, read the [React docs](https://reactjs.org/docs/hooks-intro.html) and start implementing them in your functional components.
What is Best Phone Transfer Software
Tags: transfer, datatransfer, phonetransfer, transfersoftware
Published: 2020-06-08 03:39:05

One of the biggest and common issues that people encounter in using devices with different operating systems or platforms such as iPhone and Android, is the loss of data during the transferring of files from the iPhone to the Android device. A lot of people have experienced losing some of their important information and data such as contacts, pictures, videos when they were transferring these files from their iPhone or to their Android or Windows gadget. And this is primarily because of the incompatibility issues between different operating systems. Different operating systems have their own set of protocols in handling their set of data. And once these systems detect foreign or unique forms of data entering their system, glitches and errors happen, which in result causes the loss of data. 

And one of the most effective methods in avoiding the loss of data due to glitches and error is by using a 3rd party software or application that will allow you to convert and support the foreign data from your iPhone into a compatible format for your Android device or vice versa. 

And this is where this Fonedog Phone Transfer review enters. Fonedog Phone Transfer is a 3rd party application that will help you avoid losing your data and information plus many more when handling gadgets of different operating systems. Below are some of the benefits that you will get to enjoy with the application.

* Seamless Transfer of Files

With the Fonedog Phone Transfer, you will get to enjoy seamless transfer of your files from your iPhone and iPads to your Android devices without the risk of losing some of the data. Fonedog Phone Transfer supports all kinds of data from these different systems making it easier for the application to manage and transfer files from iPhone to Android or vice versa.

* Conversion of Files

Another great feature of the application is that it allows you to convert from one file to another. Converting your HEIC images into the .PNG or .JPEG formats will be a lot easier with the application. Messages from your iPhone’s iMessages can be converted into .txt or Html formats which are the native formats for Windows devices. Videos, Podcasts, and Movies from one device can also be converted into a compatible format for another device or your TV.

* Export and Import your Data

With a just a click, you can easily import or export the data from your Windows system to your iPhone or Android phone.

* Back-up and Restore Data

And for emergency purposes, you can also choose to back-up all of your data in the application and restore it in the future.
Overall, the Fonedog Phone Transfer application is a one-stop application that will allow you to secure and manage your data from your different devices. Furthermore, other perks such as customized ringtones, de-duplication of contacts and a thorough search and delete of unnecessary files are also available in the application. Try it out now.
Statistically Significant
Tags: beginners, statistics, testing
Published: 2020-06-08 02:52:48

How do scientists test out different theories? One such strategy is using a p-value test. 

## Problem Statement
On average, do dogs weigh more than cats?

## State the Hypothesis

This is where we make our guesses. When we try to prove that event A causes event B, we have to provide the burden of proof, just like a prosecutor in a court case. Now we state our hypotheses.

> Null Hypothesis: On average, dogs do not weigh more than cats.
> Alternate Hypothesis: On average, dogs weight more than cats.  

## Set the Significance Level

For the test, we need to set a certain probability threshold that will indicate whether or not the probability we get after doing the test is significant or not. Generally the threshold is set at 0.05 or 5%. So if the test gives a probability less than 5%, then the information is significant enough to reject the null hypothesis. If the probability is greater than 5%, then the test is not significant enough to reject the null hypothesis.

> Set the significance level or alpha to 0.05

## Perform the Test

After setting the significance level, we can now perform the statistical test. This can pretty much be any test like chi square test, t-test, z-score, etc. After performing the test, we get a probabilistic value based on the test. This is called the p-value. If the p-value is less than the significance level, then we reject the null hypothesis.

## Conclusion

Now we can conclude our test. 

> P-value = 0.03. Therefore I reject my null hypothesis.
> P-value = 0.16. Therefore I do not reject my null hypothesis.
Day 7: #100DaysofCode - Setting up a Sinatra App - Part 3
Tags: ruby, womenintech, codenewbie, 100daysofcode
Published: 2020-06-08 01:43:13

<h1> Gemfile </h1>

If you bundle added all of your gems and ran ``bundle install`` your gem file will look similar to this:

```
gem "sinatra", "~> 2.0"

gem "sinatra-activerecord", "~> 2.0"

gem "activerecord", "~> 6.0"

gem "sqlite3", "~> 1.4"

gem "pry", "~> 0.13.1"

gem "require_all", "~> 3.0"
```


<h1> Gemfile.lock </h1>

This file should have been auto-generated after running ``bundle install `` . It should have all of your gem specs.


<h1> environment.rb </h1>
"SINATRA_ENV" is the key to Ruby’s ENV hash and defines your deployment environment, configures our database, and requires all the files in our app.

```
ENV['SINATRA_ENV'] ||= "development"

require 'bundler/setup'
Bundler.require(:default,ENV['SINATRA_ENV'])

configure :development do
  set :database, {adapter: 'sqlite3', database: "db/database.sqlite3"}
end

require_all 'app'
```

<h1> application_controller.rb </h1>

```
class ApplicationController < Sinatra::Base

  set :views, -> {File.join(root, "../views")}

  get '/' do
    erb :index
  end

end

```

<h1> layout.erb </h1>

```
<html>
  <head>
    <meta charset="UTF-8">
    <title>title</title>
  </head>
  <body>
    <div class="container">
      <%= yield %>
    </div>
  </body>
</html>

```

<h1> Rakefile </h1>

Your Rakefile should be requiring your environment and if you want to be able to run ``pry`` in your rake console you should have the following in your rake file: 

```
require_relative './config/environment'

require 'sinatra/activerecord/rake'

desc "Starts console"
task :console do
  Pry.start
end
```

Now you should be able to run ``shotgun`` in your terminal and head over to <a href="http://localhost:9393/"> http://localhost:9393/ </a> in your browser and you should see "Hello". 

Next step will be to set up our database by using rake. If you want to browse the rake commands run ``rake -T`` in your console.
Making Money on the App Store
Tags: ios
Published: 2020-06-08 01:38:07

---
title: Making Money on the App Store
published: true
description: A post about moaking money on the App Store.
tags: [iOS]
//cover_image: https://direct_url_to_image.jpg
canonical_url: https://www.maeganwilson.com/2020/06/06/making-money-on.html
---

I just wanted to share this tweet from an indie developer I follow on twitter. 
{% twitter 1269349151483011072 %}
The thread and comments are worth a read when questioning why an app is paid or free or has in app purchases. If the app has servers like for logging in or weather data, then that's a reoccurring expense on the developer, and they need a way to make that money back so the app lives on.

I have both a free app ([Universe Converter](https://apps.apple.com/us/app/universe-converter-for-artnet/id1399672978)) and a paid up front up app ([iHog](https://apps.apple.com/us/app/ihog-osc-lighting-remote/id1487580623)). iHog got shared by High End Systems and has been able to pay for itself this year, but not for the website, luckily I also write blog posts that have allowed me to break even. Universe Converter hasn't made any money, but I do get at least 5 downloads a week. Anyone who has used it and found it useful hasn't tipped anything. I'm not expecting anyone too, but it's hard to make money on the App Store. It's hard to break even on the App Store.

This isn't a post begging you to give me money. It's a post to explain that there are costs involved and making money on the App Store is hard.

---

I survive off of coffee. The more coffee I get the more posts I can write. Buying me a coffee or two by clicking the image below is a way to get me more :coffee: and more posts! 

[![Donate Caffeine by buying me a coffee on Ko-Fi](https://dev-to-uploads.s3.amazonaws.com/i/8fey6iatjrl7cvrent11.png)](https://ko-fi.com/appsbymw)
Text formatting in Javascript
Tags: javascript, beginners
Published: 2020-06-08 01:04:04

At some point, you may need to transform/manipulate strings to output them in the way that you want/need. You can write custom methods, but I think there's something here for you. I present to you several javascript methods for text formatting!

##concat()

Combines the text of two strings and returns a new string.

```js
let string1 = 'Hello'
let string2 = 'world!'
let string3 = string1.concat(' ', string2)
console.log(string3)
// expected output: 'Hello world!'
```
##split()

Splits a String object into an array of strings by separating the string into substrings.

```js
let string1 = 'I!am!saying!hello!to!the!world'

string1.split('!')
// expected output:['I','am','saying','hello','to','the','world']
```
##toLowerCase(),toUpperCase()

Return the string in all lowercase or all uppercase, respectively.

```js
let string = "Hello World!"

let upperString = string.toUpperCase()
let lowerString = string.toLowerCase()

console.log(upperString)
// expected output: HELLO WORLD!
console.log(lowerString)
// expected output: hello world!
```
##slice()

Extracts a section of a string and returns a new string.

```js
let string = "Hello World!"

console.log(string.slice(0))
//expected output: Hello World!
console.log(string.slice(5))
//expected output: World!
console.log(string.slice(-1))
//expected output: !
```
##match(), matchAll(), replace(), replaceAll(), search()

Work with regular expressions.

```js
const paragraph = 'The quick brown fox jumps over the lazy dog. It barked.';
const regex = /[A-Z]/g;
const found = paragraph.match(regex);

console.log(found);
// expected output: Array ["T", "I"]

const p = 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?';

const regex = /dog/gi;

console.log(p.replace(regex, 'ferret'));
// expected output: "The quick brown fox jumps over the lazy ferret. If the ferret reacted, was it really lazy?"

console.log(p.replace('dog', 'monkey'));
// expected output: "The quick brown fox jumps over the lazy monkey. If the dog reacted, was it really lazy?"

```

##trim()

Trims whitespace from the beginning and end of the string.

```js
const greeting = '   Hello world!   ';

console.log(greeting);
// expected output: "   Hello world!   ";

console.log(greeting.trim());
// expected output: "Hello world!";
```
Convert HTML Inline Styles to a Style Object for React Components
Tags: react, javascript, webdev
Published: 2020-06-08 00:54:04

I once found myself having to copy some HTML elements and convert into JSX. The elements were accompanied with inline styles that React was evidently not happy with :rage:.

{% gist https://gist.github.com/Qausim/b91f2d76caff8c1fbb19344f440fb734/a569c4d80310d5bbfbccf984fd622a27e750096f
%}

![JSX with inline style string attribute error](https://dev-to-uploads.s3.amazonaws.com/i/pynkovw8usg1kt68z19l.PNG)
<figcaption>Erm... React is not happy with this :unamused:</figcaption>


React expects an object, with property names unhyphenated but in camel case, to be passed into the style attribute. I could do it manually but it gets boring and error prone with time. So I decided to write a Javascript function that automates the conversion.

{% gist https://gist.github.com/Qausim/b91f2d76caff8c1fbb19344f440fb734.js file=ReactInlineStyleToObject.js %}

<figcaption>Main function is "getStyleObjectFromString" while "formatStringToCamelCase" is a helper function.</figcaption>

Given a string `"display: flex; flex-direction: column; align-items: center; -webkit-align-items: center"` passed into `getStyleObjectFromString` as an argument, an empty object literal is created. On line 15 the string is split around all semicolons resulting in an array of strings ```["display: flex", "flex-direction: column", "align-items: center", "-webkit-align-items: center", ""]```

The array of string is then looped over using the Array's `forEach` method. `forEach` takes a callback function that receives each element of the array per iteration as argument. Our callback function splits each element around the colon (":"), separating the CSS property name and value. It assigns these to `property` and `value` variable names.

Given `"display: flex"`, property will equal `"display"` while value equals `" flex"`. Given an empty string (the last element in the array), property will equal `""` while value equals `undefined` (both falsy values).

On line 17, the function returns if `property` is falsy. On line 19, the trimmed property name - cuz "edge cases" :wink: - is passed into `formatStringToCamelCase` which splits the string parameter around every occurence of an hyphen ("-") then changes the first letter in every other word besides the first to an uppercase letter. It then joins every word together. If `"align-items"` was passed, this operation will give `"alignItems"`.

The result from `formatStringToCamelCase` is our property name, in the right format, to be used in our style object to point to the trimmed `value` string.

At the end of the day, `"display: flex; flex-direction: column; align-items: center; align-items: center; -webkit-align-items: center"` gives `{ display: "flex", flexDirection: "column", alignItems: "center", WebkitAlignItems: "center" }`.

You can check out the demo on [Code Sandbox](https://codesandbox.io/s/react-inline-css-to-style-object-drc0r)
Remove Screen Flickering OBS 💻📹
Published: 2020-06-20 17:55:15

---
title: Remove Screen Flickering OBS 💻📹
published: true
date: 2020-06-08 00:45:00 UTC
tags: 
canonical_url: https://2kabhishek.blogspot.com/2020/06/remove-screen-flickering-obs.html
---

I was recently trying out OBS for my new [YouTube Channel](https://www.youtube.com/channel/UCTedGjRpeTc8NTbchraGIuw)! but faced weird flickering issues when recording, after a lot of tweaking I found the solution. 

  

You have to turn of Vsync on your system.

  

On KDE the steps are as follows:

1. Open System Settings
2. Then go to Display and Monitor section
3. Click on Compositor
4. Here, change Tearing Prevention (vsync) to Never

This should do the trick. Try again and you shouldn't face flickering issues anymore.
I found the most amazing resource for easing functions!
Tags: go, computerscience, algorithms
Published: 2020-06-08 00:34:35

{% youtube T3LbG_9o1SY %}

Follow me on [YouTube](https://www.youtube.com/channel/UCTHij3Ac5GizLsn5yB4IX_Q/) and [Twitter](https://twitter.com/FeuryDonald) for more video editing tricks with **ffmpeg** and some **golang** programming!

So I was looking around for resources relating to easing functions, mostly for my video editing automation project I'm working on.

I came across this amazing [site](https://easings.net).

It has really nice examples of basically any easing function I could think of. Its an amazing resource.

I actually adapted all the math formulas for each easing function and put them into a go package for ease of use in your code.

The repo is [here](https://gitlab.com/dak425/easing), I'm also adding a **ffmpeg** specific sub package for it as well, to get a string representation of the same formulas to use in dynamic ffmpeg filter arguments.
Implement subdomains with VueJS.
Tags: vue, javascript
Published: 2020-06-08 00:26:24

---
title: Implement subdomains with VueJS.
published: true
description: Add subdomains with VueJS and Vue router.
tags: VueJS, Javascript
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/gitc2bfmpdao3k34x206.png
---


Tipically any VueJS project has a "router.js" file, here we need to set a subdomain route or routes:

router.js:

```js
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from './views/Home'
import CustomerHome from './views/CustomerHome'

Vue.use(VueRouter)

export default new VueRouter({
    mode: 'history',
    routes: [

        { 
            path: '/app', 
            name: 'Home', 
            component: Home 
        },

        { 
            path: '/*/app', 
            name: 'foundationHome', 
            component: CustomerHome 
        },
    ]
})

```

Here we are setting two routes, the first "/app" goes to Home view, the second is the one that is useful for set subdomains, this route can be literally "anything/app", this "anything" could be any string it's a wildcard.

## Create a link you can set:

```js
<router-link to="anything/app">Go to</router-link>
```

## But if I need to catch the wildcard value?

In any component create a computed property and add the next function:

```js
computed: {
    wildcard() {
       return this.$route.params.pathMatch
    },
},
```

## Push a route:

With an event you can create the same functionality as a route-link.

You cannot use a named route, because a wildcard is not a param so you cannot add wildcard as property in the route object, to solve this you can build a string for some route endpoint as you need it: 

```js
methods: {
    goHome() {
        return this.$router.push(`/${this.wildcard}/app`)
    }
},
```

So now you can reference the value anywhere in your component with "this.wildcard", this could be particularly useful when you need to build a request by some tenant.

Thats all, thanks for reading.
Is there such a thing as "Full Duplex" in an Ethernet environment?
Published: 2020-06-08 00:08:20

When we think about what [CSMA](https://en.wikipedia.org/wiki/Carrier-sense_multiple_access) really does; we have to ask this question. In an Ethernet environment with only 1 [NIC](https://www.google.com/search?q=nic+card) card, is "[Full Duplex](https://www.google.com/search?q=full+duplex)" mode really able to send and receive at the same time?

My original thought was no, until I was reminded by @RiturajBorpujari below that NIC cards can operate in full duplex mode.  He reminded me of crossover cables, which establish two point to point connections. In this mode CSMA is turned off.

Is there such a thing as Full Duplex in an Ethernet Environment? Yes

- CrossOver cables are true duplex
- Any network with switches (which work at Mac layer) establish 'logical' point to point connections
- Routers can use both switches and or a technique named [Mutipexing (Muxing)](https://en.wikipedia.org/wiki/Multiplexing) 

Interesting Links:

Ever wondered about the maximum throughput of [GigaBit Ehternet](https://www.cablefree.net/wireless-technology/maximum-throughput-gigabit-ethernet/)

[Bandwidths for all known devices](https://en.wikipedia.org/wiki/List_of_interface_bit_rates)

Did you know, that telephone companies were charging around $2,000.00 per month for T1 service throughout the 90's? At 1.5Mb/s that's equivalent to your wireless router @ 2Mb/s for a one time fee of $99.00 (for a good one) which may last 10 years.

```
DS1 / T1 (and ISDN Primary Rate Interface)	1.544 Mbit/s	1990
```