Saturday, 18 November 2017

Html

HTML
  • HTML stands for Hyper Text Markup Language
  • HTML describes the structure of Web pages using markup
  • HTML elements are the building blocks of HTML pages
  • The first tag in a pair is the start tag, the second tag is the end tag
Ex:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
1.The <!DOCTYPE html> declaration defines this document to be HTML5
2.The <html> element is the root element of an HTML page
EX:
<html>
</html>
3.The <head> element contains meta information about the document
EX:
<html>
<head>
</head>
</html>

4.The <title> element specifies a title for the document
EX:
<html>
<head>
<title>Welcome</title>
</head>
</html>
5.The <body> element contains the visible page content
EX:
<html>
<head>
<title>Welcome</title>
</head>
<body>
</body>
</html>
6.The <h1> element defines a large heading
EX:
<html>
<head>
<title>Welcome</title>
</head>
<body>
 <h1> Testing </h1>
</body>
</html>
8 Link <a> 
<a href="https://www.w3schools.com">This is a link</a>
9.<img>
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">
Alt- Alternate one.
10.<pre>
<pre>
  My Bonnie lies over the ocean.

  My Bonnie lies over the sea.
 </pre>
11. <b> - Bold
ex: WELCOME
12. <strong> - Important text
ex:WELCOME
13. <i> - Italic text
ex: Welcome
14. <em> - Emphasized text
ex: Welcome
15. <mark> - Marked text
ex: milk
16. <small> - Small text
ex: <h2>HTML <small>Small</small> Formatting</h2>
17. <del> - Deleted text
ex: WELCOME
18. <ins> - Inserted text
            ex: WELCOME 
19. <sub> - Subscript text
ex: Welcome subscript 
20. <sup> - Superscript text
eX: Welcome superscript

21. <q> - Quotations
ex:WELCOME
22. <address>
ex: <address>
Written by John Doe.
<br> 
Visit us at:
<br>
Example.com
<br>
Box 564, Disneyland
<br>
USA
</address>
23. <bdo>
ex:<bdo dir="rtl">This Line</bdo>
o/p : This line

24. <!-- This is a comment -->
25. target =”_blank” -open into New tab.
26.tables
Ex:<table style="width:100%">
  <tr>
    
<th>Firstname</th>
    
<th>Lastname</th> 
    
<th>Age</th>
  
</tr>
  
<tr>
    
<td>Jill</td>
    
<td>Smith</td> 
    
<td>50</td>
  
</tr>
  
<tr>
    
<td>Eve</td>
    
<td>Jackson</td> 
    
<td>94</td>
  
</tr>
</table>
27.Lists
<ul>
  <li>Coffee</li>
  
<li>Tea</li>
  
<li>Milk</li>
</ul>
28.iframe
<iframe src="demo_iframe.htm" style="border:none;"></iframe>
29. Define the character set used:
<meta charset="UTF-8">
30.Define a description of your web page:
<meta name="description" content="Free Web tutorials">
31. Define keywords for search engines:
<meta name="keywords" content="HTML, CSS, XML, JavaScript">
32.Define the author of a page:
<meta name="author" content="John Doe">
33.Refresh document every 30 seconds:
<meta http-equiv="refresh" content="30">
34.Responsive Design
<meta name="viewport" content="width=device-width, initial-scale=1.0">
35. <nav> - Defines a container for navigation links
36.Space -  &nbsp;




Sunday, 5 November 2017

WEB API

WEB API


API (Application Programing Interface).

set of subroutine definitions, protocols, and tools for building software and applications.

some kind of interface which has a set of functions that allow programmers to access specific features or data of an application, operating system or other services.

building HTTP based services

only supports HTTP protocol.

ideal platform for building RESTful services.

 supports ASP.NET request/response pipeline

Web API supports different formats of response data. Built-in support for JSON, XML, BSON format.

Web API can be hosted in IIS, Self-hosted or other web server that supports .NET 4.0+.



WEB API Versions:

Web API Version
Supported .NET Framework
Coincides with
Supported in
Web API 1.0
.NET Framework 4.0
ASP.NET MVC 4
VS 2010
Web API 2 - Current
.NET Framework 4.5
ASP.NET MVC 5
VS 2012, 2013
WEB API Vs WCF:

Web API
WCF
Open source and ships with .NET framework.
Ships with .NET framework
Supports only HTTP protocol.
Supports HTTP, TCP, UDP and custom transport protocol.
Maps http verbs to methods
Uses attributes based programming model.
Uses routing and controller concept similar to ASP.NET MVC.
Uses Service, Operation and Data contracts.
Does not support Reliable Messaging and transaction.
Supports Reliable Messaging and Transactions.
Web API can be configured using HttpConfiguration class but not in web.config.
Uses web.config and attributes to configure a service.
Ideal for building RESTful services.
Supports RESTful services but with limitations.
We can use the following third party tools for testing Web API.
  1. Fiddler
  2. Postman     
The following table lists possible action method names for each HTTP method:

HTTP Request Method
Possible Web API Action Method Name
Usage
GET
Get()
get()
GET()
GetAllStudent()
*any name starting with Get *
Retrieves data.
POST
Post()
post()
POST()
PostNewStudent()
*any name starting with Post*
Inserts new record.
PUT
Put()
put()
PUT()
PutStudent()
*any name starting with Put*
Updates existing record.
PATCH
Patch()
patch()
PATCH()
PatchStudent()
*any name starting with Patch*
Updates record partially.
DELETE
Delete()
delete()
DELETE()
DeleteStudent()
*any name starting with Delete*
Deletes record.






























WEBAPI vs MVC
Web API Controller
MVC Controller
Derives from System.Web.Http.ApiController class
Derives from System.Web.Mvc.Controller class.
Method name must start with Http verbs otherwise apply http verbs attribute.
Must apply appropriate Http verbs attribute.
Specialized in returning data.
Specialized in rendering view.
Return data automatically formatted based on Accept-Type header attribute. Default to json or xml.
Returns ActionResult or any derived type.
Requires .NET 4.0 or above
Requires .NET 3.5 or above