Beginners Guide to Python

Execute a Python script

In the following example we will write a variation of the mandatory “Hello World” script:

>>> print "It's easy to write a Python script!"
It's easy to write a Python script!
>>> 

Continue reading “Beginners Guide to Python”

Advertisements

What does in XML mean?

article-page-main_ehow_images_a04_s0_bp_use-cdata-xml-800x800CDATA stands for Character Data and it means that the data in between these tags includes data thatcould be interpreted as XML markup, but should not be.

The key differences between CDATA and comments are:

  • CDATA is still part of the document, while a comment is not.
  • In CDATA you cannot include the string ]]> (CDEnd), while in a comment -- is invalid.
  • Parameter Entity references are not recognized inside of comments.

This means given these three snippets of XML from one well-formed document:

<!ENTITY MyParamEntity "Has been expanded">

<!--
Within this comment I can use ]]>
and other reserved characters like <
&, ', and ", but %MyParamEntity; will not be expanded
(if I retrieve the text of this node it will contain
%MyParamEntity; and not "Has been expanded")
and I can't place two dashes next to each other.
-->

<![CDATA[
Within this Character Data block I can
use double dashes as much as I want (along with <, &, ', and ")
*and* %MyParamEntity; will be expanded to the text
"Has been expanded" ... however, I can't use
the CEND sequence (if I need to use it I must escape one of the
brackets or the greater-than sign).
]]>

Why does it look so weird?

The CDATA section is a marked section. In SGML there is both an abstract syntax as well as a concrete syntax. The abstract syntax of a marked section declaration begins with a markup declaration open(mdo) delimiter followed by a declaration subset open (dso) delimiter. A status keyword comes next followed by a second declaration subset open (dso) delimiter. A marked section ends with a marked section close (msc) delimiter followed by a markup declaration close (mdc) delimiter. Therefore the abstract syntax of a marked section declaration is:

mdo dso status-keyword dso my-data msc mdc

concrete syntax is defined for each document. This syntax is specified within the SGML declaration associated with each document. The concrete syntax defines the delimiters to be used for the document. The default SGML delimiters, which I assume are defined in ISO 8879:1986, are as follows:

  • Markup declaration open: <!
  • Declaration subset open: [
  • Marked section close: ]]
  • Markup declaration close: >

But you are free to define your own concrete syntax and so can modify the characters used as the delimiters.

Therefore the default concrete syntax of a marked section declaration is:

<![ status-keyword [my-data]]>

Possible status-keywords are: CDATA, RCDATA, IGNORE, INCLUDE, TEMP

Which brings us to:

<![ CDATA [my-data]]>

301 Permanent Redirects of non-www to www

The Problem

Search engines consider http://carra-lucia-ltd.co.uk and http://www.carra-lucia-ltd.co.uk different websites. As a result, if your website has been linked to from other websites using a mix of the two URLs you are effectively splitting the potential benefit of valuable link popularity.

The Solution

Using a 301 redirect on the “non-www” version of the URL, which is essentially a “permanent” redirect in server talk, you can effectively consolidate all of your link popularity to a single URL. This consolidation will serve to increase your website’s chances of obtaining and maintaining top rankings.

How To Enable The 301 Redirect

You need to instruct the server you are hosting your website on to redirect the traffic seamlessly. To do this you need to first establish what type of server your website is hosted on. There are two main types of servers that are in use: Microsoft and Apache (Linux/Unix). Once you have established the server type you need to follow their related instructions below. Please note this is best left to a person with some technical knowledge.

 


IMPORTANT: 301 redirects are a critical step in ensuring your website is search engine friendly. That said, there are over 120 elements that also contribute to maximum search engine friendliness. These elements are discovered by conducting an effective SEO Website Audit.

 

A) Installing the Non-WWW 301 Redirect on an Apache Server

  1. Ensure that your hosting provider has the Apache Rewrite Module turned on; this is a definite requirement for this fix to work. In most cases your hosting provider will not have a problem enabling the module if it isn’t already enabled (it seems to be on in most circumstances).If you have access to the httpd.conf file on your server then you can actually enable the module yourself. Open the httpd.conf file, back it up somewhere in case of error (you cannot be too safe) and then uncomment the following line:
    LoadModule rewrite_module modules/mod_rewrite.so
    Once the line is uncommented, save the file and restart the server then proceed with the following steps.
  2. Download the .htaccess file from your website’s root web folder to a folder on your machine where you can edit it.
  3. Make a copy of the .htaccess file and save it somewhere else for safe keeping in case you need to revert to the old version – do not edit this version.
  4. Open the original .htaccess you downloaded in Notepad
  5. Add the following code (in red) into the .htaccess file. Be sure to substitute “example.com” with your own website information but touch nothing else.
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example.com
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
  6. Upload the file back to your website in the exact same place you downloaded it.
  7. Once the upload is complete open a browser and try visiting the “non-www” version of your website address. If the .htaccess is working as it should you will be redirected immediately to the proper “www” version of your website. This will be reflected in your browser’s address bar.
  8. To be 100% certain this has worked appropriately I suggest visiting this URL and typing in your “non-www” website address into the HTTP Server Header Checker. This tool will show you whether the 301 redirect is being provided by the server. This is what a search engine will see when it visits the site. The result should look like the following areas in red:
    #1 Server Response: http://example.com
    HTTP Status Code: HTTP/1.1 301 Moved Permanently
    Date: Wed, 14 Mar 2007 22:49:28 GMT
    Server: Apache/1.3.27 (Unix) PHP/4.4.1 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.6b
    Location: http://www.example.com/
    Connection: close
    Content-Type: text/html; charset=iso-8859-1
    Redirect Target: http://www.example.com/#2 Server Response: http://www.example.com/
    HTTP Status Code: HTTP/1.1 200 OK
    Date: Wed, 14 Mar 2007 22:49:28 GMT
    Server: Apache/1.3.27 (Unix) PHP/4.4.1 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.6b
    Connection: close
    Content-Type: text/html
  9. If the redirect worked you are done! Congratulations.If this has not worked you need to restore the backup you made of the .htaccess file to your website. After the backup is restored go back and review the revised .htaccess on your computer, compare the information to the instructions above and make sure there were no mistakes. If no mistakes are found your server may require custom programming which is beyond the scope of this FAQ; please contact your hosting provider for more information.

B) Installing the Non-WWW 301 Redirect on a Microsoft IIS Server

Microsoft servers do not have a .htaccess file to alter so we suggest that you contact your hosting provider and request they make this change for you. If they are baffled or need further instructions on how to make the changes you can refer them to the tutorials referenced below:

  1. Using Internet Services Manager create a new IP-based website using the http://xyzname.comURL or alternatively you can avoid using a unique IP by using the host header (virtual website) ofwww.xyzname.com.
  2. Now verify the server headers for each website using the Server Header Checker. The server response should be 200 OK for both addresses.
  3. Now add your domain-revised version of the following ASP code to the default home page forhttp://xyzname.com:
    < %@ Language=VBScript %>
    < %
    Response.Status=”301 Moved Permanently”
    Response.AddHeader “Location”, http://www.xyzname.com
    %>
    Note: do not change the spacing or line placement within the above code; place it as is.
  4. Once the default page is online first visit your website via http://xyzname.com to ensure the redirect is working. Next check the server headers for http://xyzname.com and make sure you see the following code within #1: “HTTP Status Code: HTTP/1.1 301 Moved Permanently”. That code will confirm the 301 redirect is being properly communicated.

ASP.NET CODE TO DO A 301 REDIRECT (VB.NET)

Private Sub Page_BeginRequest(sender As Object, e As EventArgs) Handles Me.BeginRequest

Dim myContext As HttpContext = HttpContext.Current

Dim currentUrl As String = myContext.Request.Url.ToString().ToLower()
If (currentUrl.Contains(“http://domain.com“)) Then
myContext.Response.Status = “301 Moved Permanently”
myContext.Response.StatusCode = 301

myContext.Response.AddHeader(“Location”, currentUrl.Replace(“http://domain.com“, “http://www.domain.com“))

End If
End Sub

Dim myContext As HttpContext = HttpContext.Current

MCPD Course 1 – Implementing Master Pages and User Controls

Implementing Master Pages


A professional web site will have a standardized look across all pages.

For example, one popular layout type places a navigation menu on the left side of the page, a copyright on the bottom, and content in the middle. It can be difficult to maintain a standard look if you must always put the common pieces in place with every web form you build. In ASP.NET 2.0, master pages will make the job easier. You’ll only need to write the common pieces once – in the master page. A master page can serve as a template for one or more web forms. Each ASPX web form only needs to define the content unique to itself, and this content will plug into specified areas of the master page layout.

Estimated lesson time: 55 minutes
Estimated lab time: 30 minutesIC147301
Goal:
– Create a Master Page
– Create a content Page
Creating a Master Page

To add a master page to a web project, right-click your web project in the Solution Explorer window, select Add New Item, and select the Master Page item type from the Add New Item dialog.

The generated master page will have the extension “.master” as opposed to “.aspx” for an ASP.NET form and will start with the following tag:

  
<%@ Master Language="VB" CodeFile="Site.Master.vb" Inherits="Site" %>


You can have as many master pages as you want per website and implement different layouts in each. You can then set different pages to use different master pages.

Master pages will define the <html>, <head>, <body >, and <form>, tags. A new control, the ContentPlaceHolder control also appears in our master page.
You can have one or more ContentPlaceHolder controls in a master page.
ContentPlaceHolder controls are where we want our ASPX web forms to place their content.

You can see in the picture below the two ContentPlaceHolders generated when the master page was created.

The head ContentPlaceHolder can be used to store meta tags which are individual to each page and the MainContent can be used to store the different page contents.  Just like any ASPX form, our master page can contain code in a <script> block, or in a code-behind file, and can respond to page lifecycle events. The MasterPage class (from the System.Web.UI namespace) derives from UserControl and will have all of the usual events: Init, Load, PreRender, etc.

 

Plugging In Content


The ASPX web forms we use to put content into master pages are plain .aspx files, although with a few differences. When you add a new ASPX web form to a project you’ll have the option of associating the web form with a master page.

Doing so will place a MasterPageFile attribute in the @ Page directive for the web form.

The attribute points to the .master file you have selected (you can have multiple master pages in a web project). The source code below is for a default.aspx file using the site.master master page we defined earlier.

   
<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master"
    AutoEventWireup="false"
    CodeFile="Default.aspx.vb" Inherits="_Default" %>

 

A web form associated with a master page is called a content page.
A content page may only contain markup inside of Content controls.
If you try to place any markup or controls outside of the Content controls, you’ll receive a compiler error:
Only Content controls are allowed directly in a content page that contains Content controls.

Each Content control in a content page maps to exactly one of the ContentPlaceHolder controls in the Master Page.
You do not need to define a content control for every ContentPlaceHolder control in the master.

If a Content control doesn’t exist for a place holder, the master page will simply render the default content inside of the ContentPlaceHolder of the master page (we did not define any in this example).

The runtime examines the ID of each Content control and finds a ContentPlaceHolder with a matching ID. When the runtime finds the match it will take the markup and controls inside the Content control and insert them into the ContentPlaceHolder of the master page. Even though our Content controls in this example do not contain any server side controls, like GridView controls and Calendar controls, any ASP.NET control can appear inside the Content areas.

One benefit to working with master pages in the Visual Studio IDE is the built-in design support for master pages. The screen below shows our default.aspx form in a design time view. The Content controls are the only editable sections of the form. The master page markup displays in design view, but since we are editing default.aspx and not otc.master in the screen shot, the sections defined by the master page are un-editable and ghosted out. This gives designers and developers a clear idea of content versus the layout structure defined by the master page.

 

Programatically Working With Master Pages

 

The MasterPage class derives from UserControl. The master page will inject itself as the top control in a page’s control
hierarchy by clearing the page’s Controls array and adding itself to into the collection.
Doing so includes all of the markup and controls defined inside the master page in the page’s control tree.

The master page can then walk the Content controls that existed in the web form and bring them back them into the control hierarchy
in the appropriate locations. The master page injection happens after the PreInit event fires for a Page object, but before
the Init event fires.

This ordering of events outlined above is important if you want to programmatically set the master page to use for a web form with the MasterPageFile property. This property must be set in the PreInit event (or earlier), like the code below. One the master page has injected itself into the control hierarchy it is too late to try to set a new master page for the web form. If you try to set the MasterPageFile property after the PreInit event fires, the runtime will throw an InvalidOperationException.

 

Protected Sub Page_PreInit(ByVal sender As Object, _
                           ByVal e As EventArgs) _
                           Handles Me.PreInit
    ' we can select a different master page in the PreInit event
    Me.MasterPageFile = "~/Site.master"
End Sub

Another way to interact with a master page is through the Master property of a page object.
Let’s say we need to get to the Menu defined in our master page. We would like to change its background to Gray. For this, we will define a new property inside the masterpage with the following code:

       Public Property NavigationMenuBk As System.Drawing.Color
        Get
            Return NavigationMenu.BackColor
        End Get
        Set(ByVal value As System.Drawing.Color)
            NavigationMenu.BackColor = value
        End Set
    End Property

There are two approaches to touching this property.
The first is to use the Master property of the System.Web.UI.Page class, which returns a MasterPage reference.
In order to get to the Footer property, though, we would have to cast the reference to our derived master page type, like the following code.

  CType(Master, Site).NavigationMenuBk = Drawing.Color.AliceBlue

A second approach, if you know the exact master page file your page will be using at runtime,
is to let the ASP.NET page parser generate a strongly typed Master property by adding an @ MasterType
directive to your ASPX file, as shown below.

<%@ MasterType VirtualPath=”~/otc.master” %>


The MasterType directive will instruct the runtime to add a new Master property to code-generated file for the page. The new property will return a reference matching the MasterType. With a MasterType directive in place for our web form, we don’t need a cast.

    Master.NavigationMenuBk = Drawing.Color.AliceBlue

Problems with Relative URLs when Using MasterPages


As the master page and the content page can be found in different directories, referencing relative URLs (like for images) which lead to
different directories will not work properly.

The solution would be either using full path URLs (website name, directory, file name) or changing the control to run at server:

<img src="images/tree.png" alt="1" />

will be converted to:

<img src="images/tree.png" alt="1" runat="server" />

The following markup demonstrates what will work, and not work from a master page.

<!– this will break –>

<img src=”images/tree.png” alt=”1″ />

<!– this wil work –>

<!– server side control will rebase itself –>

<img src=”images/tree.png” runat=”server” alt=”2″ />

<!– this will work –>

<!– rooted references will always work, but are fragile –>

<img src=”/masterp/images/tree.png” alt=”3″ />

<!– this will break –>

<!– app relative (~) only works  on a server side control –>

<img src=”~/images/tree.png” alt=”4″ />

<!– this will work –>

<img src=”~/images/tree.png” runat=”server” alt=”5″ />         

<!– both of these will work –>

<!– the second Image will rebase URL –>

<asp:Image ID=”Image6″ runat=”server” ImageUrl=”~/images/tree.png” AlternateText=”6″  />   

<asp:Image ID=”Image7″ runat=”server” ImageUrl=”images/tree.png” AlternateText =”7″ />

  My background irelative,  and broken

  My background works

  My background is broken. URL rebasing doesn‘t work for embedded style, event with server side control.

Nested Master Pages


You can write a content page that is itself a master page, allowing an arbitrarily deep nesting of master pages.
This technique can be useful when your application is broken into sub-applications
that need to inherit a common branded look but still be able to define their own customized layout template within the brand.

To add a nested master page, Right click on Solution Explorer and choose “New Item” – Master Page and then after filling in the new master page name (for example Master2.master), tick the “Select Master Page” tickbox and pick the master page you wish to nest the new one to.

The following listing shows a master page that would serve as a content page for our first master page example.

Nested-Master-Pages-Example


Notice we must obey the rules for a content page in this master page, that is, we can only define content inside of Content controls. The ContentPlaceHolders inside of these controls can then be filled in with web forms addressing the IDs of the nested master page. A web form cannot reach the ContentPlaceHolders in the master page above it’s own master page.

The code for a content page would look like this:

<%@ Page Title="" Language="VB" MasterPageFile="~/Master2.master"
        AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" %>

<asp:Content ID="Content2" ContentPlaceHolderID="main1" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Main2" Runat="Server">
</asp:Content>

 

Master Pages and Configuration


There are three ways to associate a web form with a master page.
You can use the Master attribute in the @ Page directive, and you can write to the MasterPageFile property in the PreInit event or earlier.

If you are assinging the master page after the PreInit directive, you will receive the following exception:
The ‘MasterPageFile’ property can only be set in or before the ‘Page_PreInit’ event.

We’ve seen examples of both of these techniques. Any web form using the Master attribute of the @ Page directive or setting the MasterPageFile property programmatically will override the web.config settings.

We can also assign a default master page for all web forms in a site in our web.config file using the <pages> element. An example excerpt from web.config is shown below.

<configuration>
  <system.Web>
    <pages master="otc.master" />
  </system.Web>
</configuration>

Creating Classes and other Web Objects in .NET


VB.NET is an Object Oriented programming language. The Objects referred to are created from something called a Class. You’ve already used Classes throughout this course. But we’ll now have a closer look at them.

Object Oriented programming


oopThe modern trend in programming languages is for code to be separated into chunks. When it’s being used, each chunk of code (a chunk of code that opens text files, for example) is known as an Object. The code for the Object can then be reused whenever it is needed. Languages like C++ and Java are Object Oriented languages. Until Microsoft came out with VB.NET, the Visual Basic programming language was not OOP (object oriented programming). This time it is.

Object Oriented programming has a steeper learning curve, and things like Encapsulation, Inheritance and Polymorphism have to be digested. We’re not going quite that far in this beginner’s course. But you should have a good, basic understanding of just what Object are by the end of this section, and how to create your own Objects.

Classes and Objects


In VB.NET, a class is that chunk of code mentioned earlier. You’ve been using Classes all the time during this course. The Form you’ve started out with is a Class. If you look right at the top of the code window, you’ll see:


Public Class _Default
    Inherits System.Web.UI.Page

The word “Public” means that other code can see it. _Default is the name of the Class.

If you look at the bottom of the coding window, you’ll see End Class, signifying the end of the code for the Class.

When you place a Button or a textbox on the Form, you’re really adding it to the Form Class.

When you start the Form, VB does something called instantiation.

This basically means that your Form is being turned into an Object, and all the things needed for the creation of the Form are being set up for you (Your controls are being added, variables are being set up an initialised, etc).

And that’s the basic difference between a Class and an Object: A Class is the code itself; the code becomes an Object when you start using it.

The NET Framework


The NET Framework is something that Microsoft have invested a lot of time, effort and money into creating. It’s big. Very big.

The way that programming will be done on a Microsoft machine from now on is with NET. And not just on a Microsoft machine. There’s something called ADO.NET which is used for creating web site, and for manipulating databases. You can create applications for mobile phones and PDA’s with NET. There is even a project in the making that will allow you to write a program on a Windows machine that will then work on a computer NOT running Windows. All this is made possible with the NET Framework. But what is it?

The NET Framework is a whole lot of Classes (called Namespaces) and the technology to get those Classes to work. The main component is called the Common Language Runtime. A Runtime is the thing that gets your code to actually run on a computer. Previously, these Runtime Languages were machine or programming language specific. The Runtime that gets a Java program to work, for example, is different to the one that gets a C program to work. With NET, more than 15 different programming languages can use the Common Language Runtime. One of these languages is, of course Visual Basic NET. Another is C# (pronounce C Sharp). They can all use the Common Language Runtime because of something called the Intermediate Language. (This is a sort of translator for the various languages, and is too advanced to go into for us.)

Namespaces


A Namespace is a group of Classes which are grouped together. The System.IO Namespace you met earlier groups together Classes that you use to read and write to a file. System.Windows.Forms is another Namespace you’ve met. In fact, you couldn’t create your forms without this Namespace. But again, it is just a group of Classes huddling under the same umbrella.

System itself is a Namespace. It’s a top-level Namespace. Think of it as the leader of a hierarchy.

IO and Data would be part of this hierarchy, just underneath the leader.
Each subsequent group of Classes is subordinate to the one the came before it.

For example:

Imports System.Data
Imports System.Data.SqlClient

This means that the Data Namespace is loaded from the System Namespace. The SQlClient is a sub-class and it will be loaded from the Data Namespace which will be loaded from the System Namespace.

The dot notation is used to separate each group of Classes.

The leader of the hierarchy is still System, though. Think of it as an army.

You’d have a Private who is subordinate to a Sergeant.

The Sergeant would be subordinate to a Captain. And the Captain would be subordinate to a General.

If the General wanted something done, he might ask the Captain to do it for him. The Captain would get the Sergeant to do it, and the Sergeant would then pick on a poor Private.

So a Button would be the Private, Forms would be the Sergeant, Page would be the Captain, and System the General.

You will see this chain of command every time you type a full stop and a pop up box appears. When you’re selecting an item from the list,
you’re selecting the next in the chain of command.

 

Make your own Controls, Classes and Namespaces


The big benefit of an Object Oriented Programming language is that you can create your own Objects. (It’s an Object when you’re using the code, remember, and a Class when you’re not.)

We’ll see how to do that now, as we create a very simple Class, and then turn that into an Object.

The Class we’ll create is a very simple one, and is intended to show you the basic technique of setting up a Class, then creating an object from it. The Class we’ll create will convert the letters in a postcode to uppercase. We’ll get the postcode from a textbox on a form. Off we go then.

Start a new VB .NET project

Add a Textbox to your form, and name it txtPerson

Add a Textbox to your form, and name it txtAge

Add a Button to your form and name it btnCalculate

Once you have a new form, you need to add a Class. This is quite easy.

Right click on Project, chose Add>new item and then browse for class. Name your class Person.vb

A new page will open with the following contents:

Public Class Person

End Class

 

Properties and Methods


A class is like a car. It has properties (like colour, engine size, owner) and it has a set of actions it can do, called methods (like StartEngine, StopEngine, RunHome).

You can declare your properties using snippets (they are pre-defined pieces of code that will simplify your coding time)

To do so, right click on the blank form and choose Insert Snippet>Double click on Code Patterns>Properties, Procedures, Events. And then select Define a Property

iSnippet

iprop

As you can see there are many options available, based on what you are looking to achieve. A Read-Only Property can read but not written to.

You will now create a property called “Name”
iname
Name your private variables with an underscore and all your public ones with Capitalisation (first letter uppercase).

Declare another property called “Age” as Integer. You can easily tab through the highlited fields and changing one will change all of them.

Now we will add a method which will check whether the person is underage or not.

To define a function (which returns a result), you will use the keyword “function”. To define a procedure (which does only work and returns no result), you will use the keyword “Sub”.

        Public Function IsMinor() As Boolean
            If _age < 18 Then
                Return True
            Else
                Return False
            End If
        End Function
  • Public will make the function visible from wherever we call it.
  • Function says that we will be returning a result
  • IsMinor – function name
  • As Boolean – return type (can be any of the types defined before)
  • If … Then .. Else .. End If — this structure will validate a condition. If the condition is true, the “Then” part will be execute, otherwise the else part. End if marks the end of the statement.
  • _ageValid operators are: < (less than); > (greater than); = (equal to); <> (different); >= (greater or equal to); <= (less than or equal to)
  • Return – each function needs to have a “Return” statement where the value is sent back to the caller.
  • True/False – possible values for a Boolean result.

 

Using a class


The usage of the class is called “instantiation” – it’s when the code becomes an Object.

Dim p As New Person 'instantiate a new Person
        p.Name = txtPerson.Text 'assign the name of the person, we are using the "Set" in the property
        p.Age = txtAge.Text
        If p.IsMinor Then
            lblResult.Text = p.Name & " is minor!"      ''we are using the "Get" in the property
        Else
            lblResult.Text = p.Name & " can drink beer!"
        End If

If you would like to skip two lines of code, you can assign the name and age of the person when the object is creating by overriding the “New” method. This is called when the object is first created and can be used to populate the inner properties.

To do this, in the class, drop down the right drop-down and chose new.

inew
          Public Sub New()


will be added to the class. Copy this function and then modify the copy like in the image below:
inew2

This means that a new “Person” object can be created without parameters or with the Name and Age as parameters.

If they are specified, they will be assigned to the person details. If we look now back in the default function, we shall erase / comment out the part we have just done and put in the new code.
When you start typing the person object instantiation, you will see that all of a sudden, you have two option when you declare it (see below)

inew3

inew4

This is it! Run the project (F5) and press the button to see what you get.

HTML TUTOR

So much could be said about HTML. Right now, I am staring at over 1,200 pages of html guides (real paper pages) of which I know, maybe, 25 percent. Suffice it to say I will not go into a long tutorial here. There are plenty of great sites to become informed through, and I would recommend them to anyone who desires to learn more. One of the best is Microsoft.com. In fact, that is my standby reference on anything to do with coding.

I will however give you just a few reference pages to make this book a little more complete:

HTML Chart

HTML Special Characters

Full HTML – Web Safe Color Chart

To be brief, and skip all the ‘nonsense’ programming techie stuff, you MUST know this:

Each HTML “tag” begins with — <
and ends with </>

Make sure you always “tag”. It will almost always be the problem when you go to copy any of these scripts into your pages. 

Furthermore, you must know that each web page is composed of two MAIN parts: the head

<head>

</head>

AND the body

<body>

</body>

Simply put, we could compare the two to a human being. The “head” thinks for us, and the “body” carries out the actions. Same in HTML.

OK. That’s ALL I’m going to say about HTML. Scary? Not at all…you don’t need anymore. Let’s move on to some cool stuff. What do you say?