Step by Step

Saturday, May 21, 2011

The Difference between HTML and XHTML


The Difference between HTML and XHTML
  HTML and XHTML have very similar names; they have some interesting differences that you need to be aware of.
 XHTML is a reformulation of HTML in XML — extensible Markup Language. This is a generic, text- and tag-based language used to describe data and is used as the base language for many other languages, including XHTML.
So, XHTML is in fact largely just HTML rewritten with XML rules. These rules are pretty simple, and most of the time VWD will help you get it right or show you a list of errors and suggestions on how to fix them.
1-Always Close Your Elements
In XHTML, all elements must be closed. So when you start a paragraph with <p>, you must use 
</p> somewhere later in your page to close the paragraph. This is also the case for elements that don’t have their own closing tags, like <img> or <br> (to enter a line break). In XHTML, these tags are written as self-closing tags, where the closing slash is embedded directly in the tag itself as in
<img src=”Logo.gif” /> or <br />.
2-Always Use Lowercase for Your Tag and Attribute Names
XML is case sensitive, and XHTML applies that rule by forcing you to write all your tags in lo
Although the tags and attributes must be in all lowercase, the actual value doesn’t have to be preceding example that displays the logo image is perfectly valid XHTML, despite the upper the image name.
3-Always Enclose Attribute Values in Quotes
Whenever you write an attribute in a tag, make sure you wrap its value in quotes.
For example when writing out the <img> tag and its src attribute, write it like this:
<img src=”Logo.gif” />
And not like this:
<img src=Logo.gif />
You could also use single quotes to enclose the attribute value, as in this example:
<img src=’Logo.gif’ />
It’s also sometimes necessary to nest single and double quotes. When some special ASP.NET syntax requires the use of double quotes, you should use single quotes to wrap the attribute’s value:
<asp:Label ID=”TitleLabel” runat=”server” Text=’<%# Eval(“Title”) %>’ />
For consistency, this book uses double quotes where possible in all HTML that ends up in the client.
4- Nest Your Elements Correctly
When you write nested elements, make sure that you frst close the inner element you opened last, and then close the outer element. Consider this correct example that formats a piece of text with both bold and italic fonts:
<b><i>This is some formatted text</i></b>
Notice how the <i> tag is closed before the <b> tag. Swapping the order of the closing tags leads to invalid XHTML:
<b><i>This is some formatted text</b></i>
5-Always Add a DOCTYPE Declaration to Your Page
A DOCTYPE gives the browser information about the kind of HTML it can expect. By default, VWD adds a DOCTYPE for XHTML 1.0 Transitional to your page:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
       “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
The DOCTYPE greatly influences the way browsers like Internet Explorer render the page. VWD’s default DOCTYPE of XHTML 1.0 Transitional gives you a good mix between valid markup and pages that render the same in all major browsers.

Thursday, May 19, 2011

Choosing the right Web site template



The New Web Site dialog box in VWD contains different web site templates, each one serving a distinct purpose.
ASP.NET Web Site

This template enables you to set up a basic ASP.NET web site. It contains a number of files and folders to jump start the development of your site.
This template is a good starting point once you start developing real-world ASP.NET web sites.
ASP.NET Empty Web Site
The ASP.NET Empty Web Site template gives you nothing but single configuration file (web .config).
The ASP.NET Empty Web Site template is useful if you have a bunch of existing files you want to use to create a new web site or when you want to create your site from scratch. You use this template as the basis for the sample web site you build in the book and add files and folders as you progress through the site.
WCF Service
This template enables you to create a web site containing one or more WCF Services. A WCF Service is somewhat similar to a web service in that it enables you to create methods that are callable over a network. However, WCF Services, or Windows Communication Foundation Services go much further than simple web services and offer you a lot more flexibility.
Dynamic Data Web Sites
The two templates for Dynamic Data enable you to create a flexible yet powerful web site to manage data in a database without a lot of manual code.
Although it seems you have to make a clear choice up front for the right web site template, this isn’t really the case. Because an ASP.NET web site in VWD is essentially just a reference to a folder, it’s easy to add types from one template to another.
For example, it’s perfectly acceptable (and very common) to add a web service file to a standard ASP.NET Web Site or an ASP.NET Empty Web Site.

Web Application Projects


Web Application Projects make it easier for developers who work in teams or who need more control over the contents of the site and their compilation and deployment processes to build web sites with VWD, because the whole web site is managed as a project with a single project file that keeps track of all the content of the web site.
In VWD 2010, you create a new Web Application Project through the File ➪ New Project dialog box.

Web Site Projects


Web Site Projects represent a project in VWD for a web site. You create a new Web Site Project by choosing File ➪ New Web Site or File ➪ New ➪ Web Site from Visual Web Developer’s main menu.
Web Site Projects were introduced in Visual Studio 2005 and provide some new flexibility in creating and working with web sites. In contrast to web sites built with earlier versions of Visual Studio .NET, a Web Site Project site is simply a Windows folder with a bunch of flies and subfolders in it.
There is no collective file (known as the project file with a .vbproj or .csproj extension) that keeps track of all the individual files in the web site. You just point VWD to a folder, and it instantly opens it as a web site. This makes it very easy to create copies of the site, move them, and share them with others, because there are no dependencies with files on your local system.
Because of the lack of a central project file, Web Site Projects are usually simply referred to as web sites.
But Microsoft also received a lot of negative response from developers who complained that Web Site Projects were too limiting for their development environment.
Because there is no container file that keeps track of everything in the site, it became
much harder to exclude files or folders from the site and work with source control systems a centralized system that enables developers to work on a project collaboratively and that keeps track of changes in the project automatically.
Also, Web Site Projects influenced the way web sites are compiled and deployed, making it harder for developers accustomed to the previous model to apply their knowledge and skills to the new project type.
Microsoft released the Web Application Project template in May 2006 as an add-on for Visual Studio 2005 Standard Edition and up.
The Web Application Project is now an integral part of all versions of Visual Web Developer, free and commercial

Different project types

In the initial release of Visual Web Developer 2008 Express there was one project type: the Web Site Project. The commercial versions of Visual Studio has the second project type — the Web Application Project. In August 2008, Microsoft released Service Pack 1 for Visual Web Developer 2008, which gave users of the free Express edition access to the Web Application Project template as well. This addition is still present in VWD 2010 so you have two options to choose from Web Site Projects and Web Application Project

Tuesday, May 17, 2011

Customizing Keyboard shortcuts


Customizing Keyboard shortcuts
Keyboard shortcuts are a good way to save time because they allow you to perform a task with a simple keyboard command instead of reaching for the mouse and selecting the appropriate item from the menu.
To change the keyboard shortcuts, choose Tools Options, expand Environment, and click Keyboard. Locate the command for which you want to change the shortcut in the list with commands.
Because this list contains many items, you can filter the list by typing a few letters from the command. For example, typing print in the Show Commands Containing field gives you a list of all print-related commands.
Next, in the Press Shortcut Keys field, type a new shortcut and click Assign. VWD allows you to enter a double shortcut key for a single command. For example, you can bind the command Close All Documents to the command Ctrl+K, Ctrl+O. To perform this command, you need to press both key combinations in rapid succession. Although a double shortcut key may seem like overkill, it greatly increases the number of available shortcut keys.

Stack and Heap


There are two places where your data can be on
1-Stack
2-Heap
*Stack
Where your static data saved in it
Like integer as we now that the integer size is 8 bytes
Also like Array as we set its size at declaration
-So to read from it you actually go to the address in stack and read data directly
Ok that's sound good, what about Array List [like array but its size is variables]
So we need huge place to can save our data in that case [as we didn't know how much of bytes we need]
To solve that we need to use heap
*Heap
undetermined space to save our data in it
But as our data is variable we need pointer for that place.
 We save pointer for data in stack and actual data in heep
-So to read from it you actually go to the address in stack and take the indirect address
Then with that address go to heap to read your data