Posts

Issue with Pushing Code after Merging Changes from Multiple Branches

I have a branch feature-branch and feature-branch-new-for-merging. I have made clone from feature-branch and take the pull from feature-branch-new-for-merging and made changes and when I'm pushing the code. I’m receiving this: hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.   Got it! If you’re trying to push and encountering this issue, it means your local branch is behind the remote, and Git won’t allow you to push without first integrating those remote changes. Here’s how to handle this safely: Option 1: Merge Remote Changes Locally, Then Push This is the safer option, as it integrates the remote updates without losing any local work. Fetch the latest changes from the remote: git fetch origin eight8 Merge the fetched changes into your local bran...

Last number of Range Theory for For Loops

 for i in range(n,0,-1):   It runs from n to 1. Because what I think is that the third argument of the for is by default 1 and if we pass something then it take that as an argument So, what I think is that the formula for last element of the loop is: lastElement = lastNumber - lastArgument for i in range(n): In this first number is by default 0 and last number is  lastElement = n - 1(By default it is 1) For reverse loops: lastElement = n - (-1)      = n + 1 So for above Straight Loop: Iterator will move from 1 to n-1 and for Reverse Loop: Iterator will move from n to 1

8 Patterns to solve 80% of LeetCode problems

 8 Patterns to solve 80% of LeetCode problems: 1. Sliding Window 2. Subset Pattern 3. Modified Binary Search 4. Top K Elements 5. Binary Tree DFS 6. Topological Sort 7. Binary Tree BFS 8. Two Pointers

How to merge branches when you see "merge locally" in Git

Image
How to merge branches when you see "merge locally" in Git When branches have issues on GUI while merging: Run following commands: 1. git checkout main_branch 2. git merge feature_branch 3. git rebase -- continue If git rebase have issues: git status git fetch origin git log main_branch -1 git rebase --abort git rebase origin/main_branch git add . git rebase --continue

XAMPP's Apache not starting in mac

Image
This is what helped me: sudo apachectl stop  This command killed Apache server that was pre-installed on MAC OS X.  

How to work with MySQL client package in MacBook

Image
  On installing mysqlclient package you may face the following issue: Collecting mysqlclient==2.2.0 (from -r requirements.txt (line 14))   Using cached mysqlclient-2.2.0.tar.gz (89 kB)   Installing build dependencies ... done   Getting requirements to build wheel ... error   error: subprocess-exited-with-error      × Getting requirements to build wheel did not run successfully.   │ exit code: 1         File "<string>", line 154, in <module>         File "<string>", line 48, in get_config_posix         File "<string>", line 27, in find_package_name       Exception: Can not find valid pkg-config name.       Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually       [end of output]      note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-...

How to center a div in modal?

Image
  Before applying the code                                                                 After applying the code                                    Use the below code to center a div in modal                       text-align : -webkit-center;                       margin-left : 10px ; This will make your div center in modal in all the screens whether it is a small size screen of  640px or it is a large size of 1940px