Thursday 6 October 2016

Webhooks Vs WebSockets


WebSockets Can be used to exchange event notifications but it requires a constact network connection . Signalr is best example of Websockets that can be used within an Asp.net application

Whereas WebHooks are for event notification across other web applications and other external services. It is similar to b2b communication.

Example 
You can receive a WebHook when someone sends you money to your PayPal account. PayPal fires off a POST request to your predefined URL handler and then your app does something with that notification. You pre-configure everything on the PayPal side first. You also set up an application to handle the incoming POST request. The event notification is "pushed" to you in (near) real-time. No need to hold open a network connection while waiting for events.

The two can be complementary. For example, when you receive the WebHook from PayPal, you can notify a logged in user on your webapp (using SignalR/WebSockets) that money has been received successfully.

We Will Be Updating Articles With More Information Soon .....

What are Webhooks and Webhooks vs WebAPI ?


 If you ever used API’s then you know they follow request - response mechanism . Every Request is followed by a Relevant API Response

Example 1 -  if we need to fetch our emails we will make a Reques to API with required credentials like Emailid, MessageCount and userid and API will give our Emails in Response to Source From where Request Came

Whereas As Webhooks works little different Sometime they are Called as 'Reverse APIs' Webhooks Skips this request part there is no need to give any request to them they are set to give you response data without knocking them

Best example will be Notification System Used by several Applications Like - Twilio, Dropbox for Giving Notifications to your System
Webhooks don’t require a request to be sent to give response they are set and programmed to provide details , messages , Notifications whenever available

Example 2
You can receive a WebHook when someone sends you money to your PayPal account. PayPal fires off a POST request to your predefined URL handler and then your app does something with that notification. You pre-configure everything on the PayPal side first. You also set up an application to handle the incoming POST request. The event notification is "pushed" to you in (near) real-time. No need to hold open a network connection while waiting for events.

For Using webhook, you need to register with the company providing the service by providing URL that will be your website url. That URL is a place in your application that will receive the data from that webhooks such notification messages and do something with it such as saving them to db and notifying to user . In some cases, you can tell the provider the situations when you’d like to receive data. Whenever there’s something new, the webhook will send it to your URL.

we will continue to Adding More details to Post Soon ....

What are Webhooks and Webhooks vs WebAPI ?


 If you ever used API’s then you know they follow request - response mechanism . Every Request is followed by a Relevant API Response

Example 1 -  if we need to fetch our emails we will make a Reques to API with required credentials like Emailid, MessageCount and userid and API will give our Emails in Response to Source From where Request Came

Whereas As Webhooks works little different Sometime they are Called as 'Reverse APIs' Webhooks Skips this request part there is no need to give any request to them they are set to give you response data without knocking them

Best example will be Notification System Used by several Applications Like - Twilio, Dropbox for Giving Notifications to your System
Webhooks don’t require a request to be sent to give response they are set and programmed to provide details , messages , Notifications whenever available

Example 2
You can receive a WebHook when someone sends you money to your PayPal account. PayPal fires off a POST request to your predefined URL handler and then your app does something with that notification. You pre-configure everything on the PayPal side first. You also set up an application to handle the incoming POST request. The event notification is "pushed" to you in (near) real-time. No need to hold open a network connection while waiting for events.

For Using webhook, you need to register with the company providing the service by providing URL that will be your website url. That URL is a place in your application that will receive the data from that webhooks such notification messages and do something with it such as saving them to db and notifying to user . In some cases, you can tell the provider the situations when you’d like to receive data. Whenever there’s something new, the webhook will send it to your URL.

I will continue to Adding More details to Post Soon ....

Tuesday 4 October 2016

Gitless version control system


Gitless is an experimental version control system built on top of Git. Many people complain that Git is hard to use. We think the problem lies deeper than the user interface, in the concepts underlying Git. Gitless is an experiment to see what happens if you put a simple veneer on an app that changes the underlying concepts. Because Gitless is implemented on top of Git (could be considered what Git pros call a "porcelain" of Git), you can always fall back on Git. And of course your coworkers you share a repo with need never know that you're not a Git aficionado.

Gitless Set of Commands

  • gl init - create an empty repo or create one from an existing remote repo
  • gl status - show status of the repo
  • gl track - start tracking changes to files
  • gl untrack - stop tracking changes to files
  • gl diff - show changes to files
  • gl commit - record changes in the local repo
  • gl checkout - checkout committed versions of files
  • gl history - show commit history
  • gl branch - list, create, edit or delete branches
  • gl switch - switch branches
  • gl tag - list, create, or delete tags
  • gl merge - merge the divergent changes of one branch onto another
  • gl fuse - fuse the divergent changes of one branch onto another
  • gl resolve - mark files with conflicts as resolved
  • gl publish - publish commits upstream
  • gl remote - list, create, edit or delete remote

Creating a Repository

