Fish Theory

367 2/4/2016 7:02:22 AM

Small Fish in a Big Pond, or a Big Fish in a Small Pond What kind of fish you want to be Small Fish in a Big Pond vs a Big Fish in a Small Pond? It is the questionwhich every person must have thought about it, at least once.If not then that's good. It shows you are satisfied in life –which ever pond you are in. Small Fish in a Big Pond Big Fish in a Small Pond Competition More Competition Less Competition Challenges More Challenges Less Challenges Learning More Learning Less Learning Risk More Risk, there is always risk to be eaten by big Fish (Shark) http://www.readerpublishing.com/...

Execute SQL Query Directly Using Entity Framework

567 11/28/2015 7:28:26 AM

Execute SQL query from Entity Framework: //code sample int employeeID = 1000; var sqlQuery = String.Format(@"SELECT TOP 1 EmployeeName FROM Employee WHERE EmployeeID = '{0}' ", employeeID); var result = dbContext.Database.SqlQuery<string>(sqlQuery); ...

ASP.NET MVC - Difference between Html.Partial vs Html.RenderPartial

538 11/27/2015 7:29:48 PM

Html.Partial Html.RenderPartial Razor syntax: @Html.Partial("ViewName"); @Html.RenderPartial("ViewName"); Returns: Returns MvcHtmlString Returns void Renders: Returns a html encoded string that gets constructed inline with the parent. Directly render/write on output stream. Speed: Slower than Html.RenderPartial Faster than Html.Partial ...

WCF - Contracts : Data Contracts and Message contracts

471 11/8/2015 9:14:34 PM

WCF Contract: Defines what the service does. Identifies the methods available. Its Interface between client and the server. It’s a simple interface with some attribute. Data Contracts Message Contracts Definition Data contract is a formal agreement between a service and a client that abstractly describes the data to be exchanged Message contracts describe the structure of SOAP messages sent to and from a service and enable you to inspect and control most of the details in the SOAP header and body Describes Describes type of data Describes structure of SOAP. Message Contract is an abstrac...

WCF - Endpoints

530 11/8/2015 9:44:45 AM

Relationship between Address, Contract,Binding and Behaviorsis called Endpoint. Each endpoint consists of four properties: Address, Contract, Binding and Behaviors Address (A) Defines where the service resides. Indicates where to find the endpoint. Binding (B) Defines how to communicate with the service. Specifies how a client can communicate with the endpoint. Specifies how the two parties will communicate in term of transport and encoding and protocols. Contract (C) Defines what the service does. Identifies the methods available. Its Interface between client and the server.It’s a simpl...

What is jQuery.noConflict?

453 11/8/2015 6:51:32 AM

jQuery.noConflict is used to avoid conflictof jQuery $ function or variable name used/referred by other JavaScript libraries (e.g. Prototype, MooTools). In case of conflict we can use jQuery.noconflict(). After execution of this we can reference JQuery ($) using jQuery or own specific keyword. Example 1: Refer JQuery using jQuery jQuery.noConflict(); // Something with jQuery jQuery( "div p" ).hide(); // Something with another library's $() $( "content" ).style.display = "none"; Example 2: Refer JQuery using own keyword ($own) Var $own = jQuery.noConflict(); //...

Threading - Programming Concepts

390 10/24/2015 7:27:19 PM

What is Threading? Threading to perform concurrent processing so that you can do more than one operation at a time. For example, you can use threading to monitor input from the user, perform background tasks, and handle simultaneous streams of input. ...

Serialization - Programming Concepts

395 10/24/2015 7:20:21 PM

What is Serialization? Serialization is the process of converting an object into a stream of bytes in order to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization. ...

Reflection - Programming Concepts

425 10/24/2015 7:05:33 PM

What is Reflection? Reflection is used todynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. ...


Programming Concepts- Interview Questions With Answers

520 10/24/2015 6:55:54 PM

Programming Concepts- Interview Questions With Answers...

OOPS - Structs vs Classes

516 8/30/2015 10:05:25 PM

Struct Class Definition: A Struct is a value type if it holds the data within its own memory allocation. A Class is reference type -contains a pointer to another memory location that holds the data. Includes: All numeric data types Boolean , Char, and Date All structures, even if their members are reference types Enumerations, since their underlying type is always SByte, Short, Integer, Long, Byte, UShort, UInteger, or ULong String All arrays, even if their elements are value types Class types, such as Form Delegates Holds Actual Data: Yes No Pointer to another memory location: No Yes Example:...

AngularJS - $scope : Adding Behavior

585 8/22/2015 3:08:04 AM

Business logic in the controller means exposing functions or reacting to events Append properties or methods to the $scope These methods need to be exposed to the view ...

AngularJS - Understanding $scope

