Category Archives: SSO

Crash Course – Tutorial – Learn – GIT

I have read many Articles/Manuals of git on Internet and think all the articles are messy. No body tried to explain, how to use it just have given the commands and their article is complete. So, today I am here describing my experience about Git and provide the real using of Git and how to do the things.

What is Git?

Most of the persons know what is Git but for those who doesn’t know let me explain them. In software development, Git is a distributed version/revision control and source code management (SCM) system with an emphasis on speed.

What do you mean by revision/Source Code Management system

The software development is very laborious work and to maintain the backup/Management of Source Code is a very critical thing. Let me go through an Example to understand version more easily.
Example:
A client comes to you and told you write certain code for certain project and do have done it easily, as there is no problem upto this stage. You write the Code and optimized it and given to the client.
Now, after sometime the same client comes to you and told you to do certain improvement in the same package and you have done that very easily and have no problem in it.
Now, after the lapse of some large time the same client comes to you and tell you earlier project has that feature and want to implement it. Now, here is the problem, either you have to work again or if you have taken the backup then it is easy. Here we are interested in not taken backup situation. Now, if you have done the project through Version Control system the version system would take the necessary backup at different points and you can view it easily.

Advantage of using Source Code Management system

There are many advantages of using SCM but the important advantages of using SCM are:
  1. Backups: If you accidentally delete some file (or part of a file) you can undelete it. If you change something and want to undo it, the SCM can do so.
  2. Portability:SCM are designed to help to solve the problem of Portability to your code between different computers. You do not need to bother if you always copied the newest version; the SCM will do that for you.
  3. Branching/Debuggin:Say you have developed the project as there are many things involved in it. As such Designing, Security, DBMS etc. things and now if you want to fix come thing in particular branch then you open the branch and debugging or up-gradation would start immediately rather than to see the full code again where the particular branch starts and where it ends.
  4. Simultaneously Working:Say you have developing the project as there are many things involved in it. As such you create the branches of the project and distribute them to different developers and those developers can work simultaneously without interfering with another developer work and each would be having its own new code and master branch with all working simultaneously.
  5. Cross Platform Working:This the piratical advantage that if one developer is familiar with working with one type of system and another in another type the SCM system make the both codes merged and cross-platform development would be easy development as both developers can know that things are required by other. The best example is open source projects such as Apache, MySQL, PHP and many more, which run on the cross-platform.

Does Git is the only SCM and what about cross platform running

No, Git is not only SCM available, there are many others available and that to run on cross-platform but there are certain advantages which makes Git a little superior to others. Other popular SCM are CVS, Sub-Version, Mercurial, Bazaar, Perforce and Team Foundation Server. There are many available but the TOP three are Git, CVS, Subversion. To know why Git is better than others we would have to look on the others SCM and know what are the advantages we are getting.
  1. Git allows your to work offline, with others it is not possible. Even a simple log command cribs for the server.
  2. With the philosophy of Git branching, checkout, tagging is a flash. SVN is good with branching and tagging but with checkout it is slow(goes to the server for each file).
  3. Git being content addressable, can be checked for inconsistencies(CVS had corruption).
  4. There are great workflows which suite them completely and have been worked out great with Git, here.
  5. With facilities like interactive rebasing and interactive add, stashing etc, you do not need to make bulk commits or create un-necessary branches for each bug/feature.
  6. Git is blazing fast with cloning too — it packers files and hence the transfer achieves connection speeds. With SVN and CVS there is no such tarring which makes it inherently slow over the wire.
  7. Non-significant but git metadata is almost half that of CVS and SVN and there have been better reported results with Mozilla’s transition of SVN->GIT.

Important terminology – GIT

