Thursday, February 11, 2016

Difference between == and === with Example-JavaScript

This is one of the most frequently asked question in interview when one tries to judge your jQuery orJavaScript concepts.

JavaScript provides different types of operators. Here, we will be talking about strict equality andType converting equality.
Strict equality (===) means values which we are comparing must have the same type. 
This means "2" will not be equal to 2 ("2"===2 it will return false)
Type converting equality (==) means automatically it will covert variable to value irrespective of data type, either it is string or number. This means "2" will be equal to 2 ("2" == 2 it will return true)
So the double equal (==) is an auto type converting equality and three equal (===) is strict equality operator i.e it will not covert values automatically.
Difference between == and === with Example-JavaScript
Below is the demonstration with simple examples:

Demo 1

1==”1″ // it will return true because here string will converted as number
1 === “1” // it will return false because here 1 is number and “1” is string

Demo 2

0 == false // it will return true because here false is equivalent of 0
0 === false // it will return false because both are different operands
I have included the complete example for you to check the result yourself as shown below:
<!DOCTYPE HTML>
<html>
<head>
<title>Jquery - Difference between == and ===</title>
<script type="text/javascript">
function CheckDifference() {
 var val = "2";
 document.write("Value for a variable is : " +val +"<br/>"); 

 if (val == 2)
 document.write("== returns True <br/>")
 else
 document.write("== returns False <br/>")

 if (val === 2)
 document.write("=== returns True <br/>")
 else
 document.write("=== returns False <br/>")
}
</script>
</head>
<body>
<h2>JQuery or JavaScript - Difference between == and ===</h2>
<hr/>
<br/>
<div id="div1">
<input type="button" id="Check" 
 onclick="CheckDifference()" 
 value="Click to Check Difference" />
</div>
</body>
</html>

Difference between a library and a framework?

Library

library is a reusable piece of code which you use as it comes i.e it does not provide any hooks for you to extend it.

Framework

framework is a piece of code which dictates the architecture your project will follow.
Library
Framework
·         A library is a reusable piece of code which you use as it comes i.e. it does not provide any hooks for you to extend it.
·         A framework is a piece of code which dictates the architecture your project will follow.
·         A library will usually focus on a single piece of functionality, which you access through an API.
·         Once you choose a framework to work with, you have to follow the framework’s code and design methodologies.
·         You call a library function, it executes some code and then control is returned to your code.
·         The framework will provide you with hooks and callbacks, so that you build on it.
·         Library doesn’t contain framework.
·         A framework will usually include a lot of libraries to make your work easier

Thursday, February 4, 2016

SilverLight

Silverlight is a powerful cross-browser & cross-platform technology for building the next generation web experience & rich internet applications for the web.
Silverlight applications are delivered to a browser in a text-based markup language called XAML. XAML is a declarative markup language that you can use to define the UI elements for your Silverlight-based application.
Silverlight is considered as a competitor to Adobe's flash technology.
One of the design goals of the Silverlight technology is to fill the gap between windows application and web application in terms of creating Graphical User Interface (GUI). So far web developers were not able to make client happy in terms of UI, but now web developer will be able to full fill this with the help of Silverlight technology.
You can run Silverlight in most of all the popular browsers like Internet Explorer, Firefox, Chrome, Safari etc. Silverlight can run in various devices and operating systems like Windows, Apple Mac OS-X and Windows Phone 7.
Using Silverlight you can create rich, visually stunning web applications like flash. Also you can create smooth animations using Storyboards; you can stream media over the net etc.
Silverlight web browser plug-in comes as free to install (approximately 4-5 MB in size). You can download the required plug-in from Microsoft Silverlight Site.

Monday, January 25, 2016

What's the benefits of using MVVM over MVC?

The MVVM pattern provides two-way communication between the pattern parts, whereas MVC is able only to provide one-way communication. The main advantage relates to using an additional layer of non-visual parts on the Model top. It helps a developer to map data closer to the View parts.........
MVC is suitable for web apps where you can write the entire application in C# to work on a browser.  Since in MVC View is smart and knows about the model and works on the properties of the model, can even call methods of the model (using Razor) it is lot more convenient to use.
However in MVVM, Views don't have access to the real model and has only access to a special ViewModel which contains only data that can be used for UI, and is designed so that one can have different views for the same ViewModel, for example, a mobile app designed using Xamarin that can run on Andrioid, iOS, Windows Phone.
Both have their usages.  Essentially they are the same concept with slightly different flavor.  In MVVM, you dumb down model even further, so that it carries only presentation level data that can be displayed on any device and one can collect data from any device.

Sunday, January 24, 2016

difference between the Class and Interface
A Class has both definition and an implementation whereas Interface only has a definition.

A Class can be instantiated but an Interface cannot be instantiated You can create an instance of an Object that implements the Interface.

A Class is a full body entity with members, methods along with there definition and implementation. An Interface is just a set of definition that you must implement in your Class inheriting that Interface.

Tuesday, January 12, 2016