538 8/22/2015 3:07:53 AM

Child scopes prototypically inherit JavaScript Prototypical Inheritance : If it doesn’t exist in current, it will go up the chain ( parent ). Hiding and shadowing of properties. Best practice of always have a “.” in model ...

AngularJS - Binding : double curly braces {{}} vs ng-bind directive

1402 7/19/2015 7:31:47 PM

When AngularJS is initialized,loaded with module andknows with model to use for particular scope/code block it will start replacing all binding elements (e.g. curly braces, ng-bind) ng-bind: ng-bind elements are bindated as attribute to html element. If AngularJS is not loaded thenhtml element will be displayed without value. After angularJS module is loaded correct value will displayed on html element. Double Curly Braces: Double curly brace could be loaded anywhere on html If {{SomeDataAttribute}} placeholder forvalue of html element and if angularJS is not loaded then '{{SomeDataAttribu...

AngularJS - What are Modules?

719 7/15/2015 2:20:16 AM

AngularJS module is placeholder - a collection of services, directives, controllers, filters, and configuration information. Moduld is a declarative approache for re-using componet as an when required, makes unit and End-to-End test more easy. ...

AngularJS - Hello World Application

1230 7/11/2015 10:39:28 PM

It is good start to learn a programming language with first example as Hello World. Lets take a look in AngulaJS way- . ...

AngularJS - How it works?

731 7/11/2015 10:38:18 PM

AngularJS will initialize when the DOM content is loaded. Looks for the ng-app directive – if its found, that is the root of the app Directives can be declared a variety of ways: typically with the ng- prefix (e.g. ng-controller) Load the module associated with the directive if specified When it knows with model to use for particular scope/code block it will start replacing all binding elements (e.g. curly braces, ng-bind) Uses Constructor Injection to pass dependences and decide order of initialization AnuglarJS Modularizeclient side code primarily into Model, View and Controller (MVC)....

AngularJS - What and Why?

814 6/29/2015 4:28:13 PM

What is AngularJS? AngularJS is front-end javascript framework Usedto create dynamic web pages Follows MVC pattern of development Its open source framework maintained by Google Uses declarative programming Does all sorts of client side operations like DOM manipulation, registaring callbacks, Updating UI based on data, input and filters Why we need AngularJS? AngularJS allows to doclient side code to be modularized, reusable and remove d Creating dynamic UI Decouple client side from server side Modularize application at client side Writing resuable code Manupulating DOM dynamically Do more work...

ASP.NET MVC - Show static .html files directly without controller

1164 6/20/2015 2:09:29 AM

MVC framework provide support to static files e.g. images, css, js. Its just .html files are not configured by default. In order us to include static files in application we need to tell MVC application to allow Html file. routes.IgnoreRoute("StaticHtmls/{*path}"); After you include this in Route configuration files. You should be able to access all .html files in 'StaticHtmls' folder directly. e.g. http://YourSite/StaticHtmls/YourHtmlFile.html http://YourSite/StaticHtmls/YourHtmlFile.cshtml . ...

SOA - Investigating SOAP vs REST

837 6/2/2015 12:09:24 AM

REST SOAP Stands for: Representational State Transfer Protocol Simple Object Access Protocol What is it: RESTs sweet spot is when you are exposing a public API over the internet to handle CRUD operations on data. SOAPbrings its own protocol and focuses on exposing pieces of application logic (not data) as services. Addresses : Resource Method Transport Protocol Supported: Only supports HTTP. REST requires use of HTTP. SOAPcan be sent over almost any protocol such as HTTP, SMTP, TCP, or JMS. SOAPis Language, platform, and transport independent. Data vs Function Driven : REST is very data-driven...

SQL Server - Dynamically Convert Row Data Into Columns

641 5/21/2015 11:47:42 PM

Code Snippet: DECLARE @COLUMNHEADERS VARCHAR(MAX); SET @COLUMNHEADERS = STUFF( (SELECT DISTINCT ', [' + CAST(HIREDATE AS VARCHAR(255)) + ']' FROM EMPLOYEE FOR XML PATH(''), TYPE).VALUE('.', 'VARCHAR(MAX)') , 1, 2, ''); DECLARE @SQL NVARCHAR(MAX); SET @SQL = 'SELECT * FROM ( SELECT [DEPARTMENTID], [HIREDATE], [SORTNAME], ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS RN FROM EMPLOYEE ) T PIVOT ( MAX([SORTNAME]) FOR [HIREDATE] IN (' + @COLUMNHEADERS + ') ) P'; EXECUTE SP_EXECUTESQL @SQL; ...

ASP.NET - Check If Page / File / URL Exists

623 5/21/2015 11:45:13 PM

