Friday, October 23, 2015

Mind Refreshing Puzzle - A boy goes to his grand parents house.


Mind Refreshing Puzzle - A boy goes to his grand parents house.

A boy goes to his grand parents house. There he either does   yoga in the morning / plays tennis in the evening / does neither. 


However he does not do both on the same day. 

We know that 22 days he did either 1 activity. 

24 mornings he did nothing. 

12 evenings he did nothing. 

How many min days did he stay there to have done this? 



Answer

We get three equations: 

1. Yoga + Tennis =22 
2. Tennis + Nothing=24 
3. Yoga + Nothing = 12 

We are able to conclude: Yoga = 5, Tennis = 17, Nothing =7. 

Hence the min days: 5+17+7=29 days

Wednesday, April 22, 2015

Git - Delete a branch from local OR remote


Delete a branch from local OR remote


To remove a local branch from your machine:
git branch -d the_local_branch
To remove a remote branch from the server:
git push origin :the_remote_branch

Sunday, October 26, 2014

Throw 500 internal errors on browser.

Hi Readers,

You need to replace your http error tag in web.config file with the following line


<httpErrors errorMode="Detailed" existingResponse="PassThrough">



This line will help IIS to throw the error on browser instead of showing custom page.

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 :) !!