Friday, September 3, 2010

How to create flashy effects for webpages

When you entered this page, you probably noticed that the screen dissolved from the previous one to the actual page. Nothing was wrong with your computer, it was the work of the new Flashy Introduction META tag. This tag, unfortunately, is only compatible with IE4+, but provides a great effect (and allows normal viewing in Netscape). The META tag is very easy to insert, once you know how to use it. This is the script:
<META http-equiv="Page-Enter" content="revealTrans(Duration=#,Transition=#)">
You will need to change two parts of this code. First, you will need to change the blue # after Duration to the number of seconds that you want the Flashy Introduction to take. Then, you will need to change the blue # after Transition to the number of the type of transition that you want the Flashy Intro to do. A list of what each number in Transition does is provided below. Once you make those two, small changes, insert the tag in the HEAD of your page.
The Transition # list:

    0   - Shrinking Box Changes Screen 1   - Growing Box Changes Screen 2   - Shrinking Circle Changes Screen 3   - Growing Circle Changes Screen 4   - Wipes Up to Clear Screen 5   - Wipes Down to Clear Screen 6   - Wipes Right to Clear Screen 7   - Wipes Left to Clear Screen 8   - Right Moving Stripes Clear Screen 9   - Downward Moving Stripes Clear Screen 10 - Right Moving Boxes Clear Screen 11 - Downward Moving Boxes Clear Screen 12 - Pixels "Dissolve" screen 13 - Horizontal Curtain Closing 14 - Horizontal Curtain Opening 15 - Vertical Curtian Closing 16 - Vertical Curtian Opening 17 - Strips away previous screen going Left-Down 18 - Strips away previous screen going Left-Up 19 - Strips away previous screen going Right-Down 20 - Strips away previous screen going Right-Up 21 - Horizontal Bars "Dissolve" screen 22 - Vertical Bars "Dissolve" screen 23 - Random Effect
A full example:
<META http-equiv="Page-Enter" content="revealTrans(Duration=5,Transition=21)">

How to open a new console when someone enters or leaves your site

You've probably seen this on some web sites. When you enter the site, but more frequently when you leave the site, a console pops up with some additional info or ads, or a poll etc. This can be done using Java script.
To Open A Console When Someone Enters Your Site:
<script language="JavaScript">
<!--
window.open('http://www.freewebmastertips.com','HB','toolbar=1, location=1,status=1,menubar=1, scrollbars=1,resizable=1, width=500,height=300');
// -->
</script>

Just place the above code within the BODY tags.
To Open A Console When Someone Leaves Your Site:
Place the following attribute in the <body> tag: onunload="leave()"
For example:
<body bgcolor="#000000" onunload="leave()">
Place the following code between the "</head>" and <body> tag.
<script language="JavaScript">
<!--
var exit=true;
function leave()
{
if (exit)
open("http://www.freewebmastertips.com",'HBexit','toolbar=1,location=1, status=1,menubar=1,scrollbars=1,resizable=1, width=500,height=300');
}
// -->
</script>

Now you will have a console popping up everytime you leave the site. So make sure you use the below attribute in the <a href> tag on links to avoid the exit console from popping up on sponsors and other links where this is not desired.
onclick="exit=false"
For example:
<A HREF="http://www.anydomain.com" onclick="exit=false">
NOTE: Make sure you keep the long string of codes intact; if you break them, they won't work (and that's why this page is different also). To customize the codes, replace the URL in red with the one of your choice. Oh, don't overdo this because your visitors will get annoyed.

Tuesday, August 3, 2010

JavaScript Tutorial.

JavaScript is a simple programming language built into Netscape 2.0 and greater. It is integrated with and embedded in HTML. It allows greater control of web page behavior than does HTML alone. Since the JavaScript interpreter is part of Netscape, it is platform-independent: JavaScript incorporated into HTML runs on Windows, Macintosh, and other Netscape-supported systems. Lets start comprehensive JavaScript Tutorial and enjoy.

Friday, June 12, 2009

Web Host - Host Yourself!

There are very few reasons to host yourself these days. Web servers are faster than ever, prices are down, and the majority of internet sites use such a small portion of a web server's resources that a large number of web sites can be hosted by a single server without any negative side effects. However, if you are thinking about hosting yourself, you should first see if you meet any/all of the following requirements:
  • You are technologically savvy individual.
  • Understand the basic issues in securing a server.
  • You have access to a broadband internet connection for the server.
  • Have a large amount of time to allocate for this project.
  • Excellent problem solving skills.

If you believe this pretty much describes you, then hosting your own server may be a reasonable solution. However, if you do not meet these requirements, we suggest that you skim through this information and continue on with Web Host guide. Chances are setting up your own server would only be an unnecessary headache.

Server Requirements

There are many things to consider when setting up your own web server. We have a compiled a short list of a few key items:

  • A computer that can be dedicated as a web server, not as a personal computer.
  • An NIC (Network Interface Card) and a broadband connection. A high upload rate is of the utmost importance.
  • A computer that will be enough to keep up with server requests. Processor intensive web sites will require a higher quality PC than a web site that only has a few static HTML pages.
  • Installed copy of the Linux OS. Though any OS can serve a web site, Linux is one of the most popular server OSes and is becoming an industry standard.
  • An ISP or Internet Connection that supports web traffic. Many ISPs will not allow users to run a web server unless they pay an additional fee. Contact your ISP for more details

Most of those items should be easy enough, except for the Linux OS. It is possible to serve a web site using the Windows operating system, but many more security issues need to be addressed than with the Linux OS. If you would like to learn more about linux, read a Beginner's Tutorial to get your feet wet.

Windows Hosting Information

If you have chosen to stay with windows to host your web site, please take a look at these tutorials on how to set up a Windows-based web server.

  • Windows Web Server - A steb-by-step process of building a windows web server.
  • Windows 2003 - A great resource for setting up a Windows 2003 based server.

The most important part of getting a windows server ready is to ensure that IIS/PWS (different name for different versions of Windows) is installed. Without installing this you will not be able to serve web documents to the public. If you are using Windows ME or XP Home Edition there is not a safe way to install IIS/PWS to your system. You will either have to use a different OS or install a different version of Windows.

  • XP Pro - XP Pro IIS Installation Guide.
  • Windows 98 - Windows 98 PWS Installation Guide.

Linux Hosting Information

There are many flavors of Linux to choose from. The most popular are RedHat, Slackware, and Debian. If you are new to Linux, do not worry. Many web sites are out there that will teach you all the need-to-know information to get started with linux. Here are a few helpful web sites:

There is a huge community that supports linux and most are more than happy to answer your questions, provided that you have done a little research prior to asking your question. If you have any problems with getting linux to run, the place to ask your questions is at Linux Questions.

Web Host - Research

Many variables should be considered when selecting a web host. Does the host provide the right features, databases, price, etc? The quality of a web host can make the difference between a lifetime web visitor for your web site and an annoyed first timer who will never return.

If the web host has a slow connection to the internet or a poor uptime percentage, then a web surfer would experience a boringly long delay waiting for the pages to load. In the worst case, they may simply get an Error 404 page not found! Nevertheless, there are a few steps that can be taken to find that great host and to help avoid web hosting lemons.

Quantity Research

Before you even begin to consider locking in and purchasing a web host, be sure to visit a number of random web hosts. This will allow you to get a feel for pricing standards and understand what features go with what price. Be sure to pay attention to the following:

  • Price per GB of bandwidth
  • Price per GB of storage
  • Number of databases
  • Number of domains and sub-domains allowed per account
  • Standard features - FTP access, Email features, hot link protection, etc.

After getting an idea for the standards pricing for these key items move on to quality research.

Quality Research

Now that you understand what features and prices are offered by certain hosts, how do you decide if these particular hosts are of exceptional quality? Ideally, you would have several recommendations from friends and associates that you could pick from.

However, if this is not the case, then you will have to research yourself. This step is extremely difficult because many web sites earn a huge commission by offering excellent reviews for certain hosts.

However, there are a collection of web host review sites that may be of use. Tizag.com is currently working on an impartial list of hosting providers and if you think that is a good deal, please tell us! Write to us on our Contact Form and let us know that you would be interested in our recommendations.

Server Latency

Hosts may advertise "lightning fast speeds" and "99.999%" uptime, but you can check for yourself how fast their servers are by doing a simple "ping" against their server. A ping sends a small packet of data and calculates the time it takes to get a response from the server. Ideally, you would ping a web site that you know is hosted by the company, to test the host's actual performance. To ping a web host on Windows XP just follow these instructions:

  1. Click Start
  2. Select Run
  3. Type "cmd" (without the quotes) and click OK
  4. In the command prompt type: ping www.sitenamehere.com
  5. You may also ping the IP address, for example: ping 127.0.0.1

The ping will then be executed four times (default value) and a small report of average, minimum, and maximum respone times will be displayed. Note: if you are constantly getting a "time out" message, even though you can access the web site via a web browser, the server may have pinging disabled.

Conclusion

We hope you found this guide useful and will tell others about it. Take care and watch out for those hosting lemons!

Sunday, June 7, 2009

What is SQL?

  • SQL stands for Structured Query Language
  • SQL allows you to access a database
  • SQL is an ANSI standard computer language
  • SQL can execute queries against a database
  • SQL can retrieve data from a database
  • SQL can insert new records in a database
  • SQL can delete records from a database
  • SQL can update records in a database
  • SQL is easy to learn

SQL is a Standard - BUT....

SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database systems. SQL statements are used to retrieve and update data in a database. SQL works with database programs like MS Access, DB2, Informix, MS SQL Server, Oracle, Sybase, etc.

Unfortunately, there are many different versions of the SQL language, but to be in compliance with the ANSI standard, they must support the same major keywords in a similar manner (such as SELECT, UPDATE, DELETE, INSERT, WHERE, and others).

Note: Most of the SQL database programs also have their own proprietary extensions in addition to the SQL standard!


SQL Database Tables

A database most often contains one or more tables. Each table is identified by a name (e.g. "Customers" or "Orders"). Tables contain records (rows) with data.

Below is an example of a table called "Persons":

LastName FirstName Address City
Hansen Ola Timoteivn 10 Sandnes
Svendson Tove Borgvn 23 Sandnes
Pettersen Kari Storgt 20 Stavanger

The table above contains three records (one for each person) and four columns (LastName, FirstName, Address, and City).


SQL Queries

With SQL, we can query a database and have a result set returned.

A query like this:

SELECT LastName FROM Persons

Gives a result set like this:

LastName
Hansen
Svendson
Pettersen

Note: Some database systems require a semicolon at the end of the SQL statement. We don't use the semicolon in our tutorials.


SQL Data Manipulation Language (DML)

SQL (Structured Query Language) is a syntax for executing queries. But the SQL language also includes a syntax to update, insert, and delete records.

These query and update commands together form the Data Manipulation Language (DML) part of SQL:

  • SELECT - extracts data from a database table
  • UPDATE - updates data in a database table
  • DELETE - deletes data from a database table
  • INSERT INTO - inserts new data into a database table

SQL Data Definition Language (DDL)

The Data Definition Language (DDL) part of SQL permits database tables to be created or deleted. We can also define indexes (keys), specify links between tables, and impose constraints between database tables.

The most important DDL statements in SQL are:

  • CREATE TABLE - creates a new database table
  • ALTER TABLE - alters (changes) a database table
  • DROP TABLE - deletes a database table
  • CREATE INDEX - creates an index (search key)
  • DROP INDEX - deletes an index

Create a Database

The CREATE DATABASE statement is used to create a database in MySQL.

Syntax

CREATE DATABASE database_name

To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection.

Example

In the following example we create a database called "my_db":

$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
?>


Create a Table

The CREATE TABLE statement is used to create a database table in MySQL.

Syntax

CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
column_name3 data_type,
.......

)

We must add the CREATE TABLE statement to the mysql_query() function to execute the command.

Example

The following example shows how you can create a table named "Person", with three columns. The column names will be "FirstName", "LastName" and "Age":

$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Create database
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
// Create table in my_db database
mysql_select_db("my_db", $con);
$sql = "CREATE TABLE Person
(
FirstName varchar(15),
LastName varchar(15),
Age int
)";
mysql_query($sql,$con);
mysql_close($con);
?>

Important: A database must be selected before a table can be created. The database is selected with the mysql_select_db() function.

Note: When you create a database field of type varchar, you must specify the maximum length of the field, e.g. varchar(15).


MySQL Data Types

Below is the different MySQL data types that can be used:

Numeric Data Types Description
int(size)
smallint(size)
tinyint(size)
mediumint(size)
bigint(size)
Hold integers only. The maximum number of digits can be specified in the size parameter
decimal(size,d)
double(size,d)
float(size,d)
Hold numbers with fractions. The maximum number of digits can be specified in the size parameter. The maximum number of digits to the right of the decimal is specified in the d parameter

Textual Data Types Description
char(size) Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis
varchar(size) Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis
tinytext Holds a variable string with a maximum length of 255 characters
text
blob
Holds a variable string with a maximum length of 65535 characters
mediumtext
mediumblob
Holds a variable string with a maximum length of 16777215 characters
longtext
longblob
Holds a variable string with a maximum length of 4294967295 characters

Date Data Types Description
date(yyyy-mm-dd)
datetime(yyyy-mm-dd hh:mm:ss)
timestamp(yyyymmddhhmmss)
time(hh:mm:ss)
Holds date and/or time

Misc. Data Types Description
enum(value1,value2,ect) ENUM is short for ENUMERATED list. Can store one of up to 65535 values listed within the ( ) brackets. If a value is inserted that is not in the list, a blank value will be inserted
set SET is similar to ENUM. However, SET can have up to 64 list items and can store more than one choice


Primary Keys and Auto Increment Fields

Each table should have a primary key field.

A primary key is used to uniquely identify the rows in a table. Each primary key value must be unique within the table. Furthermore, the primary key field cannot be null because the database engine requires a value to locate the record.

The primary key field is always indexed. There is no exception to this rule! You must index the primary key field so the database engine can quickly locate rows based on the key's value.

The following example sets the personID field as the primary key field. The primary key field is often an ID number, and is often used with the AUTO_INCREMENT setting. AUTO_INCREMENT automatically increases the value of the field by 1 each time a new record is added. To ensure that the primary key field cannot be null, we must add the NOT NULL setting to the field.

Example

$sql = "CREATE TABLE Person
(
personID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(personID),
FirstName varchar(15),
LastName varchar(15),
Age int
)";
mysql_query($sql,$con);