teleren/devto huggingface dataset:
Simple Js hacks for strings and objects 🙌
Tags: javascript, programming, productivity, webdev
Published: 2022-07-16 07:17:44

## Tricks

This document contain the simple yet important tricks to remember when dealing with strings or objects.

## 1. Convert any string to array simply by a single function.

**Use split("", limit{any number})**

```
//code

const str = 'abra ka dabra'
console.log(str.split(' ', 2))

output 
[ 'abra', 'ka' ]
```

## 2. Add properties to js objects dynamically

**Use (.) operator**

```
//code

const dynamicObject = {
    name: 'Himanshu',
    age: 22
};
dynamicObject.sex = 'Male';

console.log(dynamicObject);

//output

{ name: 'Himanshu', age: 22, sex: 12 }
```

## 3. Adding properties of a previous object to  new object

```

//code
const object1 = {
    name : 'Himanshu',
    age : 22
}

const newObject  = {};
newObject.name = object1.name;
newObject.age = object1.age;
newObject.sex = 'Male';

console.log(newObject);


//output
{ name: 'Himanshu', age: 22, sex: 'Male' }
```
IEEE projects for ECE
Published: 2022-07-16 05:32:16

Engineering student projects for B.Tech and M.Tech final year students. Takeoff Edu Group offers a wide range of projects best for [ieee projects for ece](https://takeoffprojects.com/ieee-projects-for-ece) looking for magnificent final projects at low cost.

We have successfully delivered ieee projects for ece to our engineering students. Our programs are specially designed by experts for best results of ieee projects for ece for engineering students. max of the B.Tech, M.Tech, PhD and Diploma scholars.

𝗧𝗮𝗸𝗲𝗼𝗳𝗳 𝗘𝗱𝘂 𝗚𝗿𝗼𝘂𝗽 provides the most creative conceptions and ideas for that can make very effective final year projects for scholars, experimenters, and engineers. So browse through our list of [ieee projects for ece](https://www.youtube.com/watch?v=8z8Pub8keZs). contents and choose the smart final year projects for your requirements moment.


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

Top 5 ieee projects for ECE:

- Smart Visitor Guidance Robot with Embedded Touchscreen Panel featuring Onscreen Signature Verification, Campus Map       Problem Description:  Rendering and Multi-Lingual Voice
- Voice Recognition Robotic Dog Guides Visually Impaired People
- Advance Automatic Toll Collection & Vehicle Detection During Collision using RFID
- An Automatic Driver Drowsiness Alert System by using GSM.
- A Remote Sensing Nano-Satellite running Hard Real Time Control and Communication System Sending Camera Images to     Ground Control Nano Satellite Station

The full form of ECE is Electronics and Communication Engineering. ECE is an engineering branch that includes the product, design, research and testing of electronic bias and technology issues related to the telecommunications systems, electronics, computers and related artificial sectors. ECE is introduced at the UG and PG standard by several institutions and universities in India applying to B.Tech and M.Tech degrees, independently.

currently, the appetite for strong development in technology has led to the demand for oneness and inventions. The demand has led to the development of colorful operations and ideas. Colleges offering ECE engineering allow the scholars to get the stylish project done for their final year so that they can recommend their profile to the top recruiters.
SvelteKit 라우팅 구성 시 주의할 점
Tags: svelte, javascript, tutorial, korean
Published: 2022-07-16 07:13:08

이 이슈는 SvelteKit 라우팅 구성 시에 대한 주의사항과 대응방안을 제시하는 팁이다. 잘 읽고 숙지하기 바란다.
참고로, Next.js 및 Nuxt.js 는 이런 귀찮고 혼란스러운 혼용 라우팅 문제를 미연에 방지하기 위해 아예 `api/` 폴더에 데이터를 뱉는 끝점을 만들도록 구성되어 있으니 해당 프레임워크로 개발하는 사람들은 그냥 안심하고 갈 길 가면 된다.

SvelteKit 라우팅은 꽤 유연한 방식을 제공하고 있으나,
너무나 유연해서 주의해야 할 게 있는게,
바로 Svelte 파일과 js 및 ts 파일 이름이 같을 경우에 대한 혼용 끝점(Endpoint)이다.
예를 들면,

> `src/routes/path/to/something.svelte`
> `src/routes/path/to/something.js`

이럴 경우, 우선 순위가 어떻게 되느냐, 누가 먼저 선점하게 되는 게 아니라,   어떤 응답을 받아도 결국엔 스벨트 컴포넌트를 응답하게 된다.
이 말인 즉슨, `.js` 끝점의 응답 값을 `.svelte` 컴포넌트의 속성에 전달한다는 뜻이다. 마치 스프링 등의 MVC 프레임워크 사용 시 컨트롤러가 데이터 바인딩 후 뷰 호출하는 것처럼.
이렇게 되기 때문에, `.js` 라우팅에서 `body` 속성을 통해 전달할 수 있는 값은 단 2가지로 한정짓게 된다.

- 원시 객체(JSON)
- 오류 객체([`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error))

만약 단독 API 구성 시 아래 유형이 추가로 지원된다.
하지만 위 혼용 문제 해결 방법을 후술할 것이며, 이를 만족할 경우에도 마찬가지.

- 바이트 배열([`UInt8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array))
- 읽기 스트림([`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream))

따라서 텍스트나 다운로드할 이미지 바이트 및 스트림 등등 자유자재 응답이 가능하다.
참고로 스트림은 `@sveltejs/kit@1.0.0-next.370` 버전부터 지원한다.
(이전 버전에도 구현했지만 [메모리 공격 문제](https://github.com/sveltejs/kit/issues/5412)가 발견되어 이를 해결한 최초 버전 기준)

다시 본론으로 가서, 혼용으로 인한 컴포넌트를 타지 않고 단독 API로 운용하고자 한다면 아래 항목 중 하나를 만족시키면 된다.
이는 현재 버전인 `@sveltejs/kit@1.0.0-next.377` 기준 HTTP METHOD(`GET`, `POST` 등)를 달리 호출 시에도 똑같이 적용된다.

- 방금 말했듯이 같은 파일명을 가진 `.svelte` 파일이 없으면 된다.
- `fetch` 등의 API 요청 시 `accept` 헤더 추가
  예) `{ headers: { accept: 'application/json' } }`
- 아예 확장자를 추가할 수도 있다. 예) `.js` 대신 `.json.js` 로 변경

이 중 2번째 방법이 같은 파일명을 가진 컴포넌트와 API 파일 사용 시에 대한 유일한 해결방안이 될 수 있겠다.

더 무서운 점은 이런 파일 기반 라우팅에 대한 구조도가 아직도 [현재진행형](https://github.com/sveltejs/kit/discussions/5037) 이라는 것이다. 아직 베타 버전이고, 심지어 RC 단계도 아니기 때문에. 확정 안 됐다. 언제든 구조가 바뀔 수도 있기 때문에 언제든 대응할 수 있도록 준비해야 할 것이다.

그래서 만약 안정적인 SSR 프레임워크 사용을 꾀한다면... 거의 완제품이나 다름없는 그냥 Next.js 및 Nuxt.js 쓰기 바란다.
참고로 스트림 응답은 위 두 개는 아직 서버리스 기준으로 아직 지원 안 한다. 물론 지원 예정이니 걱정 마시라. 아니면 node.js 단독 서버인 경우 스트림 그냥 되니 쓰면 된다. SvelteKit 가 SSR 패키지 중에는 유이하다고 하겠다. 다른 하나는 Deno의 [Fresh](https://fresh.deno.dev).
실무에 사이드 프로젝트 및 쇼케이스, 프로토타이핑, 연구 및 해당 과제를 위한 프로그램 목적 외에 상용으로 SvelteKit 를 사용하지 않는 것을 추천한다.
**차라리 그냥 스벨트를 쓰길 바란다. 걔는 안정적으로 이미 오라클, 이케아, IBM까지 굵직한 대기업에서 신뢰하면서 쓰고 있다.**

끗.
Algorithm - Find Largest Upper Case Character when a same character in lower Case & Upper Case occurs in a string
Tags: javascript, algorithms, programming, codility
Published: 2022-07-16 07:04:45

I encounter this in [Codility](https://app.codility.com/programmers/), so going to share my solution. 
```
findBiggestAlphabet = function(S){
    console.log(`Processing..`, S)
    const char_arr = [...S];
    var max_char = "";
    for(var i=0; i<S.length-1;i++){
        var char = S[i];
        var char_c = char.toUpperCase()
        //console.log(`Processing ${char}`);
        var new_arr = char_arr.slice(i+1, char_arr.length);
      
        var exist_cap = new_arr.find(x=>x===char_c)? true: false;
        if (exist_cap){
            if (char_c>max_char){
                max_char = char_c;
            }
        }
    }
    if (max_char) return max_char;
    return "NO";
}

var A_1 = "aabcDBA";
var A_2 = "dabcDBA";
var A_3 = "abcde";
console.log(findBiggestAlphabet(A_1));
console.log(findBiggestAlphabet(A_2));
console.log(findBiggestAlphabet(A_3));
```
Algorithm - How to derive Minimum Swap between 'a' or 'b' to break 3 consecutives same characters
Tags: javascript, codility, algorithms, programming
Published: 2022-07-16 07:00:43

I encounter this in [Codility](https://app.codility.com/programmers/), so going to share my solution. 

```

findSwapCharacterCounts = function (S) {
    console.log(`Processing..`, S);
    var next = 0;
    while(next<S.length-1){
        var char = S[next]
        var next_char = S[next+1];
        if(next_char==char) {
           // console.log(`${char} same as ${next_char}`);
            if ((next_char == S[next+1]) && (next_char === S[next+2])){

                var end_char = S[next+2];
                var swap_char = end_char==="a"?"b":"a";
              //  console.log(`index=${next+2}, swap_char=${swap_char}`);
                var new_str = "";
                for (var j=0; j<S.length;j++){               
                    if (j==next+2){
                        new_str+=swap_char;
                    } else {
                        new_str+=S[j];
                    }
                }
                return findSwapCharacterCounts(new_str)+1;
            }

        } else {
           // console.log(`${char} different ${next_char}`);
        }
        next++;
    }
    return 0;
}

var B_1 = "baaaaa";
var B_2 = "baaaaaa";
var B_3 = "ababababa";
var B_4 = "abbbaaab";
console.log(findSwapCharacterCounts(B_1));
console.log(findSwapCharacterCounts(B_2));
console.log(findSwapCharacterCounts(B_3));
console.log(findSwapCharacterCounts(B_4)); 


```
This week’s newsletter is out! (16-07-2022) - Saving Deprecated
Tags: javascript, tech, webdev, discuss
Published: 2022-07-16 06:55:34

---
title: This week’s newsletter is out! (16-07-2022) - Saving Deprecated
published: true
description: Another week of great javascript, tech and web development links.
tags: javascript, tech, webdev, discuss
---

Saving Deprecated

https://markjgsmith.substack.com/p/mark-smiths-newsletter-16-07-2022

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Connect your android device using Wi-Fi on VS Code
Tags: android, wifi, vscode, flutter
Published: 2022-07-16 06:55:28

For mobile developers building an Android app, it's important that you always test your app on a real device (phone, tablet) before releasing it to users.

Connecting your device through a USB cord when running your app can be stressful when you are using the device for other things like checking other apps and changing music or charging your device (if it is low). All of these can cause the USB to detach from the device and you will need to connect and run it again when the device is detached.

This solution is too simple, in my opinion. Once your device has been connected to a USB port, you can allow Wi-Fi to maintain the connection.

Android Debug Bridge (ADB) connection is used to connect our Android smartphone to our PC.

## Set up a device for development
To set up a device for development read [this](https://developer.android.com/studio/run/device#setting-up)

## Connect to your device using USB
You should already be aware that a USB cable is necessary.

Check you have Android studio installed on your PC and your have installed the SDK Platform Tools.

![sdk platform](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ueyztvrh3lueypvbq46a.JPG)

Verify that your device is connected by running the `adb devices` command from your `android_sdk/platform-tools/` directory. If connected, you'll see the device listed

Make sure the platform-tools directory is present in your environment variable. Adding the directory is required if not.

![User variable](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9n9h3ysfoz4vk67lwtv.JPG)

For flutter developers, before running your app, check if `flutter doctor` is working correctly.

## Connect to your device using Wi-Fi
Ensure that your workstation or PC and device are connected to the same wireless network.
This wireless network can be established by sharing your PC's hotspot with your android device or vice-versa.

## Install extension
1. Click on the extension tab in the left area on VS Code.

![extensions.png](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5fnwa11ceb88nl52g63b.png)

2. Search for `Android ADB WLAN` by deskbtm (developer name). Install the extension.

![wlandevice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g0cg06dly6zg2bvnjgmc.JPG)

3. Restart your VS Code. The extension added beside the `run button` on your VS Code.


![run wlan icon.JPG](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gf71ax85uw50k27jcdcf.JPG)

4. Click on the icon and select the android device name you want to connect.
5. Select the number by pressing `Enter`, 
6. Select the prompted `IP address` of the WIFI your PC is connected to by pressing `Enter`.
7. Connect successfully
8. Unplug your device and enjoy!

If there is any issue `restart the adb` by using the extension button and follow the process again.

Thanks for reading. Don't forget to share.

Contact me
[Twitter](twitter.com/TaiwoFarinu)
[LinkedIn](https://www.linkedin.com/in/taiwo-farinu-063b18120/)
What is a plate carrier made of? | Parts of a plate carrier.
Tags: news
Published: 2022-07-16 06:16:43

A plate carrier holds great importance value. This armour is responsible for the protection of our heart, liver, etc. 

Any harm to them can lead to a fatality. Therefore not only does a person needs to put on a quality plate carrier but also have proper knowledge regarding the wearable itself.

There are multiple types of plate carriers that we can discuss. Here we will be dismantling and studying the parts of a tactical plate carrier. 
It is a well-known carrier and has all the essential parts within it.

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

The [Tactical plate carrier](https://www.eod-gear.com/plate-carriers/
) can be divided into multiple parts for inspection. They are mentioned below:
**Plates:**
They are responsible for the protection of a person. The upper body cannot sustain a high amount of damage which can lead to the unnatural demise of a person. Their placement is done according to the location of the vital organs. Especially the heart and lungs.

**Carrier section:**
It includes the entire structure. Majorly any place that contains the plates. One of the major advancements is the addition of side panels. They increase protection levels in an overall sense.

**Straps/Buckles:**
The carrier section needs to be bound to the body. This is carried out by buckles or straps. The major buckle is near the waist. It is adjustable and can accommodate various waist sizes.

**Material:**
The entire plate carrier is made of kevlar with is a soft material for accommodation. The protection material mostly includes steel, ceramics or a blend of these materials to increase the safety value.
Firebase emulatos: UI doesn't work!!
Tags: firebase, node
Published: 2022-07-16 06:11:51

Hellow!!
I'm trying to develop REST API with CloudRun and Firestore, and I need to firestore emulator. So I was trying to use firebase-tools. But It occurs error like below.

```
// This is firebase-debug.log

u [FetchError]: request to http://localhost:4400/emulators failed, reason: connect ECONNREFUSED ::1:4400
    at ClientRequest.<anonymous> (/Users/thikashi/.cache/firebase/emulators/ui-v1.7.0/server.bundle.js:326:16909)
    at ClientRequest.emit (node:events:513:28)
    at Socket.socketErrorListener (node:_http_client:481:9)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}
```

```
// This is console

Emulator UI has exited upon receiving signal: SIGINT

```

In my case, I was using node.js ver 18, and I have changed to ver.16. It works well!!

The problems took 3 hours... ... OMG.
See my latest video on You tube
Tags: youtube
Published: 2022-07-16 05:57:47


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

https://github.com/Chiki1601

https://www.youtube.com/shorts/xP4aKQEinZY




Hello guys....
I have uploaded my first short in my you tube channel...

if you like my video,
then Don't forget to subscribe m youtube Channel....
And don't forget to follow me on Github!
QuickBooks Desktop Mac 2021 Features
Tags: javascript, beginners, tutorial
Published: 2022-07-16 05:51:07


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/labt15df1nlobwhd9azl.jpg)Each year, QuickBooks brings in new version of QuickBooks that adds to different features and functionalities. [QuickBooks Desktop for Mac 2021](url=https://www.qberrorsupport.com/quickbooks-desktop-mac-2021-features/) brings both new and improved features designed to benefit your business. In this post, we are going to talk about those features and functionalities that came along with QuickBooks desktop for Mac 2021. To know more about these features, make sure to read the post till the end. Or you can contact our team professionals at+18445210490   and they will provide you with further information.

Features offered by QuickBooks desktop for Mac
**•Automated Payment Reminders**
Automated payment reminders makes it easy to let the customers know when they have invoices they need to pay you for.  Once you've set up payment reminders, QuickBooks will let you know when you have invoices available to send. Then, you can review and approve them before they go out.
•**Combine Multiple Emails**
In case you send multiple forms, like invoices or statements, to the same customer, you can combine them into a single email instead of sending multiple emails.
**•Credit Card Refunds**
If you have Merchant Services, you can now refund credit card payments in QuickBooks with the help of this feature.
**•Email Templates**
Create customized email templates with different subject lines and email bodies for all the forms you email customers. Then, all you have to do is select the email template to use when you send an invoice, sales receipt, estimate, or any other transactions.
These were the features involved in [QuickBooks desktop Mac 2021](url=https://hostdocket.com/quickbooks-desktop-mac-2019-is-coming-soon/). However, if you have any queries, you can discuss the same with our QuickBooks support professionals at +18445210490 and ask them to help you in clearing your clouds of confusion. We are a team of professionals who are well-versed with QuickBooks and its related information and we provide round the clock assistance to all QuickBooks related issues.
2333. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-16 05:47:11

```
using LL = long long;
class Solution {
public:
    long long minSumSquareDiff(vector<int>& nums1, vector<int>& nums2, int k1, int k2) 
    {
        vector<LL>nums;
        for (int i=0; i<nums1.size(); i++)
            nums.push_back(abs(nums1[i]-nums2[i]));
        sort(nums.rbegin(), nums.rend());
        
        int n = nums.size();        
        vector<LL>presum(n);
        presum[0] = nums[0];
        for (int i=1; i<n; i++)
            presum[i] = presum[i-1]+nums[i];
        LL ret = 0;
        
        int k = k1+k2;
        if (presum[n-1] <= k)
            return 0;        
        
        int i = 0;
        while (i<n && (presum[i] - nums[i]*(i+1) <= k))
            i++;        
        i--;
        
        LL diff = k - (presum[i] - nums[i]*(i+1));
        LL each = diff / (i+1);
        LL extra = diff % (i+1);

        int a = extra;  // nums[i]-each-1;
        int b = i+1-a;  // nums[i]-each;
        
        ret += (nums[i]-each-1)*(nums[i]-each-1) * a;
        ret += (nums[i]-each)*(nums[i]-each) * b;                        
        
        for (int j=i+1; j<n; j++)            
            ret += nums[j]*nums[j];
                
        return ret;
    }
};
```

#leetcode
#weekly contest
Here is the link for the problem.....
https://leetcode.com/contest/biweekly-contest-82/problems/minimum-sum-of-squared-difference/
I understand why everyone does not make a tech start-up now - New Years Resolution - Dev Log 36
Tags: webdev, programming, beginners, startup
Published: 2022-07-16 05:21:59

I have had a proper 9-5 job for 3 weeks now. I now understand why most developers do not try to create tech start-ups all the time. After 8 hours of staring at a screen, I do feel that it is more difficult than before to get into the proper flow of things. With that on the table, I am still coding routinely and remember why my UI's are usually simple. Creating awesome animations and beautiful UI's on all screen sizes is difficult. Now that I have iterated twice over my website's home page UI, I am making the decision to dumb it down and make it simple like my last project. A simple UI done well looks better than a complex one done poorly any day of the week. I am particularly excited that I have outsourced my Hero image to Fivver. This time round no holds are barred. I will use a professionally made image instead one I found on Google.

I also have a cool CSS trick to report. When creating the header for the third time, I decided to implement a hamburger menu. I rendered this under the section that had the rest of the header in the DOM. The problem was that when the menu would slide out it would go over the top of the hero section but not the header (because in the HTML it was rendered second). I figured that if I just slapped a z-index on it then that would solve my issue. It did not. So before I rearranged the HTML (JSX in this case), I decided to solve another issue with the slide-out menu. I needed to remove it from the document object flow in order to not have the rest of the site rendered under it. The menu having a height of 100vh obviously needs to have stuff under it. So I made the position absolute and the hero section appeared where it should, success. But then I thought to just add a "top" property to the slide-out menu to force it into covering the header; that way I do not have to bother with the HTML. In doing this I found a cool trick, if you add a "top" value of 0px, for some reason it renders the slide-out menu over everything else, even the header that is technically above it in the DOM. The slide-out menu does have a height of 100hv so it is as tall as the screen, but before the "top" value of 0px it would not cover the header, now it does.

Just thought I would share that trick. So I am gonna get back to the grind. Sorry for the terrible blog schedule. Got a lot on my plate right now. Honestly, I still love the idea of the project so I still am not willing to share it.
2334. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-16 05:16:52

```
struct DSU {
    int mx;
    vector<int> par, size;
    
    DSU (int n) {
        mx = 1;
        par.resize(n+1);
        size.resize(n+1, 1);
        
        for (int j = 1; j <= n; j ++) par[j] = j;
    }
    
    int Leader (int x) {
        if (par[x] == x) return x;
        return (par[x] = Leader (par[x]));
    }
    
    void merge (int x, int y) {
        x = Leader(x);
        y = Leader(y);
        
        if (x == y) return;
        if (size[x] > size[y]) swap (x, y);
        
        size[y] += size[x];
        par[x] = y;
        
        mx = max (mx, size[y]);
    }
};

class Solution {
public:
    int validSubarraySize(vector<int>& nums, int threshold) {
        int n = nums.size();
        
        vector<pair<double, int>> val_and_ind;
        for (int j = 0; j < n; j ++) {
            val_and_ind.push_back({nums[j], j+1});           
        }
        
        sort (val_and_ind.begin(), val_and_ind.end());
        
        vector<bool> active (n+1, false);
        int k = 1;
        DSU dsu(n);
        
        for (int j = n-1; j >= 0 && k <= n;) {
            double k_threshold = (double)threshold/k;
            
            while (j >= 0 && val_and_ind[j].first > k_threshold) {
                int ind = val_and_ind[j].second;
                active[ind] = true;
                
                if (active[ind-1]) dsu.merge (ind, ind-1);
                if (active[ind+1]) dsu.merge (ind, ind+1);
                
                j --;
            }
                        
            if (j < n-1 && dsu.mx >= k) return k;
            k ++;
        }
        
        return -1;
    }
};
```

#leetcode
#weekly contest
Here is the link for the problem.....
https://leetcode.com/contest/biweekly-contest-82/problems/subarray-with-elements-greater-than-varying-threshold/