One must understand, the terms used by git manual or used in other blogs and website and without understand them, we can’t learn using Git. The important terminology used by Git are:
  1. Repository: The purpose of Git is to manage a project, or a set of files, as they change over time. Git stores this information in a data structure called a repository. The Git repository is stored in the same directory as the project itself, in a subdirectory called .git. A git repository contains, among other things, the following:
    1. A set of files and directories
    2. A set of commit objects (i.e. the finalized code or different stages of backup of code or upgrading of code)
    3. Historical record of changes in the repository. A set of references to commit objects, called heads
  2. Branches: A branch is a separate code line with its own history. You can create a new branch from an existing one and change the code independently from other branches. One of the branches is the default (normally named master). The user selects a branch and works in this selected branch, which is called the “working copy”. Selecting a branch is called “checkout a branch”.
    Example: Say you are working on a paper. You’ve gotten a first draft out, submitted for review. You then get a new batch of data, and you’re in the process of integrating it into the paper. Halfway in, however, the review committee calls you up and tells you that you need to change some of your section headings to conform to format specifications. What do you do?
    Obviously you don’t want to send them your half-baked revisions with corrected headings. What you want to do is jump back to the version you sent out, change the headings on that version, and send off that copy, all the while keeping your recent work safely stored somewhere else.

    This is the idea behind branching, and Git makes it easy to do.

  3. Tagging: Git has the ability to ‘tag’ specific points in history as being important/milestone achieved – generally people use this to mark release points (‘version 1.0’, etc). There are two types of tags available in Git are:
    1. Lightweight: Lightweight tags are very much like branches that don’t change – it’s just a pointer to a specific commit.
    2. Annotated: Annotated tags, however, are stored as full objects in the Git database. They are checksum, contain the taggers name, email and date, have a tagging message and can be GPG signed and verified.
    It’s generally recommended to create annotated tags so you can have all this information, but if you want a temporary tag or for some reason don’t want to keep that other information, lightweight tags are available too.
  4. Commit: Committing is a relatively straight forward process that adds your changes to the history of your repository and assigns a commit this name to it. The change is not sent to a central repository, though. Other people can pull the change from you, or you can push the change to some other repository, but there’s no automatic updating. You can use commit in multiple ways to commit changes to your repository, but every commit requires a log message. You can add a message by adding -m “your message”. The message can be any valid string. You can also specify multiple paragraphs by passing multiple -m options to git commit.
  5. Revision: Represents a version of the source code. Git identifies revisions with SHA1 ids. SHA1 ids are 160 bits long and are represented in hexadecimal. The latest version can be addressed via “HEAD”, the version before that via “HEAD~1” and so on.
  6. HEAD: is used by your repository to define what is currently checked out:
    1. If you checkout a branch, HEAD symbolically refers to that branch, indicating that the branch name should be updated after the next commit operation.
    2. If you checkout a specific commit, HEAD refers to that commit only. This is referred to as a detached HEAD, and occurs, for example, if you check out a tag name.
Those who doesn’t like GUI or want to learn Command line operation the list of important commands is very necessary to learn are:

Important GIT Command

GIT Command Name Command Description
Add Add is used for adding the contents of the file to index.
bisect If any bug is created after update then the command is used to find the changes that introduced a bug in project.
branch branch command is used to create, view, list or delete the branches
checkout Checkout is used for switching between branches
clone clone means duplicate, in git it is used to duplicate the project at different location
commit commit is update the changes to index, note it doesn’t update the remote repository
diff To view the changes between two commits
fetch If you want to use the objects from different project then fetch is used to fetch the particular tag or branch
init create a empty git repository or re-initialize the an existing one
log It is used to show the message sent with commits
merge it is used to join two or more histories
pull pull is the important command used to fetch in case of multiple developers doing work on same project. It fetch from and merge with another repository or local branch
push after commit the project push is required to update the remote project.
rebase In case you deleted the file and wanted it again rebase is used to Forward-port local commits to updated upstream head
reset Moving the head to specified commit or state.
show used to view the different types of objects used in a project
status An important command to view the current status of branch either the code is edited by some body locally or not and if yes then in which files.
tag Tag is used to create, delete, list or verify the tag with GPG

Perquisites to understand GIT

The only thing required for Git is the software git installation, as users from Linux are much know about GIT and I don’t talk about Linux system. My target is for Windows and on Windows Git Can be installed by two ways: i) Either Install Cygwin/Migwin on the system first and then install/download the program through cygwin, ii) installing MSysGit.
I have not used Mac/Embedded systems or other systems and thus my personal interest in Windows and using the Open Source Tools and using GCC for development with cross-platform.
I personally like the second way, as installing the cygwin will be time-consuming and to understand cygwin one has to learn the command line commands and in second option download the simple package and install it and start working with GUI or command line as choice is yours. MSysGit can be downloaded here
I am going to talk about the Remote Git and using Git Locally and update the code Remote and also side by development and distribution with many developers maintaining the code. So, search about free git providers and signup and install GIT locally and generate the SSH key and upload the Key at website, so that you can easily update the code. At this point I am presuming that you have installed the Git and signed up a free/paid Git Provider and also setup the SSH key to update the key generated through your system.
Note: For downloading the SSH Key is not required the SSH Key is only required to update the source code to confirm the developer only update the source code and not by any person.

Creating the First Project on Remote Server

On Git registered website create a new Repositories with any name you like but remember whatever name you give on downloading the code through Git the project name is changed to project folder Name. Since we are using the example and best would be Hello_World.
There are two ways download the Repositories to you system i.e. i) through GUI and ii) through Bash (i.e. command line). I will let you know both the things.
GUI: Click on Start => All program’s => Git => Git GUI. Select the clone option provided there and provide the url of your project created as source and destination as any local system location of your choice.
BASH: Select the folder or drive to use as destination and right lick mouse button and choose the option of git bash from list and in command line write git clone url (url means the project remote address) and press enter and it would ask your password and after that the folder with the name of your Repositories would be created and we have to work under this folder.

First Commit/First update of Project

Now create your project under the folder created by git, here I am creating hello world example as project but you can make any project of any language. The code of hello project is as under:
#include 				/* Including the standard i/o file */
int main(){					/* Starting the main program */
	printf("hello world!!");		/* If all the right print hello world */
	return 0;				/* returning 0 to end the program */
}
At any time during coding you think a stage is reached or the time has come to take the backup then do the following steps to take a backup. Go the folder of the project created by GIT and under that folder right-click on empty screen as both GUI and Bash required this step.
GUI: Select GIT GUI. It will open a new Window which will let you the changes made in project. Under un-stacked the list of files would be displayed on which the changes are made and on clicking any listed file would show the changes made by you and if the file is new then whole new file contents. Stack the changes you want to made by selecting files and press ^T and the files would move from un-staked to stacked changes provide the comment on the small text window, you can type any thing you like to give a note for the project or any other think and press commit button. Now, the changes are staked but the stacked are not sent to remote server and you can also edit the changes upto this step and the last step is to click on push and a new window would pop and again press push and after that your project is updated on the remote server too.
Bash: Select Git Bash for command line update tool, First of all check the “git status”, as it will let you know what files are changed. After you confirm the files are correctly show then issue a command of “git add file-name”. This would all the files as stack to commit, you can also supply multiple file names in “git add file-name file-name …..”. When you have added all the files and no changes are required in files then right “git commit -m ‘your message'”, git commit will make the staked changes to final stage and those changes the original files with recent committed files or stake the changes to the original files, -m is used to write a message as comment as you can provide the description about commit and the changes made by you on the project. It is one of the important thing to write and let you know what is done at the time of that commit. Now the last step to push the changes to the remote git by “git push”, this command make your local committed copy and remote copy sync, and when again somebody or you download the project the new updated copy would be provided.

Note

