<?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>Wed, 4 Jul 2008 13:33:37 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_32.png</url>
<link>http://www.nealgrosskopf.com</link>
</image>
<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 [2]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Sun, 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>
</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 [1]</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 [0]</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 [1]</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 [1]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Mon, 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>Sun, 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 [4]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Sun, 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>
<item>
<title>Embedding Flash Without Click To Activate Using Valid HTML</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=9</link>
<description>
<![CDATA[
<p>I am currently working on a website for a client and one of their requests was that their home page have some animation featuring some of their promotions. Now I know the first thing you are saying is 
"please, God, say it aint so, not FLASH!" Yes I know flash is evil, I absolutely hate it but in this instance it is the best tool for the job.</p>

<p>I won't tell you how annoying the software is to make a flash movie but I will tell you how annoying it is to simply embed a flash file in your web page using valid HTML.</p>

<h4>Here is the jist of what I needed to accomplish:</h4>

<ol>
	<li>Valid HTML</li>	
	<li>A movie that doesn't repeat</li>
	<li>A movie with a clickable link/region</li>
	<li>A movie with a transparent background</li>
	<li>Avoid annoying "Click to activate this control" in Internet Explorer</li>
</ol>

<p>I was able to do these things but never a combination of all of them. I first tried using a javascript library called <a href="http://code.google.com/p/swfobject/">SWF Object</a> since that
is something I've seen on our work websites. SWF Object worked fine although it failed miserably with the transparent background. I tried pretty much everything I could think of to get that to work
even using examples from the documentation but to no avail it sucks.</p>

<p class="i">On a side note, people are seriously over-using these javscript libraries. Within a few years every legitimate web developer will have forgotten getElementById() and will assume that javascript can naturally select individual elements by class name with no problem.
I think libraries are the cheap way out, not to mention how many KB they take up. Check out one of my work <a href="http://www.ipsousa.com/">websites</a>. It has over 12 javascript files, clocking in at over 240KB. Gez.
</p>

<p>After that I tried simply hardcoding the html into the webpage. This worked fine in IE but Firefox and the likes required the noncompliant EMBED tag to make it work. Even worse was I was now
faced with the annoying Click to activate this control problem in Internet Explorer.</p>

<p>After various modifications to my code I ended up just taking the invalid EMBED tag wrapped with an OBJECT tag and through it in an external javascript file using multiple document.writes</p>

<p>Everything worked now, except the code technically wasn't valid HTML even though the W3C validator said so. Then today I read <a href="http://www.alistapart.com/articles/flashembedcagematch">this article</a> on Alistapart and specifically <a href="http://www.alistapart.com/comments/flashembedcagematch?page=3#29">this comment</a>.
After that it all made sense to me. After hours of toiling I had found the solution and everybody was wrong!</p>

<p>This code not only validates but it works. The only drawback here is we still have the annoying click to activate this control problem in Internet Explorer. The trick here was to remove the ClassID attribute since that stopped it from working in Firefox and adding the DATA attribute.</p>

<pre>
&lt;object type=&quot;application/x-shockwave-flash&quot; data=&quot;/yourfile.swf&quot;&gt;
&lt;param name=&quot;movie&quot; value=&quot;/yourfile.swf&quot;&gt;
&lt;param name=&quot;loop&quot; value=&quot;false&quot;&gt;
&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;
&lt;/object&gt;
</pre>

<h4>Embeding Flash Without Click To Active And Using Valid HTML</h4>

<p>Simply place this script in an external .JS file and call it using the bottom function. Viola, no more click to activate, transparent background, doesn't repeat, and work fine in all browsers without the stupid EMBED tag and without annoying
conditional comments for IE.</p>

<pre>
&lt;script type=&quot;text/javascript&quot;&gt;
function writeFlash(file)
{
document.write('&lt;object type=&quot;application/x-shockwave-flash&quot; data=&quot;'+file+'&quot;&gt;')
document.write('&lt;param name=&quot;movie&quot; value=&quot;'+file+'&quot;&gt;')
document.write('&lt;param name=&quot;loop&quot; value=&quot;false&quot;&gt;')
document.write('&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;')
document.write('&lt;/object&gt;')
}
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
writeFlash(&quot;/yourfile.swf&quot;);
&lt;/script&gt;
</pre>

<h4>G00gle B0mb Attempts</h4>
<ul>
	<li><a href="http://www.alistapart.com/comments/flashembedcagematch?page=3#29">The answer</a></li>
	<li><a href="http://code.google.com/p/swfobject/">Doesn't completely work</a></li>
	<li><a href="http://www.alistapart.com/articles/flashembedcagematch">Not the right answer</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=9">View Comments [2]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Sat, 7 Apr 2008 18:24:0 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=9</guid>
<author>Neal Grosskopf</author>
<category>validation</category><category>flash</category><category>html</category>
</item>
<item>
<title>Using Media Targeting With CSS With @Media</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=8</link>
<description>
<![CDATA[
<p>Recently I've been crafting my stylesheets a bit different than I had in the past. I discovered that using a stylesheet link with the media type of all (see below) you can embed other media types within your &quot;all&quot; stylesheet. Note many people are unsure of what to name their stylesheets and I choose to name it after the media type it is targeting or whether it is targeting Internet Explorer (ie6.css &amp; ie7.css etc)</p>

<code>
&lt;link rel="stylesheet" type="text/css" href="/all.css" media="all"&gt;
</code>

<p>The advantages of doing this over the old fashioned way of creating seperate link references for each of the media types is that you can cut down on requests to your web server. If you have a highly visited website this can make a difference. After you have created your all.css file. The next step is to simply create all the typical things you would for the CSS screen media type. Then below that, place this code. You can replace the .class reference with your own personal CSS. For testing the handheld media type download the Opera web browser since it comes with handheld rendering built into it. </p>

<h4>Targeting Specific Media Types With CSS:</h4>

<code>
@media print {

	.class
	{
	}

}

@media handheld {

	.class
	{
	}

}

@media aural {

	.class
	{
	}

}
</code>

<h4>Notes:</h4>

<p>This works on all modern browsers including IE 6 so feel free to integrate it into your site. </p><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=8">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, 25 Mar 2008 21:15:25 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=8</guid>
<author>Neal Grosskopf</author>
<category>css</category>
</item>
<item>
<title>Checking Plurals With ASP - A Simple Check Plural Function</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=7</link>
<description>
<![CDATA[
<p>I notice that a lot of database driven websites make easy mistakes by not checking for plural words. An example might be "2 vote" or "1 votes". Here is an example of a function
using ASP to check for plurals.</p>

<code>
function CheckPlural(input)
	if input <> 1 then
		CheckPlural = "s"
	else
		CheckPlural = ""
	end if
end function
</code>

<p>This function can be called like so:</p>

<code>
25 Vote&lt;%=CheckPlural(25)%&gt;
</code><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=7">View Comments [2]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Sat, 21 Mar 2008 14:34:46 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=7</guid>
<author>Neal Grosskopf</author>
<category>asp</category><category>function</category>
</item>
<item>
<title>Get File Size And Type Using ASP</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=6</link>
<description>
<![CDATA[
<p>Often times it is nice to add some text after a link on your website to let your users
know whether the link goes to a PDF and how large that PDF file is. I've found that manually doing this works but after awhile when that PDF file get updated, the file size next to it is incorrect. It is even possible that the link is no longer a PDF but somebody forgot update the text. </p>

<p>An easy solution to these problems is to create a function within ASP that spits out the file type and the file size after the link to let your users know using asp how large a file is and what the file type is. </p>

<h4>How To Get File Size and Type Using ASP</h4>

<code>
function GetFileSizeType(WhatFile)

	set fs=Server.CreateObject("Scripting.FileSystemObject")
	file = Server.MapPath(WhatFile) 
	set f = fs.GetFile(file)
	intSizeK = Int((f.Size/1024) + .5)
	if intSizeK = 0 then intSizeK = 1
	
	GetFileSizeType = "("&amp;UCase(fs.GetExtensionName(file))&amp;", "&amp;intSizeK&amp;"K)"
	
	set f=nothing
	set fs=nothing

end function
</code>

<p>To call this function simply do this:</p>

<code>
GetFileSizeType("/files/pdfs/myfile.pdf")
</code><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=6">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, 16 Mar 2008 19:02:31 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=6</guid>
<author>Neal Grosskopf</author>
<category>asp</category>
</item>
<item>
<title>Change Text Selection Color Using CSS</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=5</link>
<description>
<![CDATA[
<p>With the advent of CSS3 there are many new ways to style web pages. One of the new features in CSS3 is the ability to change the highlighting color on web pages using CSS. It seems that many websites ignore this simple to implement feature. By default the color will be inherited by your operating system colors. On Windows Vista the hex. color is #3399ff.</p>
<h4>Here's How To Change The Text Selection Color:</h4>
<code>
::selection { background: red; color: white; }
::-moz-selection { background: red; color: white; }
</code>
<h4>Notes:</h4>
<p>This is currently supported by Firefox and Safari. I would suspect that Opera also supports it. Unfortunately Internet Explorer
does not support it, but with IE8 coming out soon supporting CSS better, it may work in there as well.</p>
<h4>Sources</h4>
<ul>
	<li><a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28CSS%29#Selectors">Comparison of layout engines (CSS)</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=5">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, 9 Mar 2008 18:32:41 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=5</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>css3</category>
</item>
<item>
<title>Advanced Link Styling With CSS - Style External &amp; PDF Links</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=4</link>
<description>
<![CDATA[
<p>A problem many web designers run into is as their site grows beyond the 50 page mark, it becomes very difficult to introduce new site wide styles. As most of us know it is best to spend as much time planning your site as it is designing and developing it. A step that many designers miss during the planning stage is the styling of specific links. </p>

<h4>The Forgotten Links:</h4>

<ul>
	<li>External links</li>
	<li>PDF links</li>
	<li>Email links (mailto)</li>
    <li>Anchored links</li>
    <li>Popup links (target=&quot;_blank&quot; </li>
    <li>etc. </li>
</ul>

<p>By adding specific styles to these types of links you can add a second layer of usability to your website. When a user sees a PDF icon next to a link they will automatically know that what they are about to click is a PDF. The same can be said for external website links and email links. Many novice CSS designers will solve this problem using classes, i.e &lt;a href=&quot;http://...&quot; class=&quot;external&quot;&gt;My Link&lt;/a&gt;. While this would work early on in site development many of us in the real world inherited a really poorly developed site and need to use other methods to style links site wide. </p>


<h4>Styling External Links With CSS: </h4>

<p>By using CSS3 selectors we can select all &lt;a&gt; tags that <b title="Use the CSS ^ symbol">begin</b> with &quot;http&quot; giving them a background image and padding right to accommodate that image: </p>

<code>
a[href^="http"] {
padding-right: 15px;
background: url(external-image.png) no-repeat center right;
}
</code>


<h4>Styling Email Links With CSS: </h4>

<p>The same can be done with email links. Here we style all &lt;a&gt; tags that <b title="Use the CSS ^ symbol">begin</b> with &quot;mailto:&quot; and apply our email background image. </p>

<code>
a[href^="mailto:"] {
padding-right: 15px;
background: url(email.png) no-repeat center right;
}
</code>


<h4>Styling PDF Links With CSS: </h4>

<p>Finally PDF links can be styled by styling all &lt;a&gt; tags that <b title="Use the CSS $ symbol">end</b> with &quot;.pdf&quot; and apply a pdf icon to them. </p>

<code>
a[href$=".pdf"] {
padding-right: 15px;
background: url(pdf.png) no-repeat center right;
}
</code>


<h4>Putting it all together:</h4>

<code>
a[href^="http"] {
padding-right: 15px;
background: url(external-image.png) no-repeat center right;
}

a[href^="mailto:"] {
padding-right: 15px;
background: url(email.png) no-repeat center right;
}

a[href$=".pdf"] {
padding-right: 15px;
background: url(pdf.png) no-repeat center right;
}
</code>


<h4>Notes:</h4>

<p>This will not work in IE6 but because IE6 does not support the CSS3 selectors. It will show the links as normal without the background image and without the padding. This works out perfectly as users with more modern browsers such as IE7 and Firefox will reap the rewards of your ingenious CSS coding.</p>

<h4>Sources:</h4>

<ul>
	<li><a href="http://en.wikipedia.org/skins-1.5/monobook/main.css">Wikipedia's Style Sheet</a></li>
	<li><a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)#Selectors">Comparison of layout engines (CSS)</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=4">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, 4 Mar 2008 18:19:50 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=4</guid>
<author>Neal Grosskopf</author>
<category>css</category>
</item>
<item>
<title>CSS Diagnostics - Find Deprecated Elements Using CSS</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=3</link>
<description>
<![CDATA[
<h4 class="highlight">UPDATED: April 25th</h4>

<p>I've been getting so many hits on this article that I decided to update it. I have added a few more elements and attributes and changed the colors around. 
The most severe code is colored red while less severe is colored yellow.  There is also a medium severarity that is colored orange. Also remember that elements have solid borders while
attributes have dotted boreders. Also check out my <a href="/tech/resources/3/test_suite.html">Test Suite showing examples of CSS Diagnostics in action</a>.</p>

<p>The other day I was reading <a href="http://meyerweb.com">Eric Meyer's blog</a> and stumbled across his version of what he likes to call
CSS diagnostics. So what is CSS diagnostics?
It's a method to highlight those ugly spots in your code, you know &lt;font color="red" size="+1"&gt;. Yeah
under the hood, somewhere on your website garbage like that exists, yet it's always so hard to hunt down and fix.
Never fear CSS diagnostics is here!</p>

<p>CSS Diagnostics allows users to find deprecated elements using CSS and also find find deprecated attributes using CSS. 
<span class="i">Sorry to have to repeat myself so much here, I'm trying to rank high in SEO with some of these terms 
since this is still very much uncharted territory.</span></p>

<p>So how do you use CSS Diagnostics? It's easy! It requires a pretty good knowledge of CSS 2 & CSS 3 selectors and a
good knowledge of deprecated HTML elements and attributes.</p>

<h4>Follow these steps:</h4>

<ol>

<li>
<h4>Highlight Deprecated Elements</h4>
<code>
applet, basefont, center, dir, font, isindex, menu, s, strike, u, marquee, blink, acronym /* html 5, use abbr */
{ border: 5px solid red !important; }
</code>
</li>

<li>
<h4>Highlight Deprecated Attributes</h4>
<code>
br[clear], hr[noshade], *[color],
*[bordercolorlight], *[bordercolordark], *[bordercolor], *[background], *[bgcolor], *[nowrap],
body[alink], body[link], body[text], body[vlink],
body[bottommargin], body[leftmargin], body[rightmargin], body[topmargin], body[marginheight], body[marginwidth], 
ol[compact], ul[compact], *[start],
img[hspace], img[vspace]
*[align], *[valign],
*[height], *[width],
ul[type], ol[type], li[type],
basefont[size], font[size], hr[size]
{ border: 5px dotted red !important; }
</code>
</li>

<li>
<h4>Highlight Proposed Deprecated Elements</h4>
<code>
input[type="button"], input[type="reset"], input[type="submit"],
tt, embed,
big, small
{ border: 5px solid orange !important; }
</code>
</li>

<li>
<h4>Highlight Proposed Deprecated Attributes</h4>
<code>
a[target], table[cellpadding], table[cellspacing],
map[name], img[name], object[name], form[name], iframe[name], a[name],
table[border], img[border], object[border], input[border],
object[classid], object[codebase], embed[quality], embed[pluginspage]
{ border: 5px dotted orange !important; }
</code>
</li>

<li>
<h4>Highlight Specific Empty Elements:</h4>
<code>
div:empty, span:empty, li:empty, p:empty, td:empty, th:empty 
{ padding: 20px; border: 5px solid yellow !important; }
</code>
</li>

<li>
<h4>Highlight Specific Empty Attributes</h4>
<code>
*[alt=""], *[title=""], *[class=""], *[id=""], a[href=""], a[href="#"] 
{ border: 5px dotted yellow !important; }
</code>
</li>

</ol>


<h4>Putting it all together:</h4>

<p>Place this code at the end of your stylesheet:</p>

<code>
/* Deprecated Elements */
applet, basefont, center, dir, font, isindex, menu, s, strike, u, marquee, blink, acronym /* html 5, use abbr */
{ border: 5px solid red !important; }

/* Deprecated Attributes */
br[clear], hr[noshade], *[color],
*[bordercolorlight], *[bordercolordark], *[bordercolor], *[background], *[bgcolor], *[nowrap],
body[alink], body[link], body[text], body[vlink],
body[bottommargin], body[leftmargin], body[rightmargin], body[topmargin], body[marginheight], body[marginwidth], 
ol[compact], ul[compact], *[start],
img[hspace], img[vspace]
*[align], *[valign],
*[height], *[width],
ul[type], ol[type], li[type],
basefont[size], font[size], hr[size]
{ border: 5px dotted red !important; }

/* Proposed Deprecated Elements */
input[type="button"], input[type="reset"], input[type="submit"],
tt, embed,
big, small
{ border: 5px solid orange !important; }

/* Proposed Deprecated Attributes */
a[target], table[cellpadding], table[cellspacing],
map[name], img[name], object[name], form[name], iframe[name], a[name],
table[border], img[border], object[border], input[border],
object[classid], object[codebase], embed[quality], embed[pluginspage]
{ border: 5px dotted orange !important; }

/* Empty Elements */
div:empty, span:empty, li:empty, p:empty, td:empty, th:empty 
{ padding: 20px; border: 5px solid yellow !important; }

/* Empty Attributes */
*[alt=""], *[title=""], *[class=""], *[id=""], a[href=""], a[href="#"] 
{ border: 5px dotted yellow !important; }
</code>

<p class="b"><a href="/tech/resources/3/css-diagnostics.css">Download The Full Stylesheet</a></p>

<h4>Notes:</h4>

<p>It's a good idea to create consistency with your rules. I chose to highlight all attributes in a solid border while
highlighting all elements in a dotted border. Also choose different colors for different meanings.</p>

<p>It should also be pointed out that you should use the most standards complient web browser when checking for results. Currently
I found that Firefox 2 seems to work best as it comes with many other addons that can work side by side with the custom CSS.</p>

<p>I enjoyed reading Eric's ideas on it but felt I could expand it a bit more. Certainly other's can expand on my version as well.
Feel free to <a href="/forms/contact.asp">contact me</a> if you see something I'm missing.</p>

<h4>Sources</h4>

<ul>
	<li><a href="http://meyerweb.com/eric/tools/css/diagnostics/">http://meyerweb.com/eric/tools/css/diagnostics/</a></li>
	<li><a href="http://www.w3.org/TR/html401/index/elements.html">http://www.w3.org/TR/html401/index/elements.html</a></li>
	<li><a href="http://www.w3.org/TR/2005/WD-xhtml2-20050527/elements.html">http://www.w3.org/TR/2005/WD-xhtml2-20050527/elements.html</a></li>
	<li><a href="http://www.w3.org/TR/2005/WD-xhtml2-20050527/attributes.html">http://www.w3.org/TR/2005/WD-xhtml2-20050527/attributes.html</a></li>
	<li><a href="http://www.w3.org/TR/2008/WD-html5-diff-20080122/">http://www.w3.org/TR/2008/WD-html5-diff-20080122/</a></li>
	<li><a href="http://www.html-reference.com/depreciated.htm">http://www.html-reference.com/depreciated.htm</a></li>
	<li><a href="http://www.codehelp.co.uk/html/deprecated.html">http://www.codehelp.co.uk/html/deprecated.html</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=3">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 Feb 2008 21:51:35 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=3</guid>
<author>Neal Grosskopf</author>
<category>html</category><category>validation</category><category>css</category><category>css diagnostics</category>
</item>
<item>
<title>How To Use target="_blank" Correctly In XHTML &amp; HTML Strict</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=2</link>
<description>
<![CDATA[
<p>Occasionally web developers like their links to pop-up in a new window. Often times this is because they are
linking to a non-web file type or are linking to an external web site.</p>

<p>The easiest way to accomplish this is to place the target="_blank" attribute on an anchor. Unfortunately if you validate
your code with the W3C you will find that it is not valid to use that practice. Do not fear, there is a solution!</p>

<p>The workaround err, solution, is to place an onclick on the anchor tag. The code below will open a new window, get the value in 
the href attribute and cancel the action the href attribute would take.</p>

<code>
&lt;a href="http://www.nealgrosskopf.com" onclick="window.open(this.href);return false;"&gt;Link&lt;/a&gt;
</code><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=2">View Comments [3]</a><img src='http://www.nealgrosskopf.com/files/xml/beacon/image.asp?e=tech' height='1' width='1' /></p>]]>
</description>
<pubDate>Sat, 28 Jan 2008 19:56:1 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=2</guid>
<author>Neal Grosskopf</author>
<category>validation</category><category>javascript</category><category>html</category>
</item>
<item>
<title>How To Serve XHTML to Internet Explorer 6 And 7 as XML Using Content Negotiation</title>
<link>http://www.nealgrosskopf.com/tech/thread.asp?pid=1</link>
<description>
<![CDATA[
<p>It seems that XHTML is all the craze now days. Unfortunately very few developers and designers are using it correctly
and taking full advantage of it. So why is this?</p>

<p>XHTML can be served as text or XML. It seems that 90% of sites using XHTML are serving it as XML but are failing to serve it
correctly to Internet Explorer as XML. Never fear, there is a solution.</p>

<p>So why bother serving it as XML to Internet Explorer? If you do it will mean that your html code will appear as XML and will have
to adhere to XML standards. This means that you can be sure the code you are using is extremely compliant. It will also mean
that if your page is not valid, <a href="http://en.wikipedia.org/wiki/Screens_of_death#Mozilla">it will not display without error</a>. 
It's an annoying but great way to keep your code clean</p>

<h4>Follow these steps:</h4>

<ol>

<li>
  <h4>Serve your page as application/xml to Internet Explorer and as application/xhtml+xml to every other browser:</h4>
  <code>
If InStr(Request.ServerVariables("HTTP_ACCEPT"), "application/xhtml+xml") > 0 Then
	Response.ContentType = "application/xhtml+xml"
Else
	Response.ContentType = "application/xml"
End If
</code>
</li>

<li><h4>Use a special .xsl file at the top of your page above your doctype:</h4>
<code>
&lt;?xml-stylesheet type="text/xsl" href="xhtml.xsl"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
</code>

<h4>Contents of xhtml.xsl file:</h4>
<code>
&lt;stylesheet version="1.0"
     xmlns="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;template match="/"&gt;
        &lt;copy-of select="."/&gt;
    &lt;/template&gt;
&lt;/stylesheet&gt;
</code>
</li>

<li><h4>Add html element to page:</h4>
<code>
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
</code>
</li>

</ol>

<h4>Putting it all together:</h4>

<code>
&lt;%
If InStr(Request.ServerVariables("HTTP_ACCEPT"), "application/xhtml+xml") &gt; 0 Then
    Response.ContentType = "application/xhtml+xml"
Else
    Response.ContentType = "application/xml"
End If
Response.Charset = "utf-8"
%&gt;
&lt;?xml-stylesheet type="text/xsl" href="xhtml.xsl"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
&lt;head&gt;
&lt;title&gt;XHTML&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;/body&gt;
&lt;/html&gt;
</code>

<h4>Sources</h4>

<ul>
	<li><a href="http://www.perlmonks.org/?node_id=639170">OT: How do you serve up XHTML?</a></li>
	<li><a href="http://www.w3.org/TR/2007/WD-xhtml11-20070216/conformance.html#docconf">XHTML 1.1 Conformance Definition</a></li>
	<li><a href="http://juicystudio.com/article/content-negotiation.php#asp">MIME Types and Content Negotiation</a></li>
	<li><a href="http://blogs.msdn.com/ie/archive/2005/09/15/467901.aspx">The &lt;?xml&gt; prolog, strict mode, and XHTML in IE</a></li>
	<li><a href="http://www.w3.org/People/mimasa/test/xhtml/media-types/MSIE7.0Beta2">XHTML media type test - results: Microsoft Internet Explorer 7.0 Beta2</a></li>
	<li><a href="http://www.w3.org/People/mimasa/test/xhtml/media-types/results">XHTML media type test - results</a></li>
	<li><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2058872&amp;SiteID=1">Cannot have a DOCTYPE declaration outside of a prolog. Error processing resource</a></li>
	<li><a href="http://www.w3.org/MarkUp/2004/xhtml-faq#ie">Does Microsoft Internet Explorer accept the media type application/xhtml+xml?</a></li>
	<li><a href="http://ptaff.ca/xhtml/?lang=en_CA">XHTML: How to succeed</a></li>
	<li><a href="http://www.evotech.net/blog/2007/07/xhtml-deprecated-elements-and-attributes/">XHTML Deprecated Elements and Attributes</a></li>
</ul><p><a href="http://www.nealgrosskopf.com/tech/thread.asp?pid=1">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, 24 Jan 2008 21:02:24 CST</pubDate>
<guid>http://www.nealgrosskopf.com/tech/thread.asp?pid=1</guid>
<author>Neal Grosskopf</author>
<category>internet explorer</category><category>xhtml</category><category>xml</category><category>xsl</category>
</item>
</channel>
</rss>
