Monday, May 11, 2009

Archive - 2009-05-10

Easy Color Pallett Maker


On my quest to reach the end of the web, I stumbled accross this nifty little gadget. It takes any image off the web, parses it for colors, and creates a custom web color pallett based on the results. I recommend it.


Web Color Pallett Maker
Updated: 2009-05-11T16:43:30Z


ASP.NET - XML to DataTable to DataView


public DataTable XElementToDataTable(XElement x)
{
DataTable dt = new DataTable();

XElement setup = (from p in x.Descendants() select p).First();
foreach (XElement xe in setup.Descendants()) // build your DataTable
dt.Columns.Add(new DataColumn(xe.Name.ToString(), typeof(string))); // find columns

var all = from p in x.Descendants(setup.Name.ToString()) select p;
foreach (XElement xe in all)
{
DataRow dr = dt.NewRow();
foreach (XElement xe2 in xe.Descendants())
dr[xe2.Name.ToString()] = xe2.Value; //find values
dt.Rows.Add(dr);
}
return dt;
}


XElement x = XElement.Load(Server.MapPath(".") + "myXMLfile.xml");
DataTable dt = XElementToDataTable(x);
Updated: 2009-05-06T18:00:07Z


JavaScript - Search and Highlight Words on a WebPage with JQuery


JQuery does most of the work for you on this script. You will need to place the jquery.js file in your web folder. Download it here - Alternate



This script searches through the body of text on a page and highlights that text with the defined style.



--- place this in your head ---

<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAZBe7uHI90ESk2XAmWRL3RxR6u04U0tImA3bfwZ3-HKdEno7z2xRk2YE6OkudtBX5qy0vLrgbf1DUCg"></script>
<script type="text/javascript">

src="jquery-1.3.2.min.js');
</script>

<script type="text/javascript" charset="utf-8">
jQuery.fn.highlight = function(pat) {
function innerHighlight(node, pat) {
var skip = 0;
if (node.nodeType == 3) {
var pos = node.data.toUpperCase().indexOf(pat);
if (pos >= 0) {
var spannode = document.createElement('span');
spannode.className = 'highlight';
var middlebit = node.splitText(pos);
var endbit = middlebit.splitText(pat.length);
var middleclone = middlebit.cloneNode(true);
spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode, middlebit);
skip = 1;
}
}
else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
for (var i = 0; i < node.childNodes.length; ++i) {
i += innerHighlight(node.childNodes[i], pat);
}
}
return skip;
}
return this.each(function() {
innerHighlight(this, pat.toUpperCase());
});
};

jQuery.fn.removeHighlight = function() {
return this.find("span.highlight").each(function() {
this.parentNode.firstChild.nodeName;
with (this.parentNode) {
replaceChild(this.firstChild, this);
normalize();
}
}).end();
};


</script>


--- place this in your CSS ---


.highlight { background-color: yellow }


--- place this in your body to search for 'anyword'---


<script type="text/javascript" charset="utf-8">

$('li').highlight('anyword');
</script>


--- to un-highlight everything call this script ---


$('#highlight-plugin').removeHighlight();


Updated: 2009-05-06T17:16:59Z


JavaScript - Google Maps API with JQuery


JQuery does most of the work for you on this script. You will need to place the jquery.js file in your web folder. Download it here - Alternate

This script loads a Google API map into a div when the function is called. If the API has points created, it will list the points and allow you to select between them, updating the map as required.



--- place this in your head ---

<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAZBe7uHI90ESk2XAmWRL3RxR6u04U0tImA3bfwZ3-HKdEno7z2xRk2YE6OkudtBX5qy0vLrgbf1DUCg"></script>
<script type="text/javascript">

google.load("jquery", '1.3');
google.load("maps", "2.x");
</script>

<script type="text/javascript" charset="utf-8">

$(document).ready(function(){
var map = new GMap2($("#map").get(0));
var burnsvilleMN = new GLatLng(44.797916,-93.278046);
map.setCenter(burnsvilleMN, 8);

// setup 10 random points
var bounds = map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var lngSpan = northEast.lng() - southWest.lng();
var latSpan = northEast.lat() - southWest.lat();
var markers = [];
for (var i = 0; i < 10; i++) {
var point = new GLatLng(southWest.lat() + latSpan * Math.random(),
southWest.lng() + lngSpan * Math.random());
marker = new GMarker(point);
map.addOverlay(marker);
markers[i] = marker;
}

$(markers).each(function(i,marker){
$("<li />")
.html("Point "+i)
.click(function(){
displayPoint(marker, i);
})
.appendTo("#list");

GEvent.addListener(marker, "click", function(){
displayPoint(marker, i);
});
});

$("#message").appendTo(map.getPane(G_MAP_FLOAT_SHADOW_PANE));

function displayPoint(marker, index){
$("#message").hide();

var moveEnd = GEvent.addListener(map, "moveend", function(){
var markerOffset = map.fromLatLngToDivPixel(marker.getLatLng());
$("#message")
.fadeIn()
.css({ top:markerOffset.y, left:markerOffset.x });

GEvent.removeListener(moveEnd);
});
map.panTo(marker.getLatLng());
}
});

</script>


--- place this in your CSS ---


#map { float:left; width:500px; height:500px; }
#message { position:absolute; padding:10px; background:#555; color:#fff; width:75px; }
#list { float:left; width:200px; background:#eee; list-style:none; padding:0; }
#list li { padding:10px; }
#list li:hover { background:#555; color:#fff; cursor:pointer; cursor:hand; }


--- place this in your body ---


<div id="map"></div>

<ul id="list"></ul>
<div id="message" style="display:none;">
Test text.
</div>



Updated: 2009-05-06T17:01:53Z


JavaScript - Dynamic Page Content from Multiple Pages with JQuery


JQuery does most of the work for you on this script. You will need to place the jquery.js file in your web folder. Download it here - Alternate

This script loads external files into a div when the function is called. Great for dynamic web content where the pages require lots of bandwidth as well as code/data/style seperation.


--- Create four files ( page1.htm, page2.htm, page3.htm, page999.htm ) ---


--- place this in your head ---

<script src="jquery-latest.js" type="text/javascript"></script>

<script type="text/javascript">
function loadContent(id) {
switch (id) {
Case 1:
$("#contentArea").load("page1.htm");
Case 2:
$("#contentArea").load("page2.htm");
Case 3:
$("#contentArea").load("page3.htm");
Case 999:
$("#contentArea").load("page999.htm");
default:
$("#contentArea").load("page1.htm");
}
}
</script>


--- modify your body tag as such ---


<body onLoad="loadContent(1);">


--- place this in your body ---

<a href="javascript:loadContent(1);">Tab 1</a> |
<a href="javascript:loadContent(2);">Tab 2</a> |
<a href="javascript:loadContent(3);">Tab 3</a> |
<a href="javascript:loadContent(999);">Tab 999</a>


<div id="contentArea"/>


</div>


Updated: 2009-05-06T16:47:25Z


JavaScript - Animations Made Simple With JQuery


JQuery does most of the work for you on this script. You will need to place the jquery.js file in your web folder. Download it here - Alternate


Here's a script that animates the height and width of an element at the same time. Notice that there is no start value -- only the end value. The start values are taken from the current size of the element. I've also attached a callback function.

$('#grow').animate({ height: 500, width: 500 }, "slow", function(){
alert('The element is done growing!');
});


jQuery makes the more common animations easier with built-in functions. You can use show() and hide() elements, either instantly or at a specified speed. You can also make elements appear and disappear by using fadeIn() and fadeOut() or slideDown() and slideUp(), depending on what kind of effect you're looking for. Here's a simple example that slides down a navigation:

$('#nav').slideDown('slow');
Updated: 2009-05-06T15:52:33Z


XML - Parse a XML Feed/File with AJAX and JQuery


You can specify xml, html, script, or json, and jQuery automatically prepares the result for your callback function so that you can use it right away. You can also specify beforeSend, error, success, or complete callbacks to give the user more feedback about the Ajax experience. In addition, other parameters are available with which you can set the timeout of an Ajax request or the "Last Modified" state of a page. this example retrieves an XML document using some of the parameters that I mentioned:


$.ajax({
url: 'document.xml',
type: 'GET',
dataType: 'xml',
timeout: 1000,
error: function(){
alert('Error loading XML document');
},
success: function(xml){
// do something with xml
}
});


When you get the XML back in the success callback, you can use jQuery to look through the XML the same way you do with HTML. This makes it easy to work with an XML document and integrate the contents and data into your Web site. This example adds a list item to the Web page for each 'item' element in the XML:


success: function(xml){
$(xml).find('item').each(function(){
var item_text = $(this).text();

$('<li></li>')
.html(item_text)
.appendTo('ol');
});
}
Updated: 2009-05-06T15:37:31Z


JavaScript - AJAX Dynamic Page content with JQuery


A common use of Ajax is to load a chunk of HTML into an area of the page. To do that, simply select the element you need and use the load() function. Here's an example that updates some statistics:

$('#stats').load('stats.html');

Then, simply, initiate a call to that script from a hyperlink (ie: href='#stats' )
Updated: 2009-05-06T15:32:50Z


Javascript - Photo Gallery with Sliding Thumbnails using JQuery


An awesome photo gallery effect where the thumbnails slide to center when clicked. JQuery does most of the work for you with this script. You will need to place the jquery.js file in your web folder. Download it here - Alternate




--- Place the following in your <head> ---


<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="photoslider.js"></script>




--- Create a file called photoslider.js and place it in your webfolder ---



<script type="text/javascript">

$(document).ready(function(){
var ids = new Array(0,1,2,3);
FOTO.Slider.importBucketFromIds('default',ids);
FOTO.Slider.reload('default');
FOTO.Slider.preloadImages('default');
FOTO.Slider.enableSlideshow('default');
});

</script>



--- Place the following in your CSS ---



.photoslider {

}

.photoslider_nav {
position: relative;
border: solid black 1px;
overflow: hidden;
height: 90px;
width: 720px;
margin: auto;
}

.photoslider_thumbBar {
position: absolute;
left: 0px;
top: 0px;
display: block;
margin: 0px;
padding: 0px;
}

.photoslider_thumb {
position: relative;
border: solid black 1px;
width: 50px;
height: 50px;
float: left;
padding: 5px;
margin: 5px;
cursor: pointer;
}