Say you are in directory foo and you want turn it into a repository. You do this with thegl init command. This transforms the current working directory into an empty repository and you are now ready to start saving changes to files in foo:
$ mkdir foo
$ cd foo/
$ gl init
✔ Local repo created in /MyFiles/foo
In most cases there's already some existing repository you want to work on instead of starting with an empty repository. To make a local clone of a remote repository you can pass the URL of the repository as input to the same gl init command:
$ mkdir experiment $ cd experiment/ $ gl init https://github.com/spderosso/experiment ✔ Local repo created in /MyFiles/foo ✔ Initialized from remote https://github.com/spderosso/experiment
Complete Documentation Guidehttp://gitless.com/#documentation
Gitless Vs Githttp://gitless.com/#vs

Git Cheatsheet



Git is the open source distributed version control system that allows to perform GitHub activities on your desktop. This cheat sheet summarizes commonly used Git command line instructions for quick reference.

Git cheat list

  • list last 20 hashes in reverse
    git log -n 20 --reverse --format="%h %ae %s" --abbrev-commit
    
  • try a new output for diffing
    git diff --compaction-heuristic ...
             --color-words ...
    
  • enable more thorough comparison
    git config --global diff.algorithm patience
    
  • restoring a file from a certain commit relative to the latest
    git checkout HEAD~<NUMBER> -- <RELATIVE_PATH_TO_FILE>
    
  • restoring a file from a certain commit relative to the given commit
    git checkout <COMMIT_HASH>~<NUMBER> -- <RELATIVE_PATH_TO_FILE>
    
  • restoring a file from a certain commit
    git checkout <COMMIT_HASH> -- <RELATIVE_PATH_TO_FILE>
    
  • creating a diff file from unstaged changes for a specific folder
    git diff -- <RELATIVE_PATH_TO_FOLDER> changes.diff
    
  • applying a diff file
    • go to the root directory of your repository
    • run:  git apply changes.diff 
  • show differences between last commit and currrent changes:
    git difftool -d
    
  • referring to:
    • last commits ... HEAD~1 ...
    • last 3 commits ... HEAD~3 ...
  • show the history of changes of a file
    git log -p -- ./Scripts/Libs/select2.js
    
  • ignoring whitespaces
    git rebase --ignore-whitespace <BRANCH_NAME>
    
  • pulling for fast-forward only (eliminating a chance for unintended merging)
    git pull --ff-only
    
  • list of all tags
    git fetch
    git tag -l
    
  • archive a branch using tags
    git tag <TAG_NAME> <BRANCH_NAME>
    git push origin --tags
    
    you can delete your branch now
  • get a tagged branch
    git checkout -b <BRANCH_NAME> <TAG_NAME>
    
  • list of all branches that haven't been merged to master
    git branch --no-merge master
    
  • enable more elaborate diff algorithm by default
    git config --global diff.algorithm histogram
    
  • list of all developers
    git shortlog -s -n -e
    
  • display graph of branches
    git log --decorate --graph --all --date=relative
    
    or
    git log --decorate --graph --all --oneline 
    
  • remembering the password
    git config --global credential.helper store
    git fetch
    
    the first command tells git to remember the credentials that you are going to provide for the second command
  • path to the global config
    C:\Users\Bykov\.gitconfig
    
  • example of a global config
    [user]
       email = *****
       name = Aleksey Bykov
       password = *****
    [merge]
       tool = p4merge
    [mergetool "p4merge"]
       cmd = p4merge.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
       path = \"C:/Program Files/Perforce\"
       trustExitCode = false
    [push]
       default = simple
    [diff]
       tool = meld
       compactionHeuristic = true
    [difftool "p4merge"]
       cmd = p4merge.exe \"$LOCAL\" \"$REMOTE\"
       path = C:/Program Files/Perforce/p4merge.exe
    [difftool "meld"]
       cmd = \"C:/Program Files (x86)/Meld/Meld.exe\" \"$LOCAL\" \"$REMOTE\"
       path = C:/Program Files (x86)/Meld/Meld.exe
    
  • viewing differences between current and other branch
    git difftool -d BRANCH_NAME
    
  • viewing differences between current and stash
    git difftool -d stash
    
  • viewing differences between several commits in a diff tool
    git difftool -d HEAD@{2}...HEAD@{0}
    
  • view all global settings
    git config --global -l
    
  • delete tag
    git tag -d my-tag
    git push origin :refs/tags/my-tag
    
  • pushing tags
    git push --tags
    
  • checking the history of a file or a folder
    git log -- <FILE_OR_FOLDER>
    
  • disabling the scroller
    git --no-pager <...>
    
  • who pushed last which branch
    git for-each-ref --format="%(committerdate) %09 %(refname) %09 %(authorname)"
    
  • deleting remote branch
    git push origin :<BRANCH_NAME>
    
  • deleting remote branch localy
    git branch -r -D <BRANCH_NAME>
    
    or to sync with the remote
    git fetch --all --prune
    
  • deleting local branch
    git branch -d <BRANCH_NAME>
    
  • list actual remote branchs
    git ls-remote --heads origin
    
  • list all remote (fetched) branches
    git branch -r
    
  • list all local branches
    git branch -l
    
  • find to which branch a given commit belongs
    git branch --contains <COMMIT>
    
  • updating from a forked repository
    git remote add upstream https://github.com/Microsoft/TypeScript.git
    git fetch upstream
    git rebase upstream/master

References :

https://services.github.com/kit/downloads/github-git-cheat-sheet.pdf