teleren/devto huggingface dataset:
.bashrc vs .bash_profile, what is the difference?
Tags: bash, beginners
Published: 2022-06-03 10:54:44

# .bash_profile

This file loads each time a login happens.

```bash
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
```

# `.bashrc`

This file loads everytime we start a new bash session.

```bash
# User specific aliases and functions

alias login='kubectl exec -it'
```

> Note: 📚 In case you could not log into the linux machine due to problems in the bash configuration (`.bashrc`) file.
Press `Ctrl+C` immediately after login to prevent bash profile from loading.
A plain bash session opens. Correct the bash files. And login again.
A Useful Git Command
Tags: git, github, tip
Published: 2022-06-03 10:51:12

As a developer version control is something that is most likely in your wokflow. If not, you should really consider taking the time to incorporate it.

The most common git commands are
- **git init** - initialise an empty git repository 
- **git add** - adds file(s) to staging area
- **git commit** - to save your changes to source control
- **git push** - to push changes to a remote repository
- **git log** - to show a record of what has happened on the repository
- **git status** - to see the status of things in your version flow: new, unstaged, uncommited etc

But there is one more command, that no one told you about, one that is a game changer. 

### Enter `git add -p`
In most instance when you make changes to your file, you use `git add` to stage those files and then `git commit -m` to save them to source control. 

Let's what happens with `git add -p`:

![commis.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1654183845005/ywFZfYRW2.png)

From the screenshot above:
- I modified the commissions page slightly
- In my terminal I ran the command  `git add -p` 
- This showed me everything that's been changed and a prompt to stage those changes

If I had made more changes, It would show me the changes one by one and ask me whether I want to stage them or not

![morecomm.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1654184072499/XlgjVbp3N.png)

After staging your changes, all that's left is to commit them.

## Conclusion
I am sure you can see how useful this could be to keep proper track of the changes you make during your development flow and decide what to stage or not.  

Much better than going `git add [filename]`, no?