.photoslider_clear {
clear: both;
}

.photoslider_main {
position: relative;
height: 420px;
padding-bottom: 5px;
}

.photoslider_main img {
position: relative;
border: solid #000 10px;
display: block;
margin: auto;
}

.photoslider_caption {
font-weight: bold;
text-align: center;
}

.photoslider_control {
display: none;
text-align: center;
font-weight: bold;
padding-top: 10px;
margin: auto;
height: 30px;
width: 52px;
}

.photoslider_play, .photoslider_stop {
width: 18px;
height: 19px;
margin: auto;
padding: 3px;
cursor: pointer;
text-align: center;
border: solid #fff 1px;
float: left;
}

.photoslider_play {
background: url('/images/play_pause.gif') no-repeat 0px 0px;
}

.photoslider_stop {
background: url('/images/play_pause.gif') no-repeat -25px 0px;
}

.slideshow_disabled {
border-bottom: solid #919191 2px;
}



--- Place the following in your <body> ---



<div class="photoslider" id="default"></div>

<script type="text/javascript">
$(document).ready(function(){
//change the 'baseURL' to reflect the host and or path to your images
FOTO.Slider.baseURL = 'http://example.com/path/';

//set images by filling our bucket directly
FOTO.Slider.bucket = {
'default': {
0: {'thumb': 't_0.jpg', 'main': '0.jpg', 'caption': 'Opie'},
1: {'thumb': 't_1.jpg', 'main': '1.jpg'},
2: {'thumb': 't_2.jpg', 'main': '2.jpg', 'caption': 'Trash the Dress'},
3: {'thumb': 't_3.jpg', 'main': '3.jpg'}
}
};

//or set our images by the bucket importer
var ids = new Array(0,1,2,3);
FOTO.Slider.importBucketFromIds('default',ids);
});

</script>


Updated: 2009-05-06T15:13:46Z


JavaScript - Dynamic According Menus with JQuery


Creating dynamic according menus is tricky. JQuery does most of the work for you with this script. You will need to place the jquery.js file in your web folder. Download it here - Alternate



--- Place the following in your <head> ---


<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$(document).ready(function(){

$(".accordion2 h3").eq(2).addClass("active");
$(".accordion2 p").eq(2).show();

$(".accordion2 h3").click(function(){
$(this).next("p").slideToggle("slow")
.siblings("p:visible").slideUp("slow");
$(this).toggleClass("active");
$(this).siblings("h3").removeClass("active");
});

});

</script>



--- Place the following in your CSS ---



.accordion2 {
width: 480px;
border-bottom: solid 1px #c4c4c4;
}
.accordion2 h3 {
background: #e9e7e7 url(http://webdesignerwall.com/demo/jquery/images/arrow-square.gif) no-repeat right -51px;
padding: 7px 15px;
margin: 0;
font: bold 120%/100% Arial, Helvetica, sans-serif;
border: solid 1px #c4c4c4;
border-bottom: none;
cursor: pointer;
}
.accordion2 h3:hover {
background-color: #e3e2e2;
}
.accordion2 h3.active {
background-position: right 5px;
}
.accordion2 p {
background: #f7f7f7;
margin: 0;
padding: 10px 15px 20px;
border-left: solid 1px #c4c4c4;
border-right: solid 1px #c4c4c4;
display: none;
}




--- Place the following in your <body> ---


<div class="accordion2">
<h3>Question One Sample Text</h3>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
<h3>This is Question Two</h3>

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
<h3>Another Questio here</h3>

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
<h3>Sample heading</h3>

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
<h3>Sample Question Heading</h3>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
</div>


Updated: 2009-05-06T14:44:04Z


JavaScript - Image Comments on Hover with JQuery


Creating fancy image hover over effects can be stifling. JQuery does most of the work for you with this script that places a cute little comment over each menu ol item. You will need to place the jquery.js file in your web folder. Download it here - Alternate



--- Place the following in your <head> ---




<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$(document).ready(function(){

$(".menu2 a").append("<em></em>");

$(".menu2 a").hover(function() {
$(this).find("em").animate({opacity: "show", top: "-75"}, "slow");
var hoverText = $(this).attr("title");
$(this).find("em").text(hoverText);
}, function() {
$(this).find("em").animate({opacity: "hide", top: "-85"}, "fast");
});


});

</script>



--- Place the following in your CSS ---





