Thursday, June 21, 2012

HTML based Web Site (chap 2 web beginners)

Hello

This chapter include the following :

  • Tools
  • HTML
  • Sample of web site with HTML page
  • Sample of web site with HTML pages , pictures , sound and video.


Tools

We will need the following tools for development of HTML based web site :

  • Browser
  • IIS
  • Visual Web Developer 2010
  • HTML
  • LoopBack (127.0.0.1)

Browser - allow HTTP GET to the web site


IIS :

  • Web server for hosting the web site and serving requests


Visual Web Developer 2010 :

  • development environment
  • free download


HTML :

  • markup language
  • used for static web site. I.e the info stored on the web site is delivered to the client as is. Dynamic web site may build the page on demand
  • http://www.w3schools.com/html/



LoopBack 

  • use for internal web site testing
  • use IP 127.0.0.1 or localhost



HTML (Hyper Text Markup Language)


Basic structure of HTML page


<HTML>
<HEAD>
                  <TITLE>
                            ................ title of the page
                  </TITLE>
 </HEAD>
  <BODY>
                            ................ body of the page
  </ BODY >

</HTML>


Tag list


remark - tag are not case sensitive


<br> - new line




div - it defines a section so we can e.g. apply the font to all of them
example :


<div align="center">
  This is some text center align!

<br>
text centered
</div>

<div align="left">
  This is some text  left align!
</div>
<div align="right">
  This is some text  right align!
</div>

This will create :


<p>
The <p> tag defines a paragraph.


<h1> ..... <h7> - heading
example :


<h1>big   heading </h1>
<br>
<h7>small heading </h7>


This will create :






Tag nesting
example :

<HEAD>
                  <TITLE>
                            ................ title of the page
                  </TITLE>
 </HEAD>



<hr> - line


example :


<hr color="blue"/>


<font>
example :


<font face="arial"  size="7"/>some text</font>
size is 1-7

This will create :



<big> - big text
<small> - small text
example :


<big>big text</big>
<small>small text</small>

This will create :




Sample of web site with HTML page


Run visual studio as administrator (Windows 7)


Create a new web site





Choose ASP.Net Empty Site, HTTP, and the location of the site




Open the IIS via "Control Panel"->"Administrative Tools"  and notice the name "WebSite" which we just created


Now we will add a new HTML pahe into the web site.




By adding HTML page


Now you can edit the page



It is possible check that the page is loading correctly (using HTTP GET) in few ways :

via the browser - http://localhost/WebSite/HTMLPage.htm

via the IDE -

in any way you will get the same result on the browser

Tag list continued


style

  • attribute
  • style determine the visual appearance
example :

<div style="background:green">
<h1>text</h1>
another text
</div>
<div style="background:red">
<h1>text</h1>
another text
</div>

This will create :

You can also use : background-color, text-align,color,font-family


test it yourself

<img> - using image
the basic structure is <img src="url"  width="pixel width" height=" pixel height"/>


example :

<img src="http://budgetstockphoto.com/freeimages/environment/pics/clean_beach6085.jpg"
    width="100" height="100"/>

will create:
<ol> - ordered list
<li> - list item


example :



<h4>An Ordered List:</h4>
<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>


will create :



<ul> - un ordered list

example :



<h4>An Un Ordered List:</h4>
<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>


will create :
<dl> - definition list
<dt> - subject item in definition list
<dd> - sub subject item in definition list


example :


<dl>
  <dt>Coffee</dt>
    <dd>- black hot drink</dd>

      <dd>- latte</dd> 
  <dt>Milk</dt>
    <dd>- white cold drink</dd>
</dl>



will create :
<table> - table
<tr> - define a row in a table
<th> - define a header cell in table
<td> - define standard cell in table


example :


<table border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table>


will create :


common table attributes :
border = n , table width
cellspacing = n , space beteen cells
cellpadding = n , space inside cells
width = n , table width
bgcolor = color , table background color
colspan = n , number of columns cell should span
rowspan= n , number of rows cell should span


test it yourself !!



write hebrew
This require :

  • setting the encoding :
  • meta http-equiv="content-type" content="text/html;charset=UTF-8"
  • should be inside the head 
  • setting direction - dir=rtl

example :


<html > <HEAD> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> </HEAD> <BODY dir=rtl> שלום חבר </ BODY > </html>


will create :
<fieldset> - Group related elements in a form


exanmple :
<form>
  <fieldset>
    Name: <input type="text" /><br />
    Email: <input type="text" /><br />
    Date of birth: <input type="text" />
  </fieldset>
</form>



Will create :




The <legend> tag defines a caption for the <fieldset> element.


<form>
  <fieldset>
    <legend>Personalia:</legend>
    Name: <input type="text" size="30" /><br />
    Email: <input type="text" size="30" /><br />
    Date of birth: <input type="text" size="10" />
  </fieldset>
</form>



Will create :




links
<a> - link


attributes :

  • href - URL
  • target - specify where to open the windows e.g. _blank is new windows



link may refer to :

  • html file
  • web site
  • picture
  • audio\video file
  • mail



example
<a href="http://www.w3schools.com">Visit W3Schools.com!</a>
<br>
<a href="http://budgetstockphoto.com/freeimages/environment/pics/clean_beach6085.jpg">Nice Picture</a>
<br>
<a href="mailto:nathan@nynkmobile.com">Nathan's e-mail</a>



will create :
you can click on the links


reamrk - link can be relative e.g. point to html inside the web site.
e.g. <a href="HTMLPage.htm">Load Local Page</a>






Sample of web site with HTML pages , pictures , sound and video.


we will create a project as before


and add directories :

  • pictures
  • cars
  • airplanes
  • sound
  • video

and main html file






download files.rar into your desktop and then add to the project








loading all the file result in :




Actually we will have 6 pages which are organized like a tree as follows

  • Main page
  • Picture page
  • Cars page
  • Airplanes page 
  • Video page
  • Sound page 



project (you need to create web site and add files from above zip)


Main Page :
Picture page :
Sound Page :
Video Page :




Cars Page :




Airplane Page :






Nathan

Thursday, April 5, 2012

REST api

Hello

What is REST ?

  • REST stand for Representional State Transfer.
  • It relies on stateless,client\server,cacheable communication protocol
  • Uses HTTP
  • Restfull applications use HTTP to post data (create/update) , read data (make queries) , and delete data


REST as Lightweight Web Service
Much like Web Services a REST service is :

  • Platform independent i.e. does not care if Windows,Mac,Linux ... is used
  • Language  independent i.e. Java,C#,...
  • Standard based (runs over HTTP)
  • Can easyly be used with firewalls

How simple is REST


To get a user details the follolwing query may be used :
http://www.acme.com/phonebook/UserDetailes/1234

1234 is the requested user id
UserDetailes is the desired info

This is a URL which is sent via HTTP GET request.

More complex REST request


http://www.acme.com/phonebook/UserDetailes?firstName=John&LastName=Doe

Nathan

Tuesday, January 10, 2012

ASP.Net WebMatrix - Simple User Interaction

Hello

http://www.microsoft.com/web/post/web-development-101-part-6-creating-an-add-data-page

Points of interest

  • WebMatrix has GREAT integration with Visual Studio 2010. You can launch VS and debug e.g. cshtml file - really great !!
  • Sending info to the server via browser :
  • HTTP POST is used (check this using Site->Requests)
  • HTML form is used
  • The server must identify the POST verb and process. Here it insert user inputs into a database 



Nathan

Monday, January 9, 2012

ASP.Net WebMatrix - Using Data Base

Hello

http://www.microsoft.com/web/post/web-development-101-part-5-using-data

Points of notice

  • Very nice integration of database in WebMatrix to allow easy database\table creation
  • Reuse of the layout that was done before using Razor and cshtml
  • Very simple access of database using Razor ( http://www.w3schools.com/razor/default.asp)


Nathan

ASP.Net WebMatrix - Using Layouts

Hello

http://www.microsoft.com/web/post/web-development-101-part-4-using-layout


Points of notice

  • cshtml file - HTML + C#\VB code
  • Razor  (layout reuse)
  • Run cshtml file and _PageStart.cshtml is invoked autmatically 

Nathan

Thursday, January 5, 2012

ASP.Net WebMatrix - Getting some styles

Hello

http://www.microsoft.com/web/post/web-development-101-part-3-getting-some-style

What is style ?

  • font , color ...


Contents :

  • Divider
  • Hyperlink
  • Header and footer
  • Page look and feel - CSS
  • Remarks :
  • Note that class Title is NOT related to title , one could use Title1 instead
  •  WebMatrix supports external css file



Nathan