Quick Links to Information on this Page
HTML | Color | Cascading Style Sheets | Javascript | Flash/Actionscipt | Director/Lingo
Fonts | Photoshop | Graphics | Audio/Sounds | Digital Video | ASP | ASP.NET | CGI/Perl
htaccess | Apache | Webalizer | VSFTP | VB.NET | SQL | Excel | Word | Visio | Outlook

HTML

How can I link to a location within the same page?

<a name="NAME"></a>
Creates a target location within a document

<a href="#NAME"></a>
Links to that target location from elsewhere in the document

How can I add the Subject to a mailto: link?

Here's an example for whoever@somewhere.com.
In the Hyperlink Properties form change your link as shown below:

mailto:whoever@somewhere.com?subject=This is your subject

This writes the HTML code as shown below.

<a href="mailto:whoever@somewhere.com?subject=This is your subject">whoever@somewhere.com</a>

You can pre-fill other fields as well by separating the entries with a &. To do that, just replace subject with body, cc, bcc, etc.

For example: mailto:whoever@somewhere.com?cc=you@theretoo.com&body=This is your body text.

How do I embed audio into my web pages?

Easy enough... just copy the following and replace the sound.wav with the actual name of the sound file .

<EMBED SRC="sound.wav" AUTOSTART=TRUE>
If the sound you wish to offer is large (over 20k), you may want to give your visitors the ability to choose not to hear it. Remember, there are people who still are using 14.4kbps modems (or less). You can offer the sound as a link -- like this:

<A HREF="sound.wav">Listed to this cool sound.</A>

These examples assume that your sound file is in the same directory as the page calling it.

How do I embed windows media digital video into my web pages?

Embedding involves adding the OBJECT and EMBED tags to your HTML code. The OBJECT tag is read by Internet Explorer and the EMBED tag is read by other browsers such as Netscape (including IE for Macintosh).

<object id="MediaPlayer1" width=320 height=240
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<param name="Filename" value="myMovie.asf">
<param name="AutoStart" value="true">
<param name="ShowControls" value="false">
<param name="ShowStatusBar" value="false">
<embed type="application/x-mplayer2" name="MediaPlayer1" pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="240" src="myMovie.asf" showcontrols="0" ShowStatusBar="0">
</embed>
</object>

The object tag is used by Internet Explorer.
The id attribute uniquely identifies this player from others that may be on the page. It can be any value you would like.
The classid attribute is what tells Internet Explorer what kind of media this is. The long value must be entered precisely. This code tells IE to use the Windows Media Player control to play the media content.
The codebase attribute tells IE where to go to download Windows Media Player if version 6.4+ is not on the computer. It will automatically install in IE. Notice the Version information at the end of the line, this tells IE which version is needed to display the content and shouldn't be modified.
The standby value will display while the new WiMP is downloading and installing.
The type attribute is important because it tells IE what kind of plugin to use.

Each param gives additional information to the WiMP control.
Filename is the reference to the file you want to play. The example above indicates that the media file (myMovie.asf) is in the same folder as the Web page that contains this code. It could also be an absolute value, such as http://www.webserver.com/movies/myMovie.asf or if you are streaming from a Windows Media Server, it will be something like mms://www.windowsmediaserver.com/wmyMovie.asf. IF YOU ARE STREAMING, ALWAYS USE AN ASX FILE. Entering the path to the streaming media file directly in your Web page is inviting hackers to try to attack your media server. This is a lesson learned the hard way. Trust us! In fact, we suggest always using an ASX file, even if you're not streaming.

The autostart attribute determines whether the clip starts playing automatically or not.

The ShowControls param controls whether the Play, Pause, Stop, Volume control, time slider, and other controls appear below the embedded media. I suggest always displaying the controls, though we did not to demonstrate that they can be hidden.

That's it for the object tag (except for width and height, which I'll discuss in a minute). Now let's take a look at the embed tag. Notice that the closing </object> tag is AFTER the closing embed tag.

Embed is used by all browsers except IE on Windows.
The type attribute is vital. It tells the browser what program to use to display the content. It must be set to application/x-mplayer2.
The name attribute uniquely identifies this plugin on the page.
Pluginspage tells the browser where to send the user if they do not have the Windows Media Player plugin.
The src attribute should be the same as in the object tag.
Showcontrols works the same as in the object tag, except the value should be 0 instead of false.

EMBED TAG ATTRIBUTES SHOULD BE SET TO 0 FOR FALSE, 1 FOR TRUE. Although true and false are supposed to work, they are very buggy. True or false might work for one attribute, but not another. ALWAYS USE 1 OR 0 FOR EMBED TAG ATTRIBUTES.

If you do not display the controls (set to false in </object> and 0 in </embed>) as we did in the example above, then set the width and height to the width and height you want your movie to display.

