teleren/devto huggingface dataset:
Vue Theme - Theme for Visual Studio Code
Tags: javascript, react, php, python
Published: 2023-01-13 16:09:32

---
title: Vue Theme - Theme for Visual Studio Code
published: true
description: +395000 installs, a Theme for Visual Studio Code inspired by Vue.js, with support for more popular languages and a perfect harmony of colors for the user to work for hours, reducing visual fatigue and having an excellent coding experience.
tags: javascript, ReactJS, php, python
# cover_image: https://thepracticaldev.s3.amazonaws.com/i/uadp1bcjgjbv5r4nbb9k.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-13 15:44 +0000
---



I would like to republish about Vue Theme because today after a lot of improvements the theme achieved almost 400K installs on VS_code. 
Looks a bit funny but the theme was created inspired by vue but in 2019 I decided to change my studies to React and since it I used React as base for the them and I really liked the result 🤩. So if you are a React developer give a try 👨‍💻


### Marketplace
Currently with +395000 installs in the Visual Studio Code

### UX
All the colors in this theme have an intensity for the user to work for hours, reducing visual fatigue and having an excellent coding experience.

![Vue theme](https://thepracticaldev.s3.amazonaws.com/i/uadp1bcjgjbv5r4nbb9k.png)

###Syntax Highlight:
![Vue theme](https://thepracticaldev.s3.amazonaws.com/i/y3l9onslmmiinwvbofri.png)

### Installing

1.  Open **Extensions** sidebar panel in VS Code: `View → Extensions`
2.  Search for `Vue Theme` - by **Mário Rodeghiero**
3.  Click **Install** to install it.
4.  Click **Reload** to reload the your editor
5.  Code > Preferences > Color Theme > **Vue Theme**

You can learn a little bit more or create some PR improvements by accessing [Vue Theme GitHub](https://github.com/mariorodeghiero/vue-theme-vscode).

If you liked the theme, make your evaluation in the [Marketplace](https://marketplace.visualstudio.com/items?itemName=mariorodeghiero.vue-theme) or give me a star ⭐️ in [GitHub](https://github.com/mariorodeghiero/vue-theme-vscode), it is very important to improve the ranking. 
Thank you, I hope you like it 😊
Being a Developer Advocate: Week 17
Tags: devrel, learninpublic
Published: 2023-01-13 16:07:02

I am on it again: Talks with livecoding 😁

And basically that was all I was doing this week... and some number crunching for DevRel metrics... and sorting out documentation again.

But I will just leave the learnings here for my talk preparations as the talk and livecoding went very well imho. They also took 90% of my week 🙃

## Learnings From Preparing and Giving a Talk with Livedemos

* Be authentic and honest. Admit if you do not know something. Nothing worse than a speaker who can not admit, that an answer is out of his knowledge in my opinion.
* I spent an unproportionate amount of time (2 days) into nailing down every livedemo I would show. This made them more or less bulletproof. But also gave me the confidence to know how to fix problems that came up.
* Be ok if something does not work out. It is ok, it happens to the best. Laugh and explain what should have happened, then move on.
* Reboot your system before the talk resolve strange system issues
* OBS on Mac Silicone causes weird system crashes sometimes 🥶
Error from chokidar :System limit for number of file watchers
Tags: linux, react
Published: 2023-01-13 16:05:43

In thid post , we will fix System limit for number of file watchers error .

this error reached  because the number of files **monitored** by the **system** has reached its **limit**.
well linux use **inotify**  to monitoring filesystem events .

To  know the current limit of  **max_user_watches** :

```
> `cat /proc/sys/fs/inotify/max_user_watches`
```


and the current **_notify  user instance limit_** :


```
> `cat /proc/sys/fs/inotify/max_user_instances`
```


If you want to fix error  you need to increase the number of max user  watches by running the following command:

```
> `sudo sysctl fs.inotify.max_user_watches=524288`
```

and increase the number of maximum number of user instances by running the following command:

```
> ` sudo  fs.inotify.max_user_instances = 1024`
```
Salesforce Trekken: Salesforce CMS Migration Tool built with Tauri, React, TailwindCSS & Vite
Tags: salesforce, tooling, showdev, tauri
Published: 2023-01-13 15:56:50

The Salesforce CMS data migration experience is lacking. There is no bulk export, and there is no sorting/filtering of content and you are sent an email link instead of being able to directly download the zip file.

Salesforce Trekken aims to rethink the Salesforce CMS migration experience. Using modern web technologies and thoughtful a user experience, migrating Salesforce CMS data has never been easier.

## How does it work?

Salesforce Trekken allows users to authenticate using one of two methods:

- The [sfdx cli](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm)
- Access Token (and Instance URL)

The [Salesforce REST API](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest.htm) is used to fetch CMS Channels and the CMS Content after a specific channel has been selected.

## Features

- Multiple Authentication Methods (`sfdx cli` or ACCESS_TOKEN)
- Channel Selection: Choose the right CMS Channel to export data from
- Feature Rich Export Table
- Bundled Zip file export, ready to be imported into your target org.

## Walkthrough

#### Select Your Authentication Method

![Salesforce Trekken: Select Authetnication Method Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2swk92fgkr7pnxit5edq.png)

#### Select An Org

![Salesforce Trekken: Select An Org Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i4uqkgivqg3ypozqya2i.png)

#### Select A CMS Channel

![Salesforce Trekken: Select A CMS Channel Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x3pg9py9p0sdvx2vre10.png)

#### Search/Filter/Sort and Select Content

![Salesforce Trekken: Select CMS Content Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgj1ibx39prmfo09zr6l.png)

#### Select An Output Folder

and whether to include images as part of the export.

![Salesforce Trekken: Select An Output Folder Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bl997pnp7qjrl8cgoemg.png)

#### Success

Either open the source folder or start over.

![Salesforce Trekken: Successful Export Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3u7mwkz4ua81c6zn9gdg.png)

Your content is now ready to import into your target org.

> If you are working with `cms_image`, make sure you import your images zip file first

## Closing

Now you've seen the powers of Salesforce Trekken and its improved user experience compared to the standard salesforce experience.

Want to find out more and/or download, checkout the [Salesforce Trekken site](https://trekken.lukesecomb.digital/)
202. Happy Number
Tags: java, leetcode, 100daysofcode, algorithms
Published: 2023-01-13 15:51:39

**Problem Statement:**

Write an algorithm to determine if a number n is happy.

A happy number is a number defined by the following process:

Starting with any positive integer, replace the number by the sum of the squares of its digits.
Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1.
Those numbers for which this process ends in 1 are happy.
Return true if n is a happy number, and false if not.

 

**Example 1:**
**Input:** n = 19
**Output:** true
**Explanation:**
12 + 92 = 82
82 + 22 = 68
62 + 82 = 100
12 + 02 + 02 = 1

**Example 2:**
**Input:** n = 2
**Output:** false
 

**Constraints:**

- 1 <= n <= 231 - 1

**Solution:**

**Algorithm:**

1. Initialize slow and fast by n.
2. Do following until slow and fast meet.
a) Move slow by one iteration: compute square of digits of slow and add them.
b) Move fast by two iteration: compute square of digits of fast and add them.
3. If slow becomes 1 then return true.

**Code:**
```
public class Solution {
    public boolean isHappy(int n){
        int slow = n;
        int fast = n;
        do {
            slow = squareSum(slow);
            fast = squareSum(squareSum(fast));
        } while (slow != fast);
        return slow == 1;

        
    }
    public int squareSum(int n){
        int sum = 0;
        while (n > 0) {
            int digit = n % 10;
            sum += digit * digit;
            n /= 10;
        }
        return sum;
    }
    
}
```

**Time Complexity:**

O(logN). We need to compute the square of digits of n at most O(logN) times.

**Space Complexity:**
O(1)
Python Building Blocks: Literals, and Variables
Tags: beginners, programming, python, tutorial
Published: 2023-01-13 15:48:08

Well Happy New Year Everyone!!! Before I continue with what I'm learning I just wanted to give a quick shout out to all the programmers both aspiring and vets. I hope 2023 is prosperous for you all and let's own this year.
**Let's own our destiny.
Let's get it done!**

We talked about reserved words and syntax errors in my last entry. Today I will share more of my learning on the building blocks of Python. 

Fixed values such as numbers, letters, strings; these are what are called "string literals" and they allow us to do things. Without them, we cannot ask Python to do a whole lot. Because we haven't given it anything to work with. 

examples of literals: 

```
>>>print(1234)
1234

>>>print(13.9)
13.9

>>>print("Hello World")
Hello World
```

These literals work hand in hand with **variables**.

If you recall in my last post, we gave Python instructions speaking in its language.

Variables are very important in Python. I learned that variables are a piece of memory where we as programmers can store data and then use that data at a later time. Using last sessions example:

```
x = “Python”
print(x)
```

Speaking in a way that Python can understand, we say hey: take this small piece of computer memory and label it "x" then store the name "Python" into this small piece of memory labeled x. Lastly, print whatever the value of x is. 

So we stored some data then used that data at a later time by printing it to the screen.

We as programmers get to choose what we name our variables. The data within that variable can be changed down the line in a later statement as well. We use what is called an assignment operator (=) to "assign" data to a piece of memory. That data can be a number, string, Boolean (True or False) among others.

Example of changing the contents of a variable:

```
x = “Python”
print(x)
Python

x = "Airplane"
print(x)
Airplane

```
Our variable called x starts out with the value assignment of "Python" and we printed it to the screen. But then we changed the data inside the x variable to "Airplane" and printed it to the screen. So, it wiped the value of "Python" and reassigned the value of "Airplane" to x. Done and Done!!

There is much more great information to absorb on variables and how they can be used. I will continue to fill you in as I learn. Until next time have a great day/week everyone!
This Week In Python
Tags: python, discuss, thisweekinpython
Published: 2023-01-13 15:42:30


**Fri, January 13, 2023**


This Week in Python is a concise reading list about what happened in the past week in the Python universe. 

**I have received some good suggestions for this week's content. Thank you.**

**Did I miss anything from the Python universe this week? What did you read or tried out?**


## Python Articles


- [Classifying Python virtual environment workflows](https://snarky.ca/classifying-python-virtual-environment-workflows/)
- [Mapping Python to LLVM](https://blog.exaloop.io/python-llvm/)
- [PEP 703 – Making the Global Interpreter Lock Optional in CPython](https://peps.python.org/pep-0703/)
- [Python packaging for developers in a hurry](https://giovannipcarvalho.github.io/2023/01/08/python-packaging-in-a-hurry.html)
- [30 Helpful Python Snippets](https://morioh.com/p/271bc88c0100)


## Projects



- [Gooey](https://github.com/chriskiehl/Gooey) – Turn (almost) any Python command line program into a full GUI
- [granian](https://github.com/emmett-framework/granian) – A Rust HTTP server for Python applications
- [pypod](https://github.com/bmwant/pypod) – Python terminal music player
- [evue](https://github.com/scriptiot/evue) – high-performance gui framework
- [Django-Styleguide](https://github.com/HackSoftware/Django-Styleguide) – Django styleguide used in HackSoft projects



**Did I miss anything from the Python universe this week? What did you read or tried out?**
JavaScript map vs. forEach
Published: 2023-01-13 15:42:05

## .forEach()
### What is it?
#### This method is the most similar to the forloop. Example -

```
// forloop
const numbers = [2,6,8,10,12];

for (let i = 0; i < numbers.length; i++) {
    console.log(numbers[i]);
}
```
```
// forEach
const numbers = [2,6,8,10,12];

numbers.forEach(number => {
    console.log(number);
});
```
forEach() is simply executed "for each" element of the array.
 
## .map()
### What is it?
#### map is almost similar to the forEach method. This method loops through each element. 
```
// map
const numbers = [2,6,8,10,12];

numbers.map(number =>console.log(number))
```
```
// map
const numbers = [2,6,8,10,12];

numbers.map(number =>console.log(number * 2))
```
## map vs. forEach:
### forEach:
#### It calls a function for each element of an array but doesn't return anything. That means no result fount means undefined 
```
const numbers = [2,6,8,10,12];

let result = numbers.forEach((number) =>{
    return number*10
})
console.log(result); //undefined
```
### map:
#### This method returns a new array by applying the callback function on each element of an array. 
```
// map
const numbers = [2,6,8,10,12];

let result = numbers.map((number) =>{
    return number*10
})
console.log(result); //[20,60,80,100,120] 
```
Animations with Doodle 0.9.0
Published: 2023-01-13 15:34:42

## Version [0.9.0](https://github.com/nacular/doodle/releases/tag/v0.9.0) brings more powerful and easy to use animations and more...

* [Revamped Animation APIs](https://nacular.github.io/doodle/docs/animations)
* [New Constraint Layout Engine](https://nacular.github.io/doodle/docs/layout/constraints)
* Improved [Tables](https://nacular.github.io/doodle/docs/ui_components/overview#table) and [TreeTables](https://nacular.github.io/doodle/docs/ui_components/overview#treetable)
* [New FileSelector Control](https://nacular.github.io/doodle/docs/ui_components/overview#fileselector)
* [Form Controls](https://nacular.github.io/doodle/docs/ui_components/form_controls)(slider, rangeSlider, circularSlider, circularRangeSlider, file and files)

[**Doodle**](https://github.com/nacular/doodle) is a pure Kotlin UI framework for the Web (and Desktop), that lets you create rich applications without relying on Javascript, HTML or CSS. Check out the [documentation](https://nacular.github.io/doodle) and [tutorials](https://nacular.github.io/doodle-tutorials) to learn more.
Collaborative Development is good development
Published: 2023-01-13 15:33:15

The one thing I'm sure of, even as I'm starting my training to become an application developer, is that working with other professionals on projects is a key to success. Even if one person is the primary coder, others in the team can help by being the alpha and beta testers as well as code reviewers. I've worked in the IT industry for over twenty years, and I have never truly liked working alone. I am always running into one thing or another that makes me question either a process or policy that is in place. And when you have other experienced and knowledgeable folks to bounce ideas off of, things tend to get done much better. They might take a little longer, as the team analysis and decides on the best course of action. But ultimately, the end result will almost always be optimal. 

I am writing this post as a way to encourage the growth of my own network. If you are new to coding, a seasoned professional, or just dabble and would like to bounce some ideas around, please feel free to connect with me. I'm always open to extending my professional network. Cheers and all the best to everyone.
How to send an automated email via Google Script?
Tags: automation, beginners, programming
Published: 2023-01-13 15:32:23

To send an automated email via Google Script, you will need to do the following:

1. Go to script.google.com and sign in with your Google account.

2. Click on the "New script" button. This will create a new blank script for you.

3. Replace the existing code with the following code:
```
function sendEmail() {
  var email = "youremail@example.com";
  var subject = "This is the subject of the email";
  var body = "This is the body of the email";
  MailApp.sendEmail(email, subject, body);
}
```

4. Replace "youremail@example.com" with the email address you want to send the email to.

5. Replace "This is the subject of the email" with the subject of the email you want to send.

6. Replace "This is the body of the email" with the body of the email you want to send.

7. Save the script by clicking on the "File" menu and then selecting "Save".

8. Test the script by clicking on the "Run" menu and then selecting "sendEmail". This will send an email to the email address you specified.

9. You can also use this script to send emails to multiple recipients by separating the email addresses with a comma, like this:

`var email = "youremail@example.com, anotheremail@example.com";`

You can also customize the email further by using the various options available in the MailApp.sendEmail() function. For example, you can add attachments to the email, specify a reply-to address, or set the name of the sender. You can find more information about these options in the Google Scripts documentation.
Set default values in react-hook-form
Tags: reacthookform, react
Published: 2023-01-13 13:17:24

---
title: Set default values in react-hook-form
published: true
description: Using `reset` and `setValue` in react-hook-form
tags: reacthookform, react
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-13 12:34 +0000
---

Data is fetched from an api or some async operation, and `reset` is used to set the default values for the form. 

```jsx
  const { reset } = useForm();

  useEffect(() => {
    // you can do async server request and fill up form
    setTimeout(() => {
      reset({
        firstName: "bill",
        lastName: "luo"
      });
    }, 2000);
  }, [reset]);
```
Or if we need to partially update the form, we can pass a function to the `reset` function like so.

```jsx
<button 
  onClick={() => {
    reset(formValues => ({
      ...formValues,
      lastName: 'test',
    }))
  }}
>
  Reset partial
</button>
```

Alternatively, we can use `setValue` to set a few form fields

```jsx
const { register, setValue } = useForm();

return (
  <form>
    <input {...register("firstName")} />
    <button type="button" onClick={()=> setValue("firstName", "Bill")}>
      setValue
    </button>
  </form>
)
```
&nbsp;

## Resources and code snippets taken from: 
* https://react-hook-form.com/api/useform/reset
* https://react-hook-form.com/api/useform/setvalue
* https://codesandbox.io/s/react-hook-from-async-set-form-values-tyk12
* https://github.com/react-hook-form/react-hook-form/tree/master/examples
* https://stackoverflow.com/a/64307087/7358595
Smart-i
Tags: blockchain, python, machinelearning, deeplearning
Published: 2023-01-13 15:25:59


**Tracking and detecting any fatal activities in the surveillance camera footages using deeplearning and storing them in decentralised storage.**

## Problem
Every day, there is a rising number of tragic road accidents and other violent offenses.
 
- Road accidents are often caused by someone else's irresponsibility. If the wrongdoers are affluent and powerful, they try to erase any evidence. In other circumstances, evidence disappears easily. This denies victims justice.
- Inaccessibility to aid is also a major problem. With Smart-i, immediate notifications can be sent to the authorities for help.


## Solution
Smart-i is a blockchain-based web application that utilizes real-time surveillance footage to discover and report fatal accidents.

The footage that contains evidence of any such fatal happenings is stored in the blockchain, thus making them unalterable by anyone.

Also, the authorities concerned can be notified, thus immediate actions can be taken. 

## How it works?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9sv1r6wvqj7gppu09q1.png)
263. Ugly Number
Tags: java, 100daysofcode, leetcode, algorithms
Published: 2023-01-13 15:20:28

**Problem Statement:**

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

Given an integer n, return true if n is an ugly number.

**Example 1:**
**Input:** n = 6
**Output:** true
**Explanation:** 6 = 2 × 3

**Example 2:**
**Input:** n = 1
**Output:** true
**Explanation:** 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.

**Example 3:**
**Input:** n = 14
**Output:** false
**Explanation:** 14 is not ugly since it includes the prime factor 7.
 

**Constraints:**

- -231 <= n <= 231 - 1

**Solution:**

**Algorithm:**
1. If n is less than or equal to 0, return false.
2. Divide n by 2 as many times as possible.
3. Divide n by 3 as many times as possible.
4. Divide n by 5 as many times as possible.
5. If n is equal to 1, return true, otherwise return false.

**Code:**
```
public class Solution {
    public boolean isUgly(int n) {
        if (n <= 0) {
            return false;
        }
        while (n % 2 == 0) {
            n /= 2;
        }
        while (n % 3 == 0) {
            n /= 3;
        }
        while (n % 5 == 0) {
            n /= 5;
        }
        return n == 1;
    }
    
}
```

**Time Complexity:**
O(logN)

**Space Complexity:**
O(1)
EPHELOG
Tags: javascript, webdev, login, programming
Published: 2023-01-13 15:19:02

Usernames and passwords are ubiquitous today on possibly any website. In this online era, passwords are considered a mechanism of security. But often, one might come across a situation where he/she needs to share login credentials with a friend, colleague, or acquaintance. The most common practice is to change this password later. Not only that, it is possible that most people tend to keep similar passwords in different handles, putting them all at risk.

These temporary credentials expire after a specified interval. After they expire, any calls made with those credentials will fail, so one must generate a new set of temporary credentials. Temporary credentials cannot be extended or refreshed beyond the originally specified interval. A history of the login and the logout details are also recorded. 

## Detailed Working:
- For this service, both the users, the one who needs to share his login credentials and the one who requires it, need to login to the platform. They will be provided with a unique username.
- After logging into the required platform, the user can select Ephelog service from the extensions tab and copy the site link, and the Ephelog username of the intended user. 
- The login credentials (real username and password) are not stored in the server, temporary tokens are generated dynamically and provided to the intended user. Tokens are basically masked session ids.
- Using the token, the intended user can login and use the site for the allowed time frame. He can enter the token on the extension bar and the browser tab will refresh itself to let the user use the platform. Until the temporary login credentials expire, he can surf the site. 
- When the timer runs out, the site refreshes again and the session will expire automatically. 
- The temporary login credentials have a limited lifetime, so one does not have to rotate them or explicitly revoke them when they're no longer needed. After they expire, they cannot be reused. The user can specify how long the credentials are valid, up to a maximum limit