Hi Guys !!! Hope all is well
I am going to list down some famous Python trick for dealing with String.
Below is the example code(written in VS code IDE). You can also check my github page
https://github.com/Saurabh-12/Python_Learning
Happy Coding Discussion on Android Framework(Generic and MultiMedia), Java, JNI, C++ and Python related topic
Hi Guys !!! Hope all is well
I am going to list down some famous Python trick for dealing with String.
Below is the example code(written in VS code IDE). You can also check my github page
https://github.com/Saurabh-12/Python_Learning
Hi Guys !!! Hope all is well
I am going to list down some famous Python one liner code example.
1. Swap two variables# List creationlist_1 = [('Hi '+ y) for y in ['sks', 'mks','pks']]print(list_1) #>> ['Hi sks', 'Hi mks', 'Hi pks']
l = list(map(int, ['1', '2', '3']))print(l) #>> [1, 2, 3]
squares = { x**2 for x in range(6) if x < 4 }print(squares) #>> {0, 1, 4, 9}
phrase = 'deleveled'isPalindrome = phrase == phrase[::-1]print(isPalindrome) #>> true
Hi Guys !!! Hope all is well
I am going to list down five very handy tools to use in Android development.
Scrcpy
https://saurabhsharma123k.blogspot.com/2020/05/vysor-alternative-app-scrcpy.html
This easy-to-install, lightweight and speedy application uses your Android device’s already established USB connection to mirror its screen on your desktop.uiautomatorviewer
binary and tap on this icon:Hi Guys !!! Hope all is well
Git Status
git status
git status -- short
Manipulate the Changes
git add file_name >> adds the file file to the stage section
git restore file_name >> discards changes to the file
git restore --staged file_name >> removes the file from the stage section
Inspecting the diffs
git diff . >> displays the not-staged changes in your working tree
git diff --staged >> displays the staged changes
git diff dev >> displays changes between the working tree and the dev branch.
You might use a commit hash or tag instead.
git diff master..dev >>displays changes between the branches master and dev
Committing
git commit -m 'Commit message'
git config --global core.editor your-editor-executable-path
git commit --amend
Using git commit --amend you can either change the last commit message or
you can add an additional change to the last commit. If you want to push your changes,
though, you have to use git push -f in either case
Switch
The switch command can be used to switch between branches.
git switch branch-name >> switches to a branch-name branch
git switch -b abc >> creates branch abc and switches to it
git switch - >> switches you to the previous branch
Checkout
git checkout [branch_name] >> works as a switch but can also move HEAD to any commit/tag as well.
So, when switching to the previous branch you just need to write
git checkout -
Switching back and forth different branches means, you only have to write
git checkout -
Branches
git branch >>> returns a list of the local branches.
Use -r to list only remote branches or -a to get them all
git branch abc >>> creates abc branch
git branch -d abc >>> deletes abc if already merged.
If not, use -D to force deletion.
Log Results
git log >>> to see the commits’ history.
git log -p >>>Display the changes alongside the commit description:
git log -2 >>> display two recent commits
git log branch-name >>>Display log for a specific branch/revision:
Filter log for a specific file(s) only (glob pattern applies here):
git log *.js # or git log branch-name:*.js
Filter commits by the author (accepts partial name):
git log --author saurabh
Filter by date:
git log --since 2019-10-01
Filter by date using dynamic date ranges (days, weeks, months, years):
git log --since 2months --until 1week
git add missed-file.txt
git commit --amend
git reset /assets/img/misty-and-pepper.jpg
If you have gone as far as committing that change, no need to worry.
You just need to run an extra step before:
git reset --soft HEAD~1
git reset /assets/img/misty-and-pepper.jpg
rm /assets/img/misty-and-pepper.jpg
git commit
git reflog
git branch -m feature-brunch feature-branch
If you have already pushed this branch, there are a couple of extra steps required.
We need to delete the old branch from the remote and push up the new one:
git push origin --delete feature-brunch
git push origin feature-branch
Merging is a common practice for developers using version control systems.
Whether branches are created for testing, bug fixes, or other reasons, merging commits changes to another location.
To be more specific, merging takes the contents of a source branch and integrates them with a target branch.
In this process, only the target branch is changed. The source branch history remains the same.
Merge the master branch into the feature branch using the checkout and merge commands.
$ git checkout feature
$ git merge master
(or)
$ git merge master feature
This will create a new “Merge commit” in the feature branch that holds the history of both branches.
Rebase is another way to integrate changes from one branch to another
Rebase compresses all the changes into a single “patch.”
Then it integrates the patch onto the target branch
Unlike merging, rebasing flattens the history because it transfers the completed work from one branch
to another. In the process, unwanted history is eliminated.
Rebase the feature branch onto the master branch using the following commands.
$ git checkout feature
$ git rebase master
This moves the entire feature branch on top of the master branch. It does this by re-writing the project
history by creating brand new commits for each commit in the original (feature) branch.
This allows altering the commits as they are moved to the new branch.
This is more powerful than automated rebase, as it offers complete control over the branch’s commit history.
Typically this is used to clean up a messy history before merging a feature branch into master.
$ git checkout feature
$ git rebase -i master
This will open the editor by listing all the commits that are about to be moved.
pick 22d6d7c Commit message#1
pick 44e8a9b Commit message#2
pick 79f1d2h Commit message#3
This defines exactly what the branch will look like after the rebase is performed.
By re-ordering the entities, you can make the history look like whatever you want.
For example, you can use commands like fixup, squash, edit etc, in place of pick.
git log --online --graph
git log --online --graph -5 // SHOW only 5 most recent commits
Hi Guys!!!Hope you are doing well !!!. Today I will describe how you can write a custom kernel module(Hello world) for Android and load it a...