If you turn on controls (play, pause, stop, volume, etc. by setting the ShowControls param to true and the showcontrols attribute to 1 (or remove both of them, the default is to show the controls), then you will need to add 46 pixels to the height of your movie. The width is 320 and the height is 286 (240 + 46)

<object id="MediaPlayer1" width=320 height=286
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<param name="Filename" value="myMovie.asf">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="ShowStatusBar" value="false">
<embed type="application/x-mplayer2" name="MediaPlayer1" pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="286" src="myMovie.asf" showcontrols="1" ShowStatusBar="0">
</embed>
</object>

You can also enable what is called the status bar. The status bar shows the current status of the movie (playing, stopped, buffering) and the duration and elapsed time of the clip. Display the status bar by adding <param name="ShowStatusBar" value="true"> within the </object> tag and the showstatusbar="1" attribute to the </embed> tag.

Add 26 pixels to the height attribute if the status bar is enabled. You should always display the status bar if you are playing audio only or if you are streaming from a Windows Media Server. The status bar shows the streaming status.

If both controls and status bar are enabled, you will add 72 pixels to the height of the movie. Width is still 320. Height is set to 312, which is 240 (the movie height) + 46 (controls height) + 26 (status bar height).

<object id="MediaPlayer1" width=320 height=312
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<param name="Filename" value="myMovie.asf">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="ShowStatusBar" value="true">
<embed type="application/x-mplayer2" name="MediaPlayer1" pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="312" src="myMovie.asf" showcontrols="1" ShowStatusBar="1">
</embed>
</object>

To use an asx file, develop a ASX file containing the following code: (Use notepad)

<asx version="3.0">
<title>Simple ASX</title>
<author>John Smith</author>
<entry>
<title>An Entry in a simple ASX</title>
<author>John Smith</author>
<ref href="mms://devweba/myMovie.asf" />
</entry>
</asx>

I saved the above file as myMovie.asx

Then embed the link to the asx file in your web page.

<object id="MediaPlayer1" width=320 height=312
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<param name="Filename" value="myMovie.asx">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="ShowStatusBar" value="true">
<embed type="application/x-mplayer2" name="MediaPlayer1" pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="312" src="myMovie.asx" showcontrols="1" ShowStatusBar="1">
</embed>
</object>

How do I set the width and height of an image to 100% or how do I set an image to full screen at all resolutions?

<IMG SRC="yourImage.jpg" style='WIDTH:100%;HEIGHT:100%'>

How do I make an iFrame have no border?

Add the following line to the HTML code for the iFrame:

frameborder="0"

Like this:

<iframe src="yourPage.html" width="200" height="250" frameborder="0" allowtransparency="true" id="idFrame" name="idFrame">Alternative text for browsers that do not understand IFrames.</iframe>

How do I make the background of an iFrame be transparent?

Add the following line to the HTML code for the iFrame:

allowtransparency="true"

Like this:

<iframe src="yourPage.html" width="200" height="250" frameborder="0" allowtransparency="true" id="idFrame" name="idFrame">Alternative text for browsers that do not understand IFrames.</iframe>

How do I make a Javascript menu appear above a Flash Movie?

Add the following line to the HTML code for the Flash movie:

<param name="wmode" value="transparent">

Below is an example:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="130" height="98">
<param name=movie value="yourmovie.swf">
<param name=quality value=high>
<param name="wmode" value="transparent">
<embed src="yourmovie.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="130" height="98">
</embed>
</object>

How do I make a different page load after a given number of seconds?
How do I redirect to a different page after a given number of seconds? How do I refresh to a different page after a given number of seconds?

Add the following META tag in the HEAD section of you web page

<META HTTP-EQUIV="refresh" CONTENT="(number of seconds); url=(page to load)">

Below is an example:

<head>

<META HTTP-EQUIV="refresh" CONTENT="3; url=yourpage.html">

</head>

This will load the page "yourpage.html" after 3 seconds

Color

Yellow: FFFF00

White: FFFFFF

Red: FF0000

Green: 00FF00

Blue: 0000FF

Black: 000000

Light Gray: CCCCCC

Darker Gray: 999999

Even Darker Gray: 666666

Even Darker Gray: 333333

Some Color Links:

http://www.htmlhelp.com/cgi-bin/color.cgi

http://www.webmonkey.com/webmonkey/reference/color_codes/

CSS

How do I make a link not be underlined?

Add the following to the HEAD section of your HTML document

<STYLE type=text/css>
<!--
a:link {text-decoration: none}
a:active {text-decoration: none}
a:visited {text-decoration: none}
a:hover {text-decoration: none}
//-->
</STYLE>

How do I make a link only be underlined when the mouse is over or hovering or only on hover?

<STYLE type=text/css>
<!--
a:link {text-decoration: none}
a:active {text-decoration: none}
a:visited {text-decoration: none}
a:hover {text-decoration: underline}
//-->
</STYLE>

How do I change the color of a link when the mouse is over or hovering or only on hover?

Add the following to the HEAD section of your HTML document

<STYLE type=text/css>
<!--
a:link {color: #000000}
a:active {color: #000000}
a:visited {color: #000000}
a:hover {color: #FF0000}
//-->
</STYLE>

This changes the font color of a link from black to red when the mouse hovers over the link.

How do I change the color of a link and only be underlined when the mouse is over or hovering or only on hover?

Add the following to the HEAD section of your HTML document

<STYLE type=text/css>
<!--
a:link {color: #000000; text-decoration: none}
a:active {color: #000000; text-decoration: none}
a:visited {color: #000000; text-decoration: none}
a:hover {color: #FF0000; text-decoration: underline}
//-->
</STYLE>

When the mouse is over or hovering the link the link changes color from black to red and it becomes underlined.

How do I change the color of different links to different colors when the mouse is over or hovering or only on hover?

Add the following to the HEAD section of your HTML document

<style type="text/css">
<!--
a:link { color: #000000; text-decoration: none}
a:visited { color: #000000; text-decoration: none}
a:hover { color: ff0000; text-decoration: none}
a:link.boogiejack {color: #FF0000; text-decoration: none}
a:visited.boogiejack {color: #000000; text-decoration: none}
a:hover.boogiejack {color: #000000; text-decoration: none}
-->
</style>

For the links that you want to be black and than change to red when the mouse is over them or hovering do them like normal.

For the links that you want to be red than change to black when the mouse is over them or hovering add the class="boogiejack" inside the html link tag.

Below is an example:

<a class="boogiejack" href="yourpage.html">Some Page</a>

You can change boggiejack to what ever you want, but change it to the code in the HEAD and in the HTML tag for the link.

How do I change the color of the border of an image when it is a link or when the mouse is over or hovering the image?

Add the following to the HEAD section of your HTML document

<STYLE type=text/css>
<!--
a.pic:link img{border-color: black}
a.pic:visited img{border-color: black}
a.pic:active img{border-color: black}
a.pic:hover img{border-color: black}
//-->
</STYLE>

Add the following to the section of your HTML document

<A HREF="yourLink.htm" class="pic"><img src="yourImage.jpg" width="100" height="100" border="1"></a>

Some CSS Links:

CSSZenGarden

The Web Developer's Network

Official Cascading Style Sheets Level 2 Specification

CSS from the Ground Up

Listamatic

CSSVault

PositionIsEverything

Ruthsarian Layouts

http://www.webmonkey.com/webmonkey/reference/stylesheet_guide/

Javascript

How do I make a popup window load automatically?

Add the following into the HEAD of your HTML document

<script LANGUAGE="javascript">

<!-- Begin
function popupPage() {
var page = "yourpage.htm";
windowprops = "height=180,width=600,location=no,"
+ "scrollbars=no,menubar=no,toolbar=no,resizable=yes";

window.open(page, "Popup", windowprops);
}
// End -->
</script>

Add the following into the BODY tag:

onLoad="setTimeout('popupPage()', 10)"

Below is an example:

<body bgcolor="#FFFFFF" text="#000000" onLoad="setTimeout('popupPage()', 10)">

How do I make a popup window load using a link or button?

Add the following into the HEAD of your HTML document

<script LANGUAGE="javascript">

<!-- Begin
function popupPage() {
var page = "yourpage.htm";
windowprops = "height=180,width=600,location=no,"
+ "scrollbars=no,menubar=no,toolbar=no,resizable=yes";

window.open(page, "Popup", windowprops);
}
// End -->
</script>

Add the following into the BODY of your HTML document

<a href="javascript:popupPage()">Your Link</a>or <a href="javascript:popupPage()"><img src="yourbutton.jpg"></a>

Or for many different links to many different popup pages use the following:

Add the following into the HEAD after title:

<script LANGUAGE="javascript">

<!-- Begin
function popupPage(page) {
windowprops = "height=180,width=600,location=no,"
+ "scrollbars=no,menubar=no,toolbar=no,resizable=yes";
window.open(page, "Popup", windowprops);
}
// End -->
</script>

Add the following into the BODY of your HTML document

<a href="javascript:popupPage('yourpage.htm')">Your Link</a>or <a href="javascript:popupPage('yourpage.htm')"><img src="yourbutton.jpg"></a>

What features does a popup window have?

menubar
This is the row of functions that appears on most software applications. Normally it includes File, Edit, and a few other items.
status
This is the message bar at the bottom of your window. When you move your mouse over an HTML link, the URL appears in the status bar. You may have seen pages that use JavaScript to turn this status bar into a scrolling marquee. I'm not going to show you how to do this. If you want to know, you have to figure it out yourself. "Down with marquees," the monkey cried!
scrollbars
This allows scrollbars to appear when necessary.
resizable
If resizable is listed, the window can be resized. Be careful of the spelling. I always get it wrong.
width
The width of the window in pixels.
height
The height of the window in pixels.
toolbar
The browser toolbar, which contains the Back and Forward buttons, the Stop button, and the Home button, among others.
location
The text area of a browser into which you can type URLs.
directories
The directories that Netscape browsers have called "What's new," "What's cool," and so on

How do I close a popup window using a link or button?

<a href="javascript:window.close()">Close Window</a> or <a href="javascript:window.close()"><img src="closeWindow.jpg"></a>

How do I open a Modal Window?

Add the following into the HEAD of your Opener/Parent Page

<script LANGUAGE="javascript">

<!-- Begin
function openModal(){
var rc = new Array(0,0);
rc = window.showModalDialog('frame.htm','','');
document.getElementById('firstName').innerText = rc[0];
document.getElementById('lastName').innerText = rc[1];
//document.frmNewEmployee.submit();
}
// End -->
</script>

Add the following into the BODY of your Opener/Parent Page

<form name="frmOpenModal" method="post">
<table width="770" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="30%"><div align="left">&nbsp;<font class="frmLabel">First Name&nbsp;</font></div></td>
<td width="70%"><div align="left">&nbsp;<input class="frmInput" id="firstName" name="firstName" type="text" size="10" maxlength="15" value=""></div></td>
</tr>
<tr>
<td width="30%"><div align="left">&nbsp;<font class="frmLabel">Last Name&nbsp;</font></div></td>
<td width="70%"><div align="left">&nbsp;<input class="frmInput" id="lastName" name="lastName" type="text" size="15" maxlength="20" value=""></div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><a href="javascript:openModal();" >Get Info </a></div></td>
</tr>
</table>
</form>

Add the following into the HEAD of your Modal/Child Page named dlgModalSample.htm

<base target="_self">

<script LANGUAGE="javascript">

<!-- Begin
function Done(){
var fname = document.getElementById('firstName').value;
var lname = document.getElementById('lastName').value;
var ret = new Array(fname,lname);
window.returnValue=ret;
window.close()
}
// End -->
</script>

Add the following into the BODY of your Modal/Child Page named dlgModalSample.htm

<form name="frmModal" method="post">
<table>
<tr>
<td width="30%"><div align="left">&nbsp;<font class="frmLabel">First Name&nbsp;</font></div></td>
<td width="70%"><div align="left">&nbsp;<input class="frmInput" id="firstName" name="firstName" type="text" size="10" maxlength="15" value=""></td>
</tr>
<tr>
<td width="30%"><div align="left">&nbsp;<font class="frmLabel">Last Name&nbsp;</font></div></td>
<td width="70%"><div align="left">&nbsp;<input class="frmInput" id="lastName" name="lastName" type="text" size="15" maxlength="20" value=""></div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><a href="javascript:Done();">Done</a></div></td>
</tr>
</table>
</form>

Add the following into the HEAD of your Frame Page named frame.htm

<iframe id="ifSearch" width="100%" height="100%" tabIndex="0" scrolling="no" marginWidth="0" marginHeight="0"></iframe>
<script language="javascript">
document.getElementById("ifSearch").src="dlgModalSample.htm"
</script>

How do I go back to the previous page using a link or button in javascript?

To go back using a button:

<input type="button" value="Go Back One Page" OnClick="history.go( -1 );return true;">
or
<input type="button" value="Go Back One Page" OnClick="history.back();">

To go back using a link:

<A HREF="javascript:history.go(-1)">Go Back One Page</A>
or
<A HREF="javascript:history.back()">Go Back One Page</A>

To go forward using a button:

<input type="button" value="Go Forward One Page" OnClick="history.go( 1 );return true;">
or
<input type="button" value="Go Forward One Page" onclick="history.forward();">

To go forward using a link:

<A HREF="javascript:history.go(1)">Go Forward One Page</A>
or
<A HREF="javascript:history.forward()">Go Forward One Page</A>

How do I have the browser stay on the current webpage when the user clicks the Back Button or How do I disable the Back Button using javascript?

Add the following into the HEAD of your HTML document

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

window.history.forward(1);

// End -->

</script>

How do I SPAM-proof my email address links?

Add the following into the HEAD of your HTML document

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var user;
var domain;
var suffix;

function spammail(user, domain, suffix){
document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
}

//-->

// End -->

</script>

Add the following into the BODY of your HTML document

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

spammail("you", "somewhere", "com");

// End -->

</script>

How do I validate an email address format using javascript?

Add the following into the HEAD of your HTML document

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function checkEmail(emailAddress){
var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
var regex = new RegExp(emailReg);
if (regex.test(emailAddress) == false) {
alert("The email address is wrong format.");
frmCheckEmail.emailAddress.focus();
return (false)
} else {
return (true)
document.frmCheckEmail.action= 'pageToPostTo.cgi';
document.frmCheckEmail.method="POST"
document.frmCheckEmail.submit()
}
}

//-->

// End -->

</script>

Add the following into the BODY of your HTML document

<form name="frmCheckEmail" method="post">
<input type="text" name="emailAddress" value="">
<input type="submit" name="Submit" value="Submit" onClick="checkEmail(document.frmCheckEmail.emailAddress.value)">
</form>

How do I specify the maxlength of a textarea using javascript or how do I limit the number of characters entered into a textarea using javascript?

Add the following into the HEAD of your HTML document

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function textCounter(field, countfield, maxlimit){
if (field.value.length > maxlimit) {
// if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
} else {
countfield.value = maxlimit - field.value.length;
}
}

//-->

// End -->

</script>

Add the following into the BODY of your HTML document

<form name="frmTextAreaLength" method="post">
<textarea rows="5" cols="60" name="comments" onKeyDown="textCounter(frmTextAreaLength.comments,frmTextAreaLength.remLen,100);" onKeyUp="textCounter(frmTextAreaLength.comments,frmTextAreaLength.remLen,100);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left</font>
<br>
<input type="submit" name="Submit" value="Submit">
</form>

How do I redirect to a different page? How do I refresh to a different page?

<SCRIPT language="JavaScript">

<!-- Begin

window.location="yourpage.html";

// End -->

</SCRIPT>

How do I redirect to a different page depending on the resolution or how do I check resolution and then redirect to a different page?

Add the following code into the BODY of your HTML document

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var url640x480 = "http://www.yoursite.com/640x480";
var url800x600 = "http://www.yoursite.com/800x600";
var url1024x768 = "http://www.yoursite.com/1024x768";
var url1152x864 = "http://www.yoursite.com/1152x864";
var url1280x1024 = "http://www.yoursite.com/1280x1024";
var url1600x1200 = "http://www.yoursite.com/1600x1200";
if ((screen.width == 640) && (screen.height == 480))
window.location.href= url640x480;
else if ((screen.width == 800) && (screen.height == 600))
window.location.href= url800x600;
else if ((screen.width == 1024) && (screen.height == 768))
window.location.href= url1024x768;
else if ((screen.width == 1152) && (screen.height == 864))
window.location.href= url1152x864;
else if ((screen.width == 1280) && (screen.height == 1024))
window.location.href= url1280x1024;
else if ((screen.width == 1600) && (screen.height == 1200))
window.location.href= url1600x1200;
else window.location.href= url640x480;

// End -->

</SCRIPT>

How do I redirect to a different page depending on the resolution or how do I check resolution and then redirect to a different page using a button or link?

Add the following code into the HEAD of your HTML document

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function redirectPage() {
var url640x480 = "http://www.yoursite.com/640x480";
var url800x600 = "http://www.yoursite.com/800x600";
var url1024x768 = "http://www.yoursite.com/1024x768";
var url1152x864 = "http://www.yoursite.com/1152x864";
var url1280x1024 = "http://www.yoursite.com/1280x1024";
var url1600x1200 = "http://www.yoursite.com/1600x1200";
if ((screen.width == 640) && (screen.height == 480))
window.location.href= url640x480;
else if ((screen.width == 800) && (screen.height == 600))
window.location.href= url800x600;
else if ((screen.width == 1024) && (screen.height == 768))
window.location.href= url1024x768;
else if ((screen.width == 1152) && (screen.height == 864))
window.location.href= url1152x864;
else if ((screen.width == 1280) && (screen.height == 1024))
window.location.href= url1280x1024;
else if ((screen.width == 1600) && (screen.height == 1200))
window.location.href= url1600x1200;
else window.location.href= url640x480;
}
// End -->
</script>

Add the following code into the BODY of your HTML document

<a href="javascript:redirectPage();">Your Link</a> or <a href="javascript:redirectPage();"><img src="yourbutton.jpg"></a>

How do I redirect to a different page depending on the browser or how do I check browser and then redirect to a different page?

Add the following code into the BODY of your HTML document

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var name = navigator.appName
if (name == "Microsoft Internet Explorer")
url=("explorer/default.htm");
else
url=("netscape/default.htm")
window.location=url;

// End -->
</SCRIPT>

How do I redirect to a different page depending on the browser or how do I check browser and then redirect to a different page using a button or link?

Add the following code into the BODY of your HTML document

for a link

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var name = navigator.appName
if (name == "Microsoft Internet Explorer")
url=("msie.html");
else
url=("netscape.html")
document.write('<A HREF="' + url + '">Your Link</A>');

// End -->
</SCRIPT>

or for a button

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var name = navigator.appName
if (name == "Microsoft Internet Explorer")
url=("msie.html");
else
url=("netscape.html")
document.write('<A HREF="' + url + '"><img src="yourbutton.jpg"></A>');

// End -->
</SCRIPT>

How do I redirect to a different page depending on if the user can view flash or how do I check if the user can view flash and then redirect to a different page?

Add the following into the HEAD after title:

<SCRIPT LANGUAGE="JavaScript">
<!-- use this comment tag to hide the enclosed code from old browsers.
//Look for a version of Internet Explorer that supports ActiveX (i.e., one that's
//running on a platform other than Mac or Windows 3.1) or a browser that supports
//the plugin property of the navigator object and that has Flash Player 2.0
//installed.

if ((navigator.appName == "Microsoft Internet Explorer" &&
navigator.appVersion.indexOf("Mac") == -1 && navigator.appVersion.indexOf("3.1") == -1) ||

(navigator.plugins && navigator.plugins["Shockwave Flash"])
|| navigator.plugins["Shockwave Flash 2.0"]){

//Load a pre-defined HTML page with Flash Player in it into the browser window.
window.location='flashed.htm';
}
else {
//Load a pre-defined HTML page without Flash Player into the browser window.
window.location='nonflashed.htm';
}

// Close the comment tag. -->
</SCRIPT>

How do I randomly change an image every time the page is reloaded or refreshed?

Add the following code into the HEAD of your HTML document

<script language=Javascript>
<!--//

var index = 0;
var pictures = new Array();
pictures[0] = "images/image1.jpg";
pictures[1] = "images/image2.jpg";
pictures[2] = "images/image3.jpg";
pictures[3] = "images/image4.jpg";
pictures[4] = "images/image5.jpg";
var seed = (new Date()).getTime() % 0xffffffff;
function rand(n)
{
seed = (0x015a4e35 * seed)%0x7fffffff;
return (seed >> 16) % n;
}
//-->
</script>

Add the following code into the BODY of your HTML document

<script>
var n = rand(pictures.length);
document.write('<IMG SRC=' + pictures[n] + ">");
</script>

or another way

Add the following code into the HEAD of your HTML document

<script language=Javascript>
<!--//

var theImages = new Array()

theImages[0] = "images/image1.jpg";
theImages[1] = "images/image2.jpg";
theImages[2] = "images/image3.jpg";

var i = theImages.length;
var whichImage = Math.floor(Math.random()*i);
function showImage(){
document.write('<img src="'+theImages[whichImage]+'" alt="The Image" border="0" />');
}

//-->
</script>

Add the following code into the BODY of your HTML document

<script>showImage();</script>

How do I cycle through a group of images in a single location?

Add the following code into the HEAD of your HTML document

<script language=Javascript>
<!-- Begin
var timeDelay = 20; // change delay time in seconds
var Pix = new Array
("01.jpg"
,"02.jpg"
,"03.jpg"
,"04.jpg"
);
var howMany = Pix.length;
timeDelay *= 1000;
var PicCurrentNum = 0;
var PicCurrent = new Image();
PicCurrent.src = Pix[PicCurrentNum];
function startPix() {
setInterval("slideshow()", timeDelay);
}
function slideshow() {
PicCurrentNum++;
if (PicCurrentNum == howMany) {
PicCurrentNum = 0;
}
PicCurrent.src = Pix[PicCurrentNum];
document["ChangingPix"].src = PicCurrent.src;
}
// End -->
</script>

Add the onLoad event handler into your BODY tag

<BODY OnLoad="startPix()">

Add the following code into the BODY of your HTML document

<img name="ChangingPix" src="01.jpg">

How do I auto resize the height of an iFrame to the height of the iFrame's content?

Add the following into the HEAD of your Parent Page or Page containing the iFrame

<script language="javascript">
function resizeIframe(iframeID) {

var FramePageHeight = document.getElementById(iframeID).contentWindow.document.body.scrollHeight + 10;
/* "iframeID" is the ID of the inline frame in the parent page. */
/* The added 10 pixels prevent an unnecessary scrollbar. */

if (FramePageHeight > 140) {
document.getElementById(iframeID).style.height=FramePageHeight + 'px';
} else {
document.getElementById(iframeID).style.height=140 + 'px';
}
/* "iframeID" is the ID of the inline frame in the parent page. */

}
</script>

Make sure to call the resizeIframe function in the onload handler of your IFrame. Also make sure to pass the id of your iFrame when you call the resizeIframe function

Add the following into the BODY of your Parent Page or Page containing the iFrame

<iframe src="yourpage.html" width="200" height="250" frameborder="0" allowtransparency="true" id="idFrame" name="idFrame" onload="resizeIframe('idFrame')">Alternative text for browsers that do not understand IFrames.</iframe>

How do I collect the values of the checkboxes that were selected?

Add the following code into the HEAD of your HTML document

<script language="JavaScript">
<!--
function functionSelected(){

var selectedcount = 0;
var strCheckBoxName = new Array(4);
var max = document.myForm.checkBoxName.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.myForm.checkBoxName[" + idx + "].checked") == true) {
strCheckBoxName[selectedcount] = document.myForm.checkBoxName[idx].value;
selectedcount += 1;
}
}
if (selectedcount == 0) {
var strCheckBoxWords = 'You selected nothing.';
}
else if (selectedcount == 1) {
var strCheckBoxWords = 'You selected ' + strCheckBoxName[0];
}
else if (selectedcount == 2) {
var strCheckBoxWords = 'You selected ' + strCheckBoxName[0] + ' and ' + strCheckBoxName[1];
}
else if (selectedcount == 3) {
var strCheckBoxWords = 'You selected ' + strCheckBoxName[0] + ', ' + strCheckBoxName[1] + ', and ' + strCheckBoxName[2];
}
else if (selectedcount == 4) {
var strCheckBoxWords = 'You selected ' + strCheckBoxName[0] + ', ' + strCheckBoxName[1] + ', ' + strCheckBoxName[2] + ', and ' + strCheckBoxName[3];
}
else {
var strCheckBoxWords = 'You selected ' + strCheckBoxName[0] + ', ' + strCheckBoxName[1] + ', ' + strCheckBoxName[2] + ', ' + strCheckBoxName[3] +', and ' + strCheckBoxName[4];
}
alert("You selected " + selectedcount + " boxes." + "\n" + strCheckBoxWords);
}
//-->
</script>

Add the following code into the BODY of your HTML document

<form name="myForm">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input name="checkBoxName" type="checkbox" value="One"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">One</span></font></td>
</tr>
<tr>
<td><input name="checkBoxName" type="checkbox" value="Two"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Two</span></font></td>
</tr>
<tr>
<td><input name="checkBoxName" type="checkbox" value="Three"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Three</span></font></td>
</tr>
<tr>
<td><input name="checkBoxName" type="checkbox" value="Four"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Four</span></font></td>
</tr>
<tr>
<td><input name="checkBoxName" type="checkbox" value="Five"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Five</span></font></td>
</tr>
</table>
<CENTER><input type=submit value=Submit onClick="functionSelected()">&nbsp;&nbsp;<input type=reset value=Reset></CENTER>
</form>

How do I collect the values of a selection box that were selected?

Add the following code into the HEAD of your HTML document

<script language="JavaScript">
<!--
function functionSelected(){

var selectedcount = 0;
var selectedvalue = new Array(4);
for (i=0; i< document.myForm.selectionBoxName.options.length; i++){
if (document.myForm.selectionBoxName.options(i).selected)
{
selectedvalue[selectedcount] = document.myForm.selectionBoxName.options(i).text;
selectedcount++;
}
}
if (selectedcount == 0) {
var strSelectionBoxWords = 'You selected nothing.';
}
else if (selectedcount == 1) {
var strSelectionBoxWords = 'You selected ' + selectedvalue[0];
}
else if (selectedcount == 2) {
var strSelectionBoxWords = 'You selected ' + selectedvalue[0] + ' and ' + selectedvalue[1];
}
else if (selectedcount == 3) {
var strSelectionBoxWords = 'You selected ' + selectedvalue[0] + ', ' + selectedvalue[1] + ', and ' + selectedvalue[2];
}
else if (selectedcount == 4) {
var strSelectionBoxWords = 'You selected ' + selectedvalue[0] + ', ' + selectedvalue[1] + ', ' + selectedvalue[2] + ', and ' + selectedvalue[3].text;
}
else {
var strInterestedInWords = 'You selected ' + selectedvalue[0] + ', ' + selectedvalue[1] + ', ' + selectedvalue[2] + ', ' + selectedvalue[3] +', and ' + selectedvalue[4];
}
alert("You selected " + selectedcount + "." + "\n" + strSelectionBoxWords);
}
//-->
</script>

Add the following code into the BODY of your HTML document

<form name="myForm">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<SELECT SIZE=5 NAME="selectionBoxName" MULTIPLE>
<OPTION>One</OPTION>
<OPTION>Two</OPTION>
<OPTION>Three</OPTION>
<OPTION>Four</OPTION>
<OPTION>Five</OPTION>
</SELECT>
</td>
</tr>
</table>
<CENTER><input type=submit value=Submit onClick="functionSelected()">&nbsp;&nbsp;<input type=reset value=Reset></CENTER>
</form>

How do I collect the values of the checkboxes that were selected and make them the value of a hidden field?

Add the following code into the HEAD of your HTML document

<script language="JavaScript">
<!--
function functionSelected(){

var selectedcount = 0;
var strNumbersChecked = '';
var strCheckBoxName = new Array(4);
var max = document.myForm.checkBoxName.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.myForm.checkBoxName[" + idx + "].checked") == true) {
strCheckBoxName[selectedcount] = document.myForm.checkBoxName[idx].value;
strNumbersChecked = strNumbersChecked + ", " + strCheckBoxName[selectedcount];
selectedcount++;
}
}
document.myForm.Numbers_Checked.value = strNumbersChecked;
}
//-->
</script>

Add the following code into the BODY of your HTML document

<form name="myForm">
<input type="hidden" name="Numbers_Checked">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input name="checkBoxName" type="checkbox" value="One"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">One</span></font></td>
</tr>
<tr>
<td><input name="checkBoxName" type="checkbox" value="Two"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Two</span></font></td>
</tr>
<tr>
<td><input name="checkBoxName" type="checkbox" value="Three"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Three</span></font></td>
</tr>
<tr>
<td><input name="checkBoxName" type="checkbox" value="Four"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Four</span></font></td>
</tr>
<tr>
<td><input name="checkBoxName" type="checkbox" value="Five"><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Five</span></font></td>
</tr>
</table>
<CENTER><input type=submit value=Submit onClick="functionSelected()">&nbsp;&nbsp;<input type=reset value=Reset></CENTER>
</form>

How do I send an e-mail from an online form using Javascript?

Add the following into the HEAD of your HTML document

<script language="JavaScript">
<!--
function functionBody(){

var message = 'mailto:someOne@someWhere.com?subject=The Subject of This Email&body=Name: ' + document.EmailForm.FirstName.value + ' ' + document.EmailForm.LastName.value + '%0D%0A' + '%0D%0A' + 'Address: ' + document.EmailForm.Address.value +'.' + '%0D%0A' + '%0D%0A' + 'City: ' + document.EmailForm.City.value + '%0D%0A' + '%0D%0A' + 'State: ' + document.EmailForm.State.value;
document.EMailer.action= message;
document.EMailer.method="POST"
document.EMailer.enctype="text/plain"
document.EMailer.submit()
}
//-->
</script>

Add the following into the BODY of your HTML document

<form name="EmailForm">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">First
Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="FirstName" size="20"></td>
</tr>
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Last
Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="LastName" size="20"></td>
</tr>
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="Address" size="20"></td>
</tr>
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">City&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="City" size="20"></td>
</tr>
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="State" size="20"></td>
</tr>
</table>
</div>
</form>
<script language="JavaScript"><!--
document.write ('<form name="EMailer" ID="EMailer">');
document.write ('<CENTER><input type=button value=Submit onClick="functionBody()">&nbsp;&nbsp;<input type=reset value=Reset></CENTER>');
document.write ('</form>');
//--></script>

How do I make a line break or have text go to the next line using Javascript?

add '\n' to your string

Below is an example:

'Mr. John Smith' + '\n' + '123 Main Street' + '\n' + 'City, State'

How do I make a line break or have text go to the next line using a Javascript Mailto?

add '%0D%0A' to your string

Below is an example:

'Mr. John Smith' + '%0D%0A' + '123 Main Street' + '%0D%0A' + 'City, State'


Some Javascript Links:

http://javascript.internet.com

http://tech.irt.org/articles/script.htm

http://www.zdnet.com/devhead/resources/scriptlibrary/javascript/

http://www.dynamicdrive.com

http://www.webmonkey.com/webmonkey/reference/javascript_code_library/

Flash

How do I move an object (graphic) with motion tweening?

1. Turn the image/graphic into a Symbol
2. Select the image/graphic on the stage with the arrow tool
3. Menu option "Insert" --> "Convert to Symbol..."
4. Select the radio button for "Graphic"
5. Click in the desired end frame to select it
6. Menu option "Insert" --> "Keyframe"
7. With the end frame of the motion tween still selected, move the graphic on the stage to where you want it to end
8. Click in the first frame or beginning frame of the motion tween
9. Menu option "Insert" --> "Create Motion Tween"

How do I move an object (graphic) along a path?

1. Turn the image/graphic into a Symbol
2. Select the image/graphic on the stage with the arrow tool
3. Menu option "Insert" --> "Convert to Symbol..."
4. Select the radio button for "Graphic"
5. Click in the desired end frame to select it
6. Menu option "Insert" --> "Keyframe"
7. With the end frame of the motion tween still selected, move the graphic on the stage to where you want it to end
8. Click in the first frame or beginning frame of the motion tween
9. Menu option "Insert" --> "Create Motion Tween"
10. Make sure that the layer containing the motion tween is selected
11. Menu option "Insert" --> "Motion Guide"
12. Click on the frame in Guide Layer that corresponds to the start of the motion tween
13. Use the Pen, Pencil, Line, Circle, Rectangle, or Brush tool to draw the motion path
14. Click on the first frame or beginning frame of the motion tween in the layer containing the motion tween
15. Menu option "Window" --> "Panels" --> "Frame" to open the Frame panel and make sure there is a check mark in the box next to "Snap"
16. Click in the first frame or beginning frame of the motion tween
17. Click the Arrow Tool
18. Move the Graphic to the start or beginning of the motion path
19. Click in the end frame frame of the motion tween
20. Click the Arrow Tool
21. Move the Graphic to the end of the motion path

How do I tween shapes?

1. Create an image with any of the drawing tools for the starting shape
2. Click in the desired end frame to select it
3. Menu option "Insert" --> "Blank Keyframe"
4. Create an image with any of the drawing tools for the ending shape
5. Click in the first frame or beginning frame of the shape tween
6. Menu option "Window" --> "Panels" --> "Frame" (To open the Frame panel)
7. Where is says "Tweening:" choose "Shape" from the drop-down list
8. Where is says "Easing:" change the 0 to a positive or negative number to change the acceleration of the tween
(a positive value (1 to 100) will slow down the animation as it gets closer to the end) (a negative value (-1 to -100) will speed up the animation as it gets closer to the end
9. Where is says "Blend:" choose "Distributive" for smoother or curved edged shapes and choose "Angular" for shapes with straight lines and corners

How do I make a graphic, symbol, or movie dragable or movable with the mouse?

1. Turn the graphic/symbol into a movie
2. Select the graphic/symbol on the stage with the arrow tool 3. Menu option "Insert" --> "Convert to Symbol..."
4. Select the radio button for "Movie Clip"
5. Menu option "Window" --> "Actions" (To open the Actions panel)
6. Select the movie clip on the stage with the arrow tool
7. Open the Actions Folder with a Single Click on the word "Actions"
8. Double Click the word "evaluate" to add a line
9. Sinlge Click the words "onClipEvent (load) {" to highlight it
10. Select the radio button for "Mouse down"
11. Double Click the word "startDrag" from the same list that you Double Clicked the word "evaluate"
12. Where is says "Target:" than a text box, type "this" in the text box
13. Sinlge Click the last line or the "}" to highlight it
14. Double Click the word "evaluate" to add a line (from the same list as before and where you Double Clicked the word "startDrag")
15. Sinlge Click the words "onClipEvent (load) {" to highlight it
16. Select the radio button for "Mouse up"
17. Double Click the word "stopDrag" from the same list that you Double Clicked the words "startDrag" and "evaluate"

How do create a button that jumps to a URL?

1. Turn the graphic/symbol of the button into a button
2. Select the graphic/symbol on the stage with the arrow tool 3. Menu option "Insert" --> "Convert to Symbol..."
4. Select the radio button for "Button"
5. Menu option "Window" --> "Actions" (To open the Actions panel)
6. Select the button on the stage with the arrow tool
7. Open the Basic Actions Folder with a Single Click on the word "Basic Actions"
8. Double Click the word "Get URL"
9. Where is says "URL:" than a text box, type in the absolute or relative URL that you want to link to in the text box

How do I redirect to a different page depending on if the user can view flash or how do I check if the user can view flash and then redirect to a different page?

Add the following into the HEAD after title:

<SCRIPT LANGUAGE="JavaScript">
<!-- use this comment tag to hide the enclosed code from old browsers.
//Look for a version of Internet Explorer that supports ActiveX (i.e., one that's
//running on a platform other than Mac or Windows 3.1) or a browser that supports
//the plugin property of the navigator object and that has Flash Player 2.0
//installed.

if ((navigator.appName == "Microsoft Internet Explorer" &&
navigator.appVersion.indexOf("Mac") == -1 && navigator.appVersion.indexOf("3.1") == -1) ||

(navigator.plugins && navigator.plugins["Shockwave Flash"])
|| navigator.plugins["Shockwave Flash 2.0"]){

//Load a pre-defined HTML page with Flash Player in it into the browser window.
window.location='flashed.htm';
}
else {
//Load a pre-defined HTML page without Flash Player into the browser window.
window.location='nonflashed.htm';
}

// Close the comment tag. -->
</SCRIPT>

How do I make a Javascript menu appear above a Flash Movie?

Add the following line to the HTML code for the Flash movie:

<param name="wmode" value="transparent">

Below is an example:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="130" height="98">
<param name=movie value="yourmovie.swf">
<param name=quality value=high>
<param name="wmode" value="transparent">
<embed src="yourmovie.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="130" height="98">
</embed>
</object>

Some Flash/Actionscript Links:

http://www.actionscript.org/tutorials.shtml

http://www.actionscript.org

http://www.flashkit.com/tutorials/

http://www.flashkit.com

Director/Lingo

How do I Hold on a frame till Flash finishes playing?

Add the following lingo code to the frame script of the frame that contains the Flash.

on ExitFrame me
if the frame of sprite("channel number") < the framecount of member sprite("channel number").member then
go to the frame
else
go to frame "number of frame you want to proceed to"
end if
end ExitFrame

How do I Hold on a frame till sound finishes playing?

Add the following lingo code to the frame script of the frame that contains the sound.

on ExitFrame me
if soundBusy("channel number") = true then
go to the frame
else
go to frame "number of frame you want to proceed to"
end if
end ExitFrame

How do I Hold on a frame till quicktime movie finishes playing?

Add the following lingo code to the sprite script of the Quicktime Movie Sprite.

on exitFrame
if sprite("channel number").movieRate = 1 then
go to the frame
else
go to frame "number of frame you want to proceed to"
end if
end

Some Director/Lingo Links:

http://www.mediamacros.com

http://www.fbe.unsw.edu.au/Learning/Director/

http://www.fbe.unsw.edu.au/Learning/Director/resources/FAQ/

Fonts

What is the difference between the different file formats?

PostScript

The PostScript or “Type 1” font format was developed by Adobe in the 1980s, several years before the release of TrueType. The format is based on Adobe’s PostScript printing technology – a programming language that allows for high-resolution output of resizable graphics. PostScript has long been viewed as a reliable choice, particularly for professional designers, publishers and printers.

PostScript fonts consist of two parts, which are both necessary for the font to be properly printed and displayed on screen. With most operating systems, PostScript fonts can be installed simply by being placed in the system’s font folder. However, PC users working on operating systems that predate Windows 2000, need to install the free ATM (Adobe Type Manager) utility in order to use PostScript fonts.

TrueType

The TrueType format was jointly developed by Apple and Microsoft in the late 80s, several years after the release of the PostScript font format. Many of the fonts included with both the Macintosh and Windows operating systems are TrueType. TrueType fonts contain both the screen and printer font data in a single component, making the fonts easier to install. For this reason, TrueType is a good choice for those who have limited experience working with and installing fonts.

The TrueType format, also allows for “hinting,” a process that improves the on-screen legibility of a font. On Fonts.com, fonts that have been hinted are marked as “ESQ” (Enhanced Screen Quality). ESQ fonts are excellent choices for electronic documents and other settings where lengthy blocks of text will be displayed on screen.

OpenType

OpenType, a joint effort from Adobe and Microsoft, is the latest font format to be introduced. Like TrueType, OpenType fonts contain both the screen and printer font data in a single component. However, the OpenType format has several exclusive capabilities including support for multiple platforms and expanded character sets. OpenType fonts can be used on either Macintosh or Windows operating systems. Additionally, the OpenType format permits the storage of up to 65,000 characters. This additional space provides type designers with the freedom to include add-ons such as small caps, old style figures, alternate characters and other extras that previously needed to be distributed as separate fonts.

However, not all OpenType fonts contain additional characters. Many fonts have been converted from either PostScript or TrueType formats without expanded character sets to take advantage of the cross-platform functionality benefits of OpenType. Unless clearly stated otherwise, assume that the OpenType font you are purchasing features the traditional character set found in PostScript and TrueType fonts. OpenType fonts that do contain expanded character sets are referred to informally as “OpenType Pro” fonts. Support for OpenType Pro fonts is increasing, yet the format is yet to fully catch on. Currently, InDesign 2.0 and Adobe Photoshop 7.0 can make use of the expanded character sets. Quark and Microsoft product users, may have to wait for future releases to fully take advantage of this feature.

How do I find out what font was used in an image or what font was used in a graphic?

http://www.myfonts.com/WhatTheFont/

Some Font Links: (Both Purchase and Free Fonts)

http://www.themeworld.com/fonts/index.shtml

http://www.abstractfonts.com

http://www.acidfonts.com

http://www.flashkit.com/fonts/

http://www.indexbrasil.net/fontsdepot

http://www.top20free.com

http://www.freepcfonts.com

http://www.freewarefonts.com

http://www.myfonts.com

http://www.fonts.com

http://www.webpagepublicity.com/free-fonts-a4.html

Photoshop

How do I define a brush?

1. Create a shape that you want as a new brush with one of the drawing tools on a transparent background
2. Make a selection around the shape that you want as a new brush with one of the Marquee tools or lasso tools (dashed line tools)
3. Menu option "Edit" --> "Define Brush"
4. Name the brush

How do I define a pattern?

1. Make a selection (what you want repeated in your pattern) with one of the Marquee tools or lasso tools (dashed line tools)
2. Menu option "Edit" --> "Define Pattern"
3. Name the pattern

How do I fill an area with a pattern?

1. Make a selection (what you want to fill with) with one of the Marquee tools or lasso tools (dashed line tools)
2. Menu option "Edit" --> "Define Pattern"
3. Name the pattern
4. Make a selection (what you want to fill) with one of the Marquee tools or lasso tools (dashed line tools)
5. Menu option "Edit"--> "Fill"
6. Where it says "Use:" choose the option "Pattern" from the drop-down list
7. Where it says "Custom Pattern" choose the pattern that you want to fill with from the drop-down list

or

1. Make a selection (what you want to fill with) with one of the Marquee tools or lasso tools (dashed line tools)
2. Menu option "Edit" --> "Define Pattern"
3. Name the pattern
4. Click the paintbucket tool
5. A new menu at the top of the screen should appear for the paintbucket
6. Where it says "Fill:" choose "Pattern" from the drop-down list
7. Where it says "Pattern:" choose the pattern that you want to fill with from the drop-down list

How do I paste an image into an area?

1. Make a selection (the image you want to paste) with one of the Marquee tools or lasso tools (dashed line tools)
2. Menu option "Edit" --> "Copy"
3. Make a selection (the area you want to paste the image into) with one of the Marquee tools or lasso tools (dashed line tools)
4. Menu option "Edit" --> "Paste Into"

How do I make a selection around the contents of a layer?

1. Click on the layer to highlight the layer
2. Menu option "Select" --> "Load Selection"

How do I save a selection?

1. Menu option "Select" --> "Save Selection"
2. Name the selection

How do I load a selection that I had saved in the past or previous?

1. Menu option "Select" --> "Load Selection"
2. Where it says "Channel:" choose the selection that you want to load

How do I make a selection of the Layer Mask?

1. Right click on the Layer Mask
2. Choose "Set Selection To Layer Mask"

How do I make sure all my drop shadows are from the same angle?

1. Click the box next to "Use Global Light"

How do I make drop shadows with different angles?

1. Unclick the box next to "Use Global Light"

How do I turn a Spot Color Channel into RGB or How do Merge a Spot Channel into RGB?

First change the Image Mode to RGB

1. Menu option "Image" --> "Mode" --> "RGB Color"

Now merge the Spot Color Channel into RGB channels

2. Click on the Channels Tab

3. Click on the Spot Color channel to highlight the channel

4. Click on the arrow inside the circle on the top right of the channel palette

5. This will give you the channel palette menu

6. Choose "Merge Spot Channel"

How do create an Icon file or ICO file using Photoshop?

Icon plug-in for Photoshop:
http://www.telegraphics.com.au/svn/icoformat/trunk/dist/README.html

Creating favicons:
http://www.amenco.com/golivein24/tips/favicon/

Some Photoshop Tutorials

http://www.phong.com/tutorials/

http://www.digital-creativity.co.uk/tutorials.html

http://www.planetphotoshop.com/tutorials.html

http://www.n-sane.net/tutorials.php

http://www.photoshoproadmap.com/photoshop-tutorials-tips/interfaces-design.html

http://www.photoshoproadmap.com/photoshop-tutorials-tips/illustration-techniques.html

http://www.grafx-design.com/phototut.html

http://www.thinkdan.com/tutorials/photoshop.html

http://www.voidix.com/tutorialsphotoshop.php

http://www.photoshopcafe.com/tutorials.htm

Graphics

What is the difference between the different file formats?

BMP (Basic Multilingual Plane)

- Microsoft Windows (not recognized by other computers)

- raster file

- no compression

- loss less format

- 256 colors

- no transparency

- no interlacing

- not for online use

GIF (Graphics Interchange Format)

- raster image format (made up of predefined pixels, each pixel has a predefined color)

- no compression

- lossy (removes bits of color information to reduce file size)

- 256 colors (simple graphics/logos, not photographs)

- transparency

- interlacing (loads progressively)

- online use

- supports animation

JPEG (Joint Photographic Experts Group)

- raster image format (made up of predefined pixels, each pixel has a predefined color)

- different compression options (minimum compression/high image quality/big file size to maximum compression/low image quality/small file size)

- lossy (removes bits of color information to reduce file size depending on the compression)
(minimum compression/high image quality/big file size = less loss of information)
(maximum compression/low image quality/small file size = more loss of information)

- Millions Of Colors or True Color (photographs, good for shades of color, not good for defined edges and lines)

- no transparency

- interlacing (loads progressively)

- online use

- does not support animation

PNG (Portable Network Graphics)

- raster image format (made up of predefined pixels, each pixel has a predefined color)

- smaller files than gif and loses less information than jpeg

- PNG-8 = 8-bit - 256 colors - indexed color

- PNG-24 = 24-bit - Millions Of Colors or True Color

- transparency

- interlacing (loads progressively)

- online use to some extent (most major browsers)

TIFF (Tagged Image File Format)

- compatible with wide range of software applications and platforms (Windos, Macintosh, UNIX)

- raster image format (made up of predefined pixels, each pixel has a predefined color)

- loss less format ( does not lose any information)

- contains the maximum number of colors

- no compression

- no loss of information

- no compression/no loss of information = big file size (not for online use because of big file size-take long to download)

- no interlacing

- not for online use (big file size)

- used for print

What does bit depth mean?

Bit depth is the number of bits in each pixel.
Color depth is the maximum number of colors in an image and is based on the bit depth of the image and of the displaying monitor.

A bit is the smallest unit of information a computer understands. It has two possible states: it can be on or it can be off. All computer information is handled in this way.

A computer monitor is made of pixels (short for "picture element"). Depending on the monitor and the computer system, each pixel will have a specific number of bits assigned to it. These bits effect how the pixel will appear.

A black-and-white monitor has one bit per pixel. This bit has two possible states: it can be on or off. When it is on, the pixel looks white. When it is off, it looks black. Each pixel has a bit depth of one and a color depth of two. One bit produces two possible colors.

If there are 2-bits per pixel, the number of colors each pixel can display rises to four. Two-bits per pixel means each pixel has 2 bits and each bit has two states: on and off. In mathematical terms, 2 bits x 2 states = 4 colors.

If there are 4-bit per pixel, each pixel can display 16 colors different colors.

A basic color monitor has 8-bit pixels and is capable of displaying 256 colors.

These days, most color monitors have 16- or 24-bit capabilities, and display thousands or Millions Of Colors.

Bit Depth Color Depth Calculation
24-bit 16,777,215 colors 224 Millions Of Colors or True Color
16-bit 65,536 colors 216
8-bit 256 colors 28 (2x2x2x2x2x2x2x2) Indexed Color
6-bit 64 colors 26 (2x2x2x2x2x2) Indexed Color
4-bit 16 colors 24 (2x2x2x2) Indexed Color
2-bit 4 colors 22 (2x2) Indexed Color
1-bit 2 colors 21 (2) Black & White

If you decrease the bit depth the file size will decrease, but the quality will go down.

You have to find a happy medium between quality and file size.

What does dither mean?

Dither

- mimic or simulate colors with other colors or a blend of colors because the original color is not able to be displayed because of a decrease in bit depth

- when you decrease the bit depth and number of colors and mimic or simulate colors that can not be displayed with other colors or a blend of colors that can be displayed

What is the difference between the different palette options?

Perceptual

- most intelligent

- greatest color integrity

- varies the reduced color palette to suit the image

- produces the best transitions

Selective

- broad areas of color, not constant change in hues/shades/transitions

- preserves Web colors

- bright colors or sharp

Adaptive

- uses the most commonly used colors in the image

- selects the most frequently used colors in your image

- contains relatively few colors and you want to keep the colors as exact as possible

- one color maybe two colors, but different hues/shades

What is the difference between the different color modes?

RGB (Red Green Blue)

- for use on monitors

CMYK (Cyan Magenta Yellow Black)

- used for print

What is the difference between the different license agreements?

RIGHTS PROTECTED IMAGES

- "rented" for a one-time specific use

- one-time specific price for that one-time specific use

- price is determined by the intended use

ROYALTY FREE IMAGES

- purchased for a price determined by the file size

- can be used as many times as you want

- can be used in as many ways as you want

- certain restriction (in license agreement)

Audio/Sounds

What is the difference between the different file formats?

WAV

- encode sounds events

- large file size (100 MB per minute)

- no compression

- Windows; supported on MAC's

- created on PC's

- no streaming

- various sample rates, sizes, and channels

AIF (Audio Interchange File Format)

- encode sounds events

- large file size (100 mb per minute)

- no compression

- Macintosh; supported in Windows

- created on Macintosh

- no streaming

- various sample rates, sizes, and channels

MP3 (MPEG-1 Audio Layer 3 - Motion Picture Experts Group)

- compression

- medium file size (1 MB per minute)

- lossy (removes bits of information to reduce file sizE)

- small file size makes use for internet

- online use

- streaming

RA (Real Audio)

- compression

- small file sizes

- smaller files than MP3, but less quality

- Proprietary: requires proprietary server software to stream over internet

- online use

- streaming

- great for songs or long sounds and large sound files

What did you mean by sample rates and channels? (also bits)

Sample Rate

- the number of samples per second

bit depth

- the number of bits per sample

Audio Sample Rates

Rate Quality Level
48 kHz Studio Quality
44.1 kHz CD Quality
32 kHz Near CD Quality
22.05 kz or Below CD-ROM or Web
22.05 kz FM Radio Quality
11.025 kHz Acceptable for Music
5 kHz Acceptable for Speech

Audio Bit Depth and Quality

Bit Depth Quality Level
16-bit CD Quality
12-bit Near CD Quality
8-bit FM Radio Quality
4-bit Acceptable for music

If you decrease the sample rate or bit depth the file size will decrease, but the quality will go down.

To decrease the file size of an audio file you can decrease the sample rate, bit depth, or number of channels.
Be careful when you do this you are losing information and decreasing the quality.
You have to find a happy medium between quality and file size.

Channels

- mono-channel

- stereo - dual-channel

What is the difference between the different license agreements?

RIGHTS PROTECTED SOUNDS

- "rented" for a one-time specific use

- one-time specific price for that one-time specific use

- price is determined by the intended use

ROYALTY FREE SOUNDS

- purchased for a price determined by the file size

- can be used as many times as you want

- can be used in as many ways as you want

- certain restriction (in license agreement)

Some Sound Links: (Both Purchase and Free Sounds)

http://www.a1freesoundeffects.com/

http://www.sounddogs.com/

http://www.flashkit.com/soundfx/

http://www.flashkit.com/loops/

http://www.macromedia.com/support/flash/ts/documents/flash_sound_sites.htm

http://www.findsounds.com

http://www.geek-girl.com/audioclips.html

http://www.ibiblio.org/pub/multimedia/

http://www.ibiblio.org/pub/multimedia/pc-sounds/

http://www.ibiblio.org/pub/multimedia/sun-sounds/

http://www.soundrangers.com/

http://www.emusic.com/

http://www.royaltyfreemusic.com/

http://www.wavcentral.com/

http://www.partnersinrhyme.com/pir/PIRsfx.html

http://www.musicloops.com/Cart/index4.htm

http://www.sound-effect.com/

http://www.freeaudioclips.com

Digital Video

Frames per second (fps)

Editing Video Type Frames per second (fps)
Motion-Picture Film 24 fps
Television -
SECAM video (Sequential Couleur Avec Memoire)
France, Middle East, Northern Africa
25 fps
Television -
PAL video (Phase Alternate Line)
Australia, China, Europe, Asia, South America, Southern Africa
25 fps
Television -
NTSC video (National Television Standard)
North America (USA, Canada, Mexico), Japan, and Korea
29.97 fps
Web or CD-ROM 15 fps

What is the file size of Raw Video or How big is Raw Video?

Various Sources

1 frame = 1 MB
30 frames per second so 1 second = 30 MB
60 seconds per minute so 1 minute = 1.8 GB

1 second = 27 MB
60 seconds per minute so 1 minute = 1.62 GB

Adobe:
1 minute = 1.5 GB

Web Monkey:
1 second = 30 MB
60 seconds per minute so 1 minute = 1.8 GB

What are the Types of Video Compression?

Intra-Frame or Spatial

- When each frame of video is compressed separately.

Inter-Frame or Temporal

- Uses the fact that any given frame of video is probably very similar to the frames around it. So, instead of storing entire frames, we can store just the difference between certain frames.

- Stores keyframes in their entirety, while delta frames contain only the information that is different from the keyframes that come before and/or after. You can set how many frames between each keyframe.

- More keyframes the better quality the bigger file size, Less keyframes the lesser quality the smaller file size.

What is the difference between the different file formats?

CD & HARD DRIVE FORMATS

AVI (Audio/Video Interleaved format)

- Windows

- no streaming

- requires the Windows Media Player

MOV (Quicktime)

- Apple

- Macintosh; supported in Windows

- no streaming & streaming

- requires the Quicktime Player

MPEG (MPEG-1 & MPEG-2 - Motion Picture Experts Group)

- MPEG-1 includes the mp3 audio format

- no streaming

RM (Real Video)

- Proprietary: requires proprietary server software to stream over internet

- no streaming & streaming

- requires the Real Media Player

ONLINE & STREAMING FORMATS

ASF (Advanced Streaming Format)

- Windows

- streaming

- requires the Windows Media Player

MOV (Quicktime)

- Apple

- Macintosh; supported in Windows

- streaming & no streaming

- requires the Quicktime Player

RM (Real Video)

- Proprietary: requires proprietary server software to stream over internet

- streaming & no streaming

- requires the Real Media Player

When I attempt to insert an Apple QuickTime movie into Microsoft PowerPoint 2000, I receive the following error message:
PowerPoint couldn't insert movie from the selected file. Either the file is non-standard, or QuickTime is not installed properly.

Microsoft PowerPoint 2000 can only play back QuickTime movies (*.mov files) that use compression schemes with corresponding Media Control Interface (MCI) compatible codecs.

A codec (Compressor/Decompressor) is an algorithm or scheme used to record digital video or audio. For example, when you transmit video over the Internet, the video must be compressed on the sending end and decompressed on the receiving end. A codec can be chosen based upon the user's audio or image quality and image size preferences.

When you read a QuickTime movie, a Video for Windows decompressor decompresses the QuickTime files. If the decompressor does not support the compression method used by the QuickTime movie, it cannot render the movie onto the screen.

© 2000 Microsoft Corporation. All rights reserved. Reproduced in compliance with Microsoft's Terms of Use.

How do I Verify that the QuickTime Movies are Not Compatible with PowerPoint 2000?

There is a quick test for this: can Media Player play the movie?

Media Player, or Mplayer.exe, is not the same program as the Windows Media Player. Media Player is shipped with various versions of the Windows operating systems, and is an MCI-compliant device. However, Windows Media Player is a new technology that does not rely on MCI for its capabilities to play various forms of media. Windows Media Player can play a wider range of video and audio formats than can Media Player.

1. On the Windows Start menu, click Run.
2. In the Open box type:
    mplayer.exe
3. Click OK.
    Media Player is started
4. On the File menu, click Open
5. Browse to the QuickTime movie that you want to verify. Click Open
6. If the QuickTime movie is compatible, then Media Player will open it. If this happens, there may be a problem with PowerPoint 2000 or with the MCI settings.
    For more information, click the article number below to view the article in the Microsoft Knowledge Base:
    Q212409 PPT2000: Unable to Insert a Movie from the Selected File
7. If the movie is not played and you receive an error message in Media Player, the movie is not compatible and cannot be played in PowerPoint 2000.
    To make it compatible, convert it to a compatible compression format, using either of the following methods.

The following codecs are those that are present on both the Windows platforms and with QuickTime 4.0. Although there may be other codecs that are available on both platforms, this list contains those that are standard across both platforms and that you can use with little worry:

Standard Compression Formats

© 2000 Microsoft Corporation. All rights reserved. Reproduced in compliance with Microsoft's Terms of Use.

How do I Convert the QuickTime Movies to a Compatible Compression Format for PowerPoint 2000?

The following steps make use of QuickTime 4.0 Pro and cannot be performed with the basic version of QuickTime 4.0. The steps are the same for both Windows and Macintosh versions of QuickTime 4.0. You can use other QuickTime editing programs in place of QuickTime 4.0 Pro; see their documentation for the relevant steps.

There are two methods

Method 1: Convert QuickTime Movies to AVI Format

1. Start QuickTime Pro, and open the file that you want to convert.
2. On the File menu, click Export.
3. Set the Export file type to Movie to AVI.
4. Click Options, and then click Settings.
5. In the Compressor group, click the list of compressors and choose one from the previous list of "Standard Compression Formats". One of the more popular formats is Cinepak, but choose the one that you think works best with the movie.
6. Make sure to change the extension on the file name to .avi, and then click Save.

Method 2: Recompress the QuickTime Movies with Compatible Codec

1. Start QuickTime Pro, and open the file that you want to convert.
2. On the File menu, click Export.
3. Set the Export file type to Movie to QuickTime Movie.
4. Click Options, and then click Settings.
5. In the Compressor group, click the list of compressors and choose one from the previous list of "Standard Compression Formats". One of the more popular formats is Cinepak, but choose the one that you think works best with the movie.
6. Click Save.

© 2000 Microsoft Corporation. All rights reserved. Reproduced in compliance with Microsoft's Terms of Use.

My Method: Recompress using Adobe Premier into a MPEG

1. Start Adobe Premier, and open the file that you want to convert.
2. On the File menu, click Export Timeline --> Save For Web....
3. Where it says Settings:, select MPEG from the (Select a Setting here) drop down menu.
4. Click the Start button.
5. Cleaner5EZ for Adobe Premier will Start.
6. A Dialog Box opens with the title "Save As".
7. Where it says File name: type the name that you want the fileto have.
8. Click the Save button.

ASP

How do I check to see if a checkbox has been checked with ASP?

If you give the checkbox a value like this:
<input name="checkBoxName" type="checkbox" value="One">
then you check to see if a checkbox has been checked by it's value. If the checkbox is checked the checkbox will equal the value you gave it and if the checkbox was not checked then the value will be blank.
if Request.Form("checkBoxName") <> "" then
response.write "the checkbox has been checked"
end if
or:
if Request.Form("checkBoxName") = "One" then
response.write "the checkbox has been checked"
end if

If you don't give the checkbox a value like this:
<input name="checkBoxName" type="checkbox">
then you check to see if a checkbox has been checked by the value "on".
if Request.Form("checkBoxName") = "on" then
response.write "the checkbox has been checked"
end if

How do I do a permanent redirect to a different page using ASP? How do I do a 301 redirect to a different page using ASP?

<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.newWebSite.com"
%>

How do I redirect to a different page? How do I refresh to a different page?

<%
Response.Redirect "yourpage.htm"
%>

How do I redirect information to a different page that I collected from a form?

Develop an asp page containing the form below.

<form name="RedirectInfoForm" Action="redirectInfo.asp" Method="post">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="Address" size="20"></td>
</tr>
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">City&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="City" size="20"></td>
</tr>
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="State" size="20"></td>
</tr>
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Zip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="Zip" size="20"></td>
</tr>
<tr>
<td><font face="tahoma, Arial, Helvetica" size="2" color="#000000"><span class="text">Country&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></td>
<td><input type="text" name="Country" size="20"></td>
</tr>
</table>
</div>
<div align="center">
<input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2">
</div>
</form>

Develop another asp page containing the code below and save it as redirectInfo.asp.

<%
Option Explicit
Dim strAddress
Dim strCity
Dim strState
Dim strZip
Dim strCountry

strAddress = Request.Form("Address")
strCity = Request.Form("City")
strState = Request.Form("State")
strZip = Request.Form("Zip")
strCountry = Request.Form("Country")

Response.Redirect "yourpage.asp?address=" & strAddress & "&city=" & strCity & "&state=" & strState & "&zip=" & strZip & "&country=" & strCountry & ""

%>

Develop a third asp page containing the code below and save it as yourpage.asp.

<%
Response.Write Request.QueryString("address") & "<br>" & Request.QueryString("city") & "<br>" & Request.QueryString("state") & "<br>" & Request.QueryString("Zip") & "<br>" & Request.QueryString("Country")
%>

How do I use a Query String in ASP?

In the first page you can pass the query string in a link or a redirect.

Pass the Query String in a link: (This page can be just an HTML page)

<a href="display.asp?view=01">Display Now</a>

or

Pass the Query String in a redirect: (This page has to be an ASP page)

<%
strNumber = "01" Response.Redirect "display.asp?view=" & strNumber
%>

or

<%
Response.Redirect "display.asp?view=01"
%>

In the second page you display the value of the query string.

<%Response.Write Request.QueryString("view")%>

or as an image

<img src="<%Response.Write Request.QueryString("view")%>.jpg">

How do I send an e-mail from an online form using ASP? (CDONTS)

Have the form's action go to "sendmail.asp"

Below is an example:

<Form Name="sendmail" Action="sendmail.asp" Method="post">

Have the "sendmail.asp" file contain the following:

<%


Dim fname, lname

Dim objCDO

fname = Request.Form("FirstName")

lname = Request.Form("LastName")

Set objCDO = Server.CreateObject("CDONTS.NewMail")

objCDO.From = "me@somewhere.com"

objCDO.To = "someone@somewhereelse.com"

objCDO.Cc = ""

objCDO.Bcc = ""

objCDO.Subject = "Submitted form data from my page"

objCDO.Body = "Name: " & fname & " " & lname

objCDO.BodyFormat = 1

objCDO.MailFormat = 1

objCDO.Send

Response.Redirect "thanks.asp"


%>

What does the objCDO.BodyFormat = 1 line do?

objCDO.BodyFormat = 1 - will send the email as plain text
objCDO.BodyFormat = 0 - will send the email as HTML

What other attributes for CDONTS are there?

objCDO.AttachURL - Attaches an image with your email
objCDO.AttachFile - Attaches the specified file to your email

How do I send an e-mail from an online form using ASP? (CDO)

Have the form's action go to "sendmail.asp"

Below is an example:

<Form Name="sendmail" Action="sendmail.asp" Method="post">

Have the "sendmail.asp" file contain the following:

<%


Dim fname, lname

Dim myMail

fname = Request.Form("FirstName")

lname = Request.Form("LastName")

Set myMail=CreateObject("CDO.Message")

myMail.Subject = "Sending email with CDO"

myMail.From = "me@somewhere.com"

myMail.To = "someone@somewhereelse.com"

myMail.Bcc = ""

myMail.Cc = ""

myMail.TextBody="Name: " & fname & " " & lname

myMail.Send

Response.Redirect "thanks.asp"


%>

What does the myMail.TextBody line do?

will send email as text

What other attributes for CDO are there?

myMail.HTMLBody - will send email as HTML
myMail.HTMLBody = "<h1>This is a message.</h1>"

myMail.CreateMHTMLBody - Sending an HTML e-mail that sends a webpage from a website
myMail.CreateMHTMLBody "http://www.somewhere.com"

myMail.AddAttachment - Attaches the specified file to your email
myMail.AddAttachment "c:\mydocuments\test.txt"

How do I make a line break or have text go to the next line using ASP?

add " & vbcrlf & " to you string (without the quotes)

Below is an example:

"Mr. John Smith" & vbcrlf & "123 Main Street" & vbcrlf & "City, State"

How do I Enable ASP in IIS 6.0 on a Windows 2003 server?

1. Open IIS Manager, expand the master server node (that is, the node), and then select the Web service extensions node.
2. In the right pane of the IIS Manager, right-click the extension that you want to enable. In this example, this is Active Server Pages.
3. Click to select the Allow check box.

Why do I get the error "Active Server Pages error 'ASP 0131' | Disallowed Parent Path | The Include file '../include.asp' cannot contain '..' to indicate the parent directory"

1. Open IIS Manager
2. Right click on the website that is giving you the error and select properties from the menu that pops up
3. Click on the "Home Directory" tab
4. Click on the "Configuration..." button
5. Click on the "Options" tab
6. Click the checkbox in front of "Enable parent paths" to check it
7. Click the "OK" button
8. Click the "OK" button

Why do I get the error "SQL Server does not exist or access denied?"

1. Go to "Programs" --> "Administartive Tools" --> "Data Sources (ODBC)
2. Click on the "System DSN" tab
3. Click on the Data Source you are using from the list under the heading "System Data Sources:" to select and highlight it
4. Click on the "Configure..." button
5. Click on the "Next >" button
6. Click on the "Client Configuration..." button
7. Click the checkbox in front of "Dynamically determine port" to uncheck it
8. Where it says "Port number:", enter the port number open to connect to the SQL server in the text box (example: 2433)
9. Click the "OK" button

Why do I get the error "Login failed for user ''. Reason: Not associated with a trusted SQL Server connection?"

This error occurs because by default SQL 2000 does not support SQL Server authentication and supports only Windows authentication. To overcome this limitation

1. Enter SQL Enterprise Manager.
2. Find your server name in the tree on the left.
3. Right mouse click on the server name and select properties.
4. Click the Security folder. You should now see the screen below with "Windows Only" set as the default authentication.
5. Check SQL Server and Windows as the Authentication.
6. Click OK.
7. Click Yes to restart SQL.

Why do I get the error "javasign.dll was unable to register itself in the system registry" when I try to install Visual Studio 6.0 on Windows XP?

There is a missing javacypt.dll. Either find it on your computer and add it into the system32 directory or download it from the web and add it into the system32 directory.

ASP.NET

How do I do a permanent redirect to a different page using ASP.NET? How do I do a 301 redirect to a different page using ASP.NET?

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Status="301 Moved Permanently"
Response.AddHeader("Location", "http://www.newWebSite.com")
End Sub

How do I send an e-mail from an online form using ASP.NET?

Add the following lines at the top of your code before the "Public Class"

Imports System.Web.Mail
Imports System.Web.Mail.MailMessage
Imports System.Web.Mail.MailFormat
Imports System.Web.Mail.SmtpMail

Private Sub btnSendmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendmail.Click

'Create an instance of the MailMessage class
Dim objMailMessage as New MailMessage()

'Set the properties for the to and from, have the to go to the email address that was entered in the form
objMailMessage.To = "webmaster@yoursite.com"
objMailMessage.From = txtEmail.Text

'If you want to CC this email to someone else, uncomment the line below
'objMailMessage.Cc = "someone@someaddress.com"

'If you want to BCC this email to someone else, uncomment the line below
'objMailMessage.Bcc = "someone@someaddress.com"

'To send the email in text format
objMailMessage.BodyFormat = MailFormat.Text

'To send the email in HTML, uncomment the line below
'objMailMessage.BodyFormat = MailFormat.HTML

'Set the priority - options are High, Low, and Normal
objMailMessage.Priority = MailPriority.Normal

'Set the subject
objMailMessage.Subject = "Email from Website Online Form"

'Set the body
objMailMessage.Body = "The body of the email"

'Specify to use the Smtp Server
SmtpMail.SmtpServer = ""

'Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMailMessage)

End Sub

How do I send a webpage as an e-mail using ASP.NET?

You must first add a reference to the Microsoft CDO For Windows 2000 Library

1. On the Project menu, click Add Reference.
2. Click the COM tab, locate Microsoft CDO For Windows 2000 Library, and then click Select.
3. In the Add References dialog box, click OK.
4. If you are prompted to generate wrappers for the libraries that you selected, click Yes.

Add the following lines at the top of your code before the "Public Class"

Imports CDO
Imports CDO.ConfigurationClass

Private Sub btnSendmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendmail.Click

'Create an instance of the CDO.Message class
Dim objCDOMessage as New CDO.Message

'Set the properties for the to and from, have the to go to the email address that was entered in the form
objCDOMessage.To = "webmaster@yoursite.com"
objCDOMessage.From = txtEmail.Text

'If you want to CC this email to someone else, uncomment the line below
'objCDOMessage.Cc = "someone@someaddress.com"

'If you want to BCC this email to someone else, uncomment the line below
'objCDOMessage.Bcc = "someone@someaddress.com"

'Set the subject
objCDOMessage.Subject = "Email from Website Online Form"

'Set the webpage as the body
objCDOMessage.CreateMHTMLBody("http://www.someaddress.com/default.htm")

'Now, to send the message, use the Send method of the CDO.Message class
objCDOMessage.Send()

End Sub

How do I validate an email address format using ASP.NET?

Add the following lines at the top of your code before the "Public Class"

Imports System.Text.RegularExpressions

Add the following lines of code to a function or procedure

Function ValidateEmail() As Boolean
Dim EmailRegex As Regex = New Regex("\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*")
Dim StringEmail As String = txtEmail.Text
Dim MatchEmail As Match = EmailRegex.Match(StringEmail)
If Not MatchEmail.Success Then
lblStat.Visible = True
lblStat.Text = "Email Address is wrong format."
ValidateEmail = False
End If
End Function

How do I validate a phone number format using ASP.NET?

Add the following lines at the top of your code before the "Public Class"

Imports System.Text.RegularExpressions

Add the following lines of code to a function or procedure

Function ValidatePhone() As Boolean
Dim PhoneRegex As Regex = New Regex("((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}")
Dim StringPhone As String = txtPhone.Text
Dim MatchPhone As Match = PhoneRegex.Match(StringPhone)
If Not MatchPhone.Success Then
lblStat.Visible = True
lblStat.Text = "Phone Number is wrong format."
ValidatePhone = False
End If
End Function

How do I upload a file using ASP.NET or how do I upload an image using ASP.NET?

In the HTML it is very important that this server-side form include the ENCTYPE="Multipart/Form-Data" attribute.

In the HTML form you have to use multipart/form-data encryption and you have to use method of post.

Add the following in the HTML:

<form Method="Post" EncType="Multipart/Form-Data" RunAt="Server">
<Input ID="MyFile" Type="File" RunAt="Server">
<asp:button id="btnUploadFile" runat="server" Text="Upload"></asp:button>
</form>

The type attribute is "File"
The RunAt attribute is "Server"
The id attribute uniquely identifies this HtmlInputFile control from others that may be on the page. It can be any value you would like.
The Accept attribute specifies the MIMEencodings
The MaxLength attribute specifies the maximum length of file path
The Size attribute specifies the width of textbox of the control

The HttpPostedFile has 4 properties:

ContentLength – size of uploaded file in bytes
ContentType – MIME type of uploaded file, i.e. “image/gif”
FileName – full path to uploaded file on client’s system, i.e. c:\Some folder\MyPicture.gif
InputStream – stream object that gives us access to uploaded data.

Add the following to the Code:

Add the following lines at the top of your code before the "Public Class"

Imports System.Web.UI.HtmlControls.HtmlInputFile
Imports System.Web.HttpPostedFile

Add the following lines after the "Public Class", after the "Inherits System.Web.UI.Page", and after the "Web Form Designer Generated Code"

Private Sub btnUploadFile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUploadFile.Click

' Display properties of the uploaded file
' The FileName, FileContent, and FileSize variables refer to label Web controls. The purpose of these label Web controls is to provide information about the uploaded file
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
FileSize.InnerHtml = MyFile.PostedFile.ContentLength
UploadDetails.visible = True

'Grab the file name from its fully qualified path at client
Dim strFullFileName as string = MyFile.PostedFile.FileName

' only the attached file name not its path
Dim strFileName as string = System.IO.Path.GetFileName(strFullFileName)

'Save uploaded file to server at C:\ServerFolder\
' The Span1 and Span2 variables refer to label Web controls. The purpose of these label Web controls is to provide information about the uploaded file
Try
MyFile.PostedFile.SaveAs("C:\ServerFolder\" & strFileName)
Span1.InnerHtml = "Your File Uploaded Sucessfully at server as: C:\ServerFolder\" & strFileName
Catch Exp as exception
Span1.InnerHtml = "An Error occured. Please check the attached file"
UploadDetails.visible = false
Span2.visible=false
End Try

End Sub

The filename string of the file you upload that you would want to store in a database is strFileName

By default ASP.NET limits the size of file uploads to around 4Mb.

To enable support for larger files, you should add the following configuration setting value to your machine.config or web.config and change the maxRequestLength to the desired size.

<configuration>
<system.web>
<httpRuntime maxRequestLength="4096" />
</system.web>
</configuration>

How can I create a folder (directory) on the Web server using ASP.NET?

The FileSystemObject contains a CreateFolder method that can be used to create a folder on the Web server's file system. This method takes one parameter, the path of the folder to create. For example, to create a FooBar folder on the C:\ drive, you could use the following code:

'Create an instance of the FileSystemObject
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Create C:\FooBar
objFSO.CreateFolder("C:\FooBar")

It's that simple! One caveat: if the folder already exists and you try creating it, you will get a "File Already Exists" error. Therefore, rather than just blindly adding a new folder, you may wish to check if it exists first and, if it doesn't, then add it. You can check to see if a folder exists using the FolderExists method of the FileSystemObject object like so:

'Create an instance of the FileSystemObject
Dim objFSO
objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Create C:\FooBar
If Not objFSO.FolderExists("C:\FooBar") then
objFSO.CreateFolder("C:\FooBar")
End If

This script first checks to make sure the folder doesn't exist and then adds it. This method is preferred since it will not try to create a folder if it already exists.

A closing note: when dealing with IIS, the permissions granted to IUSR_machinename are important. For example, if you do not have write permission to the C:\ drive for IUSR_machinename, an error will occur in the above script. (The machinename part of the IUSR_machinename bit above is the name of the Web server. If the Web server's machine name is Bob, then the IUSR_Bob account must have adequate permissions.)

How can I retrieve a list of files in a folder (directory) using ASP.NET?

The FileSystemObject contains three methods to retrieve specific Drive, Folder, and File objects: GetDrive, GetFolder, and GetFile, respectively. Each of these three methods returns the appropriate object type.

To get a specific folder, use the GetFolder method. You can then iterate through each of the files in that folder by using the Files collection. For example, the following code will list the files in the directory C:\InetPub\wwwroot.

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Get the folder object associated with the directory
Dim objFolder
Set objFolder = objFSO.GetFolder("C:\InetPub\wwwroot")

Response.Write "The files found in " & objFolder.Name & ":<br>"

'Loop through the Files collection
Dim objFile
For Each objFile in objFolder.Files
Response.Write objFile.Name & "<br>"
Next

'Clean up! Set objFolder = Nothing Set objFile = Nothing Set objFSO = Nothing

How do I display an image in a web datagrid using ASP.NET or how do I display an image in a webgrid using ASP.NET?

Basically in the HTML you have to have a Datagrid.
You have to add a TemplateColumn to that Datagrid
Inside the TemplateColumn you need a TemplateItem
Inside the TemplateItem you need an image control

Add the following in the HTML:

<form id="Form1" method="post" runat="server">
<asp:datagrid id="dgWithImage" runat="server" AutoGenerateColumns="False" AllowSorting="True">
<Columns>
<asp:TemplateColumn HeaderText="Sort by:">
<HeaderStyle Width="145px"></HeaderStyle>
<ItemTemplate>
<asp:Image id="Image" runat="server" Width="140px" Height="85px" ImageUrl='<%#DataBinder.Eval(Container.DataItem, "imageURL")%>'>
</asp:Image>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</form>

When you create your SQL query you have to include a field from the database table called imageURL

Dim ImageDataAdapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter
Dim ImageDataTable As New DataTable
Dim ImageCommand As New SqlClient.SqlCommand
ImageCommand.Connection = New SqlClient.SqlConnection(ImageConnection)
ImageCommand.CommandText = "SELECT imageURL From Images"
ImageCommand.CommandTimeout = 0
ImageCommand.Connection.Open()
ImageDataAdapter.SelectCommand = ImageCommand
ImageDataAdapter.Fill(ImageDataTable)
dgWithImage.DataSource = ImageDataTable
dgWithImage.DataBind()

How do I change the text or format of text of a row in a web datagrid using ASP.NET or how do I change the text or format of text of a row in a webgrid using ASP.NET?

Private Sub dgChangeText_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgChangeText.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then
e.Item.Cells(3).Text = e.Item.Cells(4).Text & "added text" e.Item.Cells(4).Text = changeFormatOfText(e.Item.Cells(3).Text) ElseIf e.Item.ItemType = ListItemType.AlternatingItem Then
e.Item.Cells(3).Text = e.Item.Cells(4).Text & "added text" e.Item.Cells(4).Text = changeFormatOfText(e.Item.Cells(3).Text) End If
End Sub

How do I change the color of a row in a web datagrid when the mouse is over or rollover using ASP.NET or how do I change the color of a row in a webgrid when the mouse is over or rollover using ASP.NET?

Private Sub dgRollover_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRollover.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#99ccff'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='" & ColorTranslator.ToHtml(dgRollover.ItemStyle.BackColor) & "'")
ElseIf e.Item.ItemType = ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#99ccff'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='" & ColorTranslator.ToHtml(dgRollover.AlternatingItemStyle.BackColor) & "'")
End If
End Sub

How do I change the color of text of a row in a web datagrid when the mouse is over or rollover using ASP.NET or how do I change the color of text of a row in a webgrid when the mouse is over or rollover using ASP.NET?

Use Cascading Style Sheets

Create a file called text.css containing:
tr.textHover {
   font-family: Arial, Verdana, Helvetica;
   font-size: 10px;
   color: FF0000;
   text-decoration: underline;
   font-weight: none;
   cursor: hand;
}
tr.textNormal {
   font-family: Arial, Verdana, Helvetica;
   font-size: 10px;
   color: 000000;
   text-decoration: underline;
   font-weight: none;
   cursor: hand;
}

Private Sub dgRollover_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRollover.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then
e.Item.Attributes.Add("onmouseover", "className='textHover'")
e.Item.Attributes.Add("onmouseout", "className='textNormal'")
ElseIf e.Item.ItemType = ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onmouseover", "className='textHover'")
e.Item.Attributes.Add("onmouseout", "className='textNormal'")
End If
End Sub

How do I add a click event to a row in a web datagrid using ASP.NET or how do I add a click event to a row in a webgrid using ASP.NET?

Private Sub dgClick_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgClick.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then
e.Item.Attributes.Add("onclick", "window.location='viewRowInfo.aspx?idRow=" & e.Item.Cells(0).Text & "'")
ElseIf e.Item.ItemType = ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onclick", "window.location='viewRowInfo.aspx?idRow=" & e.Item.Cells(0).Text & "'")
End If
End Sub

When I created the SQL query I included the ID field from the database table and added it to the first column of each row in the web datagrid or the webgrid using ASP.NET?

Dim ClickDataAdapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter
Dim ClickDataTable As New DataTable
Dim ClickCommand As New SqlClient.SqlCommand
ClickCommand.Connection = New SqlClient.SqlConnection(ImageConnection)
ClickCommand.CommandText = "SELECT idRow From Clicks"
ClickCommand.CommandTimeout = 0
ClickCommand.Connection.Open()
ClickDataAdapter.SelectCommand = ClickCommand
ClickDataAdapter.Fill(ClickDataTable)
dgClick.DataSource = ClickDataTable
dgClick.DataBind()

How do I add a javascript to a button onclick event using ASP.NET or how do I add a javascript to a button on click event using ASP.NET?

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
btnButton.Attributes.Add("onClick", "return javascriptFunction();")
End Sub

When pressing the Enter Key the Button Control's Click event doesn't always fire using ASP.NET?

http://aspnet.4guysfromrolla.com/articles/060805-1.aspx

One way to make the Submit Button Control's Click event always fire when the Enter Key is pressed. Also how you can designate which Submit Button Control's Click event to fire when the Enter Key is Pressed, if there are multiple Submit Buttons Controls on the form

In the Form Tag add the "defaultbutton" property:
<form id="form1" runat="server" defaultbutton="btnSearch">

Using JavaScript to prevent form submission or trigger form submission when the Enter Key is pressed:
http://www.cs.tut.fi/~jkorpela/forms/enter.html

How do I add a User Control (an .ascx file) to a ASP.NET page (an .aspx file) using ASP.NET?

A User Control can be used like an include.

At the top of the User Control file (the .ascx file) (the file that will be used like an include) put
<%@ Control Language="VB" %>
Name that file something like header.ascx

At the top of the Main file (the .aspx file) put
<%@ Register TagPrefix="UserControl1" TagName="Header" Src="header.ascx" %>

Between the <body> tags of the main page (the .aspx file) put
<UserControl1:Header runat="server" ID="Header1" ></UserControl1:Header>

In the code section of the main page (the .aspx.vb file) put
Protected WithEvents Header1 As Header
In the Web Form Designer Generated Code section

How do I add commas to a number using ASP.NET?

Public Function chNumberCommas(ByRef numberToComma As Object) As Object
Dim HowMany As Integer
Dim HowManyOriginal As Integer
Dim Make_Comma_Number As String
Dim NewData As String
Dim i As Integer
Dim Counter As Integer
Dim a As Integer
Dim DataOf As String
Dim positionOfDecimal
Dim newNumberToComma As String
Dim strEnd As String
Dim numberWithCommas As String
positionOfDecimal = InStr(numberToComma, ".")
If positionOfDecimal > 0 Then
newNumberToComma = Left(numberToComma, (positionOfDecimal - 1))
HowManyOriginal = Len(numberToComma)
strEnd = Mid(numberToComma, positionOfDecimal, ((HowManyOriginal - positionOfDecimal) + 1))
Else
newNumberToComma = numberToComma
strEnd = ""
End If
HowMany = Len(newNumberToComma)
If HowMany < 4 Then
Make_Comma_Number = newNumberToComma
Else

'Add in commas----------------------
For i = 1 To HowMany
NewData = Mid(newNumberToComma, i, 1) & NewData
Next i

For a = 1 To HowMany
Counter = Counter + 1

If Counter = 4 Then
DataOf = Mid(NewData, a, 1) & "," & DataOf
Counter = 1
Else

DataOf = Mid(NewData, a, 1) & DataOf
End If

Next a
'-----------------------------------

Make_Comma_Number = DataOf
End If
numberWithCommas = Make_Comma_Number & strEnd
Return numberWithCommas
End Function

When I try to open or create a new ASP.NET Web application in Visual Studio .NET 2003, I receive the following error message:
Visual Studio .NET has detected that the specified Web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web applications or services.

1. Click Start, and then click Run.
2. In the Open text box, type cmd, and then press ENTER.
3. At the command prompt, type the following, and then press ENTER:
"%windir%\Microsoft.NET\Framework\version\aspnet_regiis.exe" -i
In this path, version represents the version number of the .NET Framework that you installed on your server. You must replace this placeholder with the actual version number when you type the command.

When I move an ASP.NET application from one local computer to another local computer and then try to run the ASP.NET application, I receive the following error message:
Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged.

1. Open IIS
2. Right click on the website
3. Select properties from the menu that pops up
4. Click the "Directory" tab
5. Where it says Application Settings
6. Click the Create button

Another possible problem/fix is:

1. Click Start menu, and then click Run.
2. In the Open text box, type cmd, and then click 'OK'.
3. At the command prompt, type the following, and then press ENTER:
C:\WINDOWS\Micorsoft.NET\Framework\v2.0.50727\aspnet_regiis -i

When I run the ASP.NET application, I receive the following error message:
unable to find script library '/aspnet_client/system_web/1_1_4322/WebUIValidation.js'. Try placing this file manually, or reinstall by running 'aspnet_regiis -c'.

You need to :
1. Go to Administrative Tools.
2. Open up the Personal Web Manager.
3. Click on the advanced Icon.
4. Select the /aspnet_client item under the Virtual Directories area.
5. Click the Edit Properties button.
6. change the directory path to c:\inetpub\wwwroot\aspnet_client
if that is the location of your aspnet_client.

When I upload to the web server and run the ASP.NET application, I receive the following error message:
Access is denied.

Check your web.cofig file to see if you are denying anonymous users from accessing your site.

Make sure the red line below is there:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings/>
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</configuration>

Make sure the red line below is not there:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings/>
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>

How do I view what is in the Global Assembly Cache (GAC)?

1. Control Panel
2. Administrative Tools
3. "Microsoft .NET Framework Configuration"
4. "Manage the Assembly Cache" or "Assembly Cache"
5. "View List of Assemblies in the Assembly Cache"

Some ASP.NET Links:

http://www.aspfaqs.com

http:/www.4GuysFromRolla.com

CGI / Perl

Where is Perl on my Server?

To find the location of perl on your server, open a command prompt and type: which perl

How do I use a Query String in CGI / Perl?

Develop the first page you pass the query string in a link.

Pass the Query String in a link: (This page can be just an HTML page)

<a href="cgi-bin/display.cgi?view=01">Display Now</a>

Develop a cgi page containing the code below and save it in the cgi-bin folder as display.cgi to display the value of the query string

#!/usr/bin/perl -w
print "Content-type:text/html\n\n";

#parse query string data
if (length ($ENV{'QUERY_STRING'}) > 0){
$buffer = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $buffer);
foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$in{$name} = $value;
}
}

print "<html>";
print "<head>";
print "<title>Portfolio</title>";
print "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";
print "</head>";
print "<body bgcolor='#FFFFFF'>";
print "<table cellpadding=0 cellspacing=0 border=0 width='100%' height='100%'>";
print " <tr>";
print " <td align=center valign=center>$in{view}</td>";
print " </tr>";
print "</table>";
print "</body>";
print "</html>";

or as an image

#!/usr/bin/perl -w
print "Content-type:text/html\n\n";

#parse query string data
if (length ($ENV{'QUERY_STRING'}) > 0){
$buffer = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $buffer);
foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$in{$name} = $value;
}
}

print "<html>";
print "<head>";
print "<title>Portfolio</title>";
print "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";
print "</head>";
print "<body bgcolor='#FFFFFF'>";
print "<table cellpadding=0 cellspacing=0 border=0 width='100%' height='100%'>";
print " <tr>";
print " <td align=center valign=center><img src='../$in{view}.jpg'></td>";
print " </tr>";
print "</table>";
print "</body>";
print "</html>";

How do I send an e-mail from an online form using CGI / Perl?

Develop a html page containing the form below and save it as mailform.htm

<form method="post" action="/cgi-bin/sendmail.cgi">
<table width="400">
<tr>
<td width="50%">First Name:</td>
<td width="50%"><input type="text" name="fname" size="30"></td>
</tr>
<tr>
<td width="50%">Last Name:</td>
<td width="50%"><input type="text" name="lname" size="30"></td>
</tr>
<tr>
<td width="50%">Address:</td>
<td width="50%"><input type="text" name="address" size="30"></td>
</tr>
<tr>
<td width="50%">City:</td>
<td width="50%"><input type="text" name="city" size="30"></td>
</tr>
<tr>
<td width="50%">State:</td>
<td width="50%"><input type="text" name="state" size="30"></td>
</tr>
<tr>
<td width="50%">Zip Code:</td>
<td width="50%"><input type="text" name="zipcode" size="30"></td>
</tr>
<tr>
<td width="50%"><input type="submit" name="submit" value="Send"></td>
<td width="50%"><input type="reset" name="submit2" size="Reset"></td>
</tr>
</table>
</form>

Develop a cgi page containing the code below and save it in the cgi-bin folder as sendmail.cgi

#!/usr/bin/perl -w
print "Content-type:text/html\n\n";

#parse form data
#the next line reads in the data passed into the script
read(STDIN, $buffer, $ENV{CONTENT_LENGTH});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
# Separate the name and value:
($name, $value) = split(/=/, $pair);
# Convert + signs to spaces:
$value =~ tr/+/ /;
# Convert hex pairs (%HH) to ASCII characters:
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Store values in a hash called %FORM:
$FORM{$name} = $value;
}

#where is the mail program?
$mailprog = '/usr/sbin/sendmail';

$recipient = 'someone@somewhereelse.com';
$sender = 'me@somewhere.com'; # default sender?

#this opens an output stream and pipes it direclty to
#the sendmail program.
#If sendmail can't be found abort nicely by calling
#the dienice subroutine

open(MAIL, "|$mailprog -t") or dienice("Can't access $mailprog\n");

#here we're printing out the header info for the mail message. You must
#specify who it's for or it will not be delivered:
print MAIL "From: ($FORM{fname} $FORM{lname})\n";

print MAIL "To: $recipient\n";

#reply to address can be set to the email address of the sender,
#assuming you have actually defined a field in your form called email.

print MAIL "Reply-to: $sender\n";

#print out a subject line so you know it is from your form cgi.
#The two \n\n's end the header section of the message.
#anything you print after this point will be part of the body of the
#email.

print MAIL "Subject: Message\n\n";

print MAIL "$FORM{fname}, $FORM{lname}, $FORM{address},
$FORM{city}, $FORM{state}, $FORM{zipcode}\n";

#when you finish writing the mail message, be sure to close
#the input stream so it actually gets mailed.

close(MAIL);

#now print something nice to the HTML page, usually thanking the person
#for filling out the form, and giving them a link
#back to your homepage

print <<EndHTML;
<body link="#FF0000"vlink="#FF0000" alink="#FFFFFF">
<H2>Thank You</H2>
Thank you for your request.


</BODY></HEAD>
EndHTML

#the dienice subroutine, for handling errors.

sub dienice
{
my($errmsg) = @_;
print "<H2>Error</H2>\n";
print "$errmsg<p>\n";
print "</BODY></HTML>\n";
exit;
}

How do I choose who to send an e-mail to from an online form using CGI / Perl?

Develop a html page containing the form below and save it as mailform.htm

<form method="post" action="/cgi-bin/sendmail.cgi">
<table width="400">
<tr>
<td width="50%">Send To:</td>
<td width="50%"><select name="Send_To">
<option selected>Select from List</option>
<option value="1">Name 1</option>
<option value="2">Name 2</option>
<option value="3">Name 3</option>
<option value="4">Name 4</option>
</select></td>
</tr>
<tr>
<td width="50%">First Name:</td>
<td width="50%"><input type="text" name="fname" size="30"></td>
</tr>
<tr>
<td width="50%">Last Name:</td>
<td width="50%"><input type="text" name="lname" size="30"></td>
</tr>
<tr>
<td width="50%">Address:</td>
<td width="50%"><input type="text" name="address" size="30"></td>
</tr>
<tr>
<td width="50%">City:</td>
<td width="50%"><input type="text" name="city" size="30"></td>
</tr>
<tr>
<td width="50%">State:</td>
<td width="50%"><input type="text" name="state" size="30"></td>
</tr>
<tr>
<td width="50%">Zip Code:</td>
<td width="50%"><input type="text" name="zipcode" size="30"></td>
</tr>
<tr>
<td width="50%"><input type="submit" name="submit" value="Send"></td>
<td width="50%"><input type="reset" name="submit2" size="Reset"></td>
</tr>
</table>
</form>

Develop a cgi page containing the code below and save it in the cgi-bin folder as sendmail.cgi

#!/usr/bin/perl -w
print "Content-type:text/html\n\n";

#parse form data
#the next line reads in the data passed into the script
read(STDIN, $buffer, $ENV{CONTENT_LENGTH});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
# Separate the name and value:
($name, $value) = split(/=/, $pair);
# Convert + signs to spaces:
$value =~ tr/+/ /;
# Convert hex pairs (%HH) to ASCII characters:
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Store values in a hash called %FORM:
$FORM{$name} = $value;
}

#where is the mail program?
$mailprog = '/usr/sbin/sendmail';

if ( $FORM{'Forward_To'} == 1 )
{
$recipient = 'name1@somewhereelse.com';
}
elsif ( $FORM{'Forward_To'} == 2 )
{
$recipient = 'name2@somewhereelse.com';
}
elsif ( $FORM{'Forward_To'} == 3 )
{
$recipient = 'name3@somewhereelse.com';
}
elsif ( $FORM{'Forward_To'} == 4 )
{
$recipient = 'name4@somewhereelse.com';
}
$sender = 'me@somewhere.com'; # default sender?

#this opens an output stream and pipes it direclty to
#the sendmail program.
#If sendmail can't be found abort nicely by calling
#the dienice subroutine

open(MAIL, "|$mailprog -t") or dienice("Can't access $mailprog\n");

#here we're printing out the header info for the mail message. You must
#specify who it's for or it will not be delivered:
print MAIL "From: ($FORM{fname} $FORM{lname})\n";

print MAIL "To: $recipient\n";

#reply to address can be set to the email address of the sender,
#assuming you have actually defined a field in your form called email.

print MAIL "Reply-to: $sender\n";

#print out a subject line so you know it is from your form cgi.
#The two \n\n's end the header section of the message.
#anything you print after this point will be part of the body of the
#email.

print MAIL "Subject: Message\n\n";

print MAIL "$FORM{fname}, $FORM{lname}, $FORM{address},
$FORM{city}, $FORM{state}, $FORM{zipcode}\n";

#when you finish writing the mail message, be sure to close
#the input stream so it actually gets mailed.

close(MAIL);

#now print something nice to the HTML page, usually thanking the person
#for filling out the form, and giving them a link
#back to your homepage

print <<EndHTML;
<body link="#FF0000"vlink="#FF0000" alink="#FFFFFF">
<H2>Thank You</H2>
Thank you for your request.


</BODY></HEAD>
EndHTML

#the dienice subroutine, for handling errors.

sub dienice
{
my($errmsg) = @_;
print "<H2>Error</H2>\n";
print "$errmsg<p>\n";
print "</BODY></HTML>\n";
exit;
}

How do I check the visitor's IP address in CGI / Perl or How do I get the visitor's IP address in CGI / Perl

Develop a cgi page containing the code below and save it in the cgi-bin folder as getIPaddress.cgi to display the value of the query string

#!/usr/bin/perl -w
print "Content-type:text/html\n\n";

$remote_addr = $ENV{'REMOTE_ADDR'};
chomp ($remote_addr);

#splits up the ip address into four variables

$ip = "$ENV{'REMOTE_ADDR'}";
($IP1, $IP2, $IP3, $IP4) = split /\./, $ip;

print "<html>";
print "<head>";
print "<title>Portfolio</title>";
print "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";
print "</head>";
print "<body bgcolor='#FFFFFF'>";
print "<table cellpadding=0 cellspacing=0 border=0 width='100%' height='100%'>";
print " <tr>";
print " <td align=center valign=center>Your ip is $remote_addr</td>";
print " </tr>";
print "</table>";
print "</body>";
print "</html>";

What should the permissions or chmod be for the cgi-bin folder and the sendmail.cgi file?

The permissions should be 755

read = 4

write = 2

execute = 1

So read, write, execute = 7 (4 + 2 + 1 = 7)

So read, execute = 5 (4 + 1 = 5)

So read, execute = 5 (4 + 1 = 5)

owner group other
     
read, write, execute read, execute read, execute
     
rwx r-x r-x

How do I redirect to a different page? How do I refresh to a different page?

print "Location: yourpage.htm\n\n";

How do I make a line break or have text go to the next line using CGI /Perl?

\n

Some Perl Links:

http://www.mediacollege.com/internet/perl/index.html

http:/www.perl.org

htaccess file

How do I do a permanent redirect to a different page using an .htaccess file? How do I do a 301 redirect to a different page using an .htaccess file?

Create a new file and save it as ".htaccess" to your root directory (if one does not exist already)
In the file put a line:

Redirect permanent /oldpage.htm http://www.yourDomainName.com/newPage.htm
or:
Redirect 301 /oldpage.htm http://www.yourDomainName.com/newPage.htm
Be sure not to add "http://www" to the first part of the statement - just put the path from the top level of your site to the page. Also ensure that you leave a single space between these elements.

How do I do a permanent redirect an entire directory using an .htaccess file? How do I do a 301 redirect an entire directory using an .htaccess file?

Create a new file and save it as ".htaccess" to your root directory (if one does not exist already) of the website, not the directory you want to permanently redirect.
In the file put:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^private(.*) http://private.newWebSite.com/$1 [R=301,L]

The first "private" is the name of the directory you want to redirect

How do I do a permanent redirect an entire website using an .htaccess file? How do I do a 301 redirect an entire website using an .htaccess file?

Create a new file and save it as ".htaccess" to your root directory (if one does not exist already) of the website you want to permanently redirect.
In the file put:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newWebSite.com/$1 [R=301,L]

How do I password protect webpages and files inside a folder and make a login pop up before one can view the webpages or files inside that folder with a web browser?

In the httpd.conf file change the lines:

AllowOverride None

to:

AllowOverride AuthConfig

to look like this:

<Directory /home/caucus/public_html/>
       AllowOverride AuthConfig
</Directory>

Create a new file and save it as ".htaccess" in the folder you want to password protect.
In the file put:

AuthName "Login to the Password Protected Folder"
AuthType Basic
AuthUserFile /home/caucus/public_html/.htpasswd
Require user david

Note that the AuthName requires quotes and whatever is in quotes will display on the login window when a user tries to access your folder with a web browser. It is vital that you properly set the path for the AuthUserFile.
Also be sure to include the user login names of the people you plan to allow to this folder next to the Require user line. In my case, I simply added myself to this folder as a user (david).

Now, create the .htpasswd file in the same folder you want to password protect but NOT by using a text editor. Instead use this command from the command line on your Linux server.

Type this command at the prompt:

htpasswd -cmb .htpasswd david dav1d

Note that you must use your own name and password, replace david with the username you want to use and dav1d with the password you want to use. The option -cmb does the following: The -c option forces the creating of a new .htpasswd file. Since this is your first time adding a user it is necessary. Next the -m option forces encryption and the -b option allows you to include the user name and password immediately.

To add users you simply need to edit both files again. First, add a user to the .htaccess file (my example is eddie).

The .htaccess file should include these lines:

AuthName "Login to the Password Protected Folder"
AuthType Basic
AuthUserFile /home/caucus/public_html/.htpasswd
Require user david eddie

Remember to save the file when youre done adding the new user!

Now add the user (my example being eddie) to the .htpasswd file using this command:

htpasswd -mb .htpasswd eddie 3dd1e

Apache

How can I Restrict Directory Indexing?

In order to prevent users from seeing the lists of all of the files in the Caucus file libraries, you should turn off directory indexing for Caucus. In the httpd.conf file add the lines:

<Directory /home/caucus/public_html>
       Options -Indexes
</Directory>

How do I do a permanent redirect an entire website? How do I do a 301 redirect an entire website?

In the httpd.conf

<VirtualHost 24.74.44.54:80>
DocumentRoot /home/oldWebsite/web
ServerName www.oldWebsite.com
Redirect 301 / http://www.newWebSite.com
</VirtualHost>

How do I password protect webpages and files inside a folder and make a login pop up before one can view the webpages or files inside that folder with a web browser?

In the httpd.conf file change the lines:

AllowOverride None

to:

AllowOverride AuthConfig

to look like this:

<Directory /home/caucus/public_html/>
       AllowOverride AuthConfig
</Directory>

Create a new file and save it as ".htaccess" in the folder you want to password protect.
In the file put:

AuthName "Login to the Password Protected Folder"
AuthType Basic
AuthUserFile /home/caucus/public_html/.htpasswd
Require user david

Note that the AuthName requires quotes and whatever is in quotes will display on the login window when a user tries to access your folder with a web browser. It is vital that you properly set the path for the AuthUserFile.
Also be sure to include the user login names of the people you plan to allow to this folder next to the Require user line. In my case, I simply added myself to this folder as a user (david).

Now, create the .htpasswd file in the same folder you want to password protect but NOT by using a text editor. Instead use this command from the command line on your Linux server.

Type this command at the prompt:

htpasswd -cmb .htpasswd david dav1d

Note that you must use your own name and password, replace david with the username you want to use and dav1d with the password you want to use. The option -cmb does the following: The -c option forces the creating of a new .htpasswd file. Since this is your first time adding a user it is necessary. Next the -m option forces encryption and the -b option allows you to include the user name and password immediately.

To add users you simply need to edit both files again. First, add a user to the .htaccess file (my example is eddie).

The .htaccess file should include these lines:

AuthName "Login to the Password Protected Folder"
AuthType Basic
AuthUserFile /home/caucus/public_html/.htpasswd
Require user david eddie

Remember to save the file when youre done adding the new user!

Now add the user (my example being eddie) to the .htpasswd file using this command:

htpasswd -mb .htpasswd eddie 3dd1e

Webalizer

How can I have webalizer easily process multiple virtual hosts?

There are many ways to process multiple virtual hosts on the same machine. The easiest way I have found, provided that each host generates it's own log file, is as follows:

1. Create a central directory for your configuration files. (I use /etc/webalizer)
2. Make a configuration file for each virtual host and place them in the central directory. Each configuration file should have at least the HostName (domain), OutputDir and LogFile configuration settings specified. You probably will want to specify other settings specific to the domain, such as HideReferrer, HideSite and maybe some others as well. Name the file the same as the domain name, and end it with a .conf extension, so you can easily tell what vhost the configuration is for.
(Just copy the webalizer.conf file to the /etc/webalizer central directory for each virtual host naming each file different for each virtual host: cp webalizer.conf webalizer/virtualhostname.conf)
3. To process all your virtual sites with a single command, a simple shell command can now be used:

for i in /etc/webalizer/*.conf; do webalizer -c $i; done

You can put this in the /etc/cron.daily/ directory so that the webalizer stats update daily
Create a new file called 00webalizer in the /etc/cron.daily/ directory
In the 00webalizer file put:

#! /bin/bash
# update access statistics for the web site


if [ -s /var/log/httpd/access_log ] ; then
   /usr/bin/webalizer
fi


for i in /etc/webalizer/*.conf;
do
   /usr/bin/webalizer -c $i;
done

exit 0

After you have it set up, to add a new host, all you need to do is create a new configuration file and put it in the directory. It will be automatically picked up the next time the command is run.

Some Webalizer Links:

http://www.mrunix.net/webalizer

VSFTP

How Do I Get VSFTPD Started?

You can start, stop, or restart VSFTPD after booting by using these commands:

[root@bigboy tmp]# service vsftpd start
[root@bigboy tmp]# service vsftpd stop
[root@bigboy tmp]# service vsftpd restart

To configure VSFTPD to start at boot you can use the chkconfig command

[root@bigboy tmp]# chkconfig vsftpd on

Note: In RedHat Linux version 8.0 and earlier, VSFTPD operation is controlled by the xinetd process, which is covered in Chapter 16, "TELNET, TFTP, and XINETD." You can find a full description of how to configure these versions of Linux for VSFTPD in Appendix III, "Fedora Version Differences."

How Do I Test to See if VSFTPD is Running?

You can always test whether the VSFTPD process is running by using the netstat -a command which lists all the TCP and UDP ports on which the server is listening for traffic. This example shows the expected output.

[root@bigboy root]# netstat -a | grep ftp

tcp 0 0 *:ftp *:* LISTEN

[root@bigboy root]#

If VSFTPD wasn't running, there would be no output at all.

Some VSFTP Links:

http://www.siliconvalleyccie.com/linux-hn/ftp-server.htm#_Toc92808796

Interesting Links

Redirect Checker

http://www.ragepank.com/redirect-check

http://www.internetofficer.com/seo-tool/redirect-check

http://www.webconfs.com/redirect-check.php

Meta Tag Analyzer

http://www.widexl.com/remote/search-engines/metatag-analyzer.html

Search Engine Spider Simulator

http://www.seo-guy.com/seo-tools/spider.php

Search Engine Ranking Tools

http://www.advantageconsultingservices.com/tools.html

Search Engine Positioning Tool

http://www.seo-guy.com/seo-tools/se-pos.php

Keyword Position Checker

http://www.ineedhits.com/free-tools/free-position-check.aspx

http://www.twospots.com/index.php?act=directory&sub=keyword-position-checker

Link Popularity Check

http://www.linkpopularitycheck.com

http://www.ineedhits.com/free/popularity

http://www.widexl.com/remote/link-popularity/index.html

http://www.submitexpress.com/linkpop

Test Your Web Site Speed

http://www.WebPageAnalyzer.com

Test Your Connection Speed

http://promos.mcafee.com/speedometer/test_0600.asp

DNS Report

http://www.dnsreport.com

http://www.dnsstuff.com

SamSpade.org

http://www.samspade.org

SPF Record Syntax

http://www.openspf.org/SPF_Record_Syntax

HOWTO - Define an SPF Record

http://www.zytrax.com/books/dns/ch9/spf.html

The SPF Setup Wizard

http://old.openspf.org/wizard.html

SPF Record Testing Tools

http://www.kitterman.com/spf/validate.html

What is my IP?

http://www.whatismyip.com

Font Finder

http://www.myfonts.com/WhatTheFont/

Internet Archive: Wayback Machine

http://www.archive.org/web/web.php

Miscellaneous

How do I copy text from a command prompt window?

1. Open Command Prompt
2. Right-click the title bar of the command prompt window, point to Edit, and then click Mark.
3. Click the beginning of the text you want to copy.
4. Press and hold down the SHIFT key, and then click the end of the text you want to copy (or you can click and drag the cursor to select the text).
5. Right-click the title bar, point to Edit, and then click Copy.
6. Position the cursor where you want the text to be inserted:
7. In an MS-DOS-based program, or in a command prompt window, right-click the title bar, point to Edit, and then click Paste.
8. In a Windows-based program, click the Edit menu, and then click Paste

How do I shutdown / restart the Computer / Server while using Windows Remote Desktop or Terminal Server?

Alt + F4. This will call up the shutdown dialog, where you get the usual shutdown options like "Shut down", "Shut down without installing updates", "Restart", "Stand by", and "Hibernate".

How do I Ctrl + Alt + Delete while using Windows Remote Desktop or Terminal Server?

Ctrl + Alt + End.

Definitions

UNC (Universal Naming Convention)

The name given for the naming used when one specifies: \\the server\the volume\the path\then the file name of a file. So, a UNC filename would look like this: \\Myserver\Docdrive\Magazine\glossary.doc.

FQDN (Fully Qualified Domain Name)

A fully qualified domain name consists of a host and domain name, including top-level domain. For example, www.webopedia.com is a fully qualified domain name. www is the host, webopedia is the second-level domain, and.com is the top level domain.
A FQDN always starts with a host name and continues all the way up to the top-level domain name, so www.parc.xerox.com is also a FQDN.

VB.NET

How to send an email from a VB.NET application? (CDONTS)

You must first add a reference to the Microsoft CDO for NTS 1.2 Library

1. On the Project menu, click Add Reference.
2. Click the COM tab, locate Microsoft CDO for NTS 1.2 Library, and then click Select.
3. In the Add References dialog box, click OK.
4. If you are prompted to generate wrappers for the libraries that you selected, click Yes.

Add the following lines at the top of your code before the "Public Class"

Imports CDONTS
Imports CDONTS.NewMailClass
Imports System.Configuration

Private Sub btnSendmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendmail.Click

'Create an instance of the CDONTS.NewMail class
Dim objNewMail As New CDONTS.NewMail

'Set the properties for the to and from, have the to go to the email address that was entered in the form
objNewMail.From = "webmaster@yoursite.com"
objNewMail.To = txtEmail.Text

'If you want to CC this email to someone else, uncomment the line below
'objNewMail.Cc = "someone@someaddress.com"

'If you want to BCC this email to someone else, uncomment the line below
'objNewMail.Bcc = "someone@someaddress.com"

'Set the subject
objNewMail.Subject = "Email from Application Form"

'Set the body
objNewMail.Body = "The body of the email"

'objNewMail.BodyFormat = 1 - will send the email as plain text
'objNewMail.BodyFormat = 0 - will send the email as HTML
objNewMail.BodyFormat = 1
objNewMail.MailFormat = 1

'Now, to send the message, use the Send method of the CDONTS.NewMail class
objNewMail.Send()

End Sub

What other attributes for CDONTS are there?

objCDO.AttachURL - Attaches an image with your email
objCDO.AttachFile - Attaches the specified file to your email

How to send an email from a VB.NET application? (CDO)

You must first add a reference to the Microsoft CDO For Windows 2000 Library

1. On the Project menu, click Add Reference.
2. Click the COM tab, locate Microsoft CDO For Windows 2000 Library, and then click Select.
3. In the Add References dialog box, click OK.
4. If you are prompted to generate wrappers for the libraries that you selected, click Yes.

Add the following lines at the top of your code before the "Public Class"

Imports CDO
Imports CDO.ConfigurationClass

Private Sub btnSendmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendmail.Click

'Create an instance of the CDO.Message class
Dim objCDOMessage as New CDO.Message

'Set the properties for the to and from, have the to go to the email address that was entered in the form
objCDOMessage.To = "webmaster@yoursite.com"
objCDOMessage.From = txtEmail.Text

'If you want to CC this email to someone else, uncomment the line below
'objCDOMessage.Cc = "someone@someaddress.com"

'If you want to BCC this email to someone else, uncomment the line below
'objCDOMessage.Bcc = "someone@someaddress.com"

'Set the subject
objCDOMessage.Subject = "Email from Application Form"

'Set the body
objCDOMessage.TextBody = "The body of the email"

'Now, to send the message, use the Send method of the CDO.Message class
objCDOMessage.Send()

End Sub

What does the objCDOMessage.TextBody line do?

will send email as text

What other attributes for CDO are there?

objCDOMessage.HTMLBody - will send email as HTML
objCDOMessage.HTMLBody = "<h1>This is a message.</h1>"

objCDOMessage.CreateMHTMLBody - Sending an HTML e-mail that sends a webpage from a website
objCDOMessage.CreateMHTMLBody "http://www.somewhere.com"

objCDOMessage.AddAttachment - Attaches the specified file to your email
objCDOMessage.AddAttachment "c:\mydocuments\test.txt"

How do I Export a Datagrid to an Excel File in VB.NET or How do I Transfer Data from a Datagrid to an Excel File in VB.NET?

You must first add a reference to the Microsoft CDO for NTS 1.2 Library

1. On the Project menu, click Add Reference.
2. Click the COM tab, locate Microsoft Excel Object Library, and then click Select.
3. In the Add References dialog box, click OK.
4. If you are prompted to generate wrappers for the libraries that you selected, click Yes.

Add the FolderBrowserDialog Control to your Form

Add the following lines at the top of your code before the "Public Class"

Imports Microsoft
Imports Microsoft.Office.Interop

Private Sub btnExcelExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExcelExport.Click
' Checks to see if the user entered a file name for the new Excel file
If txtExcelFileName.Text = "" Then
MsgBox("You must Enter an Excel File Name")
txtExcelFileName.Focus()
Exit Sub
End If

' Opens the Folder Browser Dialog so that the User Can Browse to the Folder where to Save the Excel File
FolderBrowserDialog1.ShowDialog()
Dim Path As String
Path = FolderBrowserDialog1.SelectedPath()

If fgCases.Rows.Count < 1 Then
MsgBox("There are no found Cases to Export To Excel")
Exit Sub
End If
Dim oExcel As New Excel.Application
Dim oBook As Object
Dim oSheet As Object

'Start a new workbook in Excel
oBook = oExcel.Workbooks
oBook = oBook.Add()
oSheet = oBook.Worksheets(1)

Dim myRow As DataRow
Dim myColumn As New DataColumn
Dim RowCount As Object
Dim ColumnCount As Object
Dim FileAndPath As String = Path & "\" & txtExcelFileName.Text & ".xls"

'Add the column headers to the excel sheet'
ColumnCount = 1
Dim iColumns As Integer
iColumns = 0
'For iColumns = 1 To (fgCases.Cols.Count - 1) - use this if you want to loop through all of the columns in the datagrid
'oExcel.ActiveSheet.Cells(1, ColumnCount) = fgCases.Cols(iColumns).Caption - use this if you want to loop through all of the columns in the datagrid
oExcel.ActiveSheet.Cells(1, 1) = fgCases.Cols(4).Caption
oExcel.ActiveSheet.Columns(1).ColumnWidth = 17
oExcel.ActiveSheet.Cells(1, 2) = fgCases.Cols(5).Caption
oExcel.ActiveSheet.Columns(2).ColumnWidth = 41
oExcel.ActiveSheet.Cells(1, 3) = fgCases.Cols(6).Caption
oExcel.ActiveSheet.Columns(3).ColumnWidth = 17
oExcel.ActiveSheet.Cells(1, 4) = fgCases.Cols(7).Caption
oExcel.ActiveSheet.Columns(4).ColumnWidth = 12
oExcel.ActiveSheet.Cells(1, 5) = fgCases.Cols(8).Caption
oExcel.ActiveSheet.Columns(5).ColumnWidth = 8
oExcel.ActiveSheet.Cells(1, 6) = fgCases.Cols(9).Caption
oExcel.ActiveSheet.Columns(6).ColumnWidth = 22
oExcel.ActiveSheet.Cells(1, 7) = fgCases.Cols(10).Caption
oExcel.ActiveSheet.Columns(7).ColumnWidth = 17
oExcel.ActiveSheet.Cells(1, 8) = fgCases.Cols(11).Caption
oExcel.ActiveSheet.Columns(8).ColumnWidth = 22
oExcel.ActiveSheet.Cells(1, 9) = fgCases.Cols(12).Caption
oExcel.ActiveSheet.Columns(9).ColumnWidth = 17
oExcel.ActiveSheet.Cells(1, 10) = fgCases.Cols(13).Caption
oExcel.ActiveSheet.Columns(10).ColumnWidth = 11
oExcel.ActiveSheet.Cells(1, 11) = fgCases.Cols(14).Caption
oExcel.ActiveSheet.Columns(11).ColumnWidth = 11
oExcel.ActiveSheet.Cells(1, 12) = fgCases.Cols(15).Caption
oExcel.ActiveSheet.Columns(12).ColumnWidth = 11
'ColumnCount = ColumnCount + 1 - use this if you want to loop through all of the columns in the datagrid
'Next iColumns - use this if you want to loop through all of the columns in the datagrid

ColumnCount = 1
RowCount = 2

'Add the data to the excel sheet'
iColumns = 0
'ColumnCount = 0 - use this if you want to loop through all of the columns in the datagrid
Dim iRows As Integer
'For iColumns = 1 To (fgCases.Cols.Count - 1) - use this if you want to loop through all of the columns in the datagrid
RowCount = 2
For iRows = 1 To (fgCases.Rows.Count - 1)
'oExcel.ActiveSheet.Cells(RowCount, ColumnCount) = fgCases.Item(iRows, iColumns)
oExcel.ActiveSheet.Cells(RowCount, 1) = fgCases.Item(iRows, 4)
oExcel.ActiveSheet.Cells(RowCount, 2) = fgCases.Item(iRows, 5)
oExcel.ActiveSheet.Cells(RowCount, 3) = fgCases.Item(iRows, 6)
oExcel.ActiveSheet.Cells(RowCount, 4) = fgCases.Item(iRows, 7)
oExcel.ActiveSheet.Cells(RowCount, 5) = fgCases.Item(iRows, 8)
oExcel.ActiveSheet.Cells(RowCount, 6) = fgCases.Item(iRows, 9)
oExcel.ActiveSheet.Cells(RowCount, 7) = fgCases.Item(iRows, 10)
oExcel.ActiveSheet.Cells(RowCount, 8) = fgCases.Item(iRows, 11)
' To change the format of the cell to text, use the @
oExcel.ActiveSheet.Cells(RowCount, 9).NumberFormat = "@"
oExcel.ActiveSheet.Cells(RowCount, 9) = fgCases.Item(iRows, 12)
oExcel.ActiveSheet.Cells(RowCount, 10) = fgCases.Item(iRows, 13)
oExcel.ActiveSheet.Cells(RowCount, 10).NumberFormat = "$#,##0.00"
oExcel.ActiveSheet.Cells(RowCount, 11) = fgCases.Item(iRows, 14)
oExcel.ActiveSheet.Cells(RowCount, 11).NumberFormat = "$#,##0.00"
oExcel.ActiveSheet.Cells(RowCount, 12) = fgCases.Item(iRows, 15)
oExcel.ActiveSheet.Cells(RowCount, 12).NumberFormat = "$#,##0.00"
RowCount = RowCount + 1
Next
'ColumnCount = ColumnCount + 1 - use this if you want to loop through all of the columns in the datagrid
'Next - use this if you want to loop through all of the columns in the datagrid

ColumnCount = 0

'This saves the excel file to C:\Example.xls on the server'
Try
oBook.SaveAs(FileAndPath)
'MsgBox("List of Cases have been Exported to an Excel File located C:\" & txtExcelFileName.Text & ".xls")
MsgBox("List of Cases have been Exported to an Excel File located " & Path & "\" & txtExcelFileName.Text & ".xls")
Catch ex As Exception
MsgBox(ex.Message)
Finally
System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet)
oSheet = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook)
oBook = Nothing
oExcel.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel)
oExcel = Nothing
' Garbage Collector
GC.Collect()
End Try
End Sub

' You need this for the Folder Browser Dialog, you need to add the FolderBrowserDialog Control to your form
Private Sub FolderBrowserDialog1_HelpRequest(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FolderBrowserDialog1.HelpRequest
End Sub

How do I Deploy a Windows Application in VB.NET?

1. In VS .NET, open your Windows application and go to the View menu and select Solution Explorer. Right click your Windows application solution and from the pop up menu, select Add then click New Project
2. The Add New Project dialog box appears. Select Setup and Deployment Projects in the left pane and select Setup Project in the right pane.
3. Where it says Name:, Type a name for the deployment project in the text box.
4. Click the Browse... button to select a location to save the new deployment project.
5. Click OK.
6. In the Solution Explorer, right click the new deployment project and select Add then click Project Output…
7. The Add Project Output Group dialog box appears. Select the Original Project from the drop down menu. Select Primary Output to be added to your Setup project.
8. Click OK.
9. Build menu and select Build your deployment project.

How do I Deploy a Windows Application in VB.NET that contain Crystal Reports 10 Reports?

1. In VS .NET, open your Windows application and go to the View menu and select Solution Explorer. Right click your Windows application solution and from the pop up menu, select Add then click New Project
2. The Add New Project dialog box appears. Select Setup and Deployment Projects in the left pane and select Setup Project in the right pane.
3. Where it says Name:, Type a name for the deployment project in the text box.
4. Click the Browse... button to select a location to save the new deployment project.
5. Click OK.
6. In the Solution Explorer, right click the new deployment project and select Add then click Project Output…
7. The Add Project Output Group dialog box appears. Select the Original Project from the drop down menu. Select Primary Output to be added to your Setup project.
8. Click OK.
9. In the Solution Explorer, right click the new deployment project and select Add then click Merge Module…
10. The Add Modules dialog box appears. Select CrystalReports10_NET_EmbeddedReporting.msm You can get the Crystal Reports 10 merge modules at http://support.businessobjects.com/mergemodules
11. Click Open.
12. From the new deployment project, select the Crystal Reports merge module you just added, right click and select "Properties", to display the properties.
13. Expand the MergeModuleProperties and enter a valid license key in the Keycode Properties box. The license key is the alphanumeric string you receive when registering Crystal Reports. Please note that this is not the 10-digit registration number. This is mandatory whenever you deploy a Crystal Reports for Visual Studio .NET application using CrystalReports10_NET_EmbeddedReporting.msm.
14. You can also find the license key by opening VS .NET and going to the 'Help' menu and selecting 'About…'. Under the 'Installed application list' is the license key for Crystal Reports for Visual Studio .NET.
15. Build menu and select Build your deployment project.

How do I Deploy a Windows Application in VB.NET using Visual Studio 2005 that contain Crystal Reports 10 Reports?

1. In VS .NET, open your Windows application and go to the View menu and select Solution Explorer. Right click your Windows application solution and from the pop up menu, select Add then click New Project
2. The Add New Project dialog box appears. Select Setup and Deployment Projects in the left pane and select Setup Project in the right pane.
3. Where it says Name:, Type a name for the deployment project in the text box.
4. Click the Browse... button to select a location to save the new deployment project.
5. Click OK.
6. In the Solution Explorer, right click the new deployment project and select Add then click Project Output…
7. The Add Project Output Group dialog box appears. Select the Original Project from the drop down menu. Select Primary Output to be added to your Setup project.
8. Click OK.
9. In the Solution Explorer, right click the new deployment project and select Add then click Merge Module…
10. The Add Modules dialog box appears. Select CrystalReports10_NET_EmbeddedReporting.msm You can get the Crystal Reports 10 merge modules at http://support.businessobjects.com/mergemodules
11. Click Open.
12. From the new deployment project, select the Crystal Reports merge module you just added, right click and select "Properties", to display the properties.
13. Expand the MergeModuleProperties and enter a valid license key in the Keycode Properties box. The license key is the alphanumeric string you receive when registering Crystal Reports. Please note that this is not the 10-digit registration number. This is mandatory whenever you deploy a Crystal Reports for Visual Studio .NET application using CrystalReports10_NET_EmbeddedReporting.msm.
14. You can also find the license key by opening VS .NET and going to the 'Help' menu and selecting 'About…'. Under the 'Installed application list' is the license key for Crystal Reports for Visual Studio .NET.
15. In the Solution Explorer, right click the new deployment project and select Properties
16. The Property Pages dialog box appears.
17. Click the Prerequisites... button.
18. Click the checkbox in front of "Microsoft Data Access Components 2.8" to check it.
19. Click the checkbox in front of "Crystal Reports for .Net Framework 2.0" to check it.
20. Click OK.
21. Click OK.
22. Build menu and select Build your deployment project.

How do I Deploy a SSIS Packages in SQL Server 2005?

http://decipherinfosys.wordpress.com/2008/09/16/deploying-ssis-packages-in-sql-server-2005/

How do I Pass the Database SQL logon information to a report and subreport in a Crystal Report using VB.NET?

Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
#End Region
Private Sub
Dim oRpt As ReportDocument
oRpt = New ReportDocument
oRpt.Load("C:\\Reports\\MyReport.rpt")
'
' Declare require variables.
Dim logOnInfo As TableLogOnInfo ' TableLogOnInfo Referenced By CrystalDecisions.Shared
logOnInfo = New TableLogOnInfo
Dim i As Integer
' Loop through every table in the report.
For i = 0 To oRpt.Database.Tables.Count - 1
' Set the connection information for current table.
logOnInfo.ConnectionInfo.ServerName = "server name"
logOnInfo.ConnectionInfo.DatabaseName = "database name"
logOnInfo.ConnectionInfo.UserID = "user id"
logOnInfo.ConnectionInfo.Password = "password"
oRpt.Database.Tables.Item(i).ApplyLogOnInfo(logOnInfo)
Next i
Dim j As Integer
' Loop through every subreport, then loop through every table in the subreport and set the logoninfo to every table in the subreport
If oRpt.Subreports.Count > 0 Then
For i = 0 To oRpt.Subreports.Count - 1
For j = 0 To oRpt.Subreports.Item(i).Database.Tables.Count - 1
logOnInfo.ConnectionInfo.ServerName = "server name"
logOnInfo.ConnectionInfo.DatabaseName = "database name"
logOnInfo.ConnectionInfo.UserID = "user id"
logOnInfo.ConnectionInfo.Password = "password"
oRpt.Subreports.Item(i).Database.Tables.Item(j).ApplyLogOnInfo(logOnInfo)
Next
Next
End If
oRpt.SetDatabaseLogon("user id", "password", "server name", "database name")
crvViewer.ReportSource = oRpt
crvViewer.Zoom(85%)
crvViewer.Show()
'
logOnInfo = Nothing
oRpt = Nothing
Cursor.Current = Cursors.Default
'
End Sub
End Class

Why do I get the Error Message: "Load Report Failed" when running a .NET Windows application with a Crystal Report?

A Microsoft Visual Studio .NET application uses Crystal Reports 10 for Visual Studio .NET SDK as the reporting development tool.

When the application is deployed to a computer that does not have a C drive, the following error message appears:

"Load Report Failed"

It is common to not have a C drive on Terminal servers and Citrix servers.

1. On the 'Start' menu, click 'Run'.
2. In the 'Run' dialog box, type "Regedit" then click 'OK'.
3. In the Registry Editor browse to the following subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Crystal Decisions\10.0\Report Application Server\InprocServer\LocalConnectionMgr
4. Right-click the 'ConnectionDirectoryPath' string value, then click 'Modify'.
5. In the 'Value data' text box, change "c:\" to the drive letter where the following directory exists (You may need to search your computer to find where this directory exists):
\Program Files\Common Files\Crystal Decisions\2.5\bin
6. Click 'OK'.
7. Right-click the 'LocalConnectionMgr' subkey, click 'New' then click 'String Value'.
8. Name this String Value "ReportDirectoryPath".
9. Right-click the 'ReportDirectoryPath' string value and click 'Modify'.
10. In the 'Value data' text box, type the same drive letter as you typed in step 5.

How do I add If Then statements into a formula field using Crystal Reports?

Right click on the formula field and select "Edit..."
Change "Crystal Syntax" to "Basic Syntax" in the drop down menu at the top
Now you can add to the variable "formula="
Example:
If {Table.City} = "" and {Table.State} = "" then
formula = ""
else
formula = {Table.City} + ", " + {Table.State}
end if

How do I format a string to phone number format using Crystal Reports?

Create a formula field
Change "Crystal Syntax" to "Basic Syntax" in the drop down menu at the top
Put the following in the formula field you just created:
Example:
If {Table.PhoneNumber} = "" then
formula = ""
else
formula = picture({Table.PhoneNumber},"(xxx) xxx-xxxx" )
end if

How do I catenate fields of records into one string using Crystal Reports?

Create a formula field
Keep "Crystal Syntax" in the drop down menu at the top
Put the following in the formula field you just created:

global stringvar str;
str := str + {MyTable.MyField};

Replace {MyTable.MyField} with appropriate field and table from your database.

Put the formula field in the footer section of your report.

How do I suppressing sections for a repeated field using Crystal Reports?

Individual report objects have a Suppress If Duplicated property which suppresses the object if its data is the same as the previous record. This prevents the report from duplicating the same information multiple times. But sections don’t have this property because Crystal Reports would have to analyze every field within the report section to make this decision. But you can write your own formula to do this and only base it on the fields that are important.

Crystal Reports gives you two formulas for comparing the current record to an adjacent record. In the Function Window under the Print State category, it lists the functions PreviousValue() and NextValue(). The PreviousValue() function compares the current record’s value to the previous record’s value. The NextValue() function does just the opposite by comparing it to the following record’s value. It returns True if the values match. You can use these functions to suppress an entire section if certain fields don’t change from one record to the next.

The following code is the conditional formatting for the Suppress property of the Details section. It tests if the Orders.CustomerId field is the same as the previous record, and if so, doesn’t show the section.

1. Where it says details, right click and select "Section Expert..."
2. Click the checkbox in front of "Supress (No Drill-Down)" to check it
3. Click the button with the pencil on it
4. Change "Crystal Syntax" to "Basic Syntax" in the drop down menu at the top
if ({Orders.CustomerId} = PreviousValue({Orders.CustomerId})) then
formula = TRUE
end if
5. Click the save and close button

How do I not have a blank page before the first section using Crystal Reports?

1. Right click the section and select "Format Section"
2. Click the checkbox in front of "New Page Before" to check it
3. Click the button with the pencil on it
4. Type the formula "Not OnFirstRecord"
5. Click the save and close button

SQL

How do I SELECT the next record with SQL?

Here are two examples:

SELECT idOrder FROM orders WHERE idOrder > currentIdOrder AND idCustomer=currentIdCustomer AND OrderStatus>1 ORDER BY idOrder Asc

SELECT idVehicle FROM Vehicles WHERE idVehicle > currentIdVehicle AND isDeleted = 0 ORDER BY idVehicle Asc

How do I SELECT the previous record with SQL?

Here are two examples:

SELECT idOrder FROM orders WHERE idOrder < currentIdOrder AND idCustomer=currentIdCustomer AND OrderStatus>1 ORDER BY idOrder Desc

SELECT idVehicle FROM Vehicles WHERE idVehicle < currentIdVehicle AND isDeleted = 0 ORDER BY idVehicle Desc

How do I INSERT distinct values from one column of one table into another different table?

INSERT INTO tableTwoName (newColumn) (SELECT DISTINCT originalColumn FROM tableOneName)

How do I INSERT values from one column with a specified WHERE clause into the same table with a different associated foreign key?

Copy all of Company 1's products for Company 2
companies_products table has two columns; idCompany and idProduct. We want to SELECT all of Company 1's products and INSERT the returned products for Company 2

INSERT INTO companies_products SELECT DISTINCT idProduct, '2' AS idCompany FROM companies_products WHERE idCompany = 1

How do I ORDER BY the date and time of a login field that has the login, date and time all in the same enteredBy or editedByfield?

Convert(datetime, SUBSTRING(lastEditedBy, ((CHARINDEX(' ',lastEditedBy))+1), (LEN(lastEditedBy))))

Let's go outside in:
There is a Convert(datetime, string) function that is going to change the final result string to date and time
There is a SUBSTRING(string, startingPosition, length) function that gets a substring of a string string using a starting position and length of the sub string that you want.
The string is the lastEditedBy field that contains the login, date and time
The startingPosition will be the space (' ') between the login and the date plus (+) one (1)
The length will be the length of the whole field since we want the substring to include all of the date and time and there is nothing at the end of the field that we don't want.
To get the startingPosition, there is a CHARINDEX(substringToBeFound, stringToBeFoundIn) that finds the starting position of a substring foung in another string
The substringToBeFound is the space ' ' between the login and the date
The stringToBeFoundIn is the lastEditedBy field that contains the login, date and time
To get the length, there is a LEN(string) that returns the length of a string
The string is the lastEditedBy field that contains the login, date and time

How do I Join a Table with itself to get two columns in the same record that is actually two different records from the same column field?

select c.courseID, c.coursename, convert(varchar(25), f.coursedate) + ' ' + convert(varchar(25), f.coursetime) as 'First', convert(varchar(25),s.coursedate) + ' ' + convert(varchar(25),s.coursetime) as 'Second', f.officeName, month(f.coursedate),month(s.coursedate)
from coursedate f, coursedate s, course c
where f.fkcourseID = c.courseID and s.fkcourseID = c.courseID
and f.status = 'offering'
and s.status = 'offering'
and f.officeName = s.officeName
and convert(varchar(25), f.coursedate) + ' ' + convert(varchar(25), f.coursetime) < convert(varchar(25),s.coursedate) + ' ' + convert(varchar(25),s.coursetime)
and month(f.coursedate) = month(s.coursedate)
and f.fkcourseID = s.fkcourseID

How do I find a stored procedure containing <text>?

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%text%'
AND ROUTINE_TYPE='PROCEDURE'

How do I SELECT records from the last six months with SQL?

The DATEADD function allows you to compute a date that is 6 months ago:

DATEADD(m, -6, getdate())

use this to compare your date column:

SELECT *
FROM yourTable
WHERE yourdatecolumn > DATEADD(m, -6, getdate())

How do I SELECT Only the Date Part of the Current Date with SQL?

SELECT CONVERT(varchar(10), getdate(), 101)

How do I calculate the difference between two dates with SQL?

The DATEDIFF function allows you to calculate the amount of time between two dates

To find out the difference in minutes. Find out how many minutes it took to respond to the problem ticket:

SELECT DATEDIFF(minute, tableTicket.ticketDate, tableTicket.dateHistoryChanged) as no_of_minutes FROM tableTicket

To find out the difference in days, Find out how many days a ticket has been open:

SELECT DATEDIFF(day, tableTicket.ticketDate, getdate()) as no_of_days FROM tableTicket

The getdate() function returns the current date and time.

How do I convert a string into a datetime data type with SQL?

Use the CONVERT function

Convert(datetime, strDateTime)

How do I SELECT a field from a different query or How do I select a field from a different select statement with SQL?

We want to select the sum of a field that we selected with a different select statement:
The field we want to sum is no_of_minutes. We selected that field, no_of_minutes, from a query or select statement that we named qryNumMins

SELECT SUM(qryNumMins.no_of_minutes) from (SELECT DATEDIFF(minute, tableTicket.ticketDate, tableTicket.dateHistoryChanged) as no_of_minutes FROM tableTicket) as qryNumMins

How do I SELECT the length or number of characters of a field?

For Columns with the Data Types VarChar and nVarChar:

SELECT LEN(data)

For Columns with the Data Type TEXT:

SELECT DATALENGTH(data)

How do I get the smallest number that is available and not in the database or How do I get the lowest available number not already in the database?

Using a Stored Procedure

BEGIN
 /* Get the Lowest Number */
 SET @availNum = (SELECT MIN(numAssigned) as LowestNum FROM yourTable)
 /* If the Lowest Number is One then One is Not Available and Get the Lowest Number Available */
 IF @availNum = 1
  SET @availNum = (SELECT MIN(numAssigned) + 1 AS minnumber FROM yourTable WHERE (numAssigned + 1) NOT IN (SELECT numAssigned FROM yourTable))
 /* If the Lowest Number is not One then One is Available */
 ELSE
  SET @availNum = 1
 /* Return the Lowest Number Avaiable */
 SELECT @availNum AS minAvailNum
END

Why do I get the Error Message: "Error 21002: [SQL-DMO] User already exists" after I copied a database from one server to another server, attached the database to the new server, and tried to recreate the user/login under the Security --> Logins folder with SQL Server 2000?

This means that the Database ID for the user is different on the new server.
Login to the new server as sysadmin (sa), and run the following stored procedure:

SP_CHANGE_USERS_LOGIN UPDATE_ONE, 'login','login'

'login' is the user/login that you were trying to recreate on the new serverv

Why do I get the Error Message: "An error 1069 - (The service did not start due to a login failure) occurred while performing this service operation on the sqlserveragent service" when I try to start the SQL Server Agent with SQL Server 2000?

You must change the SQL Server Agent Logon

1. From the "Start" menu --> "Settings" --> "Control Panel" --> "Administrative Tools" --> "Services"
2. Find the SQLAgent service.
3. Right click on the SQLAgent service and select "Properties"
4. A New Window opens
5. Click on the "Log On" tab
6. Under the heading "Log on as:", Change the Logon information.

I changed it to the radio button "Local System account"

Why do I get the Error Message: "The MUST_CHANGE option is not supported by this version of Microsoft Windows. (Microsoft SQL Server, Error: 15195)" when creating a new Login using "SQL server authentication" with SQL Server 2005?

This means that you are not working on a WINDOWS 2003 Server. The implementation of SQL Server 2005, brought us a much wider sort of security mechanism, like exiring passwords, complexity rules etc. but they can be only used on a WIndows 2003 Server. Unless you don´t have one, I would uncheck the checkbox (User must change password at next login) as this is throwing the error message.

Why do I get the Error Message: "No description found" when creating a new Maintenance Plan and trying to save it with SQL Server 2005?

To resolve this, ensure the correct MSXML dll's are registered on the server by running the following commands in the following order:
regsvr32 msxml3.dll
regsvr32 msxml6.dll

How do I Deploy a SSIS Packages in SQL Server 2005?

http://decipherinfosys.wordpress.com/2008/09/16/deploying-ssis-packages-in-sql-server-2005/

Microsoft Excel

What is the password to edit the macros in the invoice template?

chzdood

How do I Fill Color Every Other Row?

1. Fill Color the First Row.
2. Leave the Second Row with no Fill Color.
3. Select the First and Second Row.
4. Click the Format Painter, It’s the icon in the Standard toolbar that looks like a paintbrush, once.
5. Then using the mouse select the remaining rows by holding down the mouse button and dragging the mouse.
6. When you release the mouse button, the remaining rows will be Fill Colored the same way the first two rows were.

How do I make the Top Header Row stay visible as you scroll down through data?

1. Select the cell in the first column (ex. column A) and the row just below the header.
2. Menu option "Window" --> "Freeze Panes".

Anything visible in the window above and to the left of the cell pointer will remain visible as you scroll down the worksheet. Note that since the cell pointer was in column A, only the top row of headers will remain visible.

Why do I make the column headers show numbers not letters, or instead of letters?

1. Menu option "Tools" --> "Options"
2. A New Window opens with the title "Options"
3. Click on the "General" tab
4. Under the heading "Settings", Click the checkbox in front of "R1C1 reference style" to uncheck it
5. Click the "OK" button

How do I convert a column to a row or how do I change a column to a row?

1. Copy the column you want to convert to a row
2. Select the first cell in the row in which you want to paste the data from the column
3. Menu option "Edit" --> "Paste Special..."
4. A New Window opens with the title "Paste Special"
5. Click the checkbox in front of "Transpose" to check it
6. Click the "OK" button

How do I convert a row to a column or how do I change a row to a column?

1. Copy the row you want to convert to a column
2. Select the first cell in the column in which you want to paste the data from the row
3. Menu option "Edit" --> "Paste Special..."
4. A New Window opens with the title "Paste Special"
5. Click the checkbox in front of "Transpose" to check it
6. Click the "OK" button

How do I open the Visual Basic Editor using Excel 2007?

On the "Developer" tab, click "Visual Basic".
    I don't see the Developer tab
    1. Click the "Microsoft Office Button", and then click the "Excel Options" button.
    2. A New Window opens with the title "Excel Options"
    3. Click "Popular"
    4. Click the checkbox in front of "Show Developer tab in the Ribbon" to check it.
    5. Click the "OK" button

or

Alt + F11

Microsoft Word

How do I Rotate Text in Word?

Suppose you want to make 'place cards' with text on both sides of the fold. You will want one of the peices of text to be upside down. This is not as easy as it should be in Microsoft Word.

In a Word table you can rotate 'text' 90 degrees to the left, or ninety degrees to the right. However you can NOT rotate it 180 degrees.

The solution is to rotate both peices of text through 90 degrees, one to the left, and one to the right.

1. Create a table using the table drawing tool
2. Menu option "Table" --> "Insert" --> "Table"
3. A New Window opens with the title "Insert Table"
4. Under the heading "Table size", Where it says "Number of colums:", select "2" from the drop down menu
5. Under the heading "Table size", Where it says "Number of rows:", select "1" from the drop down menu
6. Click the "OK" button
7. Right click inside the left cell and select "Text Direction..."
8. A New Window opens with the title "Text Direction - Table Cell"
9. Click on the vertical box on the right
11. Click the "OK" button
12. Right click inside the right cell and select "Text Direction..."
13. A New Window opens with the title "Text Direction - Table Cell"
14. Click on the vertical box on the left
15. Click the "OK" button

How do I Select a Picture that has been Formatted to be Behind Text Layout?

1. Display the Drawing toolbar. Menu option "View" --> "Toolbars" --> "Drawing"
2. Click the Arrow Tool or the "Select Objects" Tool
3. Click the Picture that you want to select to select it.

Microsoft Visio

What happened to the Generate and Update commands on the Database menu in Visio?

The short answer is that the Generate and Update commands are not available in the Standard and Professional editions of either Microsoft Office Visio 2003 or Microsoft Visio 2002. The Generate and Update commands are only available in Microsoft Visio Enterprise Architect edition and Microsoft Visio 2000 Enterprise Edition.

Microsoft Visio Enterprise Architect edition is part of Microsoft Visual Studio .NET 2003 Enterprise Architect.

Visio Standard and Visio Professional cannot generate a database, such as a Microsoft Access or Microsoft SQL Server™ database, from a database model diagram.

If you want to generate or update a database from a database model diagram, you must use either Microsoft Visio Enterprise Architect edition or Visio 2000 Enterprise Edition.

Note Visio 2003 uses a different file format than the 2003 edition of Visio Enterprise Architect. If you create a database model diagram in Visio 2003, you must save it as a Visio 2002 file before you can open it in Visio Enterprise Architect. On the File menu, click Save As, and then, in the Save as type list box, click Visio 2002 drawing.

Microsoft Outlook 2000

Outlook Calendar or Task reminders may not appear at the scheduled time.

1. If Outlook is not running, start Outlook, and keep Outlook running to receive reminders. .
2. When you create reminders, verify that they are saved in your primary Calendar or Task folder.
3. Quit Outlook, click Start, point to Run, type outlook /cleanreminders, and then click OK.
4. Next try the alternative, Quit Outlook, click Start, point to Run, type outlook /cleanfreebusy, and then click OK.
5. Last resort try, Quit Outlook, click Start, point to Run, type outlook /resetfolders, and then click OK.

Why do I get the error "The view is damaged. Default view settings will be used."

1. Quit Outlook, click Start, point to Run, type outlook /cleanviews, and then click OK.
2. Outlook will start without the previous error.

How do I recover items that have been hard deleted in Outlook?

http://support.microsoft.com/kb/246153
http://support.microsoft.com/kb/178630

It is also possible to permanently delete items without first moving them to the Deleted Items folder. This procedure is called a "hard delete" as opposed to a "soft delete".

By default, the Recover Deleted Items functionality is only enabled on the Deleted Items folder in a user's private folders; items that are hard deleted cannot be recovered. To enable the Recover Deleted Items functionality on mail folders other than Deleted Items (for example, for Sent Items, Drafts, Outbox and Inbox folders), you must make the following changes to the registry:

1. On the 'Start' menu, click 'Run'.
2. In the 'Run' dialog box, type "Regedit" then click 'OK'.
3. In the Registry Editor browse to the following subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Options
4. Right-click the 'Options' subkey, click 'New', and then click 'DWORD Value'.
5. Type 'DumpsterAlwaysOn' for the 'Value name', and then press 'ENTER'.
6. Double-click 'DumpsterAlwaysOn'.
7. In the 'Value data' text box, type 1, and then click 'OK'.
8. Quit Registry Editor.

After you change the registry:

1. Open Microsoft Outlook
2. Menu option "Tools" --> "Deleted Item Recovery"

A list of items that have been hard deleted during the retention time set on the server is displayed.

Microsoft Outlook 2003

How do I Recover 'permanently' deleted email in Microsoft Outlook 2003?

If there is definitely a retention policy and less time has passed than is set in the policy, your deleted items are still being stored on the Exchange server.

To recover them:

1. Open Microsoft Outlook
2. Click-select your Deleted Items folder
3. Menu option "Tools" --> "Recover Deleted Items"

Items permanently deleted from the Inbox will never get sent to the Deleted Items folder and therefore will not be recoverable from there. Instead, you need to run Recover Deleted Items from the folder from which the item was deleted.

http://support.microsoft.com/kb/246153
http://support.microsoft.com/kb/178630

It is also possible to permanently delete items without first moving them to the Deleted Items folder. This procedure is called a "hard delete" as opposed to a "soft delete".

By default, the Recover Deleted Items functionality is only enabled on the Deleted Items folder in a user's private folders; items that are hard deleted cannot be recovered. To enable the Recover Deleted Items functionality on mail folders other than Deleted Items (for example, for Sent Items, Drafts, Outbox and Inbox folders), you must make the following changes to the registry:

1. On the 'Start' menu, click 'Run'.
2. In the 'Run' dialog box, type "Regedit" then click 'OK'.
3. In the Registry Editor browse to the following subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Options
4. Right-click the 'Options' subkey, click 'New', and then click 'DWORD Value'.
5. Type 'DumpsterAlwaysOn' for the 'DWORD name', and then press 'ENTER'.
6. Double-click 'DumpsterAlwaysOn'.
7. In the 'Value data' text box, type 1, and then click 'OK'.
8. Quit Registry Editor.

After you change the registry:

1. Open Microsoft Outlook
2. Menu option "Tools" --> "Deleted Item Recovery"

A list of items that have been hard deleted during the retention time set on the server is displayed.

How do I recover items that have been hard deleted in Outlook?

http://support.microsoft.com/kb/246153
http://support.microsoft.com/kb/178630

It is also possible to permanently delete items without first moving them to the Deleted Items folder. This procedure is called a "hard delete" as opposed to a "soft delete".

By default, the Recover Deleted Items functionality is only enabled on the Deleted Items folder in a user's private folders; items that are hard deleted cannot be recovered. To enable the Recover Deleted Items functionality on mail folders other than Deleted Items (for example, for Sent Items, Drafts, Outbox and Inbox folders), you must make the following changes to the registry:

1. On the 'Start' menu, click 'Run'.
2. In the 'Run' dialog box, type "Regedit" then click 'OK'.
3. In the Registry Editor browse to the following subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Options
4. Right-click the 'Options' subkey, click 'New', and then click 'DWORD Value'.
5. Type 'DumpsterAlwaysOn' for the 'Value name', and then press 'ENTER'.
6. Double-click 'DumpsterAlwaysOn'.
7. In the 'Value data' text box, type 1, and then click 'OK'.
8. Quit Registry Editor.

After you change the registry:

1. Open Microsoft Outlook
2. Menu option "Tools" --> "Deleted Item Recovery"

A list of items that have been hard deleted during the retention time set on the server is displayed.




Please contact me with any questions, comments, or corrections.

durand@hockeymail.com