I write this article partially because [whitep4nth3r](https://twitter.com/whitep4nth3r) was on the fence about writing about it.

---
###  Thank you for reading, let's connect!
Thank you for visiting this little corner of mine. Let's connect on [**Twitter**](https://twitter.com/Psypher1), [**Polywork**](https://www.polywork.com/psypher1) and [**LinkedIn**](https://www.linkedin.com/in/jamesmidzi/)
cpp Binary to Decimal decoder
Tags: binary, decimal, decoder, cpp
Published: 2022-06-03 10:49:32

Since my ([last post](https://dev.to/analyze0/cpp-decimal-binary-calculator-3b2a)) I had been trying to make a Binary to Decimal calculator, also using C++. I went for a different method this time, and now the binary supports over 8 digits.

Credit to: [https://geeksforgeeks.org/](https://geeksforgeeks.org/)

[Link to finished project](https://replit.com/@Analyze185/Binary-to-Decimal-Decoder?v=1)

Code:

```
#include <iostream>
using namespace std;

int main() {
  char binaryNumber[] = "0101010101010101010101010101010101";
  string session = "y";
  while (session == "y") {

    cout << "\nEnter a Binary number (1s and 0s): ";
    cin >> binaryNumber;
    cout << "\n";

    cout << stoi(binaryNumber, 0, 2);
    session = "y";
    cout << "\nContinue session? [y/n]\n";
    cin >> session;
    cout << "\x1B[2J\x1B[H";
  } // end of session
  cout << "Credit to https://geeksforgeeks.org/ for helping me with some of "
          "this code!\n";
  return 1;
}
```

`
Changelog#1(Fri, Jun 3rd):
Fixed formatting
on Cloud or local computer?
Published: 2022-06-03 10:47:59

A few years ago, I am a lot excited about Cloud storage, compute and 
up to minute pricing. But, this does not seem to be a one size fits all.

But I prefer using local storage/compute:
important documents, documents that I access multiple times, and work on code on local machine and of course I have purchased the subscription of the streaming services to download music that I listen to more than once.

I think local first. I'd like to have the best version of anything available local. And cloud for synchronize and backup.

What do you think about "local first"?
How to get the unzipping done first before executing the observable post
Tags: angular
Published: 2022-06-03 10:36:52

Need to get unzipped files and store into an array files. Then need to upload the array of files. There is a need of some delay between the unzipping using loadAsSync and post ( to import). Here Post is executed before unzipping. Any help is much appreciated


code-snippets:

```
selectedfiles: File[] = [];

// Unzip and stores files into selectedfiles. 

readZip(file: any) {
    var jsZip = require('jszip')
    this.selectedfiles = [];

    jsZip.loadAsync(file).then((zip) => {
      Object.keys(zip.files).forEach((filename) => {
        zip.files[filename].async('blob').then((fileData) => {

          if (!zip.files[filename].dir) {
            const tmp = new File([fileData], filename);
            this.selectedfiles.push(tmp);
          }
        });
      });
    });
  }

// To upload the selected zip file
  upload(files: FileList): Observable<HttpEvent<Blob>> {
    const url = `${this.apiroot}/device/wifi/settings`;
    const formData = new FormData();

    this.readZip(files[0]) //stores files into selectedfiles 
                    
     this.selectedfiles.forEach((value) => {
        formData.append('file', value);
      });

    return this.http.post<HttpResponse<DSettings>>(url, formData, { observe: 'events', reportProgress: true }).pipe(
      tap(() => {
        this.log('uploaded settings');
        this.selectedfiles = [];
      }),
      catchError(this.handleError<DSettings>('upload'))
    );
  }

```
LeetCode : Maximum 69 Number with Solutions
Tags: programming, java, javascript, webdev
Published: 2022-06-03 10:16:02

Hey🖐 DevCommunity Checkout The blog for solutions above Leetcode problem statement

##Problem Statement
You are given a positive integer num consisting only of digits 6 and 9.

Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6).

 
```
Example 1:

Input: num = 9669
Output: 9969
Explanation: 
Changing the first digit results in 6669.
Changing the second digit results in 9969.
Changing the third digit results in 9699.
Changing the fourth digit results in 9666.
The maximum number is 9969.
```
```
Example 2:

Input: num = 9996
Output: 9999
Explanation: Changing the last digit 6 to 9 
results in the maximum number.
```

```
Example 3:

Input: num = 9999
Output: 9999
Explanation: It is better not to apply any change.
```

Constraints:
```
1 <= num <= 104
num consists of only 6 and 9 digits.
```

##Solution

```

class Solution {
    public int maximum69Number (int num) {
         List<Integer> nums= new ArrayList<>();
        nums.add(num);
        char[] chars= String.valueOf(num).toCharArray();

        for (int i = 0; i < chars.length; i++) {
            if(chars[i]=='6'){
                chars[i]='9';
                nums.add(Integer.valueOf(String.valueOf(chars)));
                chars[i]='6';
            }
        }
        for (int i = 0; i < chars.length; i++) {
            if(chars[i]=='9'){
                chars[i]='6';
                nums.add(Integer.valueOf(String.valueOf(chars)));
                chars[i]='9';
            }
        }

       return nums.stream().distinct().max(Integer::compare).get();
    }
}
```

###Conclusion
In this article, we learned way to solve LeetCode Problem Statement Maximum 69 Number using java.

**Checkout More about Me by visiting on below links**

[Github:- Rohan2596 ](https://github.com/Rohan2596)
[Website:- kadamrohan.com ](https://kadamrohan.com/ "https://kadamrohan.com/")
[Blogs:- rohankadam965.medium.com](https://rohankadam965.medium.com/ "https://rohankadam965.medium.com/")
[Instagram:- rohankadam_codes ](https://www.instagram.com/rohankadam_codes/)

Thank You For Reading.Do like ❤ Share and Follow for more content like this.
Also share feedbacks and Solution in the comment section below
Web Designer Guide and Tips
Published: 2022-06-03 10:04:51

Note: This is updating article.


1. Sketching
2. Inspiration
3. Userflow
4. Sitemap
5. Wireframes
6. Prototyping
7. Feedback

## Visual Design

1. Spacing and Grid
2. Typography
3. Color
4. Visual Assets
    Designing Images with whole background and generally whole screen width. Positioning on screen is much harder if you have small images. There for have image format and just adjust image css - source Udemy Case Study.

## Design System
1. Design Patters
2. Microinteraction
3. Motion
UI Testing Tools
Tags: qa, tutorial, devops, testing
Published: 2022-06-03 10:04:50


**Crowdsourced Testing**

- https://www.rainforestqa.com     No code tool for creating test cases augmented with human testers for subjective testing  

- https://testlio.com, https://www.globalapptesting.com, https://test.io/      Crowdsourced testing + test management platform



**Bug Diagnosis**


- https://www.zipy.ai  Session Playback and Monitoring tool to diagnose bug easily




**No Code / Low Code Testing**

- https://www.perfecto.io/

- https://www.mabl.com/
Trapping Rain Water
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 10:00:43

Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining.

**Example 1:**

![](https://assets.leetcode.com/uploads/2018/10/22/rainwatertrap.png)

**Input:** height = \[0,1,0,2,1,0,1,3,2,1,2,1\]
**Output:** 6
**Explanation:** The above elevation map (black section) is represented by array \[0,1,0,2,1,0,1,3,2,1,2,1\]. In this case, 6 units of rain water (blue section) are being trapped.

**Example 2:**

**Input:** height = \[4,2,0,3,2,5\]
**Output:** 9

**Constraints:**

*   `n == height.length`
*   `1 <= n <= 2 * 104`
*   `0 <= height[i] <= 105`

**SOLUTION:**

    class Solution:
        def trap(self, height: List[int]) -> int:
            blocks = 0
            n = 0
            h = float('-inf')
            for hh in height:
                blocks += hh
                n += 1
                h = max(h, hh)
            total = 0
            left = 0
            right = n - 1
            for i in range(h):
                while height[left] <= i:
                    left += 1
                while height[right] <= i:
                    right -= 1
                total += right - left
            total -= (blocks - h)
            return total
Storyblok CheatSheet for Nuxt 3
Tags: headless, nuxt, vue, sdk
Published: 2022-06-03 09:44:37

We have created a Storyblok Nuxt 3 CheatSheet for you! It provides all the information you need to get started right away.

Download the CheatSheet to have a quick and concise overview on how to configure our SDK, create Storyblok components, render pages dynamically, fetch multilingual content and much more!

[Download the Nuxt 3 CheatSheet](https://a.storyblok.com/f/88751/x/f08e494225/cs-nuxt3.pdf)
Reverse Pairs
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 09:30:40

Given an integer array `nums`, return _the number of **reverse pairs** in the array_.

A reverse pair is a pair `(i, j)` where `0 <= i < j < nums.length` and `nums[i] > 2 * nums[j]`.

**Example 1:**

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

**Example 2:**

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

**Constraints:**

*   `1 <= nums.length <= 5 * 104`
*   `-231 <= nums[i] <= 231 - 1`

**SOLUTION:**

    import bisect
    
    class Solution:
        def reversePairs(self, nums: List[int]) -> int:
            n = len(nums)
            sortednums = []
            ctr = 0
            for i in range(n):
                k = bisect.bisect_right(sortednums, 2 * nums[i])
                ctr += i - k
                bisect.insort(sortednums, nums[i])
            return ctr
From building to selling - EP.13
Tags: webdev, startup, html, css
Published: 2022-06-03 09:29:21

Welcome to day thirteen of the Crossroad build journey! This series follows my journey of indie hacking a product from building to selling. If you missed day twelve, you could [check it out here](https://www.twankrui.com/blog/from-building-to-selling-11). I also uploaded today's [Twitch stream](https://twitch.tv/twankrui) to [YouTube](https://www.youtube.com/watch?v=jyc8YUUGcDs&feature=youtu.be) if you want to watch the replay.

## The first Crossroad site is live! 🚀

Today my primary focus was building the first site that uses crossroad for its UI. What better project to take on than creating my own link in bio page? After all, if the author doesn't use it, why should you?

I decided to build my link in bio site with NextJS. I can always spin a site up quickly using this framework, and it also supports enough out of the box for all the data fetching I'll need down the road.

I decided to hardcode everything for this version of my link in bio page. While I plan on fetching my featured blog posts from my database, my main focus today was fetching any remaining bugs and missing features.

It turned out, especially on Safari (the new IE, if you ask me), that there were quite a few nasty (but easy to fix) bugs. For example, my entire social row wasn't visible because of a flexbox inside of another flexbox. 🤦‍♂️

After a little under two hours, with a lot of jotting things down and improving certain aspects of the template, my link in bio page was finally live! Yeah, you read that well, LIVE!

If you want to see the site in action, here is the link:

[links.twankrui.com](http://links.twankrui.com)

## Prepping for launch week. 🚚

Now that I have the product's final "to-fix" list, I finally have a launch date. I'll launch the product on:

**Thursday, June 9**

So I have roughly three days to wrap up the template, put it up on Gumroad, buy a domain for the landing page, and prepare the launch, including the copy and assets. It seems doable, so let's go for it!****

## See you next (launch) week! 👋

With [links.twankrui.com](http://links.twankrui.com/) up in the air, we have defined the final roadblocks to overcome before going live. All in all, I need two more days of fixing and preparation before we can go live next Thursday!


I am incredibly excited for the launch next week. I hope you share some of this excitement.

Thanks again for reading this build log. Have a great day, and I’ll see you next Tuesday!

If you want to stay updated in the meantime, [give me a follow on Twitter](https://twitter.com/twankrui).

With love,

Twankrui
WN22: What is the best piece of content you found?
Tags: webdev, todayilearned, discuss
Published: 2022-06-03 09:28:19

Another week has passed, and here we want to get the best pieces of content you found during the week!

It really can be anything:

- videos
- posts
- tweets
- books
- motivation
- etc.

Share anything that added value to your journey and could add value to other people's journey.

So, what is the best piece of content you found this week?
How to use Realtime Functionality in Supabase Postgress Database
Tags: supabase, nextjs, database
Published: 2022-06-03 09:25:32


WELCOME 👋 friends to this new blog post. In this blog post, you will learn how to fetch data or get alerted whenever a row is inserted, updated, and deleted in the supabase Postgres database with the help of a supabase subscription, 😁Pretty easy to setup.

### 🤔When to use it?

Suppose, I gave you a project of making a real-time chat app with supabase. Then you need to fetch data whenever a new chat is inserted, deleted, or updated.

First, you need to go to the supabase database settings:

![](https://cdn-images-1.medium.com/max/3840/1*wCayGy1HL4rXrjzP1ALeRw.jpeg)

![](https://cdn-images-1.medium.com/max/3840/1*3Su6HUMVVZbULCzzLY_6jA.png)

**Note: **I have selected my tables, the table settings would be different from yours.

👀Note: The tables which are enabled by clicking the green button will be able to make real-time data fetching.
{% gist https://gist.github.com/studywithdesign/ef9c1e1b3759f62515545ecb31117b0d.js %}
**on 👆 **can have three 4 types:

 1. INSERT — Listening to the table if any new row is inserted

 2. UPDATE— Listening to table if any row is updated

 3. DELETE— Listening to table if any row is deleted

 4. * — Listening to the table for all the above changes.

you will get a response something like this:

![](https://cdn-images-1.medium.com/max/3840/1*uhsBB7qQlFRgZl-DzGLPSw.jpeg)

For People who understand Hindi: [https://youtu.be/ECIfs9bb7OA](https://youtu.be/ECIfs9bb7OA)

Thanks for reading, if any error comes, feel free to ask here 👇: 
[**Join the Next Dev's server Discord Server!**](https://discord.gg/hN4Wc5VR4M)
Newbie developer says hi
Published: 2022-06-03 09:11:16

Hi everyone! I started this journey months ago, but it started to be official when I joined a Fullstack Dev. bootcamp in April 💻 🥑


![Phoebe and Rachel (Friends) jumping happily](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/978ge7vyr520ss9gr330.gif)


First of all, I would like to tell you about me, my background and my performance in diverse fields for the last years. 

If I have to choose some adjectives to describe myself, I would say I'm a cheerful and curious. I am 30 and I have been learning for the last 30 years of my life, I studied different degrees, I learnt two languages and tried other four (like Arabic, Italian, Japanese), I have learnt about marketing, design, economics, art, music... I love writing, reading, singing and writing my own songs. My favourite activity is creating new projects and picturing new ideas. If I were asked which is my profession, I would say I'm a teacher. I have been teaching English and Spanish since 2012, I am also a History and Geography teacher since 2019. Teaching, leading a lesson and looking for / creating innovative ways to explain and work concepts is one of the activities I enjoy the most.

The main point of these lines isn't showing off_- personally, I don't believe in that stupid modern habit of listing one's certifications or titles as a definition of themselves; from my point of view, a bunch of papers say nothing about how a person is or acts-_ but picturing a whole image of how I am and how I perform in life. There are not many things I wouldn't like to try in life, there are very few experiences I wouldn't add to my list. 

In Spanish, they would say that I am a "culo de mal asiento". This would mean something like "bad seating butt". 


![Crazy goat jumping from one place to another](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/orjsaatrrmts5qoprzme.gif)


However, this vision of life does not fit in what I think life should be. The purpose of human lives can't be choosing just one path to follow until death; choosing a routine, a place, a profession, a group of people, the same holiday package as the rest of the (first) world, the same system to earn money, the same structure "marriage+house+children+retirement". I just can't, even if I tried, because I need to be doing different things in my life, daily. 


![Girl nodding and moving her finger to say NOPE](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enrce6k290mx1ap3rxtd.gif)


So one of the fields I have been more interested in was web development: the fact of being able to create by myself any digital product, design or platform which allowed me to launch and boost my own projects makes me happy and motivated enough to master new programming languages, toolkits and any feature that could make my professional way more interesting.

Soy HELL0 W0RLD, I'm a fem coder who's gonna nail it! 


![Little girl celebrating she nailed it](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12q95h5xkyjrvjxfi3yz.gif)
Remove K Digits
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 09:00:43

Given string num representing a non-negative integer `num`, and an integer `k`, return _the smallest possible integer after removing_ `k` _digits from_ `num`.

**Example 1:**

**Input:** num = "1432219", k = 3
**Output:** "1219"
**Explanation:** Remove the three digits 4, 3, and 2 to form the new number 1219 which is the smallest.

**Example 2:**

**Input:** num = "10200", k = 1
**Output:** "200"
**Explanation:** Remove the leading 1 and the number is 200. Note that the output must not contain leading zeroes.

**Example 3:**

**Input:** num = "10", k = 2
**Output:** "0"
**Explanation:** Remove all the digits from the number and it is left with nothing which is 0.

**Constraints:**

*   `1 <= k <= num.length <= 105`
*   `num` consists of only digits.
*   `num` does not have any leading zeros except for the zero itself.

**SOLUTION:**

    class Solution:
        def removeKdigits(self, num: str, k: int) -> str:
            n = len(num)
            if n == k:
                return "0"
            stack = []
            for i in range(n):
                if len(stack) == 0:
                    stack.append(num[i])
                else:
                    while len(stack) > 0 and int(num[i]) < int(stack[-1]) and len(stack) >= i - k + 1:
                        stack.pop()
                    if len(stack) == 0 or len(stack) < n - k:
                        stack.append(num[i])
            return str(int("".join(stack)))
Longest Palindromic Substring
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 08:30:37

Given a string `s`, return _the longest palindromic substring_ in `s`.

**Example 1:**

**Input:** s = "babad"
**Output:** "bab"
**Explanation:** "aba" is also a valid answer.

**Example 2:**

**Input:** s = "cbbd"
**Output:** "bb"

**Constraints:**

*   `1 <= s.length <= 1000`
*   `s` consist of only digits and English letters.

**SOLUTION:**

    class Solution:
        def strech(self, s, i, j, n):
            l = 0
            while i - l >= 0 and j + l < n and s[i - l] == s[j + l]:
                l += 1
            l -= 1
            return (i - l, j + l)
        
        def longestPalindrome(self, s) -> str:
            n = len(s)
            mx, my = 0, 0
            for i in range(n - 1):
                for a, b in [(i, i), (i, i + 1)]:
                    x, y = self.strech(s, a, b, n)
                    if y - x > my - mx:
                        mx, my = x, y
            return s[mx:my+1]
Discuss: As a developer would you rather be a specialist or a generalist?
Tags: webdev, discuss, css, html
Published: 2022-06-03 08:24:46

Hello Everyone,

So I have been wanting to ask which is better, being a generalist developer or a specialist developer?

As a developer, would you rather be a generalist, someone who knows a lot about different types of software and can use them to get the job done? or a specialist, someone who specializes in a certain kind of software?

What do you guys think?

Also, I would appreciate it if yáll joined my online developer community on Twitter to share your articles, ask questions and share the different stuff you are learning. Here is the [link](https://twitter.com/i/communities/1532313139810906114)