teleren/devto huggingface dataset:
How to debug React Native WebView
Published: 2021-07-29 03:42:48

Assuming that you have already started working with React Native and possibly began to check how to debug code in and out using the debug menu in devices.
Keeping aside the traditional code and bringing focus on the WebView component only. Recently, React Native Dev made some changes in the web view repo and replaced UIWebView with WKWebView in iOS 8.0.
Then the next change happened, if you are reading this, then you probably must know this, React Native removed WebView from its repository and made it a self-supported import. Now it exists in,

[React Native Web View](https://medium.com/r/?url=https%3A%2F%2Fgithub.com%2Freact-native-webview%2Freact-native-webview)

Now, coming back to the main agenda of debugging HTML in iOS and Android devices.

...

**For iOS**
We need probably two things, an app running in any iOS device/iOS simulator with the app in debug state and Safari Developer Toolkit.

**To enable "Develop" mode in Safari Browser:**
* Open Safari Browser
* Under the Safari option, click on 'Preferences'
* Under the 'Advanced' tab, enable check "Show Develop menu in menu bar"

**Steps for debugging:**
* Run the React Native app with WebView in iOS device/ iOS simulator in debug mode
* Open Safari, from the menu bar, we need to click on 'Develop' option, 'Develop' > {Device Name} > {Application Name} > {Title}
* Now you can debug the HTML rendered within the WebView

...

**For Android**
We can debug the contents of the WebView in Chrome directly.

**Steps for debugging:**
* Firstly, we need to make some edits in the "MainApplication.java" file so that we can enable debugging, see below-attached image for importing

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vellqj2chju74do5goc9.png)
 
* Run the React Native app with WebView in Android device or Android emulator
* Open Chrome, and follow the links, DevTools > 3 dot menu > More tools > Remote devices
* Select the current device and then hit 'Inspect'
* Now you can debug the HTML content of the WebView

*Note: USB debugging must be enabled in your device settings.*

...

I was stuck at debugging the content for a while and then I referred this [link](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Debugging.md). I hope it'll be a great help to you.

**Happy Coding :)**
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. - Flutter
Published: 2021-07-29 03:12:36

1.  In the build.gradle file (app level),  Upgrade one signal gradle to the latest level eg
*from* `classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'`
*to* `classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.10'`

2. In the build.gradle file (project level), upgrade android build tool aswell *from* `classpath 'com.android.tools.build:gradle:3.5.0'` *to* `classpath 'com.android.tools.build:gradle:4.1.3'`

3. In side the gradle folder edit *gradle-wrapper.properties* and update the gradle e.g *from* `distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip` *to* `distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip`

4. Additionally, update the version of one signal to the latest version in `pubsec.yaml` and rebuild your project 

[Reference] (https://stackoverflow.com/questions/67362119/flutter-could-not-determine-the-dependencies-of-task-appcompiledebugjavawit)
Torrenting from your terminal 💻
Tags: tutorial, todayilearned, vim
Published: 2021-07-29 03:08:36

One of my favorite ways to torrent is by using [lynx 🐆](https://lynx.invisible-island.net/) along with [rtorrent 🌊](https://github.com/rakshasa/rtorrent) to effortlessly download and then torrent files using only my terminal window.

The benefits of using lynx to source torrents are:

* you can manually choose what cookies are saved to your computer (easily tap `N` to deny all cookies from a domain)

* javascript is disabled

* no obscene advertisements / malvertisements are shown to you, which are usually common on torrent search engines

* vim bindings 💪 (if you want them)

The basics of using lynx is something like this:

To get to the torrent website:

```
lynx anytorrentwebsite.com
```

Once you are at the download page, you only have to press `D` to download the torrent file.

You can then press `q` to close lynx.

The directory which you called lynx from in your terminal will be the directory that the .torrent file is saved to.

From there, you can call rtorrent with the .torrent file as your argument.

E.g.

```
rtorrent download.torrent
```

Then press up arrow key to select the torrent followed by `ctrl-s` to start the torrent.

Once the file is 100% downloaded, (it will say), press `ctrl-q` to quit rtorrent.

If you have [IINA](https://iina.io/) installed, and what you downloaded was a video file, then you can call:
```
open -a IINA {video-directory}
```

This will start your movie 🍿.

Enjoy
TDD Conference 2021 - How To Get Started With Test-Driving Your Code - Jov Mit
Tags: oop, programming, codenewbie, tdd
Published: 2021-07-29 03:02:35

First International Test Driven Development took place on July 10th. 

In this series, I will include every talk together with my notes and further reading.

Hopefully, a lot of readers will watch and rewatch the talks, as they are worth several reviews.

Let's continue...

## Bio 

Jov is a software craftsman and TDD practitioner, working on Android for around 10 years now. He has a big passion for clean code, TDD, software craftsmanship, and knowledge sharing. He co-organized the DevTernity conference. 
 
> TL;DR: TDD is hard to master, with good guidance we can get excellent solutions.

## Talk

{% youtube pmsql3qOmNA %}

# My Personal notes

- TDD is not a testing strategy or tool.
- TDD is a skill
- It takes a lot of time to master TDD.
- Customers don't care if we write tests, but they do care about the quality.
- Today there are at least two TDD Styles: [London School and Chicago School](https://cleancoders.com/episode/comparativeDesign-episode-1)
- Chicago School is inside-out. It designs on the green.
- London School is outside-in and [abuses mocks](https://dev.to/mcsee/code-smell-30-mocking-business-3glm). It designs on the red stage.
- When we plan the tests, we can use [ZOMBIES](https://dev.to/mcsee/how-i-survived-the-zombie-apocalypse-59gj) guidance.
- We must ensure tests are failing for the right reason. It is not enough to watch them fail.
- In TDD, procrastination is a good thing. The more we delay a decision, the better our solutions are. 

# Speaker Links

- Twitter [@jovchem](https://twitter.com/jovchem) 
- LinkedIn [@jovmit](https://www.linkedin.com/in/jovmit/)
- YouTube[@https://www.youtube.com/channel/UC71omjio31Esx7LytaZ2ytA](https://www.youtube.com/channel/UC71omjio31Esx7LytaZ2ytA)
- Site [https://jovmit.io](https://jovmit.io)
- Medium [@jovmit](https://medium.com/@jovmit)

* * *

Please follow TDD Conference on:

- [YouTube](https://www.youtube.com/channel/UCKn-DadPoyYssfAOMk1LSew)
- [Twitter](https://twitter.com/tddconf)
Introducing coco
Published: 2021-07-29 02:49:19

Hey, 

Recently I have been running a lot of curl scripts, and they get annoying to google, copy and paste into the terminal. I built coco to fix that.

Coco provides a simple CLI to add scripts with full argument support, so you can make curl requests faster.

Lets say I want to get someones GitHub contributions:

```
coco add contributions "https://github-contributions-api.deno.dev/+1.term"```

Now, I can type `coco contributions GITHUB_USERNAME` and that'd template out to `https://github-contributions-api.deno.dev/GITHUB_USERNAME.term`

It's simple but does the trick. I plan to add more features that get suggested.

If you want to star the repo, here is the link. https://git.io/coco

Thanks, and, hope coco helps you out somehow.
How to delete a file in terminal on your mac book
Published: 2021-07-29 02:44:51

1. Open the terminal
2. Navigate to the folder with the file you intend to delete
3. Check that the file you wish to delete is within folder **use `ls` command**
4. To delete file type `rm fileName.doc` - this permantely deletes the file named fileName from your machine

**[Reference](https://www.lifewire.com/use-terminal-to-delete-a-file-on-a-mac-4769045)**
Sparky's Tool Tips: "Favorite Documents" Visual Studio extension
Tags: tooling, visualstudio, dotnet, productivity
Published: 2021-07-29 02:23:58

When you're working with a Visual Studio solution, even if it contains multiple projects and dozens of files, you usually spend most of your time working with a handful of documents.

The [Favorite Documents](https://marketplace.visualstudio.com/items?itemName=SergeyVlasov.FavoriteDocuments) Visual Studio 2019 extension adds a "Favorite Documents" menu to Visual Studio to make it easy to get to them.

When you're working with a file that you want to get back to easily later, just click the "Favorite Documents" toolbar's "⭐" icon:

![Favorite Documents "Add to Favorites" button / dialog](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ttj10wstuipsu1u6hsqo.png)

...and click the popup dialog's "Add" button to add it to the favorites menu:

![Favorite Documents menu with file added](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vnx4rdiprt3l5ix09k8o.png)

In this screenshot, I've added several favorite documents:

![Favorite Documents menu with multiple files](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f67jhqtrzz4jzi263dl0.png)

The second, "eight-pointed star" icon adds all open documents to your Favorite Documents, and the third icon can be used to add external documents.

Favorites are "remembered", so if you close a solution and come back to it later, the favorites will still be there.

By default, favorites are "Solution-specific" - they're tied to the solution's folder, so if you open another branch of the same solution you won't see the favorites.

If you don't check the "Solution-specific" checkbox when adding, the favorites are relative to the solution root, so they work across multiple branches. Here are my cross-solution favorites:

![Favorite Documents menu with cross-solution favorites](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gm9ib5y70dbyvny5wl5w.png)

Two things I'd like to point out in the screenshot above:
- You can add Source Control Explorer links as favorites
- You can organize favorites in folders

The last icon on the Favorite Documents toolbar brings up the "Organize Favorites" window:

!["Organize Favorites" window](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/134eqzar6kjaxpn52yvc.png)
A beginner's story...
Tags: webdev, react
Published: 2021-07-29 01:53:35

I was told a blog post is one sure way to get your employers enthused about employing a junior developer these days. Well, this is where my story begins. I've been holding back to this for quite a long time to start talking about my experiences but I guess it's time to give it a go :). I'm gonna try and document my experiences much more this time and post occasionally about whatever new thing I learn. 

I love JaaaaavaScript..It gave me a whole new vision to programming world. Can't wait to be better at it with time :).
Feel free to hit me up with any interesting developments in the tech world I should know. See y'all at the top :)
The UseEffect() Hook
Tags: react, hooks, javascript, programming
Published: 2021-07-29 12:18:56

---
title: The UseEffect() Hook
published: true
date: 2021-07-29 01:45:05 UTC
tags: react,hooks,javascript,programming
canonical_url: https://medium.com/codex/the-useeffect-hook-261b0cafaf1e
---

[![](https://cdn-images-1.medium.com/max/2600/0*BOr3jQIpiGcTuMwL)](https://medium.com/codex/the-useeffect-hook-261b0cafaf1e?source=rss-be00f566a88f------2)

How to implement React.useEffect() when dealing with side-effects in our code

[Continue reading on CodeX »](https://medium.com/codex/the-useeffect-hook-261b0cafaf1e?source=rss-be00f566a88f------2)
Use Webcam with React easily
Tags: react, typescript, codesandbox
Published: 2021-07-29 01:35:25

## Step1 Create a react app with `create-react-app`

```zsh
$ yarn create react-app webcam-app --template typescript
```

## Step2 Install `react-webcam` (@types/react-webcam)
{% github mozmorris/react-webcam%}
```zsh
$ yarn add react-webcam @types/react-webcam
```

## Step3 Create a simple component

`src/components/WebCamDisplay/index.tsx`

```ts
import { useRef } from "react";
import Webcam from "react-webcam";

export const WebCamDisplay = () => {
  const webcam = useRef<Webcam>(null);

  return (
    <>
      <Webcam audio={false} ref={webcam} />
    </>
  );
};

```

```zsh
$ yarn start
```

Codesandbox
https://codesandbox.io/s/agitated-stonebraker-h11sl?file=/src/components/WebCamDisplay/index.tsx
PHP Recursive Fibonacci
Tags: php
Published: 2021-07-29 01:32:52


```
<?php
  $inputdata = @$_POST[‘inputdata’];  if(empty($inputdata))
  {
   $inputdata = @$_GET[‘inputdata’];
  }  
  
  $result = array();
  if(is_numeric($inputdata))
  {
   if(!empty($inputdata))
   {
   
    $result = array();
 
    for ($i = 0; $i < $inputdata; $i++)
    {  
        $dataseriestemp=series($i); 
        if($dataseriestemp==0)
        {
        }
        else if($dataseriestemp%2==1)
        {
          $result[]=$dataseriestemp;
        } 
     } 
   }
 }

function series($num)
{ 
 if($num == 0)
 { 
   return 0; 
 }
 else if($num == 1)
 { 
   return 1; 
 } 
 else 
 { 
   return (series($num-1) + series($num-2)); 
 } 
}

rsort($result);
header(‘Content-Type: application/json’);
echo json_encode($result);
?>
```
PHP Damarau levenstein on Longest Match SubString
Tags: php
Published: 2021-07-29 01:18:38

```
function getLongestMatchingSubstring($str1, $str2)
{
    $len_1 = strlen($str1);
    $longest = '';
    for($i = 0; $i < $len_1; $i++){
        for($j = $len_1 - $i; $j > 0; $j--){
            $sub = substr($str1, $i, $j);
            if (strpos($str2, $sub) !== false && strlen($sub) > strlen($longest)){
                $longest = $sub;
                break;
            }
        }
    }
    return $longest;
}
```
useInterval - React hook
Tags: codesandbox, react, webdev, frontend
Published: 2021-07-29 00:47:31

This is a series of tying out the custom hooks introduced in the really good article by [team] (https://thesmartcoder.dev/author/team/) about useful React custom hooks.

[8 Awesome React Hooks](https://thesmartcoder.dev/awesome-react-hooks/)

### useInterval

Counts up by 2 at 2.5-second intervals

{% codesandbox ck9i6 %}
Node....so far.
Published: 2021-07-29 00:19:58

Recently, I've been working a full-time job as a hydroponic farmer, working to keep up with my fitness goals and coding. It's hard when most of your time is already spread out over so many activities. I've been looking to try and learn new technologies as I continue to sharpen my current skills. After a while of second guessing, I decided to take the plunge into node.js. I'm learning some pretty cool things as I go through this udemy course. 

So...what is node exactly? The official node js doc describes node as 'a JavaScript runtime built on Chrome's V8 JavaScript engine.' An easier, and probably over simplified, way to think about node is that it is a tool that allows you to run javascript outside of a browser. This allows us the ability to create back-end services.

While I'm still learning about node, I'm becoming very familiar with the basics. If you're new to using node and want to check if you have it on your computer in the terminal you can type:

```
node -v
```

If it is installed you should see a version number. If you don't its just a simple trip to the docs and downloading whichever version is right for your computer(windows or mac). After following the prompts run the above command in terminal to double check if node exists on your computer now. You should see a version number appear like:

```
v15.5.0
```
Once started you can test out your code skills in the REPL environment that node provides. Just type 'node' in the terminal and it will open up an environment for you to play around it. You can assign variable, practice functions, and maybe even more. Another way to practice your js chops within node is to create a .js file and practice your JS skill there. Depending if you want to check on certain outputs of a function you could run the file in your terminal as well by using 

```
node *file_name*.js
```

As I stated in the beginning, very basic knowledge so far, but a week ago I didn't even know what node was. Sounds like a win to me. I'm excited to dive deeper into using node and gain an even greater understanding of it. Give it a try and as always, Happy Coding!
How to delete a user in Linux?
Tags: resource
Published: 2021-07-29 00:00:00

---
  title: How to delete a user in Linux?
  published: true
  tags: Resource
  date: Thu Jul 29 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/delete-a-new-user-linux
  cover_image: https://melvingeorge.me/_next/static/images/main-20a3fc01524dc79ae970b76171a0802c.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/delete-a-new-user-linux)
  
To delete a user in Linux, you can use the `userdel` command followed by a space and the name for the user to delete in Linux.

For example, let's say you want to delete a user called `john`, you can use the `userdel` command like this,

```bash
# Delete a user in Linux
sudo userdel john
```

- Sometimes you may need to use the `sudo` command before the `userdel` command to obtain the correct privileges to execute the command.

Try executing the above command in this [online terminal](https://copy.sh/v86/?profile=archlinux) to see the result.

### Feel free to share if you found this useful 😃.

---
Merge several individual ssh configuration files to one single file in Golang
Tags: go
Published: 2021-08-04 19:49:59

---
title: Merge several individual ssh configuration files to one single file in Golang
published: true
date: 2021-07-29 00:00:00 UTC
tags: #go #golang
canonical_url: https://mnlwldr.com/ssh-merge-config-golang/
---

The easiest way to achieve this is to write something like `cat ~/.ssh/config_* >> ~/.ssh/config` in the shell or add an alias, but that’s not so funny.

## Usage

```
ssh-merge-config ~/.ssh/config.d/ ~/.ssh/config

```

The first parameter is the source folder to read and the second parameter is the destination file.

## Output

```
~ ssh-merge-config ~/.ssh/config.d/ ~/.ssh/config
done

```

That’s it. The code is on GitHub [https://github.com/mnlwldr/ssh-merge-config](https://github.com/mnlwldr/ssh-merge-config "ssh-merge-config on Github").

```
package main

import (
    "bytes"
    "fmt"
    "io/ioutil"
    "log"
    "os"
    "time"
)

func main() {

	name := os.Args[0]

	if len(os.Args) < 3 {
		help(name)
		os.Exit(255)
	}

	directory := os.Args[1]
	output := os.Args[2]

	if _, err := os.Stat(directory); os.IsNotExist(err) {
		log.Printf("%s does not exist", directory)
		os.Exit(255)
	}

	files, err := ioutil.ReadDir(directory)
	checkErr(err)

	var content bytes.Buffer
	for _, f := range files {
		readFile,err := ioutil.ReadFile(directory + string(os.PathSeparator) + f.Name())
		checkErr(err)
		content.WriteString(string(readFile))
	}

	if _, err := os.Stat(output); err == nil {
		backup(output)
	}

	out, err := os.Create(output)
	checkErr(err)
	defer func(out *os.File) {
		err := out.Close()
		checkErr(err)
	}(out)

	_, err2 := out.WriteString(content.String())
	checkErr(err2)

	fmt.Println("done")
}

func checkErr(err error) {
    if err != nil {
        log.Fatal(err)
    }
}

func help(name string) {
    fmt.Printf("Usage: %s [input directory] [output file]\n", name)
    fmt.Println("Example: ")
    fmt.Printf("\t %s ~/.ssh/config.d/ ~/.ssh/config\n", name)
}

func backup(filename string) {
    var backupFile bytes.Buffer
    backupFile.WriteString(filename)
    backupFile.WriteString(".")
    backupFile.WriteString(time.Now().Format("20060102"))

    err := os.Rename(filename, backupFile.String())
    if err != nil {
        checkErr(err)
    }
}
```
What we think works vs. what actually works
Tags: practices, codereview
Published: 2021-07-29 14:19:42

---
title: What we think works vs. what actually works
published: true
date: 2021-07-29 00:00:00 UTC
tags: practices,codereview
canonical_url: https://jhall.io/archive/2021/07/29/what-we-think-works-vs.-what-actually-works/
---

Now I’m no nutritionist or physician, but I’ve done a fair amount of reading about health-related topics in the past—enough to know there are many conflicting theories about what one should eat to maintain good health:

- Eat low-fat foods.
- No, eat high-fat foods, but with “natural” fats.
- Eat low-carb foods.
- Actually carbs are fine, just avoid “processed” carbs.
- Eat low-sodium foods.
- No, no, sodium is fine, as long as it’s Himalayan salt.
- Don’t drink alcohol.
- Actually, one glass of wine per day is good for you!

Every claim is backed by multiple studies “proving” the claim is the one true claim.

But there’s one thing that practically everyone agrees on will improve your health: Exercise.

People who do exercise are practically universally healthier than those who don’t, regardless of what they eat.

In the IT field we have the same sorts of conflicting bits of advice:

- Write short functions
- No, write long functions
- Microservices are great
- Actually monoliths are easier to manage
- Scrum is the best way to do Agile
- No, you should really do Kanban
- Tabs FTW
- No, spaces

In some ways, it’s actually worse in IT, though, because most of these claims have no actual _science_ to back them up. It’s like we’re still in the folk-medicine days of IT. We’re still debating the efficacy of animal dung ointments and bloodletting with leeches.

But there has been _some_ science done in our field.

Despite the growing number of [folk claims to the contrary](https://jhall.io/archive/2021/07/28/responding-to-no-code-reviews-by-default/), one practice that’s been proven effective<sup><a href="#ref1">1</a></sup> in improving software quality is [code review](http://localhost:1313/posts/why-code-review/).

Hillel Wayne talks about this in his talk [Intro to Empirical Software Engineering: What We Know We Don’t Know](https://www.youtube.com/watch?v=WELBnE33dpY) (notes and references [here](https://www.hillelwayne.com/talks/what-we-know-we-dont-know/)).

* * *

<sup id="ref1">1</sup> [An Empirical Study of the Impact of Modern Code Review Practices on Software Quality](https://sail.cs.queensu.ca/Downloads/EMSE_AnEmpiricalStudyOfTheImpactOfModernCodeReviewPracticesOnSoftwareQuality.pdf)

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._