Box Model in CSS

Posted on Updated on

The term “Box Model ” is used when we are talking about design and layout .

In CSS, all the HTML contents are considered as boxes

It consists of :-

1. Margin

2. Border

3. Padding

4. Content

Find the reference image below:-

Box model image

· Margin – Clears area around the border. The margin does not have a background color, it is completely transparent

· Border – Border goes around the padding and content. The border is inherited from the color property of the box

· Padding – Clears an area around the content. The padding is affected by the background color of the box

· Content – The content of the box, which is actual content

· To set the width and height of an element correctly in all browsers, you need to know how the box model works.

Note: When you set the width and height properties of an element with CSS, you just set the width and height of the content area. To calculate the full size of an element, you must also add the padding, borders and margins.

Example:

The total width of the element in the example below is 200px:

Calculation:
150px (width)
+ 20px (left + right padding)
+ 10px (left + right border)
+ 20px (left + right margin)
= 200px

CodeLens in VisualStudio 2013

Posted on

CodeLens is a feature that will be available only in Visual Studio Ultimate edition (more on the controversy here), but adds some very useful behavior to the editor. By default, the number of times a property or method is referenced by your code is shown above that property or method. This information can be helpful when changing existing code, since you’ll know if the method is called from many places or just a handful. In larger projects, especially ones where you’re not familiar with the entire codebase, this can be a big time saver. The number of references is shown in a small font above each property or method on your class, as shown in below figure. Clicking on the number of references will show you all of the methods that call it, making it easy to find and navigate to those sections of your code.

CodeLens in VusalStudio image
CodeLens
CodeLens without TFS integration shows you the number of times a bit of code is referenced.
While not shown here, CodeLens also has some nice Team Foundation Server (TFS) integration. If you’re using TFS, it will allow you to see commit history and unit tests targeting the code in question.

Difference between == and === in javascript

Posted on Updated on

(==) will try to convert the values to the same type before the condition gets evaluated.

ex:-
5==’5′ —-> TRUE
null==undefined —-> TRUE
undefined==undefined —-> TRUE

(===) will not try to convert the values . this operator will check with data type as well.

ex:-
5===’5′ —-> FALSE
null===undefined —-> FALSE
undefined===undefined —-> TRUE

Action filters features in MVC 5

Posted on Updated on

The Web MVC project templates integrate seamlessly with the new One ASP.NET experience. You can customize your MVC project and configure authentication using the One ASP.NET project creation wizard. An introductory tutorial to ASP.NET MVC 5 can be found at Getting Started with ASP.NET MVC 5 .

ASP.NET Identity

The MVC project templates have been updated to use ASP.NET Identity for authentication and identity management. A tutorial featuring Facebook and Google authentication and the new membership API can be found at Create an ASP.NET MVC 5 App with Facebook and Google OAuth2 and OpenID Sign-on .

Bootstrap

The MVC project template has been updated to use Bootstrap to provide a sleek and responsive look and feel that you can easily customize. For more information, see Bootstrap in the Visual Studio 2013 web project templates.

Authentication filters

Authentication filters are a new kind of filter in ASP.NET MVC that run prior to authorization filters in the ASP.NET MVC pipeline and allow you to specify authentication logic per-action, per-controller, or globally for all controllers. Authentication filters process credentials in the request and provide a corresponding principal. Authentication filters can also add authentication challenges in response to unauthorized requests.

Filter overrides

You can now override which filters apply to a given action method or controller by specifying an override filter. Override filters specify a set of filter types that should not be run for a given scope (action or controller). This allows you to configure filters that apply globally but then exclude certain global filters from applying to specific actions or controllers.

Attribute routing

ASP.NET MVC now supports attribute routing, thanks to a contribution by Tim McCall, the author ofhttp://attributerouting.net. With attribute routing you can specify your routes by annotating your actions and controllers.