How to run Visual Studio as administrator always

Step 1 : Goto to executable of Visual studio IDE in “C:\Program Files(x86)\Microsoft Visual Studio 9.0\Common7\IDE\”, Right click on devenv.exe -> Properties -> Compatibility-> And Select “Run as Administrator” check box.
You will also need to setup for visual studio launcher.
Step 2: Go to executable of Visual Studio Launcher on “C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLauncher.exe” and follow same steps like step 1.

Wednesday, January 6, 2016

SqlSmash

SqlSmash Now Works With Microsoft Azure SQL Databases
 we rolled out support for Microsoft Azure Sql Databases in SqlSmash. When connected to Azure SQL, all the features should work exactly like they do with local Sql Server Databases.
A lot of companies are embracing the cloud going forward, and we want to support those of you using Microsoft’s Azure SQL platform.

Monday, January 4, 2016

Multiple Browser Option -- Select Browser

As a web developer, for performing cross browser testing, we need to run our web site in multiple browser from Visual Studio. Generally, in a common way, we select particular browser from browser selection menu and run the application.  However, you can set multiple browser as your default browser. When you run the application with out debugging ( Ctrl+ F5) , Visual Studio will run the application in all the browser, in case of debugging (F5),  Visual Studio will prompt you to select particular browser from the selected default browser list. You can link this feature very much with Refreshing browsers directly from Visual Studio 2013, where you can refresh the browser directly from Visual Studio.
In the browser list drop-down, by default you will be able to see all the list of added browser, with default browser as checked.
 Browse With
 Select Browser Menu Options
When you select the “Browse With…” option, following dialog will appear, and you can see all the list of browser along with the browser which marked as “(Default)”.
Default Selected Browser
Fig: Browse With Dialog Control
Now, there can be more than one default browser, and same has been written in the dialog control as well – “Browsers (Select one or more):” . So, select all the browser in which you want run the application together, and click on “Set as Default”.  That’s all. Now if you click on “Browse” button in the same dialog control, you will find your web application starts on all the selected browser same time.
Multiple Default Browser
 Select multiple browser as default browser
If you back to Visual Studio main menu, a new option “Multiple Browser” will appear.
Multiple Browser Option
Fig: Multiple browser option
Now, if you want to debug the application, and press “F5” or select the multiple browsers options, following dialog will appear, and you need to select a specific browser from the list of selected browsers.
Multiple Browser Option - Select Browser
 Select Browser from the list of default browser
If you run the application without debugging mode and wanted to run the application to verify the cross browser compatibility, Visual Studio will invoke all the browser for the same application.
This feature is really useful for web developer and who spends time on for cross browser testing ! and of courser – all the web developer spends time for the same !! So, from next time, apply this feature!
Note: This is note new features with Visual Studio 2013, it was available in previous version as well.
You might also like

Wednesday, December 30, 2015

Questions And Answers