Code Snippet: using System.Net; /// Checks the file exists or not. /// The URL of the remote file. /// True : If the file exits, False if file not exists private bool CheckIfFileExists(string url) { try { //Create the HttpWebRequest and get web response and check status. If status code is HttpStatusCode.OK then return true otherwise false return (((HttpWebResponse)WebRequest.Create(url).GetResponse()).StatusCode == HttpStatusCode.OK); } catch { //Any exception will returns false. return false; } } . ...

OOPS - Deep drive into Overloading and Overriding

518 5/21/2015 11:37:29 PM

Overloading Overriding Polymorphism: Compile Time Polymorphism Run Time Polymorphism Binding: Early / Static Binding Late / Dynamic Binding Function Parameters: Functions with same name and different parameters. Functions in the extended class with same name and same parameters as in the base class, but with different behaviors. Code Snippet: public class A { public void Print(int x) { Console.WriteLine("Parent Method"); } } public class B : A { public void child() { Console.WriteLine("Child Method"); } public void Print(float x) { Console.WriteLine("Overload child met...

OOPS - Difference between Interface and Abstract class

474 5/21/2015 11:13:29 PM

Interface Abstract An Interface contains only the signatures (no code definition) ofmethods,properties,eventsorindexers. Abstractmodifier indicates that the thing being modified has a missing or incomplete implementation. An abstract class can provide complete, default code and/or just the details that have to be overridden. Instantiation An abstract class cannot be instantiated. Implemetation A class or struct that implements the interface must implement the members of the interface that are specified in the interface definition. An abstract class must provide implementation for all interface...

ASP.NET MVC - What is difference between Dynamic vs Strongly Typed Views?

1130 5/21/2015 1:25:02 AM

There are three ways to pass information from a controller to a view in ASP.NET MVC 3 and above: As a strongly typed model object. @model IEnumarable<<MVCAppNamespace>.Controller.<ModelName>> @foreach (var item in Model) { } As a dynamic type (using @model dynamic) @model dynamic @foreach (var item in Model) { } Using the ViewBag @foreach (var item in ViewBag.<<ModelName>>) { } ...

ASP.NET MVC - How Routing Works?

695 5/21/2015 1:21:27 AM

How Request is handled in ASP.NET MVC: Is ten step process, as follows: App initialization- Browser request pages to IIS Perform routing - IIS will pass this request to Application UrlRoutingMoule will try to find Route defined in RouteTable Create MVC request handler- UrlRoutingMoule will try to find matching Route defined in RouteTable collection. If matching route found - MvcRouteHandler will create instance of MvcHandler Controller- Create controller- MvcHandler will create an instance of controller Execute controller - MvcHandler calls the controllers Execute method Invoke action - contro...

ASP.NET MVC - What are the benefits of using MVC?

545 5/21/2015 1:05:44 AM

Separation of application tasks -Easy to Manage - Manage complexity by dividing an application into the model, the view, and the controller Full control over the behavior of an application - as it doesn't use view state or server-based forms which will give full control to developer. Better support for test-driven development (TDD)- Easy to Test Best suited for large team An extensible and pluggable framework- You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NET MVC framework also supports the use of Dependency I...

.NET Framework - Boxing and Unboxing

1147 5/20/2015 3:27:15 AM

Now that we have seen difference between Value Types and Reference Types lets look at how can we convert value type to reference type and vice versa. Boxing Unboxing Conversion of: Value type to Reference type. Reference type to Value type. Process of : Boxing is the process of converting a value type to the type object or to any interface type implemented by this value type. Unboxing extracts the value type from the object. How it works: Boxing a value type allocates an object instance on the heap and copies the value into the new object. For the unboxing of value type to succeed at run time,...

ASP.NET MVC - Explain application life cycle?

752 5/18/2015 4:04:10 AM

Page Life cycle of an ASP.NET MVC: App initialization- Browser request pages to IIS Perform routing - IIS will pass this request to Application UrlRoutingMoule will try to find Route defined in RouteTable Create MVC request handler- UrlRoutingMoule will try to find matching Route defined in RouteTable collection. If matching route found - MvcRouteHandler will create instance of MvcHandler Controller- Create controller- MvcHandler will create an instance of controller Execute controller - MvcHandler calls the controllers Execute method Invoke action - controller determines which action method o...

ASP.NET MVC - What are features of the ASP.NET MVC Framework?

533 5/18/2015 4:02:09 AM

Separation of application tasks -Easy to Manage - Manage complexity by dividing an application into the model, the view, and the controller Full control over the behavior of an application - as it doesn't use view state or server-based forms which will give full control to developer. Better support for test-driven development (TDD)- Easy to Test Best suited for large team An extensible and pluggable framework- You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NET MVC framework also supports the use of Dependency I...