<?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="2.0">
<channel>
<title>NealGrosskopf.com - Geek Speak</title>
<link>http://www.nealgrosskopf.com/tech/</link>
<description>a NG Designs Website...</description>
<language>en-us</language>
<copyright>Copyright &#169; 2008 NealGrosskopf.com</copyright>
<lastBuildDate>Tue, 6 Jan 2009 06:10:48 CST</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>NealGrosskopf.com RSS Generator</generator>
<managingEditor>Neal Grosskopf</managingEditor>
<webMaster>Neal Grosskopf</webMaster>
<image>
<title>NealGrosskopf.com</title>
<url>http://www.nealgrosskopf.com/files/ico/favicon.ico</url>
<link>http://www.nealgrosskopf.com</link>
</image>
<item>
<title>CSS Basics - .Class Vs. #ID</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=29</link>
<description>
<![CDATA[
<p>A common mistake I see many beginning web designers make is deciding when to use a .class and when to use an #ID. The best way to explain it
is: classes can be used many times while IDs can only be used once per page.</p>

<p>A real world example might be your website's template. Look at the code below that I stripped down to just the layout elements of a website's template:</p>

<code style="white-space: pre;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;

&lt;head&gt;&lt;/head&gt;

&lt;body&gt;

&lt;div style=&quot;text-align:center;&quot; class=&quot;mass&quot;&gt;

	&lt;div class=&quot;logoBar&quot;&gt; 
		&lt;div class=&quot;sqLogo&quot;&gt;&lt;/div&gt;
		&lt;div class=&quot;locator&quot;&gt;&lt;/div&gt;
	&lt;/div&gt;
	  
	&lt;div class=&quot;navBarTop&quot;&gt;
		&lt;ul id=&quot;nav&quot;&gt;&lt;/ul&gt;
	&lt;/div&gt;
	  
	&lt;div id=&quot;navBarBorder&quot;&gt;&lt;/div&gt;
	  
	&lt;div class=&quot;mainCopy&quot;&gt;
	&lt;/div&gt;
	  
	&lt;div class=&quot;tagLineBox&quot;&gt;&lt;/div&gt;
	  
	&lt;div class=&quot;footerBox&quot;&gt;
		&lt;div class=&quot;alsLogo&quot;&gt;&lt;/div&gt;
		&lt;div class=&quot;footerNavBox&quot;&gt;&lt;/div&gt;
		&lt;div class=&quot;100yearLogo&quot;&gt;&lt;/div&gt;
	&lt;/div&gt;
	
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code>


<p>For structural elements like all of the elements above, IDs should be used and not classes. Classes are best used for text related elements or really anything that you might use
more than once on a webpage. IDs should be used for unique elements that will only appear once in the DOM. Also remember that classes can be combined while IDs cannot:</p>

<code>
&lt;div class=&quot;bold italic&quot;&gt;Hello World!&lt;/div&gt;
</code>

<h4>Using a HTML ID More Than Once</h4>

<p>On the flip side <b>NEVER</b> use the ID attribute more than once. The reason for this is the ID attribute has other meanings within HTML such as:</p>

<ul>
	<li>Referencing the element with JavaScript through the getElementById DOM method</li>
	<li>Making the element an anchor which can be linked to with a fragment identifier</li>
	<li>Associating a label element with a form control via the for attribute</li>
	<li>Specifying which header cell(s) that provide header information for a data cell via the headers attribute</li>
</ul>

<p>Credit: this list was taken from <a href="http://www.456bereastreet.com/archive/200812/the_id_attributes_value_must_be_unique/">Roger Johansson's</a> website.</p>

<h4>Overuse of Classes and IDs</h4>

<p>Another problem I see, is web designers overusing classes and IDs. Consider the following:</p>

<code>
&lt;div class=&quot;navBarTop&quot;&gt;
	&lt;ul id=&quot;nav&quot;&gt;&lt;/ul&gt;
&lt;/div&gt;
</code>

<p>Notice that the UL tag contains an ID? Unless it's being used by JavaScript or there is an anchor pointing to it there's really no reason to place the ID attribute on it. The element 
could be selected via CSS with <span class="s">.navBarTop</span> #navBarTop ul which essentially renders the ID attribute useless. Don't litter your HTML with redundant attributes.</p>

<h4>When Is the Best Time to Fix These Problems?</h4>

<p>The best time to hunt down redundant attributes and incorrect usage of classes vs IDs is during the initial development of a website. Once the site has been in production for awhile
it is harder to hunt down whether that ID tag is needed anymore or to have to update your template file and CSS file so that you are using IDs rather than classes.</p><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=29">View Comments [0]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Sun, 21 Dec 2008 18:23:30 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=29</guid>
<author>Neal Grosskopf</author>
<category>css</category>
</item>
<item>
<title>Microsoft Employees Caught Using Mac, Safari &amp; Firefox</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=28</link>
<description>
<![CDATA[
<p>I was doing my daily check up on <a href="http://google.com/analytics">Google Analytics</a> today (which is the best web analytics package I've ever used) and I noticed that I had
3 visits from the network location of "<a href="http://www.microsoft.com/">microsoft corp</a>". Having peaked my interest I then moved my time frame back to about March 2008 when my website
started getting a more significant amount of traffic. I then picked up another 27 visits from the Microsoft campus in Redmond, Washington. </p>

<h4>Microsoft Employees Use Firefox/Safari</h4>

<p>After viewing what pages the  employees viewed, I then proceeded to see what sort of setup they were providing their employees over there at Redmond.
To my surprise 7 visitors were using Firefox and 1 was using Safari. Safari? I asked myself with a puzzled look on my face.</p>

<p><img src="/tech/resources/28/microsoft-employees-browsers.png" alt="Microsoft Employees Use Firefox &amp; Safari"></p>

<p>Notice those 7 visits with Firefox, the competitor to Microsoft's Internet Explorer? Apparently they don't mind their employees using Firefox.
I might expect them to use Firefox to test their products out in (like they even do that...See: <a href="http://www.live.com/?scope=images">Live Image Search</a> which used to suck in Firefox)  but to visit my small time website with Firefox or Safari
would insinuate that it's the user's primary browser of choice.</p>

<h4>Microsoft Employees Use Macs</h4>

<p>What about that single user of Safari? Well I decided to open up the operating system report and lo and behold, there's an employee at Microsoft using a Macintosh.
I can understand someone using Firefox but for a Microsoft employee to be using a Mac downright defeats all logic. One would think that if Windows Vista/XP were the end all be all
operating system that they wouldn't "need no stinkn'" Macs. Being a loyal MS corporate stooge I was a bit offended to see Macintosh show up in my operating system report.</p>

<p><img src="/tech/resources/28/microsoft-employees-use-mac.png" alt="Microsoft Employees Use Macs"></p>

<h4>The IE Team Reads Your Comments and Visits Your Website</h4>

<p>Another interesting tidbit I got from Google Analytics  (I'm assuming here) is that members of the <a href="http://blogs.msdn.com/ie/">Internet Explorer Team Blog</a> actually visit their users 
websites via their blog. I posted a comment in on the IE Team blog stating that IE8 does a terrible job at rendering my website and that it looks worse in IE8 than it did in prior versions of IE. We can see in the report below that 2 employees, 
presumibly from the IE Team, read my comment and visited my website, neat! </p>

<p><img src="/tech/resources/28/microsoft-employees-msdn.png" alt="The IE Team Reads Your Comments and Visits Your Website"></p>

<h4>Conclusion</h4>

<p>Aren't web analytics great? Perhaps I'll do a simliar study on Apple Inc. employees visiting my website at another time to see if we can find any of them using Windows XP or Yahoo! 
employees searching with Google Search.</p><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=28">View Comments [0]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Mon, 15 Dec 2008 18:39:19 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=28</guid>
<author>Neal Grosskopf</author>
<category>microsoft</category><category>analytics</category>
</item>
<item>
<title>Clearing Floats In IE6, IE7, Firefox, Opera & Safari - A New Method</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=27</link>
<description>
<![CDATA[
<p>Over and over again at places I've worked,  I've noticed other web developers struggle with clearing floats in CSS. I've seen
all sorts of unique solutions to the problem, many which frighten me. I've seen solutions using JavaScript, some using obscure CSS properties such as the 
.clearfix class introduced at P.I.E. and others just setting a fixed height on elements. </p>

<h4>Common HTML Setup For A CSS Layout</h4>

<p>The HTML below is a pretty standard setup for most websites. Generally people want the #footer DIV to fall below the #container DIV. Also many people will
want the background-color of the #container DIV to be solid and touch up against the #footer DIV.</p>

<code>
&lt;div id=&quot;container&quot;&gt;
	&lt;div id=&quot;floatleft&quot;&gt;
		&lt;p&gt;Float Left&lt;/p&gt;
		&lt;p&gt;Float Left&lt;/p&gt;
		&lt;p&gt;Float Left&lt;/p&gt;
		&lt;p&gt;Float Left&lt;/p&gt;
		&lt;p&gt;Float Left&lt;/p&gt;
		&lt;p&gt;Float Left&lt;/p&gt;
	&lt;/div&gt;
	&lt;div id=&quot;floatright&quot;&gt;
		&lt;p&gt;Float Right&lt;/p&gt;
		&lt;p&gt;Float Right&lt;/p&gt;
		&lt;p&gt;Float Right&lt;/p&gt;
		&lt;p&gt;Float Right&lt;/p&gt;
		&lt;p&gt;Float Right&lt;/p&gt;
		&lt;p&gt;Float Right&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;footer&quot;&gt;Footer Div&lt;/div&gt;
</code>

<p><a href="/tech/resources/27/">Now view how this HTML renders with the basic CSS applied to it &gt; &gt;</a></p>

<h4>Solution #1: Giving The #container DIV a Height</h4>

<p>Notice how the #footer DIV is much too high and doesn't clear the #container or it's two child DIVs? The most common fix to this problem that I've seen is to give
the #container DIV a height like so:</p>

<code>
height: 232px;
</code>

<p><a href="/tech/resources/27/?example=1">View This In Action &gt;&gt;</a></p>

<p>At this point most web developers would just move on to the next project and considered this finished. The problem is, when the height changes or receives more
content this design is broken.</p>

<h4>Solution #2: Clearing Float Using clear: both;</h4>

<p>The next common fix to this is to use clear: both; on the #footer DIV:</p>

<code>
#footer { clear: both; }
</code>

<p><a href="/tech/resources/27/?example=2">View This In Action &gt;&gt;</a></p>

<p>While this does actually clear the #footer DIV notice how the yellow bordered #container DIV is still a small sliver at the top? If you used a repeating background-image
or background-color this solution would not work.</p>

<h4>Finally, a New Way To Clear Floats</h4>

<p>There's a seldom used CSS property called "overflow" which will fix this problem for us. The W3C describes the overflow property as <i>a property that specifies whether content of a 
block-level element is clipped when it overflows the element's box. It affects the clipping of all of the element's content except any descendant elements (and their respective content 
and descendants) whose containing block is the viewport or an ancestor of the element.</i>
</p>

<p>In common english that means that <b>if a container has floated  or absolute positioned elements it will not have a height</b>. In order for it to "expand" to the size of it's floated children the CSS overflow
property must be set, in this case to "auto"</p>

<code>
overflow: auto;
</code>

<p><a href="/tech/resources/27/?example=3">View This In Action &gt;&gt;</a></p>

<p>Voila! The #container DIV now assumes the variable height of it's floated children and the #footer DIV clears the #container DIV.</p><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=27">View Comments [3]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Wed, 10 Dec 2008 20:24:05 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=27</guid>
<author>Neal Grosskopf</author>
<category>css</category>
</item>
<item>
<title>How To Fix HTML Table Caption 1px Shift Bug</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=26</link>
<description>
<![CDATA[
<p>One of my favorite, but underused HTML elements is the CAPTION element. The CAPTION element should be be a description of the table while a TH should be a heading for a column. 
I think too often people use the TH element on HTML forms that really contain no tabular data and shouldn't be in a table regardless (yes I'm a hypocrite). The CAPTION element
would be better suited to describe an HTML form than a TH tag.</p>

<p>After using the CAPTION element for awhile now, I've noticed that in some browsers, it appears to be a pixel shorter in width than in other browsers. Below, take a look at the top left of the table. 
You'll see that there appears to be a 1px discrepancy. This happens in all versions of Firefox and in Internet Explorer. The bug doesn't affect Opera, Safari, or Google Chrome. </p>

<p><img src="/tech/resources/26/caption-1px-shift.png" alt="1px Shift In HTML Caption"></p>

<h4>The Solution</h4>

<p>The following code will fix the bug in Firefox and Internet Explorer.</p>

<code>
caption { margin-left: -1px; }
</code>

<h4>A Better Solution To The 1px Caption Shift Bug</h4>

<p>I would recommend doing the opposite of the selector above and leave the CAPTION margin at 0px but target Firefox and Internet Explorer using CSS hacks. I suspect that Firefox and Internet 
Explorer are actually in the wrong here and that the others are in the right.</p>

<code>
/* Target Firefox */
@-moz-document url-prefix()
{
caption { margin-left: -1px; }
}

/* Target IE (or use IF IE statement ) */
caption { _margin-left: -1px; }
</code>

<h4>Sources</h4>

<ul>
	<li><a href="http://www.w3.org/TR/html401/struct/tables.html#h-11.2.2">HTML 4.01 Caption Specification</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=26">View Comments [2]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Tue, 25 Nov 2008 20:09:56 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=26</guid>
<author>Neal Grosskopf</author>
<category>css hacks</category><category>css</category><category>html</category>
</item>
<item>
<title>Google Analytics...For Stalkers!</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=25</link>
<description>
<![CDATA[
<p>Google analytics is one of the sweetest web analytics "software" packages out there. After using Web Trends, Web Side Story and AWS Stats(?) they just don't compare.
Recently GA released a major update. I was fortunate to get on the beta list (thanks to <a href="http://www.kaushik.net/avinash/">Avinash Kaushik</a>) and I am extremely impressed with
some of the new features they've added.</p>

<h4>Segmentation in Google Analytics...Yes!</h4>

<p>With segmentation I can virtually transform an entire GA profile into a specific scenario. Want to see what users from Milwaukee, Wisconsin are doing? Easy. Want to see
what users from Milwaukee, Wisconsin, on the UWM campus are doing? Easy. Want to see what users from Milwaukee, Wisconsin, on the UWM campus that use a Macintosh, have a 1600x1200 Screen
Resolution and use Firefox are doing? Easy. Seeing a pattern here? Yes, with segmentation you can take a few 'known variables' and turn it into a uniquely identifiable person (such as a friend).</p>

<h4>Google Analytics Segmentation Example</h4>

<p><img src="/tech/resources/25/google-analytics-segmentation.png" alt="Segmentation in Google Analytics Example"></p>

<p>In the above screen shot you can see how easy it is to drill down to your stalkers' hearts content. In this example I'm looking for users at UWGB that use a Macintosh. My target? Eric Lightbody, 
a prior co-worker of mine (sorry Eric!). Depending on how much traffic you site gets, this may be really easy for you to do or really hard. My site gets a pretty small amount of visitors from Wisconsin
(where I live) so I can easily deduce the segments down to the point of identifying individuals.</p>

<h4>I'm Weirdo Stalker, How Does This Benefit Me?</h4>

<p>Well weirdo stalker, this works out great for you. With the segmentation feature you can apply these rules to your entire profile and essentially 'filter out' everything <i>but</i> your
segment. Here I can see exactly what my victim did for the entire month of November. Every web page visited, times and dates that those pages were viewed and for how long. Everything I 
could do before with those 'anonymous visitors'.</p>

<p><img src="/tech/resources/25/google-analytics-segmentation-profile.png" alt="Segmentation in Google Analytics Example"></p>

<h4>Final Thoughts?</h4>

<p>Segmentation is really cool! Even better is you can take these same rules and create a custom report and add that custom report to your main pages dashboard. Now you'll always
know when that special someone (or friend in my case) visits your website. Stalkers unite!</p>

<img src="/tech/resources/25/google-analyitcs-custom-report.png" alt="Custom Report in Google Analytics"><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=25">View Comments [7]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Wed, 19 Nov 2008 21:56:03 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=25</guid>
<author>Neal Grosskopf</author>
<category>google</category><category>analytics</category>
</item>
<item>
<title>How To Add Image Loading Icon To Large Images Using CSS</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=24</link>
<description>
<![CDATA[
<p>I ran into a problem on my website recently with slow loading images. The images weren't actually very large, the reason they were slow loading was because I was using
ASP.NET to dynamically create thumbnails for my images off of a larger source image. I guess I'm just too lazy to resize 75+ images in photoshop and I'm very clean
when it comes to throwing more files on my webserver. My solution was to have one file and just resize it with ASP.NET. That worked great but some pages had 20 or so
images and could take up to 20 seconds to load them all. I started searching for solutions to this problem with JavaScript but for the most part I dislike JavaScript
and I was looking for something better than "if (document.browser.support.some.random.method)". I found my salvation in CSS once again.</p>

<h4>Apply Ajax Style Loading Image To Your Images Without JavaScript</h4>

<p>It's really simple, in fact it's too simple I don't know why I hadn't thought of it before. Simply add the .loading class to any of your IMG elements.</p>

<code>
.loading { background: url(loading.gif) no-repeat center center; }
</code>

<h4>But wait, that's not all</h4>

<p>I would also recommend adding dimensions to your images via the Height and Width properties in CSS. This will ensure that your loading.gif file appears completely. My images
we're dynamically added to the page via an ASP loop so this was easy enough to add.</p>

<code>
height: 125px;
width: 150px;
</code>

<h4>Alt Text?</h4>

<p>The only drawback to this solution is in FireFox (and possibly other browsers, other than IE) the alt text will cover up the background-image. A workaround might be to give
the IMG tag a title attribute instead of an ALT attribute. I know this isn't ideal but it's the best I can think of. Since my images didn't need any SEO treatment I was fine with this.</p>

<p><a href="/myfiles/wallpapers/">To view a demo of this view my wallpapers section of my site</a>.</p>

<h4>Sources:</h4>

<ul>
	<li><a href="http://images.google.com/images?q=loading+gif&imgsz=icon">Google Image Search For Loading GIF Icons</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=24">View Comments [4]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Mon, 27 Oct 2008 20:58:01 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=24</guid>
<author>Neal Grosskopf</author>
<category>css</category>
</item>
<item>
<title>CSS Image Preload - :hover Pseudo Selector Parent Of display: none Elements</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=23</link>
<description>
<![CDATA[
<p>Lately at my job, our internet connection has slowed down dramatically. This means that every http request 
over our internet connection is much more noticeable. I often refer back to my own website while at work, to
steal some code or see how I did something in the past. One of the things I've noticed with our slow internet connection
is my main navigation menu's background-image is really laggy. The image on the drop down which has a value of
display: none; would have a 3 second delay before displaying.</p>

<p>Annoyed by the extreme delay in my menu's background-image I started tinkering to solve the problem. 
My first tool of choice was using the Firefox <a href="https://addons.mozilla.org/en-US/firefox/addon/3829">Live HTTP Headers</a>
addon. Using this I could load the page, and then proceed to hover over elements to see if the browser was hitting the
server for images or other files. I noticed on my navigation that when I hovered over it, it needed to retrieve my
background-image from the server. This made finding a solution much easier.</p>

<h3>What CSS Properties Will Do A CSS Image Preload?</h3>

<p>The following methods will download the images from the web server upon page load. This assumes the following code
which might be some element within your site's template:</p>

<code>
&lt;div id=&quot;preload&quot;&gt;&lt;/div&gt;
</code>

<h3>These Methods Successfully Downloaded The CSS Preload Image Upon Page Load</h3>

<code>
#preload { background-image: url(image.png); position: absolute; left: -9999px; }
#preload { background-image: url(image.png); visibility: hidden; }
#preload { background-image: url(image.png); background-repeat: no-repeat; background-position: -9999px -9999px; }
</code>

<p>I consider the background-repeat: no-repeat; background-position: -9999px -9999px; to be the most practical of these methods</p>

<h3>These Methods Did Not Download The CSS Preload Image Upon Page Load</h3>

<code>
#preload { background-image: url(image.png); display: none; }
#preload:hover { background-image: url(image.png); }
#preload:active { background-image: url(image.png); }
#preload:focus { background-image: url(image.png); }
</code>

<p>The browser will not download the images upon page load if the element has a display: none; property (interesting
that they will download the image if it's visibility is set to hidden). The browser will also not download images
that have a :hover, :active or :focus in it's selector.</p>

<h3>CSS Sprites?</h3>

<p>Nope, sorry, before you even bother commenting "why not use CSS sprites?"  In my situation that was not an option.
The element I wanted to preload the image for had :hover for it's parent element and display: none; set, talk about a
double whammy CSS sprites only work for elements that are visible on page load. I should digress that I could have bundled
these images with some other images in my site's template but semantically they had no useful purpose with any other
background-image.</p>

<h3>The Solution?</h3>

<p>I ended up using the background-repeat: no-repeat; background-position: -9999px -9999px; method. The trick is I needed to place
my CSS background-image on some unused element on the page. This is not the best solution for CSS maintainability but
it was a necessary evil if I wanted my hidden background-image to load before it was displayed on :hover</p>

<h3>How It's Done</h3>

<p>I had two elements on my page (in close proximity or parents of my elements). I decided to place these selectors in their
own section of my stylesheet so that they would stand out a bit.</p>

<code>
#nav { background: url(/files/images/template/menu_bg-trans.png) no-repeat -9999px -9999px; }
#header { background: url(/files/images/template/helper_a_bg-trans.png) no-repeat -9999px -9999px; }
</code>

<h3>Optimal Solution?</h3>

<p>No, not really but It fixed a problem I had. One could also create specific DIVs just for image preloading and 
absolutely position them outside of the viewport, but that just adds extra markup to the page and isn't really
semantically correct. Feel free to leave a comment if you can think of a better way.</p><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=23">View Comments [2]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Wed, 22 Oct 2008 20:18:43 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=23</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>html</category>
</item>
<item>
<title>How To Create A 301 Redirect For Domains Or Home Page Variances</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=22</link>
<description>
<![CDATA[
<p>I've seen countless websites that use strange in-site links when linking back to their index pages. I've also seen problems when somebody else posts a link
back to your website on a social networking website that is different than how you usually link. This can hurt your search engine optimization (SEO) on your website because the web crawlers will consider each variation a distinct webpage. 
Here are a few variations of the home page of NealGrosskopf.com.</p>

<h4>Home Page Possibilities</h4>

<ol>
	<li>http://www.nealgrosskopf.com/</li>
	<li>http://www.nealgrosskopf.com/default.asp</li>
	<li>http://nealgrosskopf.com/</li>
	<li>http://nealgrosskopf.com/default.asp</li>
</ol>

<p>It's important to standardize a way for linking to index pages within folders on your website. It's also good to relay this onto co-worker who may also be working on the same website as yourself.
Although web workers try their best to be consistent with their inner-site linking, it's impossible to maintain in a multi-user environment. Because of this I created a way to do 301 redirects
for home pages.</p>

<h4>Setup: Variables</h4>

<code>
'301 Redirect - URL Must Contain www.domain.com
CorrectDomain = "www.domain.com"
DefaultPage = "/index.asp"
QueryStrings = request.ServerVariables("QUERY_STRING")
URL = request.ServerVariables("URL")
</code>

<p>While there is of course a shorter way to do this, I decided to create variables for this article since I feel they are easier to understand.</p>

<h4>301 Domain Check</h4>

<code>
if instr(request.ServerVariables("SERVER_NAME"),CorrectDomain) = 0  then
end if
</code>

<p>First we need an IF statement to check the domain name against our CorrectDomain variable. If the current domain does not contain the domain we want it to, we enter the IF statement.</p>

<h4>Query Strings</h4>

<code>
if QueryStrings <> "" then
	QueryStrings = "?" &amp; QueryStrings
end if
</code>

<p>Next we check if there are any query strings and if so, add the question mark to the beginning.</p>

<h4>Default/Home/Index Page</h4>

<code>
if instr(URL,DefaultPage) then
	URL = replace(URL,DefaultPage,"/")
end if
</code>

<p>Then we check the path to the page and remove default,index or home.asp from the string to get a clean trailing forward slash.</p>

<h4>301 Redirect</h4>

<code>
response.Status = "301 Moved Permanently"
response.AddHeader "Location","http://" &amp; CorrectDomain &amp; URL &amp; QueryStrings
response.End
</code>

<p>Finally we do the actual 301 redirect in classic ASP using all the variables we built.</p>

<h4>Putting It All Together</h4>

<code>
'301 Redirect - URL Must Contain www.domain.com
CorrectDomain = "www.domain.com"
DefaultPage = "/index.asp"
QueryStrings = request.ServerVariables("QUERY_STRING")
URL = request.ServerVariables("URL")
	
if instr(request.ServerVariables("SERVER_NAME"),CorrectDomain) = 0  then
    
    if QueryStrings <> "" then
        QueryStrings = "?" &amp; QueryStrings
    end if
   
    if instr(URL,DefaultPage) then
        URL = replace(URL,DefaultPage,"/")
    end if
   
    response.Status = "301 Moved Permanently"
    response.AddHeader "Location","http://" &amp; CorrectDomain &amp; URL &amp; QueryStrings
    response.End
       
end if
</code><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=22">View Comments [6]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Tue, 14 Oct 2008 19:59:49 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=22</guid>
<author>Neal Grosskopf</author>
<category>seo</category><category>asp</category>
</item>
<item>
<title>Create CSS Curly Quotes Without Images </title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=21</link>
<description>
<![CDATA[
<p>The objective of most web designers is to separate content from markup. It is also an objective to not use images when possible, simply for the fact that you have to edit the images in
external software if you want to modify the look and feel them. Remember, if you can do it in CSS then do it in CSS. Below I will show you how to create CSS quotes without the need of images. The code is
also pretty pure without the use of extra nested tags or classes.</p>

<h4>Setting Up Your CSS Quotes</h4>

<p>First, lets use the blockquote tag, because it is the most semantic choice when dealing with quotations. Also I should note that support for the &lt;q&gt; tag is not there yet in Internet Explorer so we will
avoid that tag for now. The margin gives the blockquote some spacing much like a paragraph tag would, while the padding left offsets the content from our left quote. The rarely seen CSS quotes property sets what 
glyph we want to use for our quotation character. I used the HTML entity &amp;#8220 since you cannot place a literal " or ' symbol in the property, plus it will not work or validate.</p>

<code>
blockquote
{
margin: 2em 0px;
padding-left: 40px;
quotes: &amp;&#35;8220 &amp;&#35;8221;
}
</code>

<h4>Styling Our CSS Curly Quotes</h4>

<p>Now we use the :before pseudo selector to place our CSS content that we defined using the quotes property to style our CSS quotes. I change the color, font family and give it a negative margin
which is the reverse of the padding we gave to the blockquote element. Note that you must also set the content property to another rarely used CSS property called open-quote. This will
inject what we defined in the quotes property above.</p>

<code>
blockquote:before
{
color: #990000;
content: open-quote;
font-family: Arial, Helvetica, sans-serif;
font-size: 6em;
font-weight: bold;
line-height: 0px;
margin: 0px 5px 0px -40px;
vertical-align: bottom;
}
</code>


<h4>Putting It All Together</h4>

<code>
blockquote
{
margin: 2em 0px;
padding-left: 40px;
quotes: &amp;&#35;8220 &amp;&#35;8221;
}

blockquote:before
{
color: #990000;
content: open-quote;
font-family: Arial, Helvetica, sans-serif;
font-size: 6em;
font-weight: bold;
line-height: 0px;
margin: 0px 5px 0px -40px;
vertical-align: bottom;
}
</code>

<p>Click to <a href="/tech/resources/21/">view a demo of CSS curly quotes</a></p>

<h4>Sources:</h4>

<ul>
	<li><a href="http://www.w3.org/TR/css3-selectors/#first-letter">http://www.w3.org/TR/css3-selectors/#first-letter</a></li>
	<li><a href="http://www.w3schools.com/css/pr_gen_quotes.asp">http://www.w3schools.com/css/pr_gen_quotes.asp</a></li>
	<li><a href="http://developer.mozilla.org/En/CSS:content">http://developer.mozilla.org/En/CSS:content</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=21">View Comments [0]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Wed, 1 Oct 2008 19:53:10 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=21</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>quotes</category>
</item>
<item>
<title>CSS Browser Hacks For Firefox, Opera, Safari &amp; Internet Explorer</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=20</link>
<description>
<![CDATA[
<p>While I strongly advise using hacks at a minimum especially when it comes to CSS there is a time and a place for them, especially when you need a quick way to target a browser other
than Internet Explorer.</p>

<h4>CSS Hacks: The Problem</h4>

<p>Most standards favoring browsers (Firefox, Opera &amp; Safari) have no method of targeting CSS to the specific browser while Internet Explorer, the buggiest browser, has a completely
safe and easy method of serving CSS/HTML to only IE.</p>


<h4>The Setup</h4>

<p>To show that the hacks are working correctly I created 6 paragraphs with their specific browser/version identifier within them. This will let you know that the hack is working correctly</p>

<code>
&lt;p id=&quot;opera&quot;&gt;Opera 7.2 - 9.5&lt;/p&gt;
&lt;p id=&quot;safari&quot;&gt;Safari&lt;/p&gt;
&lt;p id=&quot;firefox&quot;&gt;Firefox&lt;/p&gt;
&lt;p id=&quot;firefox12&quot;&gt;Firefox 1 - 2 &lt;/p&gt;
&lt;p id=&quot;ie7&quot;&gt;IE 7&lt;/p&gt;
&lt;p id=&quot;ie6&quot;&gt;IE 6&lt;/p&gt;
</code>

<p>Next I automatically hid all P tags:</p>

<code>
&lt;style type=&quot;text/css&quot;&gt;
body p
{
display: none;
}
&lt;/style&gt;
</code>


<h4>Targeting Internet Explorer With CSS Using Conditional Comments</h4>

<p>The easiest way to target IE is with conditional comments. There is a robust syntax that Microsoft has created to allow authors to do this. I'm not going to go into detail about this since it has been <a href="http://msdn.microsoft.com/en-us/library/ms537512.aspx">re-hashed 
a million times</a> by other bloggers but here are two alternatives to parser CSS hacks:</p>

<code>
&lt;!--[if IE 7]&gt;
&lt;style type="text/css"&gt;
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;!--[if IE 6]&gt;
&lt;style type="text/css"&gt;
&lt;/style&gt;
&lt;![endif]--&gt;
</code>


<h4>Targeting Internet Explorer With CSS Using Parser Hacks</h4>

<p>I wouldn't recommend using these hacks since conditional comments are really, really easy to use but if you want to keep all your CSS in one file here is an alternative. Note that the IE7 hack will only apply to IE7 because IE6 does not understand the &gt; 
selector. It should also be noted that no other browser will recognize this hack.</p>

<code>
/* IE 7 */
html &gt; body #ie7
{
*display: block;
}

/* IE 6 */
body #ie6
{
_display: block;
}
</code>


<h4>Targeting Firefox With CSS</h4>

<p>The first hack targets only Firefox 1 and 2 by using the body:empty hack. The second hack, which is quite clever target all versions of Firefox by using the proprietary extension -moz. -moz combined with the -document url-prefix() which by the way is used by Firefox Addon creators targets Firefox and Firefox alone. I've found that by using proprietary extensions to CSS, as hacks, usually means the most surefire way to target individual browsers without having to worry about another browser possibly parsing the CSS. </p>

<code>
/* Firefox 1 - 2 */
body:empty #firefox12
{
display: block;
}

/* Firefox */
@-moz-document url-prefix()
{
#firefox { display: block; }
}
</code>


<h4>Targeting Safari With CSS</h4>

<p>The Safari CSS hack works similar to the Firefox hack because it uses a Safari proprietary extension to CSS. By using the -webkit prefix we can target Safari and only Safari. </p>

<code>
/* Safari */
@media screen and (-webkit-min-device-pixel-ratio:0) 
{ 
#safari { display: block; }
}
</code>


<h4>Targeting Opera With CSS</h4>

<p>The Opera CSS hack works because of negation in CSS. Currently I feel this hack is the weakest of all the hacks I've listed simply because it's targeting ALL browsers that support -min-device-pixel-ratio that aren't -webkit. It will only be a matter of time before Firefox supports this and this hack will then most likely apply to Firefox as well. </p>

<code>
/* Opera */
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0)
{
head~body #opera { display: block; }
}
</code>


<h4>Putting It All Together:</h4>

<code>
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
&lt;title&gt;CSS Browser Hacks&lt;/title&gt;

&lt;style type=&quot;text/css&quot;&gt;
body p
{
display: none;
}
/* Opera */
html:first-child #opera
{
display: block;
}

/* IE 7 */
html &gt; body #ie7
{
*display: block;
}

/* IE 6 */
body #ie6
{
_display: block;
}

/* Firefox 1 - 2 */
body:empty #firefox12
{
display: block;
}

/* Firefox */
@-moz-document url-prefix()
{
#firefox { display: block; }
}

/* Safari */
@media screen and (-webkit-min-device-pixel-ratio:0) 
{ 
#safari { display: block; }
}

/* Opera */
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0)
{
head~body #opera { display: block; }
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;p id=&quot;opera&quot;&gt;Opera 7.2 - 9.5&lt;/p&gt;
&lt;p id=&quot;safari&quot;&gt;Safari&lt;/p&gt;
&lt;p id=&quot;firefox&quot;&gt;Firefox&lt;/p&gt;
&lt;p id=&quot;firefox12&quot;&gt;Firefox 1 - 2 &lt;/p&gt;
&lt;p id=&quot;ie7&quot;&gt;IE 7&lt;/p&gt;
&lt;p id=&quot;ie6&quot;&gt;IE 6&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;
</code>

<h4>Sources</h4>

<ul>
	<li><a href="http://msdn.microsoft.com/en-us/library/ms537512.aspx">http://msdn.microsoft.com/en-us/library/ms537512.aspx</a></li>
	<li><a href="http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml">http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml</a></li>
	<li><a href="http://perishablepress.com/press/2006/08/27/css-hack-dumpster/">http://perishablepress.com/press/2006/08/27/css-hack-dumpster/</a></li>
	<li><a href="http://thomas.tanreisoftware.com/?p=11#opera">http://thomas.tanreisoftware.com/?p=11#opera</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=20">View Comments [25]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Tue, 22 Jul 2008 19:36:21 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=20</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>css3</category><category>css hacks</category>
</item>
<item>
<title>Triple Booting Windows XP, Windows Vista &amp; Kubuntu Linux On PCI Express Machine</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=19</link>
<description>
<![CDATA[
<p>I recently acquired a 120GB hardrive for free. Needing something to do with it and the fact that I installed Windows Vista on a separate partition but same drive as
my documents, I had reason enough to start my Windows installation over.</p>

<p>I would only need 20GB or so for Vista yet I have 120GB available. Because of this I decided to triple boot vista, xp, and linux all on the same machine. A PCI Express
machine.</p>

<h4>Windows XP And the PCI.sys 0x0000007E Error</h4>

<p>I used <a href="http://gparted.sourceforge.net">GParted</a> to segment up my hardrive and that worked beautifully. The first problem I ran into was that I could not
install Windows XP on my PCI Express computer. It simply won't work. So I naturally switched the drive out into my non-express computer.</p>

<p>Next I tried installing Vista on that computer only to find out, that Vista refused to install on it because it failed to meet the system requirements. Darn. So I 
had a problem on my hands.</p>

<p>After scouring forums I found that I need to slipstream Service Pack 2 (SP2) on to my Windows XP installation. I did this unsuccessfully until I found a great program called
<a href="http://www.google.com/search?q=autostreamer">Auto Streamer</a>. This was the only method I found where It successfully slipstreamed it. The program combines a downloaded
version of SP2 with your Windows XP installation CD and outputs it as a bootable ISO file. You can then use <a href="http://www.google.com/search?q=imgburn">IMGBurn</a> to burn a bootable ISO file.</p>

<p>After that I successfully installed Vista on a 50GB partition and installed Kunbuntu on a 12GB partition. Once that happens the computer boots using the GRUB boot loader and then you can choose Vista and then select either XP or Vista.</p>

<h4>To Triple Boot XP, Vista and Kubuntu On A PCI Express Machine</h4>

<ol>
    <li>Slipstream XP with SP2 using autostreamer</li>
    <li>Burn bootable XP/SP2 disk</li>
    <li>Install XP/SP2</li>
    <li>Install Vista</li>
    <li>Install Kubuntu</li>
</ol>

<h4>Resources</h4>

<ul>
    <li><a href="http://www.google.com/search?q=autostreamer">AutoStreamer</a></li>
    <li><a href="http://www.google.com/search?q=imgburn">IMGBurn</a></li>
    <li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=049C9DBE-3B8E-4F30-8245-9E368D3CDB5A&amp;displaylang=en">Service Pack 2 Direct Download</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=19">View Comments [3]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Tue, 1 Jul 2008 16:19:16 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=19</guid>
<author>Neal Grosskopf</author>
<category>pci.sys</category><category>operating system</category><category>os</category><category>dual-boot</category><category>tri-boot</category><category>multi-boot</category><category>howto</category><category>setup</category>
</item>
<item>
<title>Make YouTube Embed HTML Validate</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=18</link>
<description>
<![CDATA[
<p>It's nice to allow end users to post their own videos on my website, but the problem is, the HTML YouTube provides for users to embed video does not validate.</p>

<p>YouTube uses the EMBED tag wrapped by an object tag to embed their videos which is not a standards based way of embeding video. Embeding video is easy and there is no need
to resort to YouTubes method.</p>

<p>Rather than put the burden on my end users to properly embed video, I decided to write a function that would convert any videos posted from YouTube and display them in a standards based way.</p>

<h4>Converting YouTube's Garbage Embed Code To Valid HTML </h4>

<ol>

<li>
<p>The function requires that you pass it the user's embed code and a link to the YouTube video</p>
<code>
Function YouTubeCleanup(embed,link)
</code>
</li>

<li>
<p>Next we check if the embed variable contains the phrase "youtube" in it</p>
<code>
if len(replace(embed,"youtube","")) <> len(embed) then
</code>
</li>

<li>
<p>Then I build the new path to the YouTube video using the link variable</p>
<code>
url = "http://www.youtube.com/v/" & replace(link,"http://www.youtube.com/watch?v=","") & "&amp;hl=en"
</code>
</li>

<li>
<p>Next I build the output for the new standards based way of embeding flash video</p>
<code>
embed = "&lt;object type=""application/x-shockwave-flash"" data=""" & url & "&amp;hl=en""&gt;&lt;param name=""movie"" value=""" & url & """&gt;&lt;/object&gt;"
</code>
</li>

<li>
<p>Finally I return the value of the embed variable. Note that if the embed variable did not initially contain "youtube" in it, it will return the variable's default value and no harm has been done.</p>
<code>
YouTubeCleanup = embed
</code>
</li>

</ol>

<h3>Putting It All Together</h3>

<code>
Function YouTubeCleanup(embed,link)

	if len(replace(embed,"youtube","")) <> len(embed) then
		url = "http://www.youtube.com/v/" & replace(link,"http://www.youtube.com/watch?v=","") & "&amp;hl=en"
		embed = "&lt;object type=""application/x-shockwave-flash"" data=""" & url & "&amp;hl=en""&gt;&lt;param name=""movie"" value=""" & url & """&gt;&lt;/object&gt;"
	end if	
	YouTubeCleanup = embed

End Function
</code><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=18">View Comments [2]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Tue, 24 Jun 2008 06:52:11 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=18</guid>
<author>Neal Grosskopf</author>
<category>validation</category><category>asp</category><category>function</category>
</item>
<item>
<title>A Second Look At CSS Diagnostics</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=17</link>
<description>
<![CDATA[
<p>Earlier this year I wrote an article inspired by Eric Meyer's on <a href="/tech/thread.asp?pid=3">CSS Diagnostics: Selecting Deprecated Elements With CSS</a>. The article was a smash, and I my site traffic has gone 
up like crazy ever since then. I was unaware that this niche in the standards community would be so popular. Unfortunately I didn't put as much thought into my initial diagnostics 
other than just trying to improve on Eric's code. Enter part 2</p>

<h4>My IE Has Bugs!</h4>

<p>After applying my original diagnostics code to several projects (at work, and my recent site redesign) I realized that Internet Explorer wasn't quite getting it right.
In fact sometimes, IE was selecting incorrect elements. What came from this was that I needed to be more careful in the selectors I used and that using the "*" selector
resulted in some weird things in IE. What also came from that was a bug in <a href="/tech/thread.asp?pid=16">IE that selects the IMG tag when the selector calls for the proprietary IMAGE element.</a></p>

<p>I decided to go out to the HTML 4.01 specification (straight to the source) and find exactly what attributes and elements are deprecated and which aren't. That way
I could create a more authentic version of the diagnostics tool rather than just adding my personal opinion on what ought to be deprecated and what shouldn't. This
resulted in CSS Diagnostics 2.0.</p>

<h4>Diagnostics Gone Famous</h4>

<p>For my second rendition of the project, I decided that I should <a href="http://code.google.com/p/css-diagnostics/">create a Google Code Project</a> and host my diagnostics on there. I'm not completely sure if that is a good
or bad thing to do. My goals are to keep traffic coming to my own site and not Google's but perhaps the two can live together. I also learned that you can embed the Google Analytics tracking code directly into the Google Code web page thus allowing me to track traffic to that area. This makes me care less about traffic going there because if I can use GA, then I can fell like I actually own those pages. </p>

<h4>On to the code:</h4>

<ol>
<li>
<h4>Highlight Empty Attributes</h4>

<p>I chose some common attributes that people may forget to fill in. Feel free to remove the href="#". I like to use this one because while developing a website, I forget to change # links to their proper pages and this helps me catch them 
in the copy.</p>

<code>
img[alt=""], area[alt=""], *[class=""], a[href=""], a[href="#"], *[id=""], *[title=""]
{ border: 5px dotted yellow !important; }
</code>
</li>

<li>
<h4>Highlight Proposed Deprecated Attributes</h4>

<p>These are a list of attributes that aren't formally deprecated but I personally believe should be. Generally this is because there is a better alternative such as CSS or using IDs on elements rather than NAME.</p>

<code>
body[background], table[background], td[background], th[background],
input[border], table[border]
table[cellpadding],
table[cellspacing],
object[codebase],
img[height], object[height], table[height],
a[name], form[name], img[name], object[name],
a[target], area[target],
td[valign], th[valign],
img[width], object[width], table[width]
{ border: 5px dotted orange !important; }
</code>
</li>

<li>
<h4>Highlight Deprecated Attributes</h4>

<p>These attributes are officially deprecated by the W3C per the HTML 4.01 specification. If you are using the TRANSITIONAL DTD CSS Diagnostics is a great way to move you code to STRICT. It should also be noted that these should appear AFTER empty, and proposed deprecated elements due to <a href="http://reference.sitepoint.com/css/specificity">specificity in CSS</a>. </p>

<code>
applet[align], caption[align], div[align], h1[align], h2[align], h3[align], h4[align], h5[align], h6[align], hr[align], iframe[align], img[align], input[align], legend[align], object[align], p[align], table[align],
body[alink],
applet[alt],
applet[archive],
body[background],
body[bgcolor], td[bgcolor], tr[bgcolor], table[bgcolor],
img[border], object[border],
br[clear],
applet[code],
applet[codebase],
basefont[color], font[color],
dir[compact], dl[compact], menu[compact], ol[compact], ul[compact],
basefont[face], font[face],
applet[height], td[height], th[height],
applet[hspace], img[hspace], object[hspace],
script[language],
body[link],
applet[name],
hr[noshade],
td[nowrap], th[nowrap],
applet[object],
isindex[prompt],
hr[size], font[size], basefont[size],
ol[start],
body[text],
li[type], ol[type], ul[type],
html[version],
body[vlink],
li[value],
applet[vspace], img[vspace], object[vspace], 
hr[width], td[width], th[width], applet[width], pre[width]
{ border: 5px dotted red !important; }
</code>
</li>

<li>
<h4>Highlight Non-W3C Proprietary HTML Attribute</h4>

<p>These are a list of proprietary HTML attributes. Using these in your code should is more offensive than using a deprecated attribute, since these were never warrented by the W3C. Use of these
attributes should be avoided at all costs.</p>

<code>
body[bgproperties],
*[bordercolor], *[bordercolordark], *[bordercolorlight],
body[topmargin], body[rightmargin], body[bottommargin], body[leftmargin],
table[frame]
{ border: 5px dotted magenta !important; }
</code>
</li>

<li>
<h4>Highlight Empty Elements</h4>

<p>These selectors will highlight empty elements within your markup. I've commented out a few selectors that I found didn't jive with my personal website but feel free to de-comment these and use them on your website. </p>

<code>
/*span:empty,*/ /*div:empty,*/ li:empty, /*p:empty,*/ td:empty, th:empty 
{ border: 5px solid yellow !important; }
</code>
</li>

<li>
<h4>Highlight Proposed Deprecated Elements</h4>

<p>Here is a list of elements I feel should be deprecated. Inputs should be because the BUTTON element is a much better choice and allows for easier selection of all website BUTTONs especially in IE6. </p>

<code>
input[type="button"], input[type="reset"], input[type="submit"], tt, big, small
{ border: 5px solid orange !important; }
</code>
</li>

<li>
<h4>Highlight Deprecated Elements</h4>

<p>These elements are formally deprecated in the HTML 4.01 STICT specification.</p>

<code>
applet, basefont, center, dir, font, isindex, menu, s, strike, u,
listing, plaintext, xmp
{ border: 5px solid red !important; }
</code>
</li>

<li>
<h4>Highlight Non-W3C Proprietary HTML Elements</h4>

<p>All of these elements are proprietary, meaning they are not part of the W3C spec and never have been. They include some of the more infamous elements such as the MARQUEE and the BLINK tags. I've commented out the IMAGE selector because IE7 and under will select the IMG tag as well, so use at your own risk. </p>

<code>
audioscope, bgsound, blink, bq, comment, embed, fn, ilayer, /*image,*/ keygen, layer, limittext, marquee, multicol, nobr, noembed, nolayer, nosmartquotes, rt, ruby, server, sidebar, spacer, wbr, xml, blackface, shadow
{ border: 5px solid magenta !important }
</code>
</li>

<li>
<h4>Highlight XHTML 1.0 Strict Deprecated Attributes</h4>

<p>Since many people use XHTML I read the XHTML spec and through in a few deprecated attributes specific to XHTML.</p>

<code>
a[name], applet[name], form[name], frame[name], iframe[name], img[name], map[name]
{ border: 5px dotted lime !important }
</code>
</li>

<li>
<h4>Highlight XHTML 1.0 Strict Prohibitions</h4>

<p>There are also prohibitions in XHTML, essentially elements that cannot appear nested inside other elements.</p>

<code>
a > a,
pre > img, pre > object, pre > big, pre > small, pre > sub, pre > sup,
button > input, button > select, button > textarea, button > label, button > button, button > form, button > fieldset, button > iframe, button > isindex,
label > label,
form > form
{ border: 5px solid lime !important }
</code>
</li>

<li>
<h4>Highlight Deprecated Classes From Old Version Of Website</h4>

<p>I found this area of CSS Diagnostics especially helpful during my last site redesign. When I redesigned my site, I threw out all my old CSS and started from scratch. What resulted was a lot of left over classes in my markup that was non existent in my external stylesheet. This is a great way to call out those &quot;old&quot; classes that aren't being used anymore. </p>

<code>
.toolbg, .ulnone, span.b, ul.list, .eleven, 
.lines, .wide, .select, table.form, form td.b, table .top,
.gallerypic, .iegallery, .pic, .image, .transparent,
.wht, .blk, .blue, .dkgray, .ltgray, .brown, .quote, .greyhover
{ border: 5px groove red !important; }
</code>
</li>

<li>
<h4>Highlight Deprecated JavaScript Functions From Old Version Of Website</h4>

<p>The same can be applied to old JavaScript functions. I found numerous references to old function calls so I devised a way to highlight deprecated JavaScript functions. </p>

<code>
input[onfocus*="normal1px()"],
input[onfocus*="change1px()"]
{ border: 5px dashed red !important; }
</code>
</li>


<li>
<h4>Highlight Known 404 Page Links</h4>

<p>Another problem I ran across during my redesign was deleted web pages. I devised a way of highlight known 404 pages using CSS. You can substitute the URLs I have below with you own known 404 pages. A great way to determine
404 pages is to look at your server log files or to use Google Webmaster Tools.</p>

<code>
a[href*="/designs/web/web1/"],
a[href*="/designs/web/web2/"],
a[href*="/designs/web/web3/"],
a[href*="/designs/aitp/aitp-fvtc/"],
a[href*="/designs/aitp/aitp/"],
a[href*="/forms/contact.asp"], 
a[href*="/forms/email.asp"]
{ border: 5px double red !important; }
</code>
</li>

</ol>






<h4>Putting It All Together:</h4>


<code>
/* Empty Attributes */
img[alt=""], area[alt=""], *[class=""], a[href=""], a[href="#"], *[id=""], *[title=""]
{ border: 5px dotted yellow !important; }

/* Proposed Deprecation Due To CSS */
body[background], table[background], td[background], th[background],
input[border], table[border]
table[cellpadding],
table[cellspacing],
object[codebase],
img[height], object[height], table[height],
a[name], form[name], img[name], object[name],
a[target], area[target],
td[valign], th[valign],
img[width], object[width], table[width]
{ border: 5px dotted orange !important; }

/* W3C HTML 4 Strict Deprecated Attributes - http://www.w3.org/TR/html401/index/attributes.html */
applet[align], caption[align], div[align], h1[align], h2[align], h3[align], h4[align], h5[align], h6[align], hr[align], iframe[align], img[align], input[align], legend[align], object[align], p[align], table[align],
body[alink],
applet[alt],
applet[archive],
body[background],
body[bgcolor], td[bgcolor], tr[bgcolor], table[bgcolor],
img[border], object[border],
br[clear],
applet[code],
applet[codebase],
basefont[color], font[color],
dir[compact], dl[compact], menu[compact], ol[compact], ul[compact],
basefont[face], font[face],
applet[height], td[height], th[height],
applet[hspace], img[hspace], object[hspace],
script[language],
body[link],
applet[name],
hr[noshade],
td[nowrap], th[nowrap],
applet[object],
isindex[prompt],
hr[size], font[size], basefont[size],
ol[start],
body[text],
li[type], ol[type], ul[type],
html[version],
body[vlink],
li[value],
applet[vspace], img[vspace], object[vspace], 
hr[width], td[width], th[width], applet[width], pre[width]
{ border: 5px dotted red !important; }

/* Non W3C Proprietary HTML Attributes - http://en.wikipedia.org/wiki/Non-standard_HTML_tags#Proprietary_HTML_attributes */
body[bgproperties],
*[bordercolor], *[bordercolordark], *[bordercolorlight],
body[topmargin], body[rightmargin], body[bottommargin], body[leftmargin],
table[frame]
{ border: 5px dotted magenta !important; }



/* Empty Elements */
/*span:empty,*/ /*div:empty,*/ li:empty, /*p:empty,*/ td:empty, th:empty 
{ border: 5px solid yellow !important; }

/* Proposed Deprecated Elements */
input[type="button"], input[type="reset"], input[type="submit"], tt, big, small
{ border: 5px solid orange !important; }

/* W3C HTML 4 Strict Deprecated Elements - http://www.w3.org/TR/html401/index/elements.html */
applet, basefont, center, dir, font, isindex, menu, s, strike, u,
listing, plaintext, xmp
{ border: 5px solid red !important; }

/* Non W3C Proprietary HTML Elements - http://en.wikipedia.org/wiki/Non-standard_HTML_tags */
audioscope, bgsound, blink, bq, comment, embed, fn, ilayer, /*image,*/ keygen, layer, limittext, marquee, multicol, nobr, noembed, nolayer, nosmartquotes, rt, ruby, server, sidebar, spacer, wbr, xml, blackface, shadow
{ border: 5px solid magenta !important }



/* XHTML 1.0 Strict Deprecated Attributes  - http://www.w3.org/TR/xhtml1/#h-4.10 - http://www.w3.org/TR/xhtml11/changes.html#a_changes */
a[name], applet[name], form[name], frame[name], iframe[name], img[name], map[name]
{ border: 5px dotted lime !important }

/* XHTML 1.0 Strict Prohibitions  http://www.w3.org/TR/xhtml1/#prohibitions */
a > a,
pre > img, pre > object, pre > big, pre > small, pre > sub, pre > sup,
button > input, button > select, button > textarea, button > label, button > button, button > form, button > fieldset, button > iframe, button > isindex,
label > label,
form > form
{ border: 5px solid lime !important }



/* Deprecated Classes From Old Website */
.toolbg, .ulnone, span.b, ul.list, .eleven, 
.lines, .wide, .select, table.form, form td.b, table .top,
.gallerypic, .iegallery, .pic, .image, .transparent,
.wht, .blk, .blue, .dkgray, .ltgray, .brown, .quote, .greyhover
{ border: 5px groove red !important; }

/* Dreprecated JavaScript From Old Website */
input[onfocus*="normal1px()"],
input[onfocus*="change1px()"]
{ border: 5px dashed red !important; }

/* 404 Pages */
a[href*="/designs/web/web1/"],
a[href*="/designs/web/web2/"],
a[href*="/designs/web/web3/"],
a[href*="/designs/aitp/aitp-fvtc/"],
a[href*="/designs/aitp/aitp/"],
a[href*="/forms/contact.asp"], 
a[href*="/forms/email.asp"]
{ border: 5px double red !important; }
</code>


<h4>Summary:</h4>

<p>It is best to use different colors and borders to apply meaning to what error you have made in your code. I like to use yellow for minor, orange for moderate, red for severe, and magenta for extremely severe.</p>

<p>I also like to apply different border styles depending on what the problem may be. Dotted for me means there is a bad attribute. Solid means there is a bad element. Other border styles have their own meanings as well.</p>


<h4>Considerations:</h4>

<p>Make sure to place this at the end of your stylesheet and to leave in the !important rules so that they override any rules that may be inline.</p>

<p>It is also best to use a standards compliant browser when testing. IE7 is ok but I would personally suggest Firefox 3 because it supports standards better and because it has other add-ons that make web development easier and
diagnostic testing easier.</p>



<h4>Download:</h4>

<p class="notice" style="text-indent: 10px;">I've set up a <a href="http://code.google.com/p/css-diagnostics/downloads/list" class="b">Google Code Project</a> so feel free to download it.</p><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=17">View Comments [5]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Wed, 18 Jun 2008 20:44:34 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=17</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>css3</category><category>css diagnostics</category><category>validation</category>
</item>
<item>
<title>Internet Explorer 7 And Under Supports The &lt;IMAGE&gt; Tag... A New Bug.</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=16</link>
<description>
<![CDATA[
<p>Ok, so I was working on my latest and greatest version of CSS Diagnostics. I was trying to include every known proprietary element and attribute known to man
in my stylesheet which included the likes of the blink tag, marquee tag, all the way to the obscure ones like the ruby, blackface and audioscope tags.</p>

<p>The problem was Internet Explorer kept highlighting all of my images, particularly my anchored images in solid 5px magenta (essentially proprietary elements)</p>

<p>I automatically started my comment strips of selectors out method, which is short is using deduction to pick out the offending selector. This is the offending tag I ended up with:</p>

<h4>A Brand New Internet Explorer Bug...The HTML IMAGE Element:</h4>

<code>
image { border: 5px solid magenta !important; }
</code>

<p>That's right, some random archaic element. Now the real problem here is that Internet Explorer, and only Internet Explorer was highlighting regular old IMG tags even though my selector was calling for IMAGE tags.
That's a bug, and that's a new bug to my knowledge. This does beg for me to cook up some kind of hackary to target IE regarding images on web pages but why not just use conditional comments? If you had a very, very
specific case where you wanted to target IE and only IE images this might be useful. Other than that I'm not sure where it would get used.</p>

<h4>Sources:</h4>

<ul>
	<li><a href="http://en.wikipedia.org/wiki/Non-standard_HTML_tags">http://en.wikipedia.org/wiki/Non-standard_HTML_tags</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=16">View Comments [2]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Fri, 13 Jun 2008 21:53:33 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=16</guid>
<author>Neal Grosskopf</author>
<category>ie</category><category>bug</category><category>css</category>
</item>
<item>
<title>Create Class Name From URL In ASP</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=15</link>
<description>
<![CDATA[
<p>I've noticed some CMS sites doing this so I figured it might be useful to do on my own site. Basically the gist of this function is to create a CSS class name from the URL.
This class can then be referenced in your stylesheet and you can be assured that it will only target that specific page. This is most useful especially with <a href="http://reference.sitepoint.com/css/specificity">specificity problems</a>.</p>

<ol>
	<li>
		<h3>Remove First String Character In ASP Classic</h3>
		
		<p>Input String = "/products/computers/parts/default.asp"</p>
		
		<p>First lets lower case that url</p>
		
		<code>
url = lcase(request.ServerVariables("URL"))
url = right(url,len(url)-1)	
		</code>
		
		<p>What this does is moves the length of the string minus 1 space from the right position of the string using the right() and len() built in functions
		in ASP. I realize that there are probably easier ways to do this in other languages but I figured I'd fill that empty hole on the internet in this subject by writing it up. </p>
	</li>	
	<li>
		<h3>Remove Forward Slashes</h3>
		
		<p>Class Name = "products/computers/parts/default.asp"</p>
		
		<p>Next lets remove all forward slashes and replace them with underscores. (Note you can use whatever separator your want, I prefer underscores for readability.</p>
		
		<code>
url = replace(url,"/","_")
		</code>
	</li>	
	<li>	
		<h3>Remove File Extension And Add Prefix</h3>
		
		<p>Class Name = "products_computers_parts_default.asp"</p>
		
		<p>Last, lets remove the file extension and give the class a prefix of "url_" to set it apart from other class names.</p>
		
		<code>
url = replace(url,".asp","")
CreatePageClassName = "url_" & url
		</code>
	</li>
</ol>

<h3>Putting It All Together</h3>

<code>
function CreatePageClassName()

	url = lcase(request.ServerVariables("URL"))
	url = right(url,len(url)-1)	
	url = replace(url,"/","_")
	url = replace(url,".asp","")
	
	CreatePageClassName = "url_" & url

end function
</code>

<p>Class Name = "url_products_computers_parts_default"</p>


<h3>Where To Use This</h3>

<p>I would personally place this on your body tag as an ID if possible:</p>

<code>
&lt;body id="&lt;%=CreatePageClassName()%&gt;"&gt;
</code>

<p>Which would result in this:</p>

<code>
&lt;body id="url_products_computers_parts_default"&gt;
</code>

<h3>Reference:</h3>

<ul>
	<li><a href="http://reference.sitepoint.com/css/specificity">http://reference.sitepoint.com/css/specificity</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=15">View Comments [1]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Tue, 10 Jun 2008 20:30:42 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=15</guid>
<author>Neal Grosskopf</author>
<category>asp</category><category>css</category><category>function</category>
</item>
<item>
<title>Using CSS To Find Broken Links &amp; 404 Pages</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=14</link>
<description>
<![CDATA[
<p>I recently redesigned my website. In the process of doing that I moved a few pages around to locations that I thought they belonged.
The problem I had, like almost every web worker out there is that I ended up with broken links. Usually our html editing software tries it's best to 
alleviate us of these types of problems but they're never a 100% fix.</p>

<h3>CSS Selectors For Finding Broken Links</h3>

<p>Then it occurred to me, why not use my CSS to highlight broken links? Here's how.</p>

<code>
&lt;a href="/forms/contact.asp"&gt;broken link 1&lt;/a&gt;
&lt;a href="/forms/email.asp"&gt;broken link 2&lt;/a&gt;

a[href="/forms/contact.asp"],
a[href="/forms/email.asp"]
{ border: 5px double red; }
</code>

<h3>Rationale</h3>

<p>This will select any anchor tags where their href attribute equals the 404 broken link page. For those of you using my <a href="/tech/thread.asp?pid=3">CSS Diagnostics stylesheet</a>, I used a different border-style here so that we can differentiate between the highlighted elements. This works good and fine but what about those newbie coders
at work who still link to pages using "../" or the ones that include the domain name within the link?</p>

<h3>Take Two</h3>

<code>
a[href$="/contact.asp"],
a[href$="/email.asp"]
{ border: 5px double red; }

a[href="/pages/contact.asp"],
a[href="/pages/email.asp"]
{ border-width: 0px; }
</code>

<h3>Rationale</h3>

<p>This will first style the suspected broken links using CSS and then de-style the correct links.</p>

<h3>Other Uses</h3>

<p>This can also be used to style elements that are calling old JavaScript functions:</p>

<code>
&lt;a href="#" onclick="old();"&gt;Old Function&lt;/a&gt;

a[onclick*="old()"]
{ border: 5px dashed red; }
</code>

<p>This will search through the entire onclick attribute using the substring selector for "old()". The reason I used the *= select is because sometimes developers place the function call before or 
after other functions so I need to be a bit less specific.</p>

<h3>Notes</h3>

<p>Like <a href="/tech/thread.asp?pid=3">CSS Diagnostics</a>, you will need to use a standards compliant web browser fully supporting <a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)#Selectors">CSS3 selectors</a>. I've found that Firefox seems to be the best
browser since it comes with many other developer tools as well.</p><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=14">View Comments [0]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Sat, 7 Jun 2008 18:04:25 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=14</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>css3</category><category>css diagnostics</category>
</item>
<item>
<title>Getting Full URL/Path with ASP</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=13</link>
<description>
<![CDATA[
<p>One thing that always bothered me about Classic ASP is that there isn't an easy way to get the entire url. So I devised a function that will get the full path
including the query string. (Note I did not write this taking https into consideration but that could be added on to my code if need be.</p>

<code>
function GetPath()
	query_string = request.ServerVariables("QUERY_STRING")
	if query_string <> "" then
		query_string = "?" & query_string
	end if
	
	GetPath = "http://" & request.ServerVariables("SERVER_NAME") & request.ServerVariables("URL") & query_string
end function
</code><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=13">View Comments [0]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Sat, 7 Jun 2008 10:01:45 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=13</guid>
<author>Neal Grosskopf</author>
<category>asp</category><category>function</category>
</item>
<item>
<title>Always Show Scrollbars In Firefox Using CSS</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=12</link>
<description>
<![CDATA[
<p>I remember the first time I used Firefox I was extremely annoyed by the fact that the browser does not always show the scrollbars (like Internet Explorer does).
The problem with this is when a page's height is not greater than the available screen height and a users clicks a link to a page that is taller than the available screen height
it shifts the entire content area over to accommodate for the scrollbars (which probably take up 15 pixels or so). This is most likely the standards compliant way to display a page
and IE has been doing it wrong all along, regardless it is annoying seeing the web page jump back and forth in Firefox.</p>

<h4>The Solution:</h4>

<p>Fortunately there is a solution using CSS:</p>

<code>
html { overflow-y: scroll; }
</code>

<h4>The Opposite</h4>

<p>If the meaning of your life depends on not conforming to Microsoft (you're out there) you can also make IE behave like Firefox:</p>

<code>
html { overflow-y: auto; }
</code>

<p>Whatever method you prefer I would recommend placing this in your baseline stylesheet before starting a new web site or project. Your users will thank you.</p>

<h4>Sources:</h4>

<ul>
	<li><a href="http://webdevel.blogspot.com/2007/05/controlling-browser-scrollbars.html">Controlling browser scrollbars </a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=12">View Comments [2]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Wed, 30 Apr 2008 20:06:46 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=12</guid>
<author>Neal Grosskopf</author>
<category>firefox</category><category>css</category><category>css3</category><category>page jump</category>
</item>
<item>
<title>Common JavaScript Functions</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=11</link>
<description>
<![CDATA[
<p>Javascript libraries seem to be all the vogue now days. Unfortunately many of them are becoming bloated with features and are growing larger than
50KB. Some developers may only use 10% of the libraries features too. One of the more common features is the dollar sign function i.e. $('element').
Of course I am a bit biased since I am a hardcore CSS person (thanks <a href="http://pagebuildr.com/jason">Jason</a>) so I shy away from JavaScript as much as possible. Over time I have found 
that JS is necessary and many times the only solution to some problems.</p>

<p>One thing you'll notice with JavaScript programming is the methods and property calls can get quite lengthy. There is a solution to this and that is to create
your own custom functions with shorter function names.</p>

<h4>Short Named JavaScript Functions:</h4>

<code>
function gd(e) { return document.getElementById(e); }
function gs(e) { return document.getElementById(e).style; }
function gv(e) { return document.getElementById(e).value; }
function dw(i) { return document.write(i); }
</code>

<p>Each of these is simply a shorter way of calling the built in JavaScript functions. By using these you can reduce the file size of of you JavaScript and also increase
the legibility. Probably the only con to these functions is there will be a performance decrease since the code will have to do an extra call each time it's used.</p>

<p>If you can think of any other down and dirty JS functions feel free to leave a comment and fill me in.</p>

<h4>Sources:</h4>

<ul>
	<li><a href="http://chrisretlich.com/">All credit goes to Chris Retlich</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=11">View Comments [4]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Tue, 29 Apr 2008 18:58:14 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=11</guid>
<author>Neal Grosskopf</author>
<category>javascript</category>
</item>
<item>
<title>Reverse Array in ASP</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=10</link>
<description>
<![CDATA[
<p>A problem I've ran into numerous times when programming in ASP is that there is no easy way to reverse arrays. With my limited knowledge of other programming languages
I believe ASP is the minority of web languages that can't reverse or sort arrays with built in functions. I had also searched high and low on the web for a home brewed function
to do this but never had any luck.</p>

<p>Then the other day I ran across this nugget of an article.</p>

<h4>Reversing Arrays in ASP:</h4>

<ol>
<li>
Here we define our array. In most cases this is done from a database.
<code>
articlesRev = array( _
"array item 0", _
"array item 1", _
"array item 2", _
"array item 3" _
)
</code>
</li>

<li>
Next we loop through our original array and reverse it.
<code>
Dim articles()
ubnd = UBound(articlesRev)
Redim articles(ubnd)
for i = 0 to ubnd
 articles(ubnd - i) = articlesRev(i)
next
</code>
</li>

<li>
Finally we write out our array, which is reversed now.
<code>
for i=0 to ubound(articles)
 response.Write(articles(i)&"&lt;br&gt;")
next
</code>
</li>
</ol>

<h4>Putting It all together:</h4>

<code>
articlesRev = array( _
"array item 0", _
"array item 1", _
"array item 2", _
"array item 3" _
)

Dim articles()
ubnd = UBound(articlesRev)
Redim articles(ubnd)
for i = 0 to ubnd
 articles(ubnd - i) = articlesRev(i)
next

for i=0 to ubound(articles)
 response.Write(articles(i)&"&lt;br&gt;")
next
</code>

<h4>Sources:</h4>

<ul>
	<li><a href="http://www.cruto.com/blog/?p=4">http://www.cruto.com/blog/?p=4 </a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=10">View Comments [6]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Tue, 15 Apr 2008 19:21:37 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=10</guid>
<author>Neal Grosskopf</author>
<category>asp</category>
</item>
</channel>
</rss>