What is jQuery?
jQuery is not a programming language but a well written JavaScript code. It is a JavaScript code, which do document traversing, event handling, Ajax interactions and Animations.
Why jQuery is needed?
jQuery is needed for the following list:
·          Used to develop browser compatible web applications
·          Improve the performance of an application
·          Very fast and extensible
·          UI related functions are written in minimal lines of codes
Whether jQuery HTML work for both HTML and XML documents?
No, jQuery HTML only works for HTML documents not for XML Documents.
What are the methods used to provide effects?
Some of the effects methods are:
·          Show()
·          Hide()
·          Toggle()
·          FadeIn() and
·          FadeOut()
What is the advantage of using minimized version of jQuery?
Efficiency of web page increases when minimized version of jQuery is used.min.js file will be more than 50% less than the normal js file. Reduction in the file size makes the web page faster.
Is jQuery is a JavaScript or JSON library file?
jQuery is a library of JavaScript file and it consists of DOM, event effects and the Ajax functions. jQuery is said to be a single JavaScript file.
Which operating system is more compatible with jQuery?
Mac, Windows and Linux are more compatible with the jQuery.
How can we include jQuery library in ASP.Net project?
Download the jQuery library from jQuery.com and include that reference in the asp.net page.
Which command will give a version of jQuery?
The command $.ui.version returns jQuery UI version.
In what scenarios jQuery can be used?
jQuery can be used in following scenarios:
·          Apply CSS static or dynamic
·          Calling functions on events
·          Manipulation purpose
·          Mainly for Animation effects
What is the difference between find and children methods?
Find method is used to find all levels down the DOM tree but children find single level down the DOM tree.
What is jQuery connect?
A ‘ jQuery connect’  is a plugin used to connect or bind a function with another  function. Connect is used to execute function from any other function or plugin is executed.
How to use connect?
Connect can be used by downloading jQuery connect file from jQuery.com and then include that file in the HTML file. Use $.connect function to connect a function to another function.
What are the features of jQuery, has been used in web applications?
jQuery uses features like Sliding, File uploading and accordian in web applications.
What are the browser related issues for jQuery?
Browser compatibility of jQuery plugin is an issue and needs lot of time to fix it.
Whether we need to add jQuery file in both Master and Content page?
jQuery file should be added to the Master page and can use access from the content page directly without having any reference to it.
What are the basic selectors in jQuery?
Following are the basic selectors in jQuery:
·          Element ID
·          CSS Name
·          Tag Name
·          DOM hierarchy
Can we call C# code behind using jQuery?
Yes, we can call C# code from jQuery as it supports .net application.
What is the use jQuery.data method?
jQuery.data methods is used to associate the data with the DOM nodes and the objects. This data method makes the jQuery code clear and concise.
What is the use of each function in jQuery?
Each function is used to iterate each and every element of an object. It is used to loop DOM elements, arrays and the object properties.
What is the difference between size and length of jQuery?
Size and length both returns the number of element in an object. But length is faster than the size because length is a property and size is a method.
Can we add more than one ‘document.ready’ function in a page?
Yes, we can add more than one document.ready function in a page. But, body.onload can be added once in a page.
What is the use of jQuery load method?
jQuery load method is a powerful AJAX method which is used to load the data from a server and assign the data into the element without loading the page.
Whether our own specific characters are used in place of $ in jQuery?
Yes, We can use our own variable in place of $ by suing the method called no Conflict () method.
var sample = $.noConflict()
What are the four parameters used for jQuery Ajax method?
The four parameters are
·          URL – Need to specify the URL to send the request
·          type – Specifies type of request(Get or Post)
·          data – Specifies data to be sent to server
·          Cache – Whether the browser should cache the requested page
What is the use of jQuery filter?
The jQuery filter is used to filter the certain values from the object list based on the criteria. Example is to filter certain products from the master list of products in a cart website.
Which program is useful for testing jQuery?
QUnit is used to test jQuery and it is very easy and efficient.
What is CDN?
CDN is abbreviated as Content Distribution network and it is said to be a group of companies in different location with network containing copies of data files to maximize bandwidth in accessing the data.
What are the two types of CDNs?
There are two types of CDNs:
·          Microsoft – Load jQuery from Ajax CDN
·          Google – Load jQuery from Google libraries API
Which sign is used as a shortcut for jQuery?
Dollar ($) sign is used as a shortcut for jQuery.
Is jQuery is a client or server scripting?
jQuery is a client scripting.
What is the script build up by jQuery?
jQuery is a Javascript file and it is single javascript file that contains common DOM, event effects and Ajax functions.
How can we debug jQuery?
There are two ways to debug jQuery:
Debugger keyword
·          Add the debugger to the line from where we have to start debugging and then run Visual Studio in Debug mode with F5 function key.
·          Insert a break point after attaching the process
What are all the ways to include jQuery in a page?
Following are the ways to include jQuery in a page:
·          Local copy inside script tag
·          Remote copy of jQuery.com
·          Remote copy of Ajax API
·          Local copy of script manager control
·          Embedded script using client script object
What is the use of jQuery.ajax method ()?
jQuery.ajax method is used for asynchronous HTTP requests.
Where can we download JQuery?
jQuery javascript can be downloaded from jQuery official website – www.jquery.com
Is jQuery is a replacement of JavaScript?
No, jQuery is not a replacement of JavaScript.
What is called chaining?
Chaining is used to connect multiple events and functions in a selector.
What are the advantages of jQuery?
Following are the advantages of jQuery:
·          Just a JavaScript enhancement
·          Coding is simple, clear, reusable
·          Removal of writing more complex conditions and loops
Whether C# code behind can be called from jQuery?
Yes, we can call C# code behind from jQuery.
What is the use of jQuery.data() method?
jQuery data method is used to associate data with DOM nodes and JavaScript objects. This method will make a code very concise and neat.
What is the difference between onload() and document.ready()?
In a page, we can have only one onload function but we can have more than one document.ready function. Document.ready function is called when DOM is loaded but onload function is called when DOM and images are loaded on the page.
What is the use of jQuery each function?
jQuery each function is used to loop through each and every element of the target jQuery object. It is also useful for multi element DOM, looping arrays and object properties.
How method can be called inside code behind using jQuery?
$.ajax can be called and by declaring WebMethod inside code behind using jQuery.
Which is the fastest selector in jQuery?
ID and Element are the fastest selectors in jQuery.
What is the slowest selector in jQuery?
Class selectors are the slowest selectors in jQuery.
Where jQuery code is getting executed?
jQuery code is getting executed on a client browser.
What is the method used to define the specific character in place of $ sign?
‘NoConflict’ method is used to reference a jQuery and save it in a variable. That variable can be used instead of Sign.
Why jQuery is better than JavaScript?
jQuery is a library used for developing Ajax application and it helps to write the code clean and concise. It also handles events, animation and Ajax support applications.
What are the types of selectors in jQuery?
There are three types of selectors in jQuery:
·          CSS Selector
·          XPath Selector
·          Custom Selector