teleren/devto huggingface dataset:
What sets candidates apart?
Tags: interview, softwareengineering, hiring, career
Published: 2022-07-03 18:32:41

"What sets a candidate apart?" - this is a question I often get from junior engineers who are going through interviews and recruiting process.

Is it Leetcode solving? StackOverflow points or GitHub stars? Those may be some kind of indicator, but beyond the technologies, here are my other key criteria when comes to assessing a candidate

👉 problem solving thought process - I don't mean solving Leetcode problems, I mean how the candidate approaches practical ones related to a product or existing system

👉 humility vs arrogance - how they react to negative feedback or criticism, and how they portray their own knowledge and experience

👉 big picture thinking - do they think of edge cases, external impact, do they ask meaningful follow up questions

👉 curiosity vs apathy - do they try to understand the reasons behind why they do the things they do, or why certain practices or patterns are in place, or do they just go through the motions without asking questions

👉 improvement mindset - whether they think about how to better themselves, their code, and their knowledge

👉 clarity of communication - how clearly they can explain concepts, how well they can explain their own thought process

👉 collaborative nature - when I give problems I try to phrase it as something we are trying to solve together, not me against them. how they generally react to those situations, and handle back and forth's.

These can be a huge boost for the candidate's profile and can complement their tech skills, or even overcome shortcomings thereof.
Streamlit: The Best Way to Begin(Free and Paid Resources)
Tags: streamlit, python, datascience, machinelearning
Published: 2022-07-03 18:24:49

##About Streamlit : 
Streamlit is a library/framework in python that helps you make interactive data driven web application without writing any complicated codes. 

##Special Advantages: 

Streamlit can help you achieve complicated workings with minimalistic (few lines) of code. More than that there are other advantages of using streamlit like : 

1. Connecting it with react framework is lucid and a piece of cake.
2. The in-built framework is completely responsive.
3. Integrating ML models had never been easier. 
4. You can also make CRUD (Create Read Update Delete) applications using streamlit and it also support data base connectivity.
5. Facilitates interfaces to drive data uploads in various file formats. 

##Resources To Use:

###Books and Projects

Apart from the official page of [streamlit](https://streamlit.io/) recently I just received a copy of a book from Shifa Ansari and this book is your one stop solution for learning python. The link to the book is here : 

[Getting Started with Streamlit for Data Science](https://packt.live/3AIFgDk)

I'm also going to share a few project links to my gitHub repos that have data science based apps created using streamlit. Go through the codebases and I'm sure it will be helpful for you all. 

1. [Movie Recommendation System](https://github.com/Souvik1406/SouviksMovieRecommendationSystem)
2. [Emotion Detector](https://github.com/Souvik1406/StreamLitEmotionDetection)
3. [Laptop Price Predictor](https://github.com/Souvik1406/LaptopPricePredictorRegressionModel)
4. [To Do App](https://github.com/Souvik1406/toDoAppStreamLit)
5. [Automated ML App](https://github.com/Souvik1406/automatedMLBySouvikRoy)
6. [Auto KMeans Cluster Creator and Analysis Project](https://github.com/Souvik1406/kmeansclusterpredictwebsite)

###Online Tutorials: 

[Beginner Framework Familiarity Stuff](https://www.youtube.com/watch?v=UN4DaSAZel4&list=PLuU3eVwK0I9PT48ZBYAHdKPFazhXg76h5)
[Underrated Channel With end to end tutorials](https://www.youtube.com/c/JCharisTechJSecur1ty)
[Advanced and Moderate Data Science Stuff](https://www.youtube.com/c/DataProfessor)

###By the way an important announcement, In case this blog generates a good amount of views then I'm sharing a free copy of the above mentioned book to the first 100 comments and likes.
Coding Period GSoC'22 | Week 2 + 3
Tags: opensource, career, gsoc22
Published: 2022-07-03 18:17:15

These two weeks were full of fun and learning new things, it began with adding the tests for combinational analysis, bit converters, sub-circuits, and force gates in the second week.

On Saturday, June 25th, we joined a weekly meeting in which all mentors and contributors participated. During this meeting, we contributors presented our work and received guidance from the mentors.

As we entered the third week, me and my mentor decided to review our plans and to begin with the second task, which is the import and export of circuitFiles.

## Work done(Week 2 + Week 3)

The second task, import & export of circuitFiles, is now being taken on, as the Simulator Testing task is almost finished 🎯 .

![minions-excited-gif](https://c.tenor.com/bQrjUlPjAnsAAAAC/despicable-me-minions.gif)

**Link to Pull Request's**

- [Added tests for bitConvertor](https://github.com/CircuitVerse/CircuitVerse/pull/3207)
- [Added tests for Combinational Analysis](https://github.com/CircuitVerse/CircuitVerse/pull/3204)
- [Added tests for subCircuits](https://github.com/CircuitVerse/CircuitVerse/pull/3212)
- [Added tests for Force-gate](https://github.com/CircuitVerse/CircuitVerse/pull/3221)
- [Feat: Import and Export of CircuitFiles](https://github.com/CircuitVerse/CircuitVerse/pull/3222)

## What Next...?

We will focus on updating the documentation for simulator testing and completing the importing and exporting of circuitFiles during the next few weeks.

- Completion of Import and Export of CircuitFiles.
- Complete documentation stuff for Simulator Testing Part.

That's all for now; this series will go on.
🚀 Angular 14 + ESLint, Material + Transloco + Jest, TestCafe + Docker + Prettier 🚀
Tags: angular, javascript, webdev, beginners
Published: 2022-07-03 18:11:00

This is **the** Angular 14 Starter project you are looking for!

## GitHub
https://github.com/wlucha/angular-starter

## Features
✅ [Angular 14](https://angular.io/)
✅ [Angular Material](https://material.angular.io/)
✅ Unit Testing with [Jest](https://jestjs.io/)
✅ End-to-End Testing with [TestCafé](https://testcafe.io/)
✅ Internationalization with [Transloco](https://github.com/ngneat/transloco)
✅ Auto documentation with [Compodoc](https://compodoc.app/) 
✅ Analyse your project with [source-map-explorer](https://www.npmjs.com/package/source-map-explorer)
✅ [Docker](https://www.docker.com/)
✅ [ESLint](https://eslint.org/)
✅ [Prettier](https://prettier.io/)
✅ [Commit Linting](https://github.com/conventional-changelog/commitlint)

## Demo
[![StackBlitz Demo](https://user-images.githubusercontent.com/7531596/83507657-2424e180-a4c9-11ea-8e4f-b3f8e7d6b4c5.png)](https://stackblitz.com/github/wlucha/angular-starter)

## Install / Development

```bash
# Clone the project
$ git clone https://github.com/wlucha/angular-starter
$ cd angular-starter

# Install dependencies
$ npm install

# Start server
$ npm run start

# Open in browser: http://localhost:4200
```

## Docker Deployment

```bash
# Build Docker image
$ docker build . -t angular-starter

# Run Docker Container
$ docker run -p 3000:80 angular-starter
```

## Docker Hub

https://hub.docker.com/r/wlucha/angular-starter

## Commands

- `npm run start` - start the app
- `npm run lint` - lint the project
- `npm run test` - run unit tests
- `npm run build` - build the project
- `npm run build:prod` - build the project in production mode
- `npm run build:prod:stats` - build the project in product mode with stats
- `npm run analyse` - analyse bundle with [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)
- `npm run compodoc` - generate [compodoc](https://github.com/compodoc/compodoc) documentation
- `npm run changelog` - generate changelog
- `npm run prettier` - format the whole project

**GitHub**
https://github.com/wlucha/angular-starter
How to setup Infinite Scroll in your react component?
Tags: react, webdev, tutorial, javascript
Published: 2022-07-03 18:07:36

Infinite scroll is the thing of today. Unlike pagination with pages, people prefer scrolling infinitely to get more and more data, Facebook and Instagram are very fine example leveraging the power of Infinite Scroll.


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

I have come across an infinite scroll package which is quite popular and many developers across the world are using this fine [npm package](https://www.npmjs.com/package/react-infinite-scroll-component) in their web apps.

This npm package is of small size, i.e., 177kb. It takes a few props, which are as follows:

1. The first prop is **dataLength** which is the length of the data.
2. After dataLength, we have the **next** prop. This is one of the most important prop, We pass a loadMoreData function to it that triggers some action which fetches the next data. This fetched data is passed as children to the InfiniteScroll component, and note that the data should contain previous data too. So, it is basically, [newData, ...PreviousData]
3. The third prop is **hasMore**, it is clear by its name that it takes a boolean value and tells InfiniteScroll whether to call next function on reaching the bottom or shows an endMessage to the user if next is not called i.e., hasMore is false.
4. The fourth prop, **loader** takes an element which is shown as a fallback to show while the component waits for the next load of data.
5. The fifth prop is **endMessage**, which tells the user that there is no more data and hasMore is false.

You can check out a codesandbox illustrating InfiniteScroll [here](https://codesandbox.io/s/yk7637p62z).

Don't forget to give your data as children in between the opening and closing tag of InfiniteScroll.

```
<InfiniteScroll
  dataLength={dataItems.length}
  next={LoadMoreData}
  hasMore={true}
  loader={<h4>Loading...</h4>}
  endMessage={
    <p style={{ textAlign: 'center' }}>
      <b>You have seen all the data</b>
    </p>
  }
>
  {dataItems}
</InfiniteScroll>
```

There are few [other props](https://www.npmjs.com/package/react-infinite-scroll-component) too that are useful in different scenarios but the above five props are sufficient to have a cool infinite scroll on board.

Note: If you are working with InfiniteScroll inside a popup or a modal, then **ScrollableTarget** prop would help. You need to create a parent div of InfiniteScroll with an id attribute and give this id as an argument to ScrollableTarget prop. A codesandbox is available [here](https://codesandbox.io/s/r7rp40n0zm).

If you came across any other Infinite Scroll package then do mention it in the discussion and I would be happy to give it a try.
1453. Leetcode Solution in Java
Tags: java
Published: 2022-07-03 18:00:49

```
class Solution {
    public int numPoints(int[][] points, int r) {
        int maxPoints = 1;
        int pointsCount = points.length;
        for (int i = 0; i < pointsCount; i++) {
            for (int j = i + 1; j < pointsCount; j++) {
                double[][] intersections = getIntersections(points[i], points[j], r);
                for (double[] intersection : intersections) {
                    int pointsInCircle = 0;
                    for (int[] point : points) {
                        double distance = distance(intersection, point);
                        if (distance <= r + 1e-5)
                            pointsInCircle++;
                    }
                    maxPoints = Math.max(maxPoints, pointsInCircle);
                }
            }
        }
        return maxPoints;
    }

    public double[][] getIntersections(int[] point1, int[] point2, int radius) {
        int squaredDistance = squaredDistance(point1, point2);
        if (squaredDistance > radius * radius * 4)
            return new double[0][2];
        else if (squaredDistance == radius * radius * 4) {
            double[] intersection = new double[2];
            for (int i = 0; i < 2; i++)
                intersection[i] = (point1[i] + point2[i]) / 2.0;
            double[][] intersections = new double[1][2];
            intersections[0] = intersection;
            return intersections;
        } else {
            double[] midPoint = new double[2];
            for (int i = 0; i < 2; i++)
                midPoint[i] = (point1[i] + point2[i]) / 2.0;
            double remaining = Math.sqrt(radius * radius - squaredDistance / 4.0);
            int difference1 = point1[1] - point2[1];
            int difference2 = point2[0] - point1[0];
            double radian = Math.atan(1.0 * difference2 / difference1);
            double[] intersection0 = {midPoint[0] + remaining * Math.cos(radian), midPoint[1] + remaining * Math.sin(radian)};
            double[] intersection1 = {midPoint[0] - remaining * Math.cos(radian), midPoint[1] - remaining * Math.sin(radian)};
            double[][] intersections = new double[2][2];
            intersections[0] = intersection0;
            intersections[1] = intersection1;
            return intersections;
        }
    }

    public int squaredDistance(int[] point1, int[] point2) {
        return (point2[0] - point1[0]) * (point2[0] - point1[0]) + (point2[1] - point1[1]) * (point2[1] - point1[1]);
    }

    public double distance(double[] point1, int[] point2) {
        return Math.sqrt((point2[0] - point1[0]) * (point2[0] - point1[0]) + (point2[1] - point1[1]) * (point2[1] - point1[1]));
    }
}
```
1478. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-03 17:59:41

```
// Space: O(N^2)
class Solution {
public:
    int minDistance(vector<int>& A, int K) {
        if (A.size() == K) return 0;
        sort(begin(A), end(A));
        int N = A.size(); 
        vector<vector<int>> dist(N, vector<int>(N));
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                int m = A[(i + j) / 2];
                for (int k = i; k <= j; ++k) dist[i][j] += abs(A[k] - m);
            }
        }
        vector<vector<int>> dp(K + 1, vector<int> (N + 1, 1e6));
        for (int i = 0; i < N; ++i) dp[1][i + 1] = dist[0][i];
        for (int k = 2; k <= K; ++k) {
            for (int i = 0; i < N; ++i) {
                for (int j = i; j >= k - 1; --j) {
                    dp[k][i + 1] = min(dp[k][i + 1], dp[k - 1][j] + dist[j][i]);
                }
            }
        }
        return dp[K][N];
    }
};
```
1815. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-03 17:58:13

```
class Solution {
 public:
  int maxHappyGroups(int batchSize, vector<int>& groups) {
    int happy = 0;
    vector<int> freq(batchSize);

    for (int g : groups) {
      g %= batchSize;
      if (g == 0) {
        ++happy;
      } else if (freq[batchSize - g]) {
        --freq[batchSize - g];
        ++happy;
      } else {
        ++freq[g];
      }
    }

    return happy + dp(freq, 0, batchSize);
  }

 private:
  map<vector<int>, int> memo;

  // max # of partitions you can form given
  // current freq and current remainder r
  int dp(const vector<int>& freq, int r, const int& batchSize) {
    if (memo.count(freq))
      return memo[freq];

    int ans = 0;

    if (any_of(begin(freq), end(freq), [](int f) { return f != 0; })) {
      for (int i = 0; i < freq.size(); ++i)
        if (freq[i]) {
          vector<int> newFreq(freq);
          --newFreq[i];
          ans = max(ans, dp(newFreq, (r + i) % batchSize, batchSize));
        }
      if (r == 0)
        ++ans;
    }

    return memo[freq] = ans;
  }
};

```
Blogbeat is now connected to LinkedIn
Tags: blogbeat
Published: 2022-07-03 17:57:13

#### Blogbeat is now connected to LinkedIn. You are able to share your articles from Blogbeat on LinkedIn with just one click.Find out more about Blogbeat and the LinkedIn API in the following article.



Introduction
============

* Blogbeat uses the official LinkedIn api.
* Share articles on your personal profile.
* Blogbeat will never post to LinkedIn without your permission.
* A Blogbeat account is required.

Connect LinkedIn and Blogbeat
=============================

* Create a new draft on Blogbeat or open an existing draft.
* Next to the LinkedIn logo click on "Set Up" and read the instructions.
* LinkedIn will ask you to grant the following permissions to Blogbeat
	+ *Create, modify, and delete posts, comments, and reactions on your behalf*
	+ *Use your name and photo*
* Click on accept.
* Now your are connected.

Happy writing.

More Information
================

More Information regarding the LinkedIn api: <https://docs.microsoft.com/de-de/linkedin/consumer/integrations/self-serve/share-on-linkedin>

Find the original article here: <a href="http://blogbeat.app/blog/maxonce/article/set-up-linkedin-api-with-blogbeat">http://blogbeat.app/blog/maxonce/article/set-up-linkedin-api-with-blogbeat
1808. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-03 17:56:58

```
class Solution {
 public:
  int maxNiceDivisors(int primeFactors) {
    if (primeFactors <= 3)
      return primeFactors;
    if (primeFactors % 3 == 0)
      return myPow(3, primeFactors / 3) % kMod;
    if (primeFactors % 3 == 1)
      return (4 * myPow(3, (primeFactors - 4) / 3)) % kMod;
    return (2 * myPow(3, (primeFactors - 2) / 3)) % kMod;
  }

 private:
  constexpr static int kMod = 1e9 + 7;

  long myPow(long x, long n) {
    if (n == 0)
      return 1;
    if (n & 1)
      return x * myPow(x % kMod, (n - 1) % kMod) % kMod;
    return myPow(x * x % kMod, (n / 2) % kMod) % kMod;
  }
};

```
1857. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-03 17:56:11

```
class Solution {
 public:
  int largestPathValue(string colors, vector<vector<int>>& edges) {
    const int n = colors.length();
    int ans = 0;
    int processed = 0;
    vector<vector<int>> graph(n);
    vector<int> inDegree(n);
    queue<int> q;
    vector<vector<int>> count(n, vector<int>(26));

    // build graph
    for (const auto& e : edges) {
      const int u = e[0];
      const int v = e[1];
      graph[u].push_back(v);
      ++inDegree[v];
    }

    // topology
    for (int i = 0; i < n; ++i)
      if (inDegree[i] == 0)
        q.push(i);

    while (!q.empty()) {
      const int out = q.front();
      q.pop();
      ++processed;
      ans = max(ans, ++count[out][colors[out] - 'a']);
      for (const int in : graph[out]) {
        for (int i = 0; i < 26; ++i)
          count[in][i] = max(count[in][i], count[out][i]);
        if (--inDegree[in] == 0)
          q.push(in);
      }
    }

    return processed == n ? ans : -1;
  }
};

```
1862. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-03 17:55:27

```
class Solution {
 public:
  int sumOfFlooredPairs(vector<int>& nums) {
    constexpr int kMod = 1e9 + 7;
    const int kMax = *max_element(begin(nums), end(nums));
    long ans = 0;
    // count[i] := # of nums <= i
    vector<int> count(kMax + 1);

    for (const int num : nums)
      ++count[num];

    for (int i = 1; i <= kMax; ++i)
      count[i] += count[i - 1];

    for (int i = 1; i <= kMax; ++i)
      if (count[i] > count[i - 1]) {
        long sum = 0;
        for (int j = 1; i * j <= kMax; ++j) {
          const int lo = i * j - 1;
          const int hi = i * (j + 1) - 1;
          sum += (count[min(hi, kMax)] - count[lo]) * j;
        }
        ans += sum * (count[i] - count[i - 1]);
        ans %= kMod;
      }

    return ans;
  }
};

```
1866. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-03 17:54:43

```
class Solution {
 public:
  long rearrangeSticks(int n, int k) {
    if (n == k)
      return 1;
    if (k == 0)
      return 0;
    if (dp[n][k])
      return dp[n][k];
    return dp[n][k] = (rearrangeSticks(n - 1, k - 1) +
                       rearrangeSticks(n - 1, k) * (n - 1)) %
                      kMod;
  }

 private:
  constexpr static int kMod = 1e9 + 7;
  vector<vector<int>> dp = vector<vector<int>>(1001, vector<int>(1001));
};

```
1872. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-03 17:53:52

```
class Solution {
 public:
  int stoneGameVIII(vector<int>& stones) {
    const int n = stones.size();
    vector<int> prefix(n);
    // dp[i] := max score diff the current player can get when the game starts
    // at i, i.e., stones[0..i] are merged whose value is prefix[i]
    vector<int> dp(n, INT_MIN);

    partial_sum(begin(stones), end(stones), begin(prefix));

    // must take all when there're only two stones left
    dp[n - 2] = prefix.back();

    for (int i = n - 3; i >= 0; --i)
      dp[i] = max(dp[i + 1], prefix[i + 1] - dp[i + 1]);

    return dp[0];
  }
};

```
1879. Leetcode Solution in CPP
Published: 2022-07-03 17:53:04

```
class Solution {
 public:
  int minimumXORSum(vector<int>& nums1, vector<int>& nums2) {
    return dfs(nums1, nums2, vector<int>(1 << nums2.size(), INT_MAX), 0, 0);
  }

 private:
  int dfs(const vector<int>& A, const vector<int>& B, vector<int>&& dp, int i,
          int mask) {
    if (i == A.size())
      return 0;
    if (dp[mask] < INT_MAX)
      return dp[mask];

    for (int j = 0; j < B.size(); ++j)
      if (!(mask >> j & 1))
        dp[mask] = min(dp[mask], (A[i] ^ B[j]) +
                                     dfs(A, B, move(dp), i + 1, mask | 1 << j));

    return dp[mask];
  }
};

```
1883. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-03 17:52:07

```
class Solution {
 public:
  int minSkips(vector<int>& dist, int speed, int hoursBefore) {
    constexpr double kInf = 1e7;
    constexpr double kEps = 1e-9;
    const int n = dist.size();
    // dp[i][j] := min time w/ prev i-th road and j skips
    vector<vector<double>> dp(n + 1, vector<double>(n + 1, kInf));
    dp[0][0] = 0;

    for (int i = 1; i <= n; ++i) {
      const double d = dist[i - 1];
      dp[i][0] = ceil(dp[i - 1][0] + d / speed - kEps);
      for (int j = 1; j <= i; ++j)
        dp[i][j] = min(dp[i - 1][j - 1] + d / speed,
                       ceil(dp[i - 1][j] + d / speed - kEps));
    }

    for (int j = 0; j <= n; ++j)
      if (dp[n][j] <= hoursBefore)
        return j;

    return -1;
  }
};

```
1889. Leetcode Solution in Java
Tags: java
Published: 2022-07-03 17:51:15

```
class Solution {
    public int minWastedSpace(int[] packages, int[][] boxes) {
        final int MODULO = 1000000007;
        int n = packages.length, m = boxes.length;
        Arrays.sort(packages);
        for (int i = 0; i < m; i++)
            Arrays.sort(boxes[i]);
        long[] packagesPrefixSum = new long[n];
        packagesPrefixSum[0] = packages[0];
        for (int i = 1; i < n; i++)
            packagesPrefixSum[i] = packagesPrefixSum[i - 1] + packages[i];
        long minWasted = Long.MAX_VALUE;
        int maxPackage = packages[n - 1], minPackage = packages[0];
        for (int[] curBoxes : boxes) {
            int count = curBoxes.length;
            if (curBoxes[count - 1] < maxPackage)
                continue;
            int last = -1;
            long totalWasted = 0;
            for (int i = 0; i < count; i++) {
                int box = curBoxes[i];
                if (box < minPackage)
                    continue;
                int index = lastIndex(packages, box);
                long totalSpace = packagesPrefixSum[index] - (last < 0 ? 0 : packagesPrefixSum[last]);
                long wastedSpace = (long) (index - last) * box - totalSpace;
                totalWasted += wastedSpace;
                last = index;
            }
            minWasted = Math.min(minWasted, totalWasted);
        }
        return minWasted == Long.MAX_VALUE ? -1 : (int) (minWasted % MODULO);
    }

    public int lastIndex(int[] arr, int target) {
        int low = 0, high = arr.length - 1;
        while (low < high) {
            int mid = (high - low + 1) / 2 + low;
            if (arr[mid] <= target)
                low = mid;
            else
                high = mid - 1;
        }
        return low;
    }
}
```