.menu2 {
margin: 100px 0 0;
padding: 0;
list-style: none;
}
.menu2 li {
padding: 0;
margin: 0 2px;
float: left;
position: relative;
text-align: center;
}
.menu2 a {
padding: 14px 10px;
display: block;
color: #000000;
width: 144px;
text-decoration: none;
font-weight: bold;
background: url(http://webdesignerwall.com/demo/jquery/images/button.gif) no-repeat center center;
}
.menu2 li em {
font-weight: normal;
background: url(http://webdesignerwall.com/demo/jquery/images/hover.png) no-repeat;
width: 180px;
height: 45px;
position: absolute;
top: -85px;
left: -15px;
text-align: center;
padding: 20px 12px 10px;
font-style: normal;
z-index: 2;
display: none;
}




--- Place the following in your <body> ---




<ul class="menu2">
<li>
<a href="http://www.webdesignerwall.com" title="Go to homepage">Home</a>
</li>

<li>
<a href="http://www.webdesignerwall.com/about/" title="Find out who I am">About</a>
</li>
<li>

<a href="http://feeds.feedburner.com/WebDesignerWall" title="Subscribe RSS feeds">Subscribe RSS</a>
</li>
</ul>

Updated: 2009-05-06T14:36:52Z


Javascript - Sliding/Collapsing DIV with JQuery


Dynamically changing content on your webpage is a complicated process. JQuery did most of the work for you with this script that slides a new div content area out from a container wall. You will need to place the jquery.js file in your web folder. Download it here - Alternate




--- Place the following in your <head> ---




<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$(document).ready(function(){

$(".btn-slide").click(function(){
$("#panel").slideToggle("slow");
$(this).toggleClass("active"); return false;
});


});
</script>


--- Place the following in your CSS ---





a:focus {
outline: none;
}
#panel {
background: #754c24;
height: 200px;
display: none;
}
.slide {
margin: 0;
padding: 0;
border-top: solid 4px #422410;
background: url(http://webdesignerwall.com/demo/jquery/images/btn-slide.gif) no-repeat center top;
}
.btn-slide {
background: url(http://webdesignerwall.com/demo/jquery/images/white-arrow.gif) no-repeat right -50px;
text-align: center;
width: 144px;
height: 31px;
padding: 10px 10px 0 0;
margin: 0 auto;
display: block;
font: bold 120%/100% Arial, Helvetica, sans-serif;
color: #fff;
text-decoration: none;
}
.active {
background-position: right 12px;
}




--- Place the following in your <body> ---





<div id="panel">

<!-- you can put content here -->
</div>

<p class="slide"><a href="#" class="btn-slide">Slide Panel</a></p>


Updated: 2009-05-06T14:27:34Z


JavaScript - Photo Gallery with JQuery


This is a concise little photo gallery built with JQuery. You will need to place the jquery.js file in your web folder. Download it here - Alternate




--- Place the following in your <head> ---




<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$(document).ready(function(){

$("h2").append('<em></em>')

$(".thumbs a").click(function(){

var largePath = $(this).attr("href");
var largeAlt = $(this).attr("title");

$("#largeImg").attr({ src: largePath, alt: largeAlt });

$("h2 em").html(" (" + largeAlt + ")"); return false;
});

});

</script>



--- Place the following CSS in your style sheet ---




}
#largeImg {
border: solid 1px #ccc;
width: 550px;
height: 400px;
padding: 5px;
}
.thumbs img {
border: solid 1px #ccc;
width: 100px;
height: 100px;
padding: 4px;
}
.thumbs img:hover {
border-color: #FF9900;
}




--- Place the following the the <body> ---




<p><img id="largeImg" src="images/img1-lg.jpg" alt="Large image" /></p>

<p class="thumbs">

<a href="images/img2-lg.jpg" title="Image 2"><img src="images/img2-thumb.jpg" /></a>
<a href="images/img3-lg.jpg" title="Image 3"><img src="images/img3-thumb.jpg" /></a>

<a href="images/img4-lg.jpg" title="Image 4"><img src="images/img4-thumb.jpg" /></a>
<a href="images/img5-lg.jpg" title="Image 5"><img src="images/img5-thumb.jpg" /></a>

<a href="images/img6-lg.jpg" title="Image 6"><img src="images/img6-thumb.jpg" /></a>

</p>


Updated: 2009-05-06T13:48:43Z


VB.NET - Load Pages in DIV With JQuery


If you have a <DIV> in your HTML or ASP.NET page and want to load another page in that DIV, then here's how to do so using one line of jQuery code


<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

<style type="text/css">

.divPage

{

width:300px;

height:200px;

}

</style>



<script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>

<script type="text/javascript">

$(document).ready(function() {

$('#LoadPage').load('Default.aspx');

});

</script>

</head>

<body>

<form id="form1" runat="server">

<div>

<div id="LoadPage" class="divPage">

</div>

</div>

</form>

</body>

</html>
Updated: 2009-05-06T13:00:10Z


Slow Day at Home Brings Photo Inspiration


Setting up a tripod on my porch at midnight and taking a walk in the park in the rain gave me some good photo results. I especially like how the water looks in the pic of the creek:







Updated: 2009-05-02T00:08:55Z


My Brother Jon's Sites


Code Blog
Band
PBase
FlickR
Updated: 2009-04-30T18:54:00Z


Embedding Images in Google Reader


Google Reader only accepts html tags for style. It won't let you use embed or object tags to embed cool slideshows or videos. It will, however, let you use the image tag.

<p>Place your heading here:</p>

<a href='image.jpg' target='_blank'><img src='image.jpg' width='200' height='133'></a>
<a href='image.jpg' target='_blank'><img src='image.jpg' width='200' height='133'></a>
<a href='image.jpg' target='_blank'><img src='image.jpg' width='200' height='133'></a>
<a href='image.jpg' target='_blank'><img src='image.jpg' width='200' height='133'></a>
<a href='image.jpg' target='_blank'><img src='image.jpg' width='200' height='133'></a>
<a href='image.jpg' target='_blank'><img src='image.jpg' width='200' height='133'></a>
<a href='image.jpg' target='_blank'><img src='image.jpg' width='200' height='133'></a>
<a href='image.jpg' target='_blank'><img src='image.jpg' width='200'height='133'></a>
Updated: 2009-04-29T14:53:22Z


Photoshop CS3 Art


I spent some time last night creating some Photoshop art:











Updated: 2009-04-29T14:51:33Z


XML - Creating an XML RSS Feed from an Access Database


<?xml version="1.0"?>
<!DOCTYPE categories [
<!ELEMENT categories (ID,category,title,body)>
<!ELEMENT ID (#PCDATA)>
<!ELEMENT category (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT body (#PCDATA)>

<categories>
<%

set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("../fpdb/jasons web blog.mdb") & ";"

set rs = Server.CreateObject("ADODB.recordset")
On Error Resume Next

mySQL = "SELECT * FROM jasonswebblog"

rs.Open mySQL, conn

Do While Not rs.EOF

Response.Write("<ID>[CDATA[" & rs("blogID") & "]]</ID>")
Response.Write("<category>[CDATA[" & rs("blogcategory") & "]]</category>")
Response.Write("<title>[CDATA[" & rs("blogtitle") & "]]</title>")
Response.Write("<body>[CDATA[" & rs("blogbody") & "]]</body>")

rs.MoveNext
Loop

rs.close
conn.close
%></categories>
Updated: 2009-04-28T22:04:16Z


XML - More results from a Google Reader Atom Feed


If you want to get more than 15 results from a Google Reader Atom RSS Feed, put the string ?n=200 on the end of your http string.

Like so:

http://www.google.com/reader/public/atom/user/11107711695755917315/state/com.google/broadcast?n=200
Updated: 2009-04-28T21:59:54Z


Datamining a blog sucks


I just spent the last two hours datamining this blog and seeding it from an XML feed. If you don't appreciate all my hard work, you can go vx yourself!
Updated: 2009-04-28T21:54:18Z


XML - IE only method of using XML data islands to seed tables in an HTML page


1. create a new file called test.xml
-----------------------------

<category>
<subCat>
<field1>xxxxxx</field1>
<field2>xxxxxx</field2>
<field3>xxxxxx</field3>
<field4>xxxxxx</field4>
<field5>xxxxxx</field5>
<field6>xxxxxx</field6>
</subCat>
<subCat>
<field1>xxxxxx</field1>
<field2>xxxxxx</field2>
<field3>xxxxxx</field3>
<field4>xxxxxx</field4>
<field5>xxxxxx</field5>
<field6>xxxxxx</field6>
</subCat>
</category>
1. create a new file called test.html
-----------------------------

<html>
<head>
</head>
<body>

<xml src="test.xml" id="myTest" ></xml>
<table datasrc="#myTest" border="1">
<tr>
<td><span datafld="field1"></span></td>
<td><span datafld="field2"></span></td>
<td><span datafld="field3"></span></td>
<td><span datafld="field4"></span></td>
<td><span datafld="field5"></span></td>
<td><span datafld="field6"></span></td>
</tr>
</table>

</body>
</html>
This example should prepopulate a table with all the information from the xml file. However, this method only works for IE. In order to make it work in Mozilla 1,2,3, it takes a heavy amount of javascript code. I won't go into that here. Eventually, Mozilla and IE will come to an understanding about this and have a simple answer for us. I will wait until then.
Updated: 2009-04-28T21:52:05Z


VBScript - Open multiple websites automatically


1. create file named AutoOpener.vbs
-----------------------------


'This script opens Internet Explorer windows
'allowing the user to see if certain websites
'are working.
'The following SUBs, OpenIE and NEWIEWINDOW
'do essentially the same thing. I just think
'it operates better to use OpenIE first.
SUB OpenIE
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "IEXPLORE.EXE"
END SUB
SUB NEWIEWINDOW
Set IE = CREATEOBJECT("internetexplorer.application")
IE.Visible = True
WScript.Sleep 4000
END SUB
'Use the following SUB, KILLPOPUP, to
'control browser errors on the webpages.
SUB KILLPOPUP
WshShell.SendKeys "~" ' Presses enter on the keyboard
WScript.Sleep 200
END SUB
'The following SUB, DELAY, pauses the code
'long enough for certain actions to take place.
'If errors are occuring in the script, try
'changing the delay time or adding a second DELAY
'call where it is needed.
SUB DELAY
WScript.Sleep 1000
END SUB
SUB SCREENSHOT
' Set WshShell = WScript.CreateObject("WScript.Shell")
' WScript.Sleep 100 ' Give the program some time
' WshShell.SendKeys "^{PRTSC}" ' Printscreen to the clipboard
' WScript.Sleep 1000 ' Give the clipboard some time
' WshShell.Run "mspaint"
' WScript.Sleep 1000 ' Give Paint some time to load
' WshShell.SendKeys "^v"
END SUB
'--V-------------MAIN------------------------V----
DIM IE
MsgBox "Opening 23 I.E. windows. Remember to login and test Adesa.com and Adesa.ca.",1'"Site Tester"

'-------------------------------------------------
OpenIE ' Opens the homepage ( http://adesa.com )
DELAY
'-------------------------------------------------
NEWIEWINDOW
'TIMERSTART
IE.navigate2 "http://adesa.ca"
'TIMEREND
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://chryslerdirect.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://chryslerfirst.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://chryslerfleetpool.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://dealerblock.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://dealerblock.ca"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://dealerdirectbidding.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://employeepurchases.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://employeepurchases.ca"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://gmacsmartauction.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://impactauction.ca"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://tfscfauction.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://raymondglobal.net"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://adesapublicauctions.ca"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://adesainc.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://www.tfsremarketing.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://www.lfsremarketing.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://blockreport.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://blockreport.ca"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://WWW.offthelot.ca"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://www.publicauctionservices.com"
DELAY
'-------------------------------------------------
NEWIEWINDOW
IE.navigate2 "http://www.publicauctionservices.ca"
DELAY
'-------------------------------------------------
CreateObject("Shell.Application").CascadeWindows
WScript.echo "Done"
WScript.quit
'********* End
Updated: 2009-04-28T21:50:52Z


VBScript - Check to see if files exist on local/network drives


Set filesys=CreateObject("Scripting.FileSystemObject")
Function GetDate(dateVal) ' this function formats a date string as MMDDYY
Dim dateMonth, dateDay
dateMonth = Month(dateVal)
dateDay = Day(dateVal)
If dateMonth < 10 Then
dateMonth = "0" & dateMonth
End If
If dateDay < 10 Then
dateDay = "0" & dateDay
End If
GetDate = dateMonth & dateDay & Right(Year(dateVal), 2)
End Function

dim thisDate
thisDate = GetDate(Now()-1) ' selects a date one day ago
dim output
dim path1
dim path2
dim siteName(2) ' array of file and folder names
siteName(0)="CALG1"
siteName(1)="COLO1"
siteName(2)="EDMO1"
For Each x in siteName
path1=("\\file1v\amspsft\" & x & "\" & x & "_AMS_" & thisDate & ".txt") ' format the file name
path2=("\\file1v\amspsft\" & x & "\" & x & "_AMS_" & thisDate & ".old")
If filesys.FileExists(path1) Then
output = output & x & " file exists" & vbCrLf
ElseIF filesys.FileExists(path2) Then 'check for a second file extension
output = output & x & " file exists" & vbCrLf
Else
output = output & x & " could not locate file " & path1 &vbCrLf
End If
Next
wscript.echo output
Updated: 2009-04-28T21:50:27Z


PHP - Creating a dynamic database driven php / css site with a php content management page


1. for the home page, create index.php
-----------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>North Georgia Apartment Owners Association</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<link href="css.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script type="text/javascript" src="SpryAssets/SpryURLUtils.js"></script>
<script type="text/javascript">var params = Spry.Utils.getLocationParamsAsObject();</script>

</head>
<body>

<?php

$sqllink = mysql_connect('localhost', 'username', 'password');
if (!$sqllink) {
die('Could not connect: ' . mysql_error());
}

mysql_select_db('mydatabase', $sqllink);

$query = mysql_query('SELECT * FROM mycontent WHERE site_ID in (SELECT max(Site_ID) FROM mycontent)');

while ($row = mysql_fetch_assoc($query)) {

echo "<div id='backgroundTop'></div><div id='backgroundBottom'></div><h1 id='title'>";
echo $row['MyTitle'] . "</h1>";
echo "<div id='wrapper'><div id='TPanels' class='TabbedPanels'><ul class='TabbedPanelsTabGroup'>";

echo "<li class='TabbedPanelsTab' tabindex='0'>" . $row['Tab1'] . "</li>";
echo "<li class='TabbedPanelsTab' tabindex='1'>" . $row['Tab2'] . "</li>";
echo "<li class='TabbedPanelsTab' tabindex='2'>" . $row['Tab3'] . "</li>";
echo "<li class='TabbedPanelsTab' tabindex='3'>" . $row['Tab4'] . "</li>";

echo "</ul><div class='TabbedPanelsContentGroup'><div class='TabbedPanelsContent'> ";

echo "<div id='adspace'>" . $row['MyAlert'] . "</div>";
echo "<div id='main'>" . $row['Tab1_Content1'] . "</div>";
echo "<div class='content'>" . $row['Tab1_Content2'] . "</div>";
echo "<div class='content'>" . $row['Tab1_Content3'] . "</div>";
echo "<div class='content'>" . $row['Tab1_Content4'] . "</div>";
echo "<div class='content'>" . $row['Tab1_Content5'] . "</div>";

echo "</div class='TabbedPanelsContent'><div class='TabbedPanelsContent'> ";

echo "<div id='adspace'>" . $row['MyAlert'] . "</div>";
echo "<div id='main'>" . $row['Tab2_Content1'] . "</div>";
echo "<div class='content'>" . $row['Tab2_Content2'] . "</div>";
echo "<div class='content'>" . $row['Tab2_Content3'] . "</div>";
echo "<div class='content'>" . $row['Tab2_Content4'] . "</div>";
echo "<div class='content'>" . $row['Tab2_Content5'] . "</div>";

echo "</div class='TabbedPanelsContent'><div class='TabbedPanelsContent'> ";

echo "<div id='adspace'>" . $row['MyAlert'] . "</div>";
echo "<div id='main'>" . $row['Tab3_Content1'] . "</div>";
echo "<div class='content'>" . $row['Tab3_Content2'] . "</div>";
echo "<div class='content'>" . $row['Tab3_Content3'] . "</div>";
echo "<div class='content'>" . $row['Tab3_Content4'] . "</div>";
echo "<div class='content'>" . $row['Tab3_Content5'] . "</div>";

echo "</div class='TabbedPanelsContent'><div class='TabbedPanelsContent'> ";

echo "<div id='adspace'>" . $row['MyAlert'] . "</div>";
echo "<div id='main'>" . $row['Tab4_Content1'] . "</div>";

};

echo "<div class='content'>";

$result = mysql_query("SELECT Description, Location FROM events WHERE Date_Time > now()");

while($row = mysql_fetch_array($result))
{
echo "<h2>" . $row['Description'] . "</h2>";
echo "<a href='" . $row['Location'] . "' target='map'>map</a><br>";
};

echo "</div>";

$query = mysql_query('SELECT * FROM mycontent WHERE site_ID in (SELECT max(Site_ID) FROM mycontent)');

while ($row = mysql_fetch_assoc($query)) {

echo "<div class='content'>" . $row['Tab4_Content3'] . "</div>";
echo "<div class='content'>" . $row['Tab4_Content4'] . "</div>";
echo "<div class='content'>" . $row['Tab4_Content5'] . "</div>";

echo "</div class='TabbedPanelsContent'></div class='TabbedPanelsContentGroup'>";
echo "</div id='TPanels' class='TabbedPanels'><div id='footer'></div id='footer'>";
echo "</div id='wrapper'><div id='borderLeft'></div>";
echo "<div id='borderBottom'>Copyright 2009. | <a href='http://www.netjunke.com'>Design</a> | "; echo "<a href='http://www.netjunke.com/zen/blog.asp'>Login</a></div><div id='borderRight'>";
echo "</div><ul id='borderTop'>";

echo "<li><a href='index.htm?tab=3#TPanels'>" . $row['Tab4'] . "</a></li>";
echo "<li><a href='index.htm?tab=2#TPanels'>" . $row['Tab3'] . "</a></li>";
echo "<li><a href='index.htm?tab=1#TPanels'>" . $row['Tab2'] . "</a></li>";
echo "<li><a href='index.htm?tab=0#TPanels'>" . $row['Tab1'] . "</a></li>";
echo "</ul>";

};

mysql_close($sqllink);

?>

<script type="text/javascript">
<!--
var TPanels = new Spry.Widget.TabbedPanels("TPanels", {defaultTab: params.tab ? params.tab : 0});
//-->
</script>

</body>
</html>

2. for the content mangement page, create Content_Manager.php
- This page will submit to Insert_Into_MyContent.php and Insert_Into_Events.php
-----------------------------

<head>
<title>North Georgia Apartment Owners Association</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<link href="css.css" rel="stylesheet" type="text/css" />

<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script type="text/javascript" src="SpryAssets/SpryURLUtils.js"></script>
<script type="text/javascript"> var params = Spry.Utils.getLocationParamsAsObject(); </script>

</head>
<body>

<?php

$link = mysql_connect('localhost', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}

mysql_select_db('mydatabase', $link);
$result = mysql_query("SELECT * FROM mycontent WHERE site_ID in (SELECT max(site_ID) from mycontent)");

while ($row = mysql_fetch_assoc($result)) {


echo "<form action='Insert_Into_MyContent.php' method='post'>";

echo "Site Title: <br><textarea rows='4' cols='80' name='MyTitle'/>" . $row['MyTitle'] . "</textarea><br>";
echo "Tab1 Name: <input type='text' name='Tab1' value='" . $row['Tab1'] . "'/><br>";
echo "Tab2 Name: <input type='text' name='Tab2' value='" . $row['Tab2'] . "'/><br>";
echo "Tab3 Name: <input type='text' name='Tab3' value='" . $row['Tab3'] . "'/><br>";
echo "Tab4 Name: <input type='text' name='Tab4' value='" . $row['Tab4'] . "'/><br>";
echo "Alert: <br><textarea rows='4' cols='80' name='MyAlert'/>" . $row['MyAlert'] . "</textarea><br>";
echo "Tab1 Content1: <br><textarea rows='10' cols='80' name='Tab1_Content1'/>" . $row['Tab1_Content1'] . "</textarea><br>";
echo "Tab1 Content2: <br><textarea rows='10' cols='80' name='Tab1_Content2'/>" . $row['Tab1_Content2'] . "</textarea><br>";
echo "Tab1 Content3: <br><textarea rows='10' cols='80' name='Tab1_Content3'/>" . $row['Tab1_Content3'] . "</textarea><br>";
echo "Tab1 Content4: <br><textarea rows='10' cols='80' name='Tab1_Content4'/>" . $row['Tab1_Content4'] . "</textarea><br>";
echo "Tab1 Content5: <br><textarea rows='10' cols='80' name='Tab1_Content5'/>" . $row['Tab1_Content5'] . "</textarea><br>";
echo "Tab2 Content1: <br><textarea rows='10' cols='80' name='Tab2_Content1'/>" . $row['Tab2_Content1'] . "</textarea><br>";
echo "Tab2 Content2: <br><textarea rows='10' cols='80' name='Tab2_Content2'/>" . $row['Tab2_Content2'] . "</textarea><br>";
echo "Tab2 Content3: <br><textarea rows='10' cols='80' name='Tab2_Content3'/>" . $row['Tab2_Content3'] . "</textarea><br>";
echo "Tab2 Content4: <br><textarea rows='10' cols='80' name='Tab2_Content4'/>" . $row['Tab2_Content4'] . "</textarea><br>";
echo "Tab2 Content5: <br><textarea rows='10' cols='80' name='Tab2_Content5'/>" . $row['Tab2_Content5'] . "</textarea><br>";
echo "Tab3 Content1: <br><textarea rows='10' cols='80' name='Tab3_Content1'/>" . $row['Tab3_Content1'] . "</textarea><br>";
echo "Tab3 Content2: <br><textarea rows='10' cols='80' name='Tab3_Content2'/>" . $row['Tab3_Content2'] . "</textarea><br>";
echo "Tab3 Content3: <br><textarea rows='10' cols='80' name='Tab3_Content3'/>" . $row['Tab3_Content3'] . "</textarea><br>";
echo "Tab3 Content4: <br><textarea rows='10' cols='80' name='Tab3_Content4'/>" . $row['Tab3_Content4'] . "</textarea><br>";
echo "Tab3 Content5: <br><textarea rows='10' cols='80' name='Tab3_Content5'/>" . $row['Tab3_Content5'] . "</textarea><br>";
echo "Tab4 Content1: <br><textarea rows='10' cols='80' name='Tab4_Content1'/>" . $row['Tab4_Content1'] . "</textarea><br>";
echo "Tab4 Content2: <br><textarea rows='10' cols='80' name='Tab4_Content2'/>" . $row['Tab4_Content2'] . "</textarea><br>";
echo "Tab4 Content3: <br><textarea rows='10' cols='80' name='Tab4_Content3'/>" . $row['Tab4_Content3'] . "</textarea><br>";
echo "Tab4 Content4: <br><textarea rows='10' cols='80' name='Tab4_Content4'/>" . $row['Tab4_Content4'] . "</textarea><br>";
echo "Tab4 Content5: <br><textarea rows='10' cols='80' name='Tab4_Content5'/>" . $row['Tab4_Content5'] . "</textarea><br>";

echo "<input type='submit' /></form>";


}


echo "<form action='Insert_Into_Events.php' method='post'>";

echo "<hr>The following form is used to add a new event to the event calendar:<hr>Description: <br><textarea rows='4' cols='80' name='Description'/></textarea><br>";
echo "Location: <br><textarea rows='4' cols='80' name='Location'/>Place the web http address for a Google Map here</textarea><br>";
echo "Date and Time: <br><input type='text' name='Date_Time' value='2009-12-31 24:60:60'/><br>";

echo "<input type='submit' /></form>";


mysql_close($link);

?>

</body>
</html>

3. Create the form submittal action script pages, Insert_Into_MyContent.php and Insert_Into_Events.php
-----------------------------

<?php

echo $_REQUEST['MyTitle'];


$link = mysql_connect('localhost', 'username', 'password');

mysql_select_db("mydatabase", $link);

$query = "INSERT INTO MyContent
(Date_Time, Tab1, Tab2, Tab3, Tab4, MyTitle, MyAlert, Tab1_Content1, Tab1_Content2, Tab1_Content3, Tab1_Content4, Tab1_Content5, Tab2_Content1, Tab2_Content2, Tab2_Content3, Tab2_Content4, Tab2_Content5, Tab3_Content1, Tab3_Content2, Tab3_Content3, Tab3_Content4, Tab3_Content5, Tab4_Content1, Tab4_Content2, Tab4_Content3, Tab4_Content4, Tab4_Content5 ) VALUES(NOW(), '$_POST[Tab1]', '$_POST[Tab2]', '$_POST[Tab3]', '$_POST[Tab4]', '$_POST[MyTitle]', '$_POST[MyAlert]', '$_POST[Tab1_Content1]', '$_POST[Tab1_Content2]', '$_POST[Tab1_Content3]', '$_POST[Tab1_Content4]', '$_POST[Tab1_Content5]', '$_POST[Tab2_Content1]', '$_POST[Tab2_Content2]', '$_POST[Tab2_Content3]', '$_POST[Tab2_Content4]', '$_POST[Tab2_Content5]', '$_POST[Tab3_Content1]', '$_POST[Tab3_Content2]', '$_POST[Tab3_Content3]', '$_POST[Tab3_Content4]', '$_POST[Tab3_Content5]', '$_POST[Tab4_Content1]', '$_POST[Tab4_Content2]', '$_POST[Tab4_Content3]', '$_POST[Tab4_Content4]', '$_POST[Tab4_Content5]') ";


if (!mysql_query($query,$link))
{
die('Error: ' . mysql_error());
}
echo "1 record added";

mysql_close($link);
?>

-----------------------------------------------------

<?php

$link = mysql_connect('localhost', 'username, 'password');

mysql_select_db("mydatabase", $link);

$query = "INSERT INTO events
(Date_Time, Description, Location) VALUES('$_POST[Date_Time]', '$_POST[Description]', '$_POST[Location]')";

if (!mysql_query($query,$link))
{
die('Error: ' . mysql_error());
}
echo "1 record added";

mysql_close($link);
?>

4. Create the SpryAssets and Images folders, SpryTabbedPanels.js, SpryURLUtils.js, and css.css files,
Updated: 2009-04-28T21:48:19Z


PHP - Create a MySQL database and tables with PHP


<?php

$link = mysql_connect('localhost', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';


$query = 'CREATE DATABASE mydatabase';
$result = mysql_query($query);

mysql_select_db('mydatabase') or die('Cannot select database');

$query = 'CREATE TABLE events( '.
'Event_ID INT NOT NULL AUTO_INCREMENT, '.
'Date_Time datetime NOT NULL default "0000-00-00 00:00:00", '.
'Description VARCHAR(255) NOT NULL, '.
'Location VARCHAR(50) NOT NULL, '.
'PRIMARY KEY(Event_ID))';

$result = mysql_query($query);

$query = 'CREATE TABLE MyContent( '.
'Site_ID INT NOT NULL AUTO_INCREMENT, '.
'Date_Time datetime default "0000-00-00 00:00:00", '.
'Tab1 VARCHAR(10) NOT NULL, '.
'Tab2 VARCHAR(10) NOT NULL, '.
'Tab3 VARCHAR(10) NOT NULL, '.
'Tab4 VARCHAR(10) NOT NULL, '.
'MyTitle VARCHAR(255) NOT NULL, '.
'MyAlert VARCHAR(255) NOT NULL, '.
'Tab1_Content1 text NOT NULL, '.
'Tab1_Content2 text NOT NULL, '.
'Tab1_Content3 text NOT NULL, '.
'Tab1_Content4 text NOT NULL, '.
'Tab1_Content5 text NOT NULL, '.
'Tab2_Content1 text NOT NULL, '.
'Tab2_Content2 text NOT NULL, '.
'Tab2_Content3 text NOT NULL, '.
'Tab2_Content4 text NOT NULL, '.
'Tab2_Content5 text NOT NULL, '.
'Tab3_Content1 text NOT NULL, '.
'Tab3_Content2 text NOT NULL, '.
'Tab3_Content3 text NOT NULL, '.
'Tab3_Content4 text NOT NULL, '.
'Tab3_Content5 text NOT NULL, '.
'Tab4_Content1 text NOT NULL, '.
'Tab4_Content2 text NOT NULL, '.
'Tab4_Content3 text NOT NULL, '.
'Tab4_Content4 text NOT NULL, '.
'Tab4_Content5 text NOT NULL, '.
'PRIMARY KEY(Site_ID))';

$result = mysql_query($query);

mysql_close($link);
?>
Updated: 2009-04-28T21:46:43Z


PHP - Insert test data into a MySQL database with PHP


<?php

$link = mysql_connect('localhost', 'username', 'password');

mysql_select_db("mydatabase", $link);

$query = 'INSERT INTO events
(Date_Time, Description, Location) VALUES(NOW(), "Description Test", "Location Test" ) ';
$result = mysql_query($query);

$query = 'INSERT INTO MyContent
(Date_Time, Tab1, Tab2, Tab3, Tab4, MyTitle, MyAlert, Tab1_Content1, Tab1_Content2, Tab1_Content3, Tab1_Content4, Tab1_Content5, Tab2_Content1, Tab2_Content2, Tab2_Content3, Tab2_Content4, Tab2_Content5, Tab3_Content1, Tab3_Content2, Tab3_Content3, Tab3_Content4, Tab3_Content5, Tab4_Content1, Tab4_Content2, Tab4_Content3, Tab4_Content4, Tab4_Content5 ) VALUES(NOW(), "Tab1 Test", "Tab2 Test", "Tab3 Test", "Tab4 Test", "MyTitle Test", "MyAlert Test", "Tab1_Content1 Test", "Tab1_Content2 Test", "Tab1_Content3 Test", "Tab1_Content4 Test", "Tab1_Content5 Test", "Tab2_Content1 Test", "Tab2_Content2 Test", "Tab2_Content3 Test", "Tab2_Content4 Test", "Tab2_Content5 Test", "Tab3_Content1 Test", "Tab3_Content2 Test", "Tab3_Content3 Test", "Tab3_Content4 Test", "Tab3_Content5 Test", "Tab4_Content1 Test", "Tab4_Content2 Test", "Tab4_Content3 Test", "Tab4_Content4 Test", "Tab4_Content5 Test") ';
$result = mysql_query($query);

mysql_error();

mysql_close($link);
?>
Updated: 2009-04-28T21:46:11Z


PHP - Send an email requesting to add an email to a mailing list


1. from any page in your web, add this form
-----------------------------

<form method="post" action="sendmail.php">
Email:
<input name="email" type="text">
<input value="Submit" type="submit">
</form>

2. create file named sendmail.php
-----------------------------

<?php $email = $_POST['email'] ;?>
<b><?php mail( "bluemoongiftsonline@gmail.com", "-- Add me to your mailing list --", "Please add my email address to your mailing list. Thank you.", "$email" );?>
</b><?php print "Congratulations! You will now receive our newsletter.";?>
<br><?php print "Please know that we will not distribute your email to anyone else for any reason.";?>
<br><br><?php print "Thank you."; ?>
Updated: 2009-04-28T21:45:39Z


PHP - Send an email from a web page


1. from any page in your web, add this form
-----------------------------

<form method="post" action="sendmail.php">
Email:
<input name="email" type="text">
<input name="subject" type="hidden" value="Place an email subject here">
<textarea name="message" type="text" rows="10" cols="30"></textarea>
<input value="Submit" type="submit">
</form>

2. create file named sendmail.php
-----------------------------

<?php $email = $_POST['email'] ;?>
<?php $subject = $_POST['subject'] ;?>
<?php $message = $_POST['message'] ;?>
<b><?php mail( "bluemoongiftsonline@gmail.com", "$subject", "$message", "$email" );?>
</b><?php print "Congratulations! You have sent your message.";?>
<br><?php print "Please know that we will not distribute your email to anyone else for any reason.";?>
<br><br><?php print "Thank you."; ?>
PHP - Password Protect a Single Web Page
if($_GET['password'] == "Password123")
{
$code1
}
else
{
echo "wrong pasword";
}
NOTE: The variable name 'password' can come from a form submittal, http ? link, cookie, or session.
PHP - Instantiate a Variable if the Variable Does Not Exist
if (!isset($_GET['variable']))
{
$code1
}
else
{
$code2
}
NOTE: The variable name 'variable' can come from a form submittal, http ? link, cookie, or session.
Updated: 2009-04-28T21:45:08Z


Javascript - Tell a webform to redirect after submitting to a 3rd party site


1. place the following in the head of the form page:
<script language="JavaScript">
<!--
function FormRedirect(){
setTimeout('this.document.location.href = "thankyou.htm"',499);}
//-->
</script>
If you are having issues with the timeout setting (if you changed it to above 499) on the third party server, do not exceed 499 milliseconds
2. place the following in the <form> tag:
onsubmit="FormRedirect()
Updated: 2009-04-28T21:32:58Z


Javascript - Make an iframe transparent and have absolute position on the page


1. put this code in the body of a page (not iframe page)
---------------------------------------

<iframe src="my_iframe_page.asp" name="iframe1" width="400" height="500" frameborder="0" allowtransparency="true" style="position:absolute; top:125; right:15" marginwidth="1" marginheight="1" scrolling="no"></iframe>

---------------------------------------
2. put this code in the head of all pages displayed in the iframe
---------------------------------------

<style type="text/css">
Body { Background: transparent; }
</style>
Updated: 2009-04-28T21:32:30Z


Javascript - A Drop Down Box that Automatically Redirects the Browser to one of the Options


<FORM ACTION="">
<select name="jumpto" onChange='window.location.href= this.form.jumpto.options[this.form.jumpto.selectedIndex].value'>
<option selected>Change template...</option>
<option value="page1.html" target="iframe_main">home</option>
<option value="page2.html" target="iframe_main">services</option>
<option value="page3.html" target="iframe_main">shop</option>
<option value="page4.html" target="iframe_main">about us</option>
</select>
</FORM>
Javascript - Gradient Image from Javascript and CSS alone
http://www.netjunke.com/zen/blog files/gradient_demo.htm
<div style='width:400px;'>
<script type="text/javascript">

var gradient_color='333300';
var gradient_color_dec;
var gradient_counter=1;
var vertical_position=0;
var horizontal_position=0;

while (gradient_counter<=255)
{
document.write("<div style='background-color: #" + gradient_color);
document.write("; width: 100%; height: 4px; top: " + vertical_position);
document.write("px; left: " + horizontal_position);
document.write("px;'></div>");

gradient_color_dec=parseInt(gradient_color,16);
gradient_color_dec=gradient_color_dec+1;
gradient_color=gradient_color_dec.toString(16);

gradient_counter=gradient_counter+1;
vertical_position=vertical_position+1;
}
</script>
</div>
Updated: 2009-04-28T21:31:50Z


VB.NET - Config File for GoDaddy.com


NOTE: GoDaddy does not come with .NET activated on your Windows server account. Follow these instructions to activate .NET on your GoDaddy Windows server account: 1. logon to GoDaddy.com. 2. Go to your hosting account manager. 3. Click manage your site. 4. Go to content --> Add on languages. 5. Click on ASP 2.0/3.0/3.5. 6. Wait for 24 hours. 7. follow steps 1-3 again. 8. go to content--> IIS settings. 9. Create a new virtual directory. 10. give it Anonymous access and set it as your application root. 11. upload your web.config and .aspx files to this directory.
1. create a file called web.config
----------------------------

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation
defaultLanguage="c#"
debug="true"
/>
<customErrors mode="Off"/>
<authentication mode="Windows" />
<authorization>
<allow users="*" />
</authorization>
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>

</system.web>
</configuration>
Updated: 2009-04-28T21:26:38Z


VB.NET - Very simple 'dynamic web form content' using tabs


1. create a file called multiview_demo.aspx
-----------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>MultiView Demo</title>
<link rel="stylesheet" href="style.css" />
<script runat="server" language="VB">
Sub SwitchView0(s as Object, e as EventArgs)
myMultiView.ActiveViewIndex = 0
End Sub
Sub SwitchView1(s as Object, e as EventArgs)
myMultiView.ActiveViewIndex = 1
End Sub
Sub SwitchView2(s as Object, e as EventArgs)
myMultiView.ActiveViewIndex = 2
End Sub
</script>
</head>
<body>

<form runat="server">
<div id="menu_container">
<div id="menu_tab">
<asp:LinkButton id="myButton1" Text="Switch View 1" runat="server" OnClick="SwitchView0" /></div id="menu_button">
<div id="menu_tab">
<asp:LinkButton id="myButton2" Text="Switch View 2" runat="server" OnClick="SwitchView1" /></div id="menu_button">
<div id="menu_tab">
<asp:LinkButton id="myButton3" Text="Switch View 3" runat="server" OnClick="SwitchView2" /></div id="menu_button">
</div id="menu_container">
<asp:MultiView ID="myMultiView" runat="server"
ActiveViewIndex="0">
<asp:View ID="firstView" runat="server">
<div class="dynamic_container">Everything you see here is occuring on one webform</div class="dynamic_container">
</asp:View>
<asp:View ID="secondView" runat="server">
<div class="dynamic_container">Some of the html code is hidden while other code is shown</div class="dynamic_container">
</asp:View>
<asp:View ID="thirdView" runat="server">
<div class="dynamic_container">You can use fancy tab shaped image backgrounds instead of the ugly colors above.</br>You can add more tabs or take some away with very easy to understand modifications of the code.<br>You can easily style any aspects of the tabs, menu, or container with CSS.<br>You can place the buttons anywhere on the page that you want (vertically, horizontally, scattered, embedded in text, or nested in an imageMap )<br>It can be used to create an image slideshow.<br>...Really, the possibilities are endless.</div class="dynamic_container">
</asp:View>
</asp:MultiView>
</form>
</body>
2. Create a file called style.css
-----------------------------

@charset "utf-8";
/* CSS Document */
#menu_container {
height: 25px;
width: auto;
background-color: transparent;
padding: 0px;
margin: 0px;
}
#menu_tab {
background-color: silver;
border: 2px coral solid;
text-align: center;
padding: 5px;
margin: 0px;
width: 140px;
float: left;
}
.dynamic_container {
position: absolute;
top: 150px;
left: 100px;
}
button {
color: blue;
background-color: yellow;
}
body {
background-color: #669900;
}


NOTE: If you want this control to be pretty, you should replace the boring buttons I provided with tab shaped images. Use a different image of the same size but different color for an added mouseover, onclick, or active tab effect.
Updated: 2009-04-28T21:25:30Z


CSS - DIVs with Absolute Position


1. create a file called mytest.html
2. insert the following code between the <body> tags
-----------------------------

<div id="navigation">
<a href="page1.html"> Link 1 </a> <br />
<a href="page2.html"> Link 2 </a> <br />
<a href="page3.html"> Link 3 </a>
</div>

3. create a file called mytest.css
4. insert the following code
-----------------------------

#navigation {
position: absolute; left: 50px; top: 100px; margin-left: 10px;margin-top: 10px;
border : dashed 1px #000000;
background : #c0c0c0;
padding : 4px;
width: 100px;
height: 400px;}
Updated: 2009-04-28T20:47:07Z


CSS - Make a DIV Semi-Transparent


1. create a file called mytest.html
2. insert the following code between the <body> tags
-----------------------------

<div id="navigation">
<a href="page1.html"> Link 1 </a> <br />
<a href="page2.html"> Link 2 </a> <br />
<a href="page3.html"> Link 3 </a>
</div>

3. create a file called mytest.css
4. insert the following code
-----------------------------
#navigation
{
filter:alpha(opacity=60);
-moz-opacity: 0.6; /*for older firefox browsers*/
opacity: 0.6;
}
Link to a Stylsheet
4. place the following between the <head> tags of your document
-----------------------------
<link rel="stylesheet" href="mystyle.css" />
Make a DIV Transparent
1. create a file called mytest.html
2. insert the following code between the <body> tags
-----------------------------

<div id="navigation">
<a href="page1.html"> Link 1 </a> <br />
<a href="page2.html"> Link 2 </a> <br />
<a href="page3.html"> Link 3 </a>
</div>

3. create a file called mytest.css
4. insert the following code
-----------------------------
#navigation
{
filter:alpha(opacity=0);
-moz-opacity: 0.0; /*for older firefox browsers*/
opacity: 0.0;
}
Updated: 2009-04-28T20:46:39Z


CSS - Make an Image Change Transparency on Hover


1. create a file called mytest.html
2. insert the following code between the <body> tags
-----------------------------

<img src="myimage.jpg" class="mouseoverimage">

3. create a file called mytest.css
4. insert the following code
-----------------------------
.mouseoverimage
{
filter:alpha(opacity=40);
-moz-opacity: 0.4; /*for older firefox browsers*/
opacity: 0.4;
}
.mouseoverimage:hover
{
filter:alpha(opacity=100);
-moz-opacity: 1.0; /*for older firefox browsers*/
opacity: 1.0;
}
Define Hyperlink Colors
1. add the following to your CSS page
-----------------------------
a {font-family:Georgia,serif; font-size:large}
a:link {color: #FF0000} /* unvisited link */
a:visited {color: #00FF00} /* visited link */
a:hover {color: #FF00FF} /* mouse over link */
a:active {color: #0000FF} /* selected link */
Change Text, Paragraphes, etc on Hover
1. add the following to your html page
-----------------------------
<div id="box">
<p onmouseover="this.className = 'onHover'" onmouseout="this.className='offHover'">
This is example #1...blah, blah.
</p>
</div>
2. add the following to your CSS page
-----------------------------
#box p:hover { /* the p: tag refers to the <p> tag on the html page.*/
/* change this for <img>,<ul>,<font>, etc */
background: #dd0;
}
.onHover {
background: #dd0;
height: 1%; /* Holly Hack */
}

.offHover {
background: #cc0;
}
NOTE: Two different methods are defined here because one method works with IE and the other with Mozilla
Updated: 2009-04-28T20:46:05Z


CSS - Center Aligned DIV Regardless of Window Size or Display Resolution


1. the following CSS center aligns a DIV
-----------------------------
#container {
background-color: transparent;
width: 700px;
position: absolute;
height: auto;
left: 50%;
top: 100px;
margin-left: -350px;
}
2. My Example: Create a new page called Default.html
-----------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="Default.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Center Aligned DIV</title>
</head>

<body class=body>

<div id=container>
<div id=leftColumn>
<div class=box>
<div class=boxHeader>head fklj f </div>
<div class=boxBody>
body dlfkjsdlfjkds'fkj fkdjafka
lfjdsafjkasfj'kasf f fs usufu sh fs f sfh sf ids fhds fis </div>
</div>

<div class=box>
<div class=boxHeader>head fklj f </div>
<div class=boxBody>
body dlfkjsdlfjkds'fkj fkdjafka
lfjdsafjkasfj'kasf f fs usufu sh fs f sfh sf ids fhds fis </div>
</div>
</div>


<div id=rightColumn>
<div class=box>
<div class=boxHeader>head fklj f </div>
<div class=boxBody>
body dlfkjsdlfjkds'fkj fkdjafka
lfjdsafjkasfj'kasf f fs usufu sh fs f sfh sf ids fhds fis </div>
</div>

<div class=box>
<div class=boxHeader>head fklj f </div>
<div class=boxBody>
body dlfkjsdlfjkds'fkj fkdjafka
lfjdsafjkasfj'kasf f fs usufu sh fs f sfh sf ids fhds fis </div>
</div>
</div>
</div>

</body>
</html>

3. Create a new page called Default.css
-----------------------------
@charset "utf-8";
/* CSS Document */

.boxHeader {
height: 25px;
width: auto;
background-color: #CCCCCC;
padding: 5px;
margin: 0px;
clear: both;
}
.boxBody {
height: auto;
width: auto;
background-color: #666666;
padding: 5px;
margin: 0px;
clear: both;
}
.box {
padding: 5px;
height: auto;
width: auto;
background-color: transparent;
margin: 0px;
clear: right;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
#container {
background-color: transparent;
width: 700px;
position: absolute;
height: auto;
left: 50%;
top: 100px;
margin-left: -350px;
}

#rightColumn {
width: 200px;
padding: 0px;
background-color: transparent;
right: 0px;
float: right;
}
#leftColumn {
width: 500px;
padding: 0px;
left: 0px;
float: left;
}
.body {
background-color: #669900;
}
Updated: 2009-04-28T20:44:58Z


CSS - Background image changes dynamically on window resize


NOTE: The image you use for the top (first) layer must be a gif with a portion of the image transparent. You should be able to see through the top image to the image below. When you drag to resize the window, the images will move at different speeds and change the appearance of the background. Depending on the images you create, this effect will either be really cool or really lame.
#layer0 {
background-color: transparent;
height: 140%;
width: 140%;
position: absolute;
background-image: url(images/circles0.gif);
margin-left: -20%;
margin-top: -20%;
}
#layer1 {
background-color: transparent;
height: 110%;
width: 110%;
position: absolute;
background-image: url(images/circles0.gif);
margin-left: -5%;
margin-top: -5%;
}
Updated: 2009-04-28T20:43:33Z


ADO - ASP DELETE (or any query) from Access Database


<%
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("fpdb/Inventory_Devices.mdb"))


iDeviceID = Request.QueryString("DeviceID")
sSQL = "DELETE FROM Devices WHERE DeviceID = " & iDeviceID

Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = oConn
rs.Source = sSQL
rs.Open


Set rs = Nothing
oConn.Close
Set oConn = Nothing
%>
Updated: 2009-04-28T20:38:55Z


ADO - ASP Edit/Delete Access Database records - with form submittals


1. Create an asp page called Edit_Record_List.asp that will send the Record ID to be edited/deleted to the edit/delete form pages
-------------------------------------------------------------------------------------------------------
<table width="600">
<tr>
<%
set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("/fpdb/jasons web blog.mdb") & ";"

set rs = Server.CreateObject("ADODB.recordset")

mySQL = "SELECT blogID, blogtitle, blogcategory FROM jasonswebblog"
rs.Open mySQL, conn

do until rs.EOF
blogID = rs.Fields("blogID")
Response.Write("<td width=75><a href='Edit_Record_Form.asp?blogID=" & blogID & "'>" & " Edit </a></td>")
Response.Write("<td width=75><a href='Delete_Record_Form.asp?blogID=" & blogID & "'>" & " Delete </a></td>")
for each x in rs.Fields
Response.Write("<td width=150>" & x.value & "</td>")
next
rs.MoveNext
Response.Write("</tr><tr>")
loop

rs.close
conn.close
%>
</tr></table>

2. Create a self-populated form page called Edit_Record_Form.asp with all the editable fields of the record and sends those to an edit action page
-------------------------------------------------------------------------------------------------------
<form method="post" action="Edit_Record_Action.asp">
Record ID= <%=request("BlogID")%><br>

<%

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open Server.MapPath("/fpdb/jasons web blog.mdb")

Set rs = Server.CreateObject("ADODB.recordset")
On Error Resume Next

strSQL = ("SELECT * FROM jasonswebblog WHERE blogID = " & request("blogID") )

rs.open strSQL, conn

rs.MoveFirst
WHILE NOT rs.EOF
Response.Write("<input type='hidden' name='blogID' value='" & rs("blogID") & "' /><br />")
Response.Write("<input type='text' name='blogtitle' value='" & rs("blogtitle") & "' /><br />")
Response.Write("<textarea rows='25' cols='10' name='blogbody' />" & rs("blogbody") & "</textarea><br />")
Response.Write("<input type='text' name='blogcategory' value='" & rs("blogcategory") & "' /><br />")
rs.MoveNext
WEND

rs.Close
Set rs = Nothing

conn.Close
Set conn = Nothing
strSQL = " "

%>
<br /><input type='submit' value='Submit' />
</form>

3. Create a page called Edit_Record_Action.asp that will take the form fields from the form page and update them in the database
-------------------------------------------------------------------------------------------------------
<%
' Response.write(Request.Form("blogID")) & "<br>"
Response.write("Title: <br>" & Request.Form("blogtitle")) & "<br>"
Response.write("Body: <br>" & Request.Form("blogbody")) & "<br>"
Response.write("Catagory: <br>" & Request.Form("blogcategory")) & "<br>"

set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("/fpdb/jasons web blog.mdb") & ";"

mySQL = "UPDATE jasonswebblog SET "
mySQL = mySQL & "blogtitle='" & Request.Form("blogtitle") & "', "
mySQL = mySQL & "blogbody='" & Request.Form("blogbody") & "', "
mySQL = mySQL & "blogcategory='" & Request.Form("blogcategory") & "' "
mySQL = mySQL & "WHERE blogID = " & Request.Form("blogID") & ""
on error resume next

conn.Execute mySQL

if err<>0 then
Response.Write("No update permissions!")
else
Response.Write("<h3>" & recaffected & " record edited!</h3>")
end if

conn.close

%>

4. Create a page called Delete_Record_Form.asp that will take the record ID from the list page and put it in a form submittal
-------------------------------------------------------------------------------------------------------
If you are sure you want to <br><font color="red">DELETE THIS RECORD FOREVER</font>, <br>press submit. <br>Otherwise, use your browser's BACK button.

<form method="post" action="Delete_Record_Action.asp">

<input type="hidden" name="blogID" value="<%=request("blogID")%>" size="25">
<br /><input type='submit' value='Submit' />
</form>
5. Create a page called Delete_Record_Action.asp that will take the record ID from the form page and delete it from the database
-------------------------------------------------------------------------------------------------------
<%

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open Server.MapPath("/fpdb/jasons web blog.mdb")

Set rs = Server.CreateObject("ADODB.recordset")

strSQL = ("DELETE * FROM jasonswebblog WHERE blogID = " & request("blogID") )

conn.execute(strSQL)



conn.Close
Set conn = Nothing
strSQL = " "

%>

Your record has been deleted.
ADO - ASP INSERT form submittal to Access Database with error report.
<%
Response.write(Request.Form("personal_name")) & "<br>"
Response.write(Request.Form("email")) & "<br>"
Response.write(Request.Form("password")) & "<br>"
Response.write(Request.Form("about_me")) & "<br>"
' Response.write(Request.Form("verified")) & "<br>"
' Response.write(Request.Form("blocked")) & "<br>"

set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("/fpdb/for_sale_cars.mdb") & ";"

mySQL = "INSERT INTO Account "
mySQL = mySQL & "(personal_name, email, password, about_me, Verified, Blocked) "
mySQL = mySQL & "VALUES ('" & Request.Form("personal_name") & "', '"
mySQL = mySQL & Request.Form("email") & "', '"
mySQL = mySQL & Request.Form("password") & "', '"
mySQL = mySQL & Request.Form("about_me") & "', '"
mySQL = mySQL & Request.Form("Verified") & "', '"
mySQL = mySQL & Request.Form("Blocked") & "')"

on error resume next

conn.Execute mySQL

if err<>0 then
Response.Write("No update permissions!")
else
Response.Write("<h3>" & recaffected & " record added</h3>")
end if

conn.close

%>
Updated: 2009-04-28T20:38:36Z


ADO - ADODB SELECT from Access Database


<%
set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("/fpdb/for_sale_cars.mdb") & ";"

set rs = Server.CreateObject("ADODB.recordset")

mySQL = "SELECT personal_name FROM Account WHERE Account_ID = "
mySQL = mySQL & Request("Account_ID")

rs.Open mySQL, conn

do until rs.EOF
for each x in rs.Fields
Response.Write("<h2>" & x.value & "</h2>")
next
rs.MoveNext
loop

rs.close
conn.close
%>
<%
set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("/fpdb/for_sale_cars.mdb") & ";"

set rs = Server.CreateObject("ADODB.recordset")

mySQL = "SELECT about_me FROM Account WHERE Account_ID = "
mySQL = mySQL & Request("Account_ID")

rs.Open mySQL, conn

do until rs.EOF
for each x in rs.Fields
Response.Write("<h4>" & x.value & "</h4>")
next
rs.MoveNext
loop

rs.close
conn.close
%>


<%
set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("/fpdb/for_sale_cars.mdb") & ";"

set rs = Server.CreateObject("ADODB.recordset")

mySQL = "SELECT personal_name FROM Account WHERE (email = '"
mySQL = mySQL & Session("email") & "' AND password = '"
mySQL = mySQL & Session("password") & "' )"

rs.Open mySQL, conn

do until rs.EOF
for each x in rs.Fields
Response.Write("<h4>" & "<a href='Posting_New1.asp'>Post a new listing</a>" & "<br><a href='Posting_Edit1.asp'>Edit a listing</a>" & "<br><a href='Account_Edit1.asp'>Edit my profile</a><br><br>")
next
rs.MoveNext
loop

rs.close
conn.close
%>
Updated: 2009-04-28T20:37:53Z


ADO - ADODB SELECT "Best Version" for Access Database


<%

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open Server.MapPath("/fpdb/for_sale_cars.mdb")

Set rs = Server.CreateObject("ADODB.recordset")
On Error Resume Next

strSQL = "SELECT title, price, location, body, email FROM Posting WHERE Posting_ID = "
strSQL = strSQL & request("Posting_ID") & " AND active = 'On'"

rs.open strSQL, conn

rs.MoveFirst
WHILE NOT rs.EOF
Response.Write("<b><h1>" & rs("title") & "</h1></b>")
Response.Write("<b>$" & rs("price") & ".00</b>")
Response.Write(" " & rs("location") & "<br/><hr>")
Response.Write(rs("body") & "<br/><hr>")
Session("email_to") = rs("email")
rs.MoveNext
WEND

rs.Close
Set rs = Nothing

conn.Close
Set conn = Nothing
strSQL = " "

%>
Updated: 2009-04-28T20:37:27Z


ADO - ASP SELECT from Access Database with Table


<table width=680>
<h5><tr>
<td width=480><b>Title</b>
<td width=100><b>Price $</b>
<td width=200><b>Catagory</b>
<td width=100>
</tr>
<h5><tr>

<%
set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("/fpdb/for_sale_cars.mdb") & ";"

set rs = Server.CreateObject("ADODB.recordset")

mySQL = "SELECT title, price, catagory, active FROM Posting WHERE Account_ID = "
mySQL = mySQL & Request("Account_ID")

rs.Open mySQL, conn

do until rs.EOF
for each x in rs.Fields
Response.Write("<td>" & x.value & "</td>")
next

rs.MoveNext
Response.Write("</tr><tr>")
loop

rs.close
conn.close
%>
</tr></table>
Updated: 2009-04-28T20:37:04Z


ADO - ASP SELECT from Access Database with table - passes parameters to another asp page


<table width="1550">
<p style="margin-top: 0; margin-bottom: 0">
<td width=400>
<p style="margin-top: 0; margin-bottom: 0"><b>Title</b>
<td width=100>
<p style="margin-top: 0; margin-bottom: 0"><b>Price $</b>
<td width=550>
<p style="margin-top: 0; margin-bottom: 0"><b>Location</b>
<td width=100>
<h5 style="margin-top: 0; margin-bottom: 0"><tr>
<td width=400>
<p style="margin-top: 0; margin-bottom: 0">
</tr></h5>
<h5><tr>
<%
set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("/fpdb/for_sale_cars.mdb") & ";"

set rs = Server.CreateObject("ADODB.recordset")

mySQL = "SELECT price, location, Posting_ID, title FROM Posting WHERE catagory = '"
mySQL = mySQL & Request("catagory") & "' AND active = 'Active'"
rs.Open mySQL, conn

do until rs.EOF
Post_ID = rs.Fields("Posting_ID")
titletemp = rs.Fields("title")
Response.Write("<td><a href='PostingPage.asp?Posting_ID=" & Post_ID & "'>" & titletemp & "</a></td>")
for each x in rs.Fields
Response.Write("<td>" & x.value & "</td>")
next
rs.MoveNext
Response.Write("</tr><tr>")
loop

rs.close
conn.close
%>
</tr></h5></table>
Updated: 2009-04-28T20:36:25Z


ASP - Parse a Hulu XML RSS feed and put it in your webpage


----------------------------------------------------------------------------------------------------------
<font color="green">Insert the following code in your .ASP page:
The RSS feed style can be controlled with a CSS page
----------------------------------------------------------------------------------------------------------

<%
' change the RSSURL variable to the exact URL of the RSS Feed you want to pull
RSSURL = "http://www.hulu.com/feed/queue/smailliwnosaj"

Dim objHTTP ' this object is used to call the RSS Feed remotely
Dim RSSURL,RSSFeed ' these variables hold the URL and Content for the RSS Feed
Dim xmlRSSFeed ' this variable hold the XML data in a DOM Object
Dim objItems,objItem, objChild ' these variables are used to temporarily hold data from the various RSS Items
Dim title,description,link ' these are local variables that will hold the data to be displayed
Dim OutputHTML_1,OutputHTML_2,OutputHTML_3 ' these variables will hold the HTML that was converted from the RSS Feed

' this code requests the raw RSS/XML and saves the response as a string <RSSFeed>
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHTTP.open "GET",RSSURL,false
objHTTP.send
RSSFeed = objHTTP.responseText

' this code takes the raw RSSFeed and loads it into an XML Object
Set xmlRSSFeed = Server.CreateObject("MSXML2.DomDocument.4.0")
xmlRSSFeed.async = false
xmlRSSFeed.LoadXml(RSSFeed)

' this code disposes of the object we called the feed with
Set objHTTP = Nothing

' this is where you determine how to display the content from the RSS Feed

' this code grabs all the "items" in the RSS Feed
Set objItems = xmlRSSFeed.getElementsByTagName("item")

' this code disposes of the XML object that contained the entire feed
Set xmlRSSFeed = Nothing

' loop over all the items in the RSS Feed
For x = 0 to objItems.length - 1
' this code places the content from the various RSS nodes into local variables
Set objItem = objItems.item(x)
For Each objChild in objItem.childNodes
Select Case LCase(objChild.nodeName)
Case "title"
title = objChild.text
Case "link"
link = objChild.text
Case "description"
description = objChild.text
End Select
Next
' Here are some various display samples.
OutputHTML_1 = OutputHTML_1 & "<a href=" & link & ">" & title & "</a><br />" & description & ""
OutputHTML_2 = OutputHTML_2 & "<a href=""" & link & """>" & title & "</a><br />"
OutputHTML_3 = OutputHTML_3 & "<a href=""" & link & """>" & title & "</a><hr />"
Next
%>
<%=OutputHTML_1%>
Updated: 2009-04-28T20:27:20Z


ASP - Display all image files (with thumbnails) from a web folder


----------------------------------------------------------------------------------------------------------
I commented out items that discriminate what type of file to be displayed
Create a folder called 'My_Images' in the webroot
Inside 'My_Images', create two folders called 'thumbnails' and 'large'
Place a thumbnail version of an image in the 'thumbnails' folder, and a full size one with the same file name in the 'large' folder
----------------------------------------------------------------------------------------------------------

<center>
<%
Response.Buffer = True
%>

<%
' File System Object
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")

' "My_Images" Folder
Dim folder
Set folder = fso.GetFolder(Server.MapPath("My_Images/thumbnails/"))

If folder.Size > 0 Then
For Each file In folder.Files
// If left(file.name, 9) = request("ID") Then
Response.Write "<a href='My_Images/large/" & file.Name & "' target=_blank>"
Response.Write "<img height=100 border=0 src='My_Images/thumbnails/" & file.Name & "'></a> "
Response.Write ""
// Else
// End If
Next

Else
Response.Write "<ul><li type=""circle"">No Files Uploaded.</ul>"
End If

%>

</center>
Updated: 2009-04-28T20:25:50Z


ASP - Send email from a web page on an ASPupload compatible Windows IIS Server


----------------------------------------------------------------------------------------------------------
Create a page called mail_send.asp
From another web page, make a form that sends the following
fields: email_from, body
and sets a session cookie for: email_to
----------------------------------------------------------------------------------------------------------

<%
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "RE: Your Posting on HoosierTopics.com"
myMail.From = request.form("email_from")
myMail.To = Session("email_to")
myMail.HTMLBody = request.form("body")
myMail.Send
set myMail = nothing
%>
<%

Session("email_to")="DeleteThisCookie"

response.write("<b>From:</b> " & request.form("email_from") & "<br><br>")
response.write("<b>Message:</b> " & request.form("body") & "<br><br>")
%>
Updated: 2009-04-28T20:25:06Z


ASP - Password protect web pages


----------------------------------------------------------------------------------------------------------
1. create file named logon.asp
----------------------------------------------------------------------------------------------------------

<html>
<head>
<title>Logon Form</title>
<%

Username="Admin"
Password="Password"

Validated = "OK"
if Strcomp(Request.Form("User"),Username,1)=0 AND Request.Form("password") = Password then
'Set the validation cookie and redirect the user to the original page.
Response.Cookies("ValidUser") = Validated
'Check where the users are coming from within the application.
If (Request.QueryString("from")<>"") then
Response.Redirect Request.QueryString("from")
else
'If the first page that the user accessed is the Logon page,
'direct them to the default page.
Response.Redirect "inv_index.asp"
End if
Else
' Only present the failure message if the user typed in something.
If Request.Form("User") <> "" then
Response.Write "<h3>Authorization Failed.</h3>" & "<br>" & _
"Please try again.<br> <br>"
End if
End if
%>
</head>
<body bgcolor="#FFFFFF">
<FORM ACTION=<%Response.Write "Logon.asp?"&Request.QueryString%> method="post">
<h3>Logon Page for MyPage.asp</h3>
<p>
Username:
<INPUT TYPE="text" NAME="User" VALUE='' size="20"></INPUT>
Password:
<INPUT TYPE="password" NAME="password" VALUE='' size="20"></INPUT>
<INPUT TYPE="submit" VALUE="Logon"></INPUT>
</FORM>
</body>
</html>

----------------------------------------------------------------------------------------------------------
2. add this to top of every protected page
----------------------------------------------------------------------------------------------------------

<%
Validated = "OK"
if Request.Cookies("ValidUser") <> Validated then
'Construct the URL for the current page.
dim s
s = "http://"
s = s & Request.ServerVariables("HTTP_HOST")
s = s & Request.ServerVariables("URL")
if Request.QueryString.Count > 0 THEN
s = s & "?" & Request.QueryString
end if
'Redirect unauthorized users to the logon page.
Response.Redirect "Logon.asp?from=" &Server.URLEncode(s)
End if
%>
Updated: 2009-04-28T20:24:20Z


2009-04-04
I learned that Microsoft SQL Server 2008 is far, far


2009-04-04




I learned that Microsoft SQL Server 2008 is far, far harder to configure on a Windows machine than MySQL Server. I spent a good day not getting SQL Server to work, trying everything under the sun. I got as far as getting an ODBC connection set up on the machine, but could never get PHP to work with it. There is probably something in that PHP for IIS 7.0 is still in its infancy. Anyway, I decided to use MySQL instead. Bam!!! On the first install, it worked like a charm. Combine that with the fact that MySQL Server has a built in command-line tool that makes testing and updating your server a cinch.
Well, I have officially made my decision on what is the best SQL server, MySQL hands down.




2009-03-24



Vicki and I took the kids on a spring break road trip to South Carolina. On the way down, we stopped at the Mammoth Caves and Fall Creek Falls. Vickis mom, dad, bros and sis met us down there. We stayed at the Berkely Country Club Estates in Blanton, Hilton Head, SC at Vickis Aunt Diana and Uncle Jim Georges house. They had an alligator in their front pond. We did an ocean fishing excursion. I caught a few fish off of a reef 15 miles out but Jim Steen caught the only keepers. We had a fancy dinner at the country club, spent a day at the health club, rode bikes on the beach, went on a catered dolphin tour ( the dolphins came right up to the boat ), and played volleyball on the beach. On the way back, we toured the Biltmore Estate in Asheville, NC. Fun week.












2009-03-02



It turns out the Three Geeks and a Mouse did actually pay me for my time. Though, it took them quite a long time to do it. I have no choice but to give 3GAAM a semi for not getting the check in the mail sooner. Sorry, Bill Carson.




2009-02-20



I ran an audio/video presentation for Vince Poscente. He is known for going from being a 26 year old nobody to (in just four years) shattering the world downhill speed skiing record at the winter olympics. He held the record for a while. But, now he is a full-time motivational speaker. This time, he spoke to the Young Presidents Organization of Indiana.




2009-02-01



I uploaded about two thousand web templates. View them here: Web Templates




2009-01-12




Working all this week at the Adesa Auction plant in Carmel, IN, doing Network Monitoring Support. 40 hours




2009-01-11



Did a one-day PC tech job for Three Geeks and a Mouse out of Texas. They needed a tech for a home PC support role. 1.75 hours. TGAAM have very bad reps for not paying their techs. I will post an update if they screw me for my $130




2009-01-10



Worked all week at the Adesa Auction plant in Kansas City, MO, moving PCs from their old site to their new. 88 hours.




2008-12-25



Christmas was totally awesome. More presents than I have ever seen under a tree. The kids were all treated really well. Friends remembered us. And to top it all off. I surprised Vicki when I asked her to marry me ( sunset in front of some really cool art sculptures at DePauw ).





2008-12-19



I spent the afternoon integrating a CMS to keep track of hours and expenses for clients and to generate personalized invoices for each. It turned out awesome. Here is a sample of the invoice page:

Invoice




2008-11-24





Thanksgiving was great! Kaelis dad, Jeramiah, flew in for a surprise visit, I almost hospitalized myself from food overdose, and we came together as a family without anyone getting grounded. Awesome.


I learned that Microsoft SQL Server 2008 is far, far harder to configure on a Windows machine than MySQL Server. I spent a good day not getting SQL Server to work, trying everything under the sun. I got as far as getting an ODBC connection set up on the machine, but could never get PHP to work with it. There is probably something in that PHP for IIS 7.0 is still in its infancy. Anyway, I decided to use MySQL instead. Bam!!! On the first install, it worked like a charm. Combine that with the fact that MySQL Server has a built in command-line tool that makes testing and updating your server a cinch.
Well, I have officially made my decision on what is the best SQL server, MySQL hands down.

Updated: 2009-04-28T19:12:56Z




No comments: