teleren/devto huggingface dataset:
How to upgrade Kotlin plugin in Android Studio
Tags: android, kotlin
Published: 2022-06-08 17:49:53

Problem: I am on Android Studio Bumblebee, and every time, I get an error saying that "Outdated Bundled Kotlin Compiler" error, and whenever I go to Tools > Kotlin > Configure Kotlin Plugin Update, I see the "Update" button, but when I do that, I get an error: "plugin kotlin was not installed: request failed with 404"

Solution: We need to install the plugin manually: 

- Go to this webpage: https://plugins.jetbrains.com/plugin/6954-kotlin

- Click on GET button, and select Android studio from dropdown

- Next you gotta figure out your android studio version, and expected plugin version to download. I found which plugin to download by going to Android Studio > Preferences > Plugins >  search for kotlin and note down the plugin version there.

I just downloaded the plugin version mentioned in above step and to install that, in  Android Studio > Preferences > Plugins, there is a settings button, which shows a dropdown to install plugin from disk, choose that, choose the plugin file and restart android studio
![Dropdown where the install plugin from disk option is](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l8go08yxd8dcvgwynzsq.png)
React useRef Hook simple example
Published: 2022-06-08 17:40:41

## React useRef Hook

The useRef Hook is used to persist values between renders.
It does not cause a re-render when updated and can be used to store a mutable value, it also used to access a DOM element directly.

Below, is an example of useRef to keep the previous value of your state (name) after changing it.

```js
import React, { useState, useEffect, useRef } from 'react';

export default function App(){
  const [name, setName] = useState('')
  const prevName = useRef()

  useEffect(()=> {
    prevName.current = name
  },[name])
  
  return (
     <>
       <input value={name} onChange={e => setName(e.target.value)}/>
      <div> My name is {name} and it used to be {prevName.current}</div>

     <>
   )
}
```
Ref:

1. [React useRef w3schools](https://www.w3schools.com/react/react_useref.asp)
2. [React useRef Youtube](https://www.youtube.com/watch?v=t2ypzz6gJm0&ab_channel=WebDevSimplified)
Top 7 Websites For Free Instagram Followers and likes Without Login
Tags: tooling, listing, socialmedia, top5
Published: 2022-06-08 17:37:41


{% youtube https://www.youtube.com/watch?v=rCB7HoCn6Q4 %}

---

1. [Skweezer.net](Skweezer.net)
2. [Popery.com](https://poprey.com/)
3. [Turbomedia.io](https://www.turbomedia.io/)
4. [Ininsta.com](Ininsta.com)
5. [MrInsta.com](MrInsta.com)
6. [Followers Gallery](https://www.insfollowup.com/)
7. [Idgiic.net](https://www.idigic.net/)
JavaScript Methods and this Keyword
Tags: javascript, webdev, beginners, programming
Published: 2022-06-08 17:36:35

## OBJECT METHODS

- JavaScript Object contains a function as a value in a key/name.
- Simply, JavaScript Method is an Object property that has a function. 

**Syntax**

```
const object_name = {
    key_1: value_1;
    key_2: value_2
    key_3: function() {
        // code to be execute.
    }   
}
```
**Accessing Methods**
We know how to access an object and how to call a function. Both will combine we can access the JavaScript method.

**Syntax**

```
objectName.key(or)method name();
```
**NOTE :**
To access the methods, we put must () end of the method name.

**Example**

```
const person = {
  name: 'Manikandan',
  age: 24,
  sayHello: function () {
    console.log('Hello Manikandan');
  },
};

// ** access property
console.log(person.name); // Manikandan

// ** access property as well as function in an object.
console.log(person.sayHello); // [Function: sayHello]

// ** access method
person.sayHello(); // Hello Manikandan

```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qf34y8par7m79ee6rikb.png)

## 'this'  key word
To access a property of an object from within a method of the same object,
we use this keyword.

```
const person = {
    name: 'Manikandan',
    age: 23,
    sayHello: function() {
        console.log(`Hi, This is ${this.name}. I am ${this.age} yrs old`);
    }
}

person.sayHello();
```
here, 
sayHello method(person.sayHello) needs to access name property in same object(person.name). 
Both of the same Object.(person) so we used this keyword here.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fmaw1i8veycim8bzf09v.png)
First Bad Version
Tags: leetcode, dsa, theabbie
Published: 2022-06-08 17:30:41

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.

Suppose you have `n` versions `[1, 2, ..., n]` and you want to find out the first bad one, which causes all the following ones to be bad.

You are given an API `bool isBadVersion(version)` which returns whether `version` is bad. Implement a function to find the first bad version. You should minimize the number of calls to the API.

**Example 1:**

**Input:** n = 5, bad = 4
**Output:** 4
**Explanation:**
call isBadVersion(3) -> false
call isBadVersion(5) -> true
call isBadVersion(4) -> true
Then 4 is the first bad version.

**Example 2:**

**Input:** n = 1, bad = 1
**Output:** 1

**Constraints:**

*   `1 <= bad <= n <= 231 - 1`

**SOLUTION:**

    # The isBadVersion API is already defined for you.
    # def isBadVersion(version: int) -> int:
    
    class Solution:
        def firstBadVersion(self, n: int) -> int:
            beg = 1
            end = n
            while beg < end:
                mid = (beg + end) // 2
                pos = isBadVersion(mid)
                if pos:
                    end = mid
                else:
                    beg = mid + 1
            return beg
Laravel Framework
Tags: laravel, php, programming
Published: 2022-06-08 17:29:32


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0v04njk3te6ui2z5mr4x.png)

Laravel is a PHP open-source framework that is dynamic and robust.

It is built based on the MVC architecture pattern. MVC stands for Model-View-Controller which is a design pattern. Laravel is used to develop dynamic web applications.

This framework is used to develop scalable web-based applications due to its robust nature and it contains a large set of features that enable the application to boost its speed in real-time.

Laravel is is used to build high-end dynamic web applications using its significant and awesome features. It comes with a robust collection of tools and provides application enhancement and building the architecture.

The security of the application is by default and will be accomplished by Laravel. Features of this framework will increase the speed of web development. By using laravel it is very efficient to develop an application.

It contains various characteristics of other frameworks and programming languages like Codeigniter , Node JS, and many more. It enables developers by saving lot of time and helps to build an application faster.

The web application becomes more scalable using laravel as a framework due to its features provided.

Laravel framework uses composer and artisan for installing the dependencies and to manage them while developing the application or a website.

**Tools used with Laravel:**

**Composer:**

A composer is a tool that incorporates every one of the dependencies and libraries. It permits a user to make an undertaking for the referenced system (for instance, those utilized in Laravel installation). External libraries can be introduced effectively with the assistance of a composer.

**Artisan:**

An artisan is a command-line tool that allows the developer to manage the development workflow in a laravel environment.

Laravel current Version:

The current version of Laravel is 9, which is a stable release, released on February 8, 2022.

To learn more about features and releases [https://fsh.org.in/blog-details/Frameworks/Laravel+Framework/14](https://fsh.org.in/blog-details/Frameworks/Laravel+Framework/14)
Day 3 : What Is IIFE in Javascript ?
Tags: javascript, webdev, tutorial, 100daysofproductivity
Published: 2022-06-08 17:21:15

- `Immediately Invoked Function Expression`

```
IIFE
(function () {
  /* ... */
})();

Arrow function
(() => {
  /* ... */
})();

Async
(async () => {
  /* ... */
})();

```

- This also called as self executing anonymous function

Let's understand this in 2 parts

```
(

// This prevents accessing variables within the IIFE idiom as well as polluting the global scope.

let a = 10; // will be discarded after the function is executed.

)() =>  immediately invoked function

```

Example

```

// "counter" is a function that returns an object with properties, which in this case are functions.
let counter = (function () {
    let i = 0;

    return {
        get: function () {
            return i;
        },
        set: function (val) {
            i = val;
          	return `value ${i} set successfully` 
        },
        increment: function () {
            return ++i;
        }
    };
})();

// Just to log data
const log = (f) => console.log(f);

// These calls access the function properties returned by "counter".
log(counter.get())       // 0
log(counter.set(3))		 // "value 3 set successfully"
log(counter.increment()) // 4
log(counter.increment()) // 5
 
log(counter.i) // accessing private variables undefined. 

```
Day-104 Training At Ryaz
Tags: webdev, javascript, beginners, programming
Published: 2022-06-08 17:07:11

- Date:8/06/2022
- Day:Wednesday

today, I stared at about 10:30 am as I was in progress to complete the bidding project so, today I started with left over task as I was stuck in a small problem that category in the db was not working fine so, I connected with my mentor and solved it up with the help of him and according to the suggestions given by him so, I did some change in the front end. and after this I did some of necessary fixes in the project and again hosted on heruko so, this way my day ended up and I got to learn many new things.
My Next.js Boilerplate now has 2000+ GitHub stars
Tags: nextjs, javascript, react, webdev
Published: 2022-06-08 17:03:25

My Next.js boilerplate has just crossed 2000+ stars on GitHub. Thanks to all GitHub stargazers for the support!

A project I have started 2 years ago for my own personal use and I thought it would be a great idea to share it. Now, I use it for all my project in React and Next.js.

Now, I also get help from the community. Other developers makes suggestion to the boilerplate code. There are also some external contributors.

{% embed https://github.com/ixartz/Next-js-Boilerplate %}

I'm currently writing a blog post on how the project reached 2000 stars on GitHub, you can be notified when the article is published by [following me](https://twitter.com/ixartz) on Twitter.
Minimize Result by Adding Parentheses to Expression
Tags: leetcode, dsa, theabbie
Published: 2022-06-08 17:00:48

You are given a **0-indexed** string `expression` of the form `"<num1>+<num2>"` where `<num1>` and `<num2>` represent positive integers.

Add a pair of parentheses to `expression` such that after the addition of parentheses, `expression` is a **valid** mathematical expression and evaluates to the **smallest** possible value. The left parenthesis **must** be added to the left of `'+'` and the right parenthesis **must** be added to the right of `'+'`.

Return `expression` _after adding a pair of parentheses such that_ `expression` _evaluates to the **smallest** possible value._ If there are multiple answers that yield the same result, return any of them.

The input has been generated such that the original value of `expression`, and the value of `expression` after adding any pair of parentheses that meets the requirements fits within a signed 32-bit integer.

**Example 1:**

**Input:** expression = "247+38"
**Output:** "2(47+38)"
**Explanation:** The `expression` evaluates to 2 \* (47 + 38) = 2 \* 85 = 170.
Note that "2(4)7+38" is invalid because the right parenthesis must be to the right of the `'+'`.
It can be shown that 170 is the smallest possible value.

**Example 2:**

**Input:** expression = "12+34"
**Output:** "1(2+3)4"
**Explanation:** The expression evaluates to 1 \* (2 + 3) \* 4 = 1 \* 5 \* 4 = 20.

**Example 3:**

**Input:** expression = "999+999"
**Output:** "(999+999)"
**Explanation:** The `expression` evaluates to 999 + 999 = 1998.

**Constraints:**

*   `3 <= expression.length <= 10`
*   `expression` consists of digits from `'1'` to `'9'` and `'+'`.
*   `expression` starts and ends with digits.
*   `expression` contains exactly one `'+'`.
*   The original value of `expression`, and the value of `expression` after adding any pair of parentheses that meets the requirements fits within a signed 32-bit integer.

**SOLUTION:**

    class Solution:
        def getInt(self, s):
            if len(s) == 0:
                return 1
            return int(s)
        
        def minimizeResult(self, expression: str) -> str:
            a, b = expression.split("+")
            minVal = float('inf')
            m = len(a)
            n = len(b)
            minPos = None
            for i in range(m):
                for j in range(1, n + 1):
                    currVal = self.getInt(a[:i]) * (self.getInt(a[i:]) + self.getInt(b[:j])) * self.getInt(b[j:])
                    if currVal < minVal:
                        minVal = currVal
                        minPos = (i, j)
            i , j = minPos
            return "{}({}+{}){}".format(a[:i], a[i:], b[:j], b[j:])
Ubuntu 22.04 で Thinkpad の Windows を上書きする
Tags: ubuntu, windows10
Published: 2022-06-08 16:55:16


## Ubuntu iso ファイルを Windows の useName/Downlaods に入れる

https://ubuntu.com/download/desktop

Ubuntu 公式から userName/Downlaod/ にダウンロード

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjuso8c6i77kwsb517y3.png) 

この時直接 USB スティクに入れると
ブート用にするときに選択できないので、ダウンロードフォルダに入れよう。

---

## balena etcher を windows にインストールして USB スティックをブートローダーに改造する。

https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview

Ubuntu 公式を見ると

https://www.balena.io/etcher/

balena etcher が公式ではおすすめされている。

これを Windows にインストールする

そして開いて

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xxuhus0u7gi6rggu4c2c.png)
 
先ほど DL した iso ファイルで USB をブートドライブにする。

https://linuxhint.com/install_etcher_linux/

Linux OS 上で etcher を入れるのは、依存関係も解決しないといけないので、Windows の方が効率が良い。

---

## Windows をオフにして、USB から起動し、Ubunutu で上書きする。

マシンによって異なるが、Thinkpad でのやり方を紹介する。

https://support.lenovo.com/jp/ja/solutions/ht500216

Shift を押しながら再起動すると

Lenobo のロゴの後に Enter を押すと起動を中断すると出る。

Enter の後に F12 を押すと USB から起動できる。

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c40tlonq3ljd4pp72iaj.png)
 

その後 USB から起動した仮の Ubuntu から
このマシンを上書きする項目をクリックすると、インストールが始まる。

これで Ubunutu だけ使える！やったね！！！！

k8s/Docker が最速だ！！！
MoonTheme by Ercicion
Tags: css, bootstrap, html
Published: 2022-06-08 16:37:01

This is my **Bootstrap theme project** for the web. The theme was created through Bootstrap and with clean and minimal code. It is a very lean and fast one page theme, fully customizable.
[Demo Page](http://ercicion.altervista.org/demo/moontheme/)
[Download Page](https://ercicion.altervista.org/blog/?p=2043)

> After downloading the zip file, extract it and in the assets folder you will find the css and js files to edit. You can recall the code in the html file, while the images can be easily replaced in the images folder!


Features:

- Based on Bootstrap
- 2022 Update
- HTML5 CSS3
- SmoothScroll
- Parallax Effect
- Fixed Menu
- Social Share Button
- Google Maps integration
- Fully Responsive
- Clean code

Screenshot:

![Screenshot moontheme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aitrmh125xa37d3rejde.jpg)
Follow me also on [Scoop](https://www.scoop.it/topic/technology-by-antonio-ercicione) and on [Twitter](https://twitter.com/ercicion)
Special thanks go to my graphic collaborator for helping me on both mobile and desktop aspect ratios.
Top K Frequent Elements
Tags: leetcode, dsa, theabbie
Published: 2022-06-08 16:30:42

Given an integer array `nums` and an integer `k`, return _the_ `k` _most frequent elements_. You may return the answer in **any order**.

**Example 1:**

**Input:** nums = \[1,1,1,2,2,3\], k = 2
**Output:** \[1,2\]

**Example 2:**

**Input:** nums = \[1\], k = 1
**Output:** \[1\]

**Constraints:**

*   `1 <= nums.length <= 105`
*   `k` is in the range `[1, the number of unique elements in the array]`.
*   It is **guaranteed** that the answer is **unique**.

**Follow up:** Your algorithm's time complexity must be better than `O(n log n)`, where n is the array's size.

**SOLUTION:**

    import heapq
    
    class Solution:
        def topKFrequent(self, nums: List[int], k: int) -> List[int]:
            freq = {}
            for num in nums:
                freq[num] = freq.get(num, 0) + 1
            klargest = heapq.nlargest(k, [(value, key) for key, value in freq.items()])
            return [item[1] for item in klargest]
Paracetamol.js💊| #136: Explica este código JavaScript
Tags: javascript, webdev, programming, spanish
Published: 2022-06-08 16:13:11

## **<center>Explica el siguiente código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
const comidas =[
  {
    categoria: "sopas",
    plato:"Sopa de cebolla"
  },
  {
    categoria: "plato fuerte",
    plato: "Asado"
  },
  {
    categoria:"plato fuerte",
    plato:"Pollo frito"
  },
  {
    categoria:"sopas",
    plato:"Sopa de mani"
  },
  {
    categoria: "postres",
    plato:"Gelatina"
  }
];

const f = arr => [...new Set(arr.map((item) => item.categoria))]
console.log(f(comidas))
```

A. `["sopas", "plato fuerte", "plato fuerte", "sopas", "postres"]`
B. `["Sopa de cebolla", "Asado", "Pollo frito", "Sopa de mani", "Gelatina"]`
C. `["sopas", "plato fuerte", "postres"]`
D. `{"sopas", "plato fuerte", "postres"}`

Respuesta en el primer comentario.

---
Wiggle Subsequence
Tags: leetcode, dsa, theabbie
Published: 2022-06-08 16:00:42

A **wiggle sequence** is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequences.

*   For example, `[1, 7, 4, 9, 2, 5]` is a **wiggle sequence** because the differences `(6, -3, 5, -7, 3)` alternate between positive and negative.
*   In contrast, `[1, 4, 7, 2, 5]` and `[1, 7, 4, 5, 5]` are not wiggle sequences. The first is not because its first two differences are positive, and the second is not because its last difference is zero.

A **subsequence** is obtained by deleting some elements (possibly zero) from the original sequence, leaving the remaining elements in their original order.

Given an integer array `nums`, return _the length of the longest **wiggle subsequence** of_ `nums`.

**Example 1:**

**Input:** nums = \[1,7,4,9,2,5\]
**Output:** 6
**Explanation:** The entire sequence is a wiggle sequence with differences (6, -3, 5, -7, 3).

**Example 2:**

**Input:** nums = \[1,17,5,10,13,15,10,5,16,8\]
**Output:** 7
**Explanation:** There are several subsequences that achieve this length.
One is \[1, 17, 10, 13, 10, 16, 8\] with differences (16, -7, 3, -3, 6, -8).

**Example 3:**

**Input:** nums = \[1,2,3,4,5,6,7,8,9\]
**Output:** 2

**Constraints:**

*   `1 <= nums.length <= 1000`
*   `0 <= nums[i] <= 1000`

**Follow up:** Could you solve this in `O(n)` time?

**SOLUTION:**

    class Solution:
        def maxWig(self, nums, i, n, inc):
            if (i, inc) in self.cache:
                return self.cache[(i, inc)]
            maxSeq = 1
            for j in range(i + 1, n):
                if inc:
                    if nums[j] > nums[i]:
                        maxSeq = max(maxSeq, 1 + self.maxWig(nums, j, n, False))
                else:
                    if nums[j] < nums[i]:
                        maxSeq = max(maxSeq, 1 + self.maxWig(nums, j, n, True))
            self.cache[(i, inc)] = maxSeq
            return maxSeq
        
        def wiggleMaxLength(self, nums: List[int]) -> int:
            self.cache = {}
            n = len(nums)
            maxSeq = 1
            for i in range(n):
                maxSeq = max(maxSeq, self.maxWig(nums, i, n, True))
                maxSeq = max(maxSeq, self.maxWig(nums, i, n, False))
            return maxSeq
#blogger #js
Published: 2022-06-08 15:55:58

https://2daypromo.blogspot.com/2022/05/fat-coupon.html

`
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i8h7jssadaj7arzjo4n0.jpg)[URL description](https://2daypromo.blogspot.com/2022/05/fat-coupon.html
)`
OpenCV – Remove the background in your camera feed 🎦
Tags: englishpost, codesample, opencv
Published: 2022-06-08 19:08:51

---
title: OpenCV – Remove the background in your camera feed 🎦
published: true
date: 2022-06-08 15:48:18 UTC
tags: EnglishPost,CodeSample,EnglishPost,OpenCV
canonical_url: 
---

Hi !

Yesterday I share 10 lines of code to adddress this very simple scenario:

#### [Load and image and remove the background.](https://dev.to/azure/opencv-10-lines-to-remove-the-background-in-an-image-3m98)

Today I’ll add a few extra lines, and I’ll remove the background from my camera feed. It’s fun to see how the Captain America shield was included in the cropped polygon 😁

![](https://brunocapuano.files.wordpress.com/2022/06/2022-06-08-opencv-remove-bg-camera-01.gif?w=320)

And the sample code:

{% gist https://gist.github.com/elbruno/d4e35e9fe4fad2bc9b3aea7d856c8b86 %}

Happy coding!

Greetings

El Bruno

More posts in my blog [ElBruno.com](https://www.elbruno.com).

* * *
Teonet C library
Tags: teonet, microservices, clientserver, go
Published: 2022-06-08 15:47:49

Teonet news.

Today we published [Teonet v5 C library](https://github.com/teonet-go/teonet-c) and examples project.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3j7appm1nsdjbd5cin7w.jpg)


[Teonet](https://github.com/teonet-go/teonet) is designed to create client-server systems and build networks for server applications operating within a microservice architecture.

Main Teonet v5 code was created on Golang. This project make c/c++ dynamic library to use it in any C/C++ and C compatible applications.

The description of Teonet you can find at main [Teonet-go](https://github.com/teonet-go) page.

The examples of this project copy Teonet-go examples functional. So look this project examples to get started with teonet-c library: [examples](https://github.com/teonet-go/teonet-c/tree/main/cmd)

See the project code and description on Github:
https://github.com/teonet-go/teonet-c

We are waiting your support! Please give stars to our [Teonet-c](https://github.com/teonet-go/teonet-c) and [Teonet](https://github.com/teonet-go/teonet) projects in Github.

Best regards,
Kirill Scherba
https://github.com/kirill-scherba
Welcome Thread - v177
Tags: welcome
Published: 2022-06-08 15:39:33

---
title: Welcome Thread - v177
published: true
description: Welcome to DEV! A thread of hellos and intros.
tags: welcome
canonical_url: 
---

![cartoon hands shaking hands](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fjbqzfnd08i2nivdax2s.gif)

### Welcome to DEV!

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

**Great to have you in the community!**