Git can work with the same workflow as Subversion, with a group of developers using a single repository for exchange of their work. The only change is that their changes aren’t submitted automatically but they have to push (however, you can set up a post-commit hook that will push for you every time you commit; that loses the flexibility to fix up a screwed commit, though). The developers must have either an entry in htaccess (for HTTP DAV) or a UNIX account (for SSH). You can restrict their shell account only to Git pushing/fetching by using the git-shell login shell. In the next article, I would tell you about more advanced features for development under many developers, merging the changes and to track bugs and many more things.
Tagged , , , , , , , , , , ,

Single Sign On

Every website is made for the purpose of collecting information about user and to provide the service to the user according to their needs. Presently there are about 15 billion website on the internet and they are growing daily. So, if you surf any website and want to get the information from website then you have to register with them and for registration you have to fill up the form. So, if you visit 100 website and want to have information then you have to register with 100 websites and fill 100 forms and remember 100 user names and 100 passwords. The management of passwords and user names is the headache for the user, how can a person remember 100 different user name and 100 different password. To help the users not to remember the 100 user-names and 100 passwords the service of Single Sign on (SSO) comes into existence. So, we can say that:

Single sign-on (SSO) session/user authentication process that permits a user to enter one name and password in order to access multiple applications. The process authenticates the user for all the applications they have been given rights to and eliminates further prompts when they switch applications during a particular session.

With the service of SSO a user doesn’t have to go through registration form and don’t have to remember the different user names and passwords. The SSO, is used by many on the websites, the numbers are growing regularly.

How, get the service of SSO?

SSO, service is provided by many websites, the user can use Google or Gmail, Yahoo, Hotmail, Facebook, Twitter etc., user names and passwords to access the website where SSO are implemented. Some of the popular website using SSO are stackexchange.com,  stackoverflow.com, sourceforge.net, openid.net, janrain.com etc website and with these website you don’t have fill the registration form, just let them know that you are SSO service provider and grant them the access to the information and you are registered with them.

How does developer uses to integrate the SSO service and that free of Cost?

The developer has to integrate the SSO service in their forms and that are

  1. OPENID
  2. OAUTH
  3. HYBRID

OpenID is an Open standard that describes how users can be Authenticated in a decentralized manner, obviating the need for services to provide their own ad hoc systems and allowing users to consolidate their `Digital identities’. The OpenID protocol does not rely on a central authority to authenticate a user’s identity. Moreover, neither services nor the OpenID standard may mandate a specific means by which to authenticate users, allowing for approaches ranging from the common (such as passwords) to the novel (such as Smart Cards or Biometrics). The term OpenID may also refer to an ID as specified in the OpenID standard;  these IDs take the form of a unique URL, and are managed by some ‘OpenID provider’ that handles authentication. What is your OPENID, if you are using one of the service of famous providers are:

Google.com – google.com/profiles/username
Yahoo.com – me.yahoo.com
AOL – openid.aol.com/screenname
Blogger – username.blogger.com or blogid.blogspot.com
Myopenid.com – username.myopenid.com
LiveJournal – username.livejournal.com
Wordpress – username.wordpress.com

There are many more, which can’t be provided here, to know the complete list kindly visit openid.net. This simply means if you are using any one of the service of above mentioned then you can login any website where Openid service has been accepted as login system.

OAuth (Open Authorization) is an Open Standard for Authorization. It allows users to share their private resources (e.g. photos, videos, contact lists) stored on one site with another site without having to hand out their credentials, typically username and password. OAuth allows users to hand out tokens instead of credentials to their data hosted by a given service provider. Each token grants access to a specific site (e.g. a video editing site) for specific resources (e.g. just videos from a specific album) and for a defined duration (e.g. the next 2 hours). This allows a user to grant a third-party site access to their information stored with another service provider, without sharing their access permissions or the full extent of their data. For more about implementation kindly visit oauth.net.

Hybrid – lets web developers combine a OpenID request with an OAuth authentication request. This extension is useful for web developers who use both OpenID and OAuth, particularly in that it simplifies the process for users by requesting their approval once instead of twice.

%d bloggers like this: