Thursday, 14 July 2016

Callback, Trigger and Event handler in javaScript

what callback, trigger and event handler in javaScript
Callback is a function that is passed to another function as parameter and callback function is called inside another function.
Example:
$("#MyButton").click(function(){
    $("p#hideDiv").hide("slow", function(){
        alert("function() is callback and called.");
    });
});

Here following are callback function.
function(){
        alert("function() is callback and called.");
    }



The trigger is code that is executed automatically on some events.
Example:
<script>
$(document).ready(function(){
    $("input").select(function(){
        $("input").after(" Text marked!");
    });
    $("button").click(function(){
        $("input").trigger("select");
    });
});
</script>
<input type="text" value="Hello World" />
<button>Click on this button</button>



Handler: An event handler executes a part of a code based on certain events occurring within the application such as onClick, onBlur, onLoad etc.
Example:
$(document).ready(function(){
    $("button").click(function(){
        $("input").trigger("select");
    });
});



Following are few more event handler
Event Description
onchange An HTML element has been changed
onclick The user clicks an HTML element
onmouseover The user moves the mouse over an HTML element
onmouseout The user moves the mouse away from an HTML element
onkeydown The user pushes a keyboard key
onload The browser has finished loading the page



Thursday, 30 June 2016

Top 10 SVN commands with Examples

Top 10 SVN commands with Examples

SVN Checkout
Checkout command is used to download sources from SVN repository to working directory. Syntax: svn checkout/co URL PATH
URL: Full URL of Repot
PATH: Path where you want to get the checkout
svn co http://repo.com/folder .



SVN List
Lists directory and files entries. Syntax: svn list
svn list


SVN Add
Add a new file to SVN repository. Syntax: svn add filename.php
svn add myfile.php
Need to commit
svn commit -m "Adding a myfile.php file" myfile.php


SVN Commit
Commit the file from local to Repo. Syntax: svn commit
svn commit -m "This is message"



SVN delete
Delete a new file From SVN repository. Syntax: svn delete filename.php
svn delete filename.php
Need to comit
svn commit -m "deleting a myfile.php file" myfile.php



SVN up
Upload all file to server. Syntax: svn up
Upload All files
svn up

Upload one file
svn up filename.php

Upload multiple file
svn up filename2.php, filename.php



SVN logs
View the svn log for single file Or mutiple file. View top 25 logs for all files
svn log

View top logs for filename.php
svn log filename.php

check the log for particular revision number
svn log -r 825




SVN Move
Rename or move a file from one directory to another. Syntax: svn move
svn move filename.php newFilename.php



SVN update
svn update command brings changes from the repository into your working copy.
Syntax: svn update
Get all updates
svn update

Get file update
svn update filename.php