Thursday, September 18, 2014

Create new login like "sa" in sql server management studio

a)      Open you sql server management studio
b)      Connect using Window authentication

c)    Right click on “security - > New - >Login..” as shown in below figure


        d)      This will open up with a new popup as shown below:
1)      Enter Login name
2)      Check second radio button “SQL Server authentication
3)      Select the Default Database from the dropdown shown bottom of the page.
4)      Click Ok




      e)      Select “User Mapping” from the left menu and select the database for which you are creating new login
And then select the role membership I selected “Db_owner” in my case

f)     Next Step is “Status” from the left menu and enabling the account as shown in the figure

g)    The Final Step is restarting the SQL server instance by right clicking on instance name and restart


h) That's is. You are done with creating new login. Open New Instance and login using new credentials.

Some basic commands of GIT

I started learning git and using git in my current project so sharing few git command that are very basic everyone,

You can enjoy learning git commands:

a) For add a file:
            git add -A
b) For Commit:
 git commit –a –m “Comment”
c) For Push:
                Git push origin csn-4973
d) Merge Tool:
                Git mergetool –y
e) For Update:
       Go to Parent Branch :
git checkout ParentBranchName
git fetch
git reset – hard origin/ParentBranchName
f) Goto Child branch
                Git checkout ChildBranchName
                Git fetch
                Git reset – hard origin/ChildBranchName
g) Merge Command
                Git merge ParentBranchName (Parent Branch: This will down merge parent branch changes to child)

h) Pull command:
Git pull origin ParentBranchName

i) Revert Of Revert :
Git checkout prod-child-branch
Git pull origin ccid-42
Git revert SHA-CODE
Git Reset HEAD
Git push origin prod-10892
j) Save Local Changes to STASH:
             Git stash “Comment”
k) To Get All Stash changes:

             Git Stash apply


Happy Coding!!!!

Thanks ..

Tuesday, September 2, 2014

Git command to check the difference of local and remote server

When you start using Git, you will require to learn git commands as soon as possible and this is the command which you will be using most of the time to check the changes made to your local directory and this command will show you the new added files to repository

git Status

Happy Coding!!!

Monday, September 1, 2014

Disable Enter key using javascript code

Here is the function to disable Enter keys using javascript code,  you have to paste this code and call this javascript method from your window onload method or using Jquery ready methods:


function DisableEnterKey(e) {
    var key;

    if (!e) {
        e = window.event;
    }

    if (e.keyCode) {
        key = e.keyCode;
    }
    else {
        key = e.which;
    }

    return (key != 13);
}


Happy Coding :) !!

Set focus on first visible element using Javascript

Here is the Javascript code, you can use to set the focus of cursor on first visible element of the page.


function SetDefaultFocus()
{
    try
    {
        //loop will work for each form on the page
        for (f=0; f < document.forms.length; f++)
        {
           // for each element in each form
            for(i=0; i < document.forms[f].length; i++)
            {
              // if it's not a hidden element and it's not disabled
              if (document.forms[f][i].type != "hidden" && document.forms[f][i].disabled != true)
              {    
                    document.forms[f][i].focus();
                    return;
              }    
            }//eof sub-for  
        }//eof main for
    }
    catch(e)
    {
     
    }
}

Only you have to call this method on window onload or in jquery ready methods, This will automatically set the focus to that position.

Happy Coding!!