Tuesday, December 30, 2008

Special Features of Visual C++ .NET

With such a large change in the way Visual C++ applications are written within Visual Studio .NET, it should come as no surprise that Microsoft has added several language features to accommodate writing applications for the .NET framework while still maintaining the ability to create older Visual C++ application types. Through the addition of new language keywords, attributes, preprocessor directives, and new compiler and linker switches, the ability to create such differing styles of applications makes the task much easier.

In this tutorial, you will learn about the new special features for writing .NET applications in Visual C++ .NET.

Specifically, in this hour you will learn:

  • New language keywords

  • Attributes and how they are defined

  • Pragmas that specify managed or unmanaged code

  • Preprocessor directives

  • Compiler options

  • Linker options

What is .Net and Where is ASP.NET?

This article is desiged for those you wish to learn a little bit about the .Net framework. Not only will it show you how .Net operates, it will explain where ASP.NET fits in.What is .NET, though? If you check out Microsoft's .NET Page, it is described as

software services.

However, these pitches are just looking at one tiny facet of .NET, and looking at it from a business or corporate perspective. For developers, .NET is an entirely new design paradigm. In this article we will examine this new paradigm in easy-to-understand terms and we'll look at how ASP.NET fits in!

Dynamically Using Methods in ASP.NET

There are a lot of little known features in .NET that can sometimes prove useful in the line of duty, calling methods is one of them. Have you ever needed to get more information about a method through code? For example, is it public, what does it belong to, what are it's parameters?

You can do all of this through code and it's quite easy


This article will show you about information stored in a Type as well as the MethodInfo class and how they can be used to look at and even execute a method without actually calling it yourself.

ASP Hosting

If we want our Web Site to be visible to the world, it has to be hosted on a Web Server.
Web Server
# The collection of all our web pages is called our web site.
# To let others view our work, we must publish our web site.
# To publish our work, we must copy our site to a web server.
# Our own PC
can act as a web server if it is connected to a network.
# Most common is to use an Internet Service Provider (ISP).

Internet Service Provider
# ISP is a shortcut for Internet Service Provider.
# An ISP provides Internet services.
# A common Internet service is web hosting
.
# Web hosting means storing our web site on a public server.
# Web hosting normally includes email services.
# Web hosting often includes domain name registration.

Advantages of using an Internet Service Provider

Renting a server from an Internet Service Provider (ISP) is a common option. Here are some advantages:
Connection Speed
Most providers have very fast connections to the Internet, like full T3 fiber-optic 45Mps connections equivalent to about 2000 traditional (28K) modems or 1000 high speed (56K) modems.

Powerful Hardware

Service providers often have many powerful web servers that can be shared by several companies. You can also expect them to have an effective load balancing, and necessary backup servers.
Security and Stability
Internet Service Providers are specialists on web hosting. Expect their servers to have more than 99% up time, the latest software patches, and the best virus protection.

How to select Internet Service Provider

24-hour support

Make sure our Internet service provider offers 24-hours support. Don’t put our self in a situation where we cannot fix critical problems without having to wait until the next working day. Toll-free phone could be vital if we don’t want to pay for long distance calls.

Daily Backup

Make sure our service provider runs a secure daily backup routine; otherwise we may lose some valuable data.

Traffic Volume

Study the provider’s traffic volume restrictions. Make sure that we don’t have to pay a fortune for unexpected high traffic if our web site becomes popular.

Bandwidth or Content Restrictions

Study the provider’s bandwidth and content restrictions. If you plan to publish pictures or broadcast video or sound, make sure that we can.

Email Capabilities

Make sure our provider fully supports the email capabilities we need.

Database Access

Make sure our provider fully supports the database access we need if we plan to use databases from our site.

Domain Name

A Domain Name is a unique name for our web site.
Choosing a hosting solution should include domain name registration.
Our domain name should be easy to remember and easy to type.

Hosting Capacities

Make sure we get the disk space, Connection speed and the traffic volume we need.

Hosting Email Services

Hosting services should include proper Email Accounts and Email Services.

Web Hosting Server Technology

ASP Domains

# A Domain Name is a unique name for our web site.
# Choosing a hosting solution should include domain name registration.
# Our domain name should be easy to remember and easy to type.

A domain name is a unique name for a web site, like google.com and w3schools.com.
Domain names must be registered. When domain names are registered they are added to a large domain name register, and information about our site - including our internet IP address - is stored on a DNS server.
DNS stands for Domain Name System. A DNS server is responsible for informing all other computers on the Internet about our domain name and our site address.

Registering a Domain

Domains can be registered from domain name registration companies. These companies provide interfaces to search for available domain names and they offer a variety of domain name extensions that can be registered at the same time.
Domain Name Registration provides registration services for .com .net .org .biz .info .us .nu .ws .cc and .tv domains.
Newer domain extensions such as .biz .info and .us have more choices available as many of the popular domains have yet to be taken. While .com and .net domains are well established and recognized, most popular domains with these extensions are already registered.

Choosing Our Domain

Choosing a domain is a major step for any individual or organization.
While domains are being registered at a record, new domain extensions and creative thinking still offer thousands of excellent choices. When selecting a name it is important to consider the purpose of a domain name, which is to provide people an easy way to reach our web site. The best domains have the following characteristics:
Short - People don’t like to type! The shorter our domain, the easier it is to reach and the less are the chance the user will make a typographical error while typing it.

Meaningful - A short domain is nothing without meaning, 69j5mw72.com is only 8 characters long but would not be easy to enter or remember. Select a domain that relates to your site in a way that people will understand.
Clear - Clarity is important when selecting a domain name. We should avoid selecting a name that is difficult to spell or pronounce. Also, pay close attention to how our domain sounds and how effectively it can be communicated over the phone.

Setting up a Test Server on Your Own Computer

When you’re developing a website, you need to see it in action on a real server, to see how it will work. While you could upload your pages to your web host every time you make a change, this quickly gets time-consuming and tiresome. Wouldn’t it be great if you could have a little test server of your own? Well, the server is nothing but a piece of software – so you can! Please note that, for the purposes of this article, I will assume you’re using Windows as your operating system.

Installing an IIS Test Server.

While using IIS isn’t recommended, a test server is very easy to install. All you need to do is open ‘Add or Remove Programs’ in Windows’ control panel. All you need to do is click Internet Information Services (IIS), click OK, and you’re done.

Of course, there are downsides to this. Many versions of Windows don’t come with IIS, and there’s no way to install it on them – Windows XP Professional, for example, comes with IIS, but Windows XP Home does not. You might also want to consider that installing IIS on your computer will often make it less secure.

Installing an Apache Test Server.

Compared to installing IIS, installing Apache is hard – Linux distributions all have relatively easy ways of doing it, but Windows wasn’t designed for it. To get Apache installed, then, you’re going to need to have a little fight with the system.

Note: If you want to skip all the following steps, you might consider using an ‘easy installer’ version of Apache, such as XAMPP (for Windows), which you can get at www.apachefriends.org/en/xampp-windows.html. The downside to this approach is that you will be relying on them to provide new releases, instead of being able to update things yourself.

First of all, download Apache from http://httpd.apache.org/download.cgi. Make sure you download the Windows Installer (MSI) version. You’ll find it easiest to make the server run as a service, as this will make it run automatically – Apache will appear in your system tray (in the bottom-right corner of your screen).

Now, you need to find your Apache configuration file. In the folder where you installed Apache, look for another folder named ‘conf’, and then a file named ‘httpd.conf’. Open this file and look for a setting called DocumentRoot. You should change this to point to a folder on your hard drive, such as ‘c:/html’.

Now, you’ve got Apache, but that’s not usually much good on its own. The chances are that you’ll want to install PHP and MySQL as well, so here’s how:

Download PHP from http://www.php.net/downloads.php. Again, go for the installer. Once you’ve installed PHP, find its folder, and rename the php.ini-dist file there to php.ini. Find the ‘doc_root’ setting there, and set it to the same thing you set Apache’s to.

Back in Apache’s httpd.conf, you should add these lines:

LoadModule php5_module “c:/php/php5apache2.dll”
AddType application/x-httpd-php .php
PHPIniDir “c:/php”

ASP Scripting Languages

An ASP file normally contains HTML tags, just like an HTML file. However, an ASP file can also contain server scripts, surrounded by the delimiters < % and %>. Server scripts are executed on the server, and can contain any expressions, statements, procedures, or operators valid for the scripting language we prefer to use.

VBScript

• VBScript is a scripting language
• A scripting language is a lightweight programming language
• VBScript is a light version of Microsoft’s programming language Visual Basic
When a VBScript is inserted into a HTML document, the Internet browser will read the HTML and interpret the VBScript. The VBScript can be executed immediately, or at a later event.

Scripts in a page will be executed immediately while the page loads into the browser. This is not always what we want. Sometimes we want to execute a script when a page loads, other times when a user triggers an event.
Scripts to be executed when they are called or when an event is triggered go in the head section. When we place a script in the head section we will assure that the script is loaded before anyone uses it.
When we place a script in the body section it generates the content of the page.

JavaScript

To set JavaScript as the default scripting language for a particular page you must insert a language specification at the top of the page: