<?xml version="1.0" encoding="ISO-8859-1"?>
<rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" 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>Sat, 20 Mar 2010 12:22:34 -0500</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>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ng-tech" /><feedburner:info uri="ng-tech" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
<title>Google vs. China: How It Will Affect Web Workers</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/Kd46f0PQqFM/thread.php</link>
<description>&lt;p&gt;&lt;i&gt;First let me start with this won't be my typical "how-to-like" article which I typically write on my website. I haven't posted many of those over the past month mostly because I was in the
process of moving but I'm settled in again.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;I've been following the &lt;a href="http://arstechnica.com/tech-policy/news/2010/03/china-warns-google-partners-as-censored-results-leak-through.ars"&gt;Google vs. China fiasco&lt;/a&gt; online, 
mostly through my RSS feeds, and I've begun to ponder on what a Google-less China would be like. China has 1.3 billion people, or 20% 
of the earth's population, and is poised to &lt;a href="http://arstechnica.com/tech-policy/news/2007/07/china-set-to-overtake-the-us-in-number-of-internet-users.ars"&gt;overtake the US as the 
#1 country in internet users&lt;/a&gt;. While China flat-out blocking Google.cn is a big deal (and I suspect this would include &lt;b&gt;all&lt;/b&gt; of Google search such as Google.com), 
what if China blocked &lt;b&gt;all&lt;/b&gt; of Google's online services?&lt;/p&gt;

&lt;div class="image-caption" style="margin: 20px 0px; width: 560px;"&gt;
	&lt;img src="/tech/resources/68/no-google.png" alt="Google vs. China"&gt;
	&lt;h3&gt;Google vs. China&lt;/h3&gt;
	&lt;p&gt;If China decides to block Google an all its services it could be a headache for web developers.&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;What Makes Google?&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://www.google.com/options/"&gt;To start out with, go and take a look at all the services Google offers &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's say China decides to block everything that is Google i.e. all of &lt;a href="http://www.google.com/options/"&gt;Google's online services&lt;/a&gt;. Think of all the services 
you use that are hosted on Google's servers? Here's a list of just a few things I can think of that would be troublesome to web developers:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://code.google.com/apis/ajaxlibs/"&gt;Google Hosted Javascript Libraries&lt;/a&gt; such as jQuery, MooTools etc.&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.youtube.com"&gt;YouTube videos&lt;/a&gt; &amp;amp; specifically all those embedded videos around the internet.&lt;/li&gt;
	&lt;li&gt;Chinese users would no longer be tracked in &lt;a href="http://www.google.com/analytics/"&gt;Google Analytics.&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;You website would lose all the Chinese traffic Google was sending to it via Google search.&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://feedburner.google.com/"&gt;Feedburner&lt;/a&gt; would no longer work in China. You would lose any Chinese RSS feed subscribers.&lt;/li&gt;
	&lt;li&gt;Embedded &lt;a href="http://maps.google.com/"&gt;Google Maps&lt;/a&gt; would stop working.&lt;/li&gt;
	&lt;li&gt;What about all the Gmail users in China?&lt;/li&gt;
	&lt;li&gt;Using the &lt;a href="http://www.google.com/cse/"&gt;Google Site Search feature&lt;/a&gt; on your website? Not in China you aren't.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Other Problems&lt;/h3&gt;

&lt;p&gt;I don't have specific cases for these products but I'm curious as to how a 100% Google blockade would affect these Google services since they can be embedded in external websites:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Google Checkout&lt;/li&gt;
	&lt;li&gt;Picasa Embedded Galleries&lt;/li&gt;
	&lt;li&gt;Google Translate Widget&lt;/li&gt;
	&lt;li&gt;Blogger&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;So What?&lt;/h3&gt;

&lt;p&gt;I did a quick search and if China decided to block Google and its services this won't be the 
&lt;a href="http://techcrunch.com/2009/06/24/censorship-20-china-blocks-google-search-apps-gmail-and-more/"&gt;first time&lt;/a&gt; so perhaps this would only be temporary. Another argument might 
be that Google isn't a big player in China like their native Baidu search engine. &lt;a href="http://www.searchenginejournal.com/google-losing-market-share-in-china/3816/"&gt;Statistics would help 
this argument&lt;/a&gt;, but even if Google Search isn't a big player in China, I have a feeling many of their ancillary services &lt;i&gt;are&lt;/i&gt; even if only behind the scenes.&lt;/p&gt;

&lt;h3&gt;Aftermath&lt;/h3&gt;

&lt;p&gt;If China decides to go through with this, I'm predicting that a schism will occur in the internet. There will be the People's Internet of China and the rest of the world's.
If China gets away with this, it will be a lot easier to for them to block other, smaller, websites.&lt;/p&gt;

&lt;h3&gt;Other Takeaways&lt;/h3&gt;

&lt;p&gt;One takeaway I got from this brainstorming exercise was how reliant many of our websites are on third party providers. Its difficult to build a website nowadays without linking to a resource 
from another site. Will that site/service be there 5-10 years from now? What happens when it's discontinued? Maybe its web developer job security and I should stop complaining?&lt;/p&gt;

&lt;p&gt;&lt;b&gt;What do you think about it? Speak your mind below -&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=68"&gt;View Comments [0]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/Kd46f0PQqFM" height="1" width="1"/&gt;</description>
<pubDate>Tue, 16 Mar 2010 20:32:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=68</guid>
<author>Neal Grosskopf</author>
<category>google</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=68</feedburner:origLink></item>
<item>
<title>Don't Like The New Facebook Home Page? Fix It With 5 Lines of CSS</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/b6UmUpgY2ls/thread.php</link>
<description>&lt;div style="width: 260px; float: right; margin: 0px 0px 20px 20px;" class="image-caption"&gt;	
	&lt;img src="/tech/resources/67/screenshot.jpg" alt="Screenshot of the New Facebook home page"&gt;
	&lt;h3&gt;New Facebook Home Page&lt;/h3&gt;	
	&lt;p&gt;Above is a screenshot of the new Facebook home page. One change on the new page is showing all types of updates rather than just status updates.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Facebook has once again decided to redesign their home page. These types of changes usually result in millions of users joining groups titled "I hate the new design" or something similar. 
Being a web designer I sympathize with Facebook.&lt;/p&gt;

&lt;p&gt;One thing they changed with the recent redesign was removing the "status updates only" option on their home page. I'm now forced to sift through every group, fan page, image and application post 
my friends have made. Facebook does give me the option to hide specific applications but with 1000's of apps out there, it isn't practical to hide each and every one. &lt;b&gt;Enter Stylish&lt;/b&gt;.&lt;/p&gt;

&lt;h3&gt;Hacking Facebook's CSS&lt;/h3&gt;

&lt;p&gt;Using a &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2108"&gt;Firefox addon called Stylish&lt;/a&gt; I was able to sift through Facebook's HTML &amp;amp; CSS and determine if they did a good job giving their home page elements proper class 
names and IDs. For whatever reason Facebook uses custom HTML attributes. One of these was called &lt;samp&gt;data-ft&lt;/samp&gt;. The first value in that attribute is a number that represents various home page types. The example below uses "46" which is plan ol' 
vanilla status updates:&lt;/p&gt;

&lt;code&gt;
&amp;lt;div class=&amp;quot;GenericStory UIStory clearfix aid_718391393&amp;quot; data-ft=&amp;quot;{&amp;quot;sty&amp;quot;:&amp;quot;46&amp;quot;,&amp;quot;actrs&amp;quot;:&amp;quot;718391393&amp;quot;,&amp;quot;fbid&amp;quot;:&amp;quot;328181226116&amp;quot;,&amp;quot;s_obj&amp;quot;:&amp;quot;11&amp;quot;,&amp;quot;s_edge&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;s_prnt&amp;quot;:&amp;quot;11&amp;quot;}&amp;quot; id=&amp;quot;div_story_1630882208_328181226116&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Show Status Updates Only&lt;/h3&gt;

&lt;p&gt;By adding the code below into Stylish it will hide ALL types of updates on the Facebook home except for regular status updates:&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("facebook.com") {
.GenericStory { display: none !important; }
#pagelet_intentional_stream  div[data-ft*='sty":"46'] { display: block !important; }
}
&lt;/code&gt;

&lt;p&gt;Below is an example of this would be entered into Stylish:&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/67/stylish-screenshot.png" alt="Screenshot of Stylish"&gt;&lt;/p&gt;

&lt;h3&gt;Other Update Types&lt;/h3&gt;

&lt;p&gt;You could also substitute the number &lt;samp&gt;46&lt;/samp&gt; above with one of the below to show only these types of updates by default:&lt;/p&gt;

&lt;table class="data"&gt;
&lt;caption&gt;Attribute Value Table&lt;/caption&gt;
&lt;tr&gt;
	&lt;th&gt;Update Type&lt;/th&gt;
	&lt;th&gt;Number Value&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Fan Page Added&lt;/td&gt;
	&lt;td&gt;161&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Application&lt;/td&gt;
	&lt;td&gt;237&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Friend Added&lt;/td&gt;
	&lt;td&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Group Added&lt;/td&gt;
	&lt;td&gt;21&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Photo Added&lt;/td&gt;
	&lt;td&gt;65&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Photo Album Added&lt;/td&gt;
	&lt;td&gt;247&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Video Added&lt;/td&gt;
	&lt;td&gt;128&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;To Each His Own&lt;/h3&gt;

&lt;p&gt;Some people may love seeing &lt;i&gt;everything&lt;/i&gt; their friends do on Facebook. I'm more interested in what they have to say and the rest just feels like noise. Feel free to take this code and make it your own.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=67"&gt;View Comments [3]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/b6UmUpgY2ls" height="1" width="1"/&gt;</description>
<pubDate>Mon, 08 Feb 2010 22:45:00 -0600</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=67</guid>
<author>Neal Grosskopf</author>
<category>facebook</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=67</feedburner:origLink></item>
<item>
<title>Find Unused CSS Selectors With CSS Usage, A Firebug Extension</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/7jf1zo3nOX8/thread.php</link>
<description>&lt;p&gt;As a website grows so does its stylesheet. The problem is, the opposite is not true. As a pages get removed, seldom do the selectors in the 
external stylesheet. This becomes even worse with multiple employees, especially if people come and go. Enter &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/10704"&gt;CSS Usage&lt;/a&gt;.&lt;/p&gt;

&lt;div style="margin: 20px 0px; width: 560px;" class="image-caption"&gt;
	&lt;img src="http://www.nealgrosskopf.com/tech/resources/65/main.png" alt="Example of CSS Usage"&gt;&lt;/a&gt;
	&lt;h3&gt;CSS Usage&lt;/h3&gt;
	&lt;p&gt;Above is an example screenshot showing selectors in green that were found and selectors in red that were not. As a website is browsed, the tool will continue to re-analyze 
	the stylesheet.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;I found this Firebug extension a couple weeks ago and thought it was worth talking about. CSS Usage shows up as a tab within Firebug so if you don't have that 
extension yet, head over to Mozilla's addon site and download it - &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;https://addons.mozilla.org/en-US/firefox/addon/1843&lt;/a&gt;&lt;/p&gt;

&lt;img src="http://www.nealgrosskopf.com/tech/resources/65/toolbar.png" alt="CSS Usage tab within Firebug"&gt;

&lt;p&gt;The jist of CSS Usage is to scan your stylesheet selectors and HTML to determine if each selector is used. Used selectors are colored in &lt;span style="color: #00CC00;"&gt;green&lt;/span&gt;
 while unused selectors are colored in &lt;span style="color: red;"&gt;red&lt;/span&gt;. Selectors previously found on other pages are colored in &lt;span style="color: #336600"&gt;dark green&lt;/span&gt;&lt;/p&gt;
 
&lt;p&gt;By default it will only analyze a page if you hit 'scan' but I like to turn on the auto-scan feature and just browse around my site for about 20 pages to give it a good mix of selectors. 
After that I had only a handful of selectors that were left unused. I took those selectors and did a site wide search to try to identify if they were used.&lt;/p&gt;

&lt;h3&gt;Cons&lt;/h3&gt;

&lt;p&gt;There are a few drawbacks with the addon. Currently it will only scan pages you visit. It does not have the ability to scan your entire site. Sites with 100's of pages may be difficult 
to scan with this tool. I also found the line numbering to be a bit flaky (as seen in my screenshot above).&lt;/p&gt;

&lt;h3&gt;Pros&lt;/h3&gt;

&lt;p&gt;Some great pros of this addon include cleaning up your stylesheets and reducing filesize. You can also save a little bandwidth by making them smaller in size.&lt;/p&gt;

&lt;h3&gt;Download&lt;/h3&gt;

&lt;p&gt;Head over to the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/10704"&gt;CSS Usage&lt;/a&gt; page on Mozilla's addon site and give it a try.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=66"&gt;View Comments [10]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/7jf1zo3nOX8" height="1" width="1"/&gt;</description>
<pubDate>Wed, 27 Jan 2010 22:05:00 -0600</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=66</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>firefox</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=66</feedburner:origLink></item>
<item>
<title>A List of New CSS Features In Firefox 3.6, Set to be Released Tomorrow</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/PU7KnYCieD0/thread.php</link>
<description>&lt;div style="margin: 0px 0px 20px 20px; width: 235px; float: right;" class="image-caption"&gt;	
	&lt;img alt="Firefox 3.6" src="/tech/resources/52/firefox.jpg"&gt;	
	&lt;h3&gt;Firefox 3.6&lt;/h3&gt;	
	&lt;p&gt;Firefox 3.6 looks to have plenty of new features for web developers to play with.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Firefox 3.6 is set to be released January 21st and is packing several new and exciting properties in it. Perhaps we can rename Firefox 3.6 to Firefox: Background Edition since the majority of those properties are background related.&lt;/p&gt;

&lt;h3&gt;CSS Background Gradients&lt;/h3&gt;

&lt;p&gt;Backgrounds gradients are something &lt;a href="http://www.webstandards.org/2008/01/18/tell-the-css-wg-what-you-want-from-css3/#comment-59477"&gt;I've been requesting for a long time now&lt;/a&gt;. 
It looks like the browser vendors finally listened! To use CSS gradients you'll need to use them within the context of a &lt;samp&gt;background-image&lt;/samp&gt;.&lt;/p&gt;

&lt;p&gt;This example will create a horizontal white to black gradient.&lt;/p&gt;

&lt;code&gt;
html
{
background-image: -moz-linear-gradient(left, #fff, #000);  
}
&lt;/code&gt;

&lt;h3&gt;Advanced Gradients&lt;/h3&gt;

&lt;p&gt;Firefox also supports more advanced gradients such as &lt;a href="https://developer.mozilla.org/en/CSS/-moz-radial-gradient"&gt;radial (circle) gradients&lt;/a&gt; 
and linear gradients at an &lt;a href="https://developer.mozilla.org/en/CSS/-moz-linear-gradient"&gt;angle (i.e. diagonal gradients)&lt;/a&gt; much like one would create in Photoshop or Fireworks. 
It will also support &lt;a href="https://developer.mozilla.org/en/CSS/-moz-linear-gradient#Example.3a.c2.a0Multiple_color_stops"&gt;color stops&lt;/a&gt; which are midpoints in your gradient.&lt;/p&gt;

&lt;p&gt;Each of these topics are worthy of their own full length tutorial so I'm not going to dig too deep into them right now. Just be aware that they are now supported by Gecko (Firefox) and Webkit (Safari, and later Google Chrome) based browsers.&lt;/p&gt;

&lt;p&gt;To learn more about CSS gradients check out the &lt;a href="https://developer.mozilla.org/en/Using_gradients"&gt;Mozilla Developer Center page on CSS Gradients&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Multiple Backgrounds in CSS&lt;/h3&gt;

&lt;p&gt;Multiple backgrounds are what we've all been waiting for. Gone are the days of nesting &lt;samp&gt;DIV&lt;/samp&gt;s like this:&lt;/p&gt;

&lt;code&gt;
&amp;lt;div id=&amp;quot;top-bg&amp;quot;&amp;gt;
	&amp;lt;div id=&amp;quot;bottom-bg&amp;quot;&amp;gt;
		&amp;lt;div id=&amp;quot;inner-bg&amp;quot;&amp;gt;
		Content
		&amp;lt;/div&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;

&lt;p&gt;We can now use a single element if our page requires multiple backgrounds using the code below:&lt;/p&gt;

&lt;code&gt;
html
{ 
background-image: url(image1.png), url(image2.png), url(image3.png);
background-repeat: no-repeat, no-repeat, repeat;  
background-position: right top, left bottom, top;  
}  
&lt;/code&gt;

&lt;p&gt;To learn more about multiple backgrounds check out the &lt;a href="http://www.w3.org/TR/css3-background/#layering"&gt;CSS Spec on Multiple Backgrounds&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;CSS Background Scaling&lt;/h3&gt;

&lt;p&gt;Another background related addition to Firefox 3.6 is the &lt;samp&gt;-moz-background-size&lt;/samp&gt; property. This allows us to resize background images, that are perhaps too big or too small for the element they are in.&lt;/p&gt;

&lt;p&gt;If the our image &lt;samp&gt;image.png&lt;/samp&gt; default size is 150px x 75px this would scale the image up larger:&lt;/p&gt;

&lt;code&gt;
div
{
background: url(image.png) no-repeat left top;
-moz-background-size: 300px;
}
&lt;/code&gt;

&lt;h3&gt;Try It Yourself&lt;/h3&gt;

&lt;p&gt;Head over to &lt;b&gt;&lt;a href="http://www.mozilla.com/firefox/"&gt;http://www.mozilla.com/firefox/&lt;/a&gt;&lt;/b&gt; and grab a copy for yourself.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=65"&gt;View Comments [10]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/PU7KnYCieD0" height="1" width="1"/&gt;</description>
<pubDate>Wed, 20 Jan 2010 18:15:00 -0600</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=65</guid>
<author>Neal Grosskopf</author>
<category>firefox</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=65</feedburner:origLink></item>
<item>
<title>Create An Icon Bouncing Effect With jQuery &amp; CSS</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/KHz7EyYSfmA/thread.php</link>
<description>&lt;p&gt;Adding animations to a webpage can give it a polished appearance to visitors. One effect that can be added, is a bouncing effect on icons or graphics. In many ways 
this is much like the 'dock' in Mac OSX. Here's a &lt;a href="http://www.quantumlaundry.com/"&gt;few examples&lt;/a&gt; of &lt;a href="http://speedqueen.com/home/products/inner-strength/"&gt;the effect&lt;/a&gt; that I've done in the past.&lt;/p&gt;

&lt;div class="image-caption" style="margin: 20px 0px; width: 558px;"&gt;
	&lt;a href="/tech/resources/64/"&gt;&lt;img src="/tech/resources/64/visual.jpg" alt="visual example"&gt; &lt;/a&gt;
	&lt;h3&gt;Icon Bouncing&lt;/h3&gt;
	&lt;p&gt;Above is a visual of what happens when an icon is hovered over. Notice how the Opera logo is slightly higher than the other icons? &lt;a href="/tech/resources/64/"&gt;Click to see a live demo of this effect &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;HTML Structure&lt;/h3&gt;

&lt;p&gt;Here's the barebones HTML structure:&lt;/p&gt;

&lt;code&gt;
&amp;lt;ul id=&amp;quot;icons&amp;quot;&amp;gt;
	&amp;lt;li&amp;gt;&amp;lt;img src=&amp;quot;image.jpg&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;
	....
&amp;lt;/ul&amp;gt;
&lt;/code&gt;

&lt;h3&gt;CSS Code&lt;/h3&gt;

&lt;p&gt;The &lt;samp&gt;UL&lt;/samp&gt; gets collapsed by floating the &lt;samp&gt;LI&lt;/samp&gt;'s left. One thing I'd recommend is giving the &lt;samp&gt;LI&lt;/samp&gt;'s a fixed height. Otherwise 
the list will be growing taller and shorter as users hover over it causing content on the rest of the page to shift around. Also the &lt;samp&gt;padding-top&lt;/samp&gt; should equal the same amount of pixels as the 
&lt;samp&gt;margin-top&lt;/samp&gt; in the jQuery code.&lt;/p&gt;

&lt;code&gt;
#icons
{
list-style-type: none;
margin: 0px;
padding: 0px;
overflow: auto;
}

#icons li
{
float: left;
height: 100px;
padding: 10px 0px 0px 0px;
}

#icons li img
{
display: block;
border: 0px;
}
&lt;/code&gt;

&lt;h3&gt;jQuery Code&lt;/h3&gt;

&lt;p&gt;This is actually quite simple. I used a custom animation since &lt;a href="http://docs.jquery.com/Effects"&gt;jQuery's built in effects&lt;/a&gt; cannot accomplish this. In my example below, I changed the 
&lt;samp&gt;marginTop&lt;/samp&gt; &amp;amp; &lt;samp&gt;opacity&lt;/samp&gt; properties on hover. Also, I added &lt;samp&gt;.stop()&lt;/samp&gt; so that if a user hovers over the elements quickly it won't be lagging behind on the animations.&lt;/p&gt;

&lt;code&gt;
$(document).ready(function(){
	$("#icons img").hover(function(){
		$(this).stop().animate({opacity: 0.75, marginTop: -10}, 400);
	},function(){
		$(this).stop().animate({opacity: 1.0, marginTop: 0}, 400);
	});
});
&lt;/code&gt;

&lt;h3&gt;CSS Transitions&lt;/h3&gt;

&lt;p&gt;This same effect can be accomplished using CSS Transitions in browsers that support it:&lt;/p&gt;
 
&lt;code&gt;
#icons li img
{
-webkit-transition-property: margin-top, opacity;
-webkit-transition-duration: .4s, .4s;
}

#icons li img:hover
{
margin-top: -10px;
opacity: .75;
}
&lt;/code&gt;

&lt;h3&gt;Demo&lt;/h3&gt;

&lt;p&gt;&lt;a href="/tech/resources/64/"&gt;Click to see a live demo of this effect &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=64"&gt;View Comments [0]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/KHz7EyYSfmA" height="1" width="1"/&gt;</description>
<pubDate>Tue, 19 Jan 2010 21:45:00 -0600</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=64</guid>
<author>Neal Grosskopf</author>
<category>jquery</category><category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=64</feedburner:origLink></item>
<item>
<title>A jQuery Tool That Generates External Stylesheets From Your HTML Structure</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/c1b3tm-M9bI/thread.php</link>
<description>&lt;div class="image-caption" style="margin: 20px 0px; width: 560px;"&gt;
	&lt;a href="/tech/resources/63/"&gt;&lt;img src="/tech/resources/63/jquery-dom-tool.png" alt="A jQuery Tool That Generates External Stylesheets From Your HTML Structure"&gt;&lt;/a&gt;
	&lt;h3&gt;HTML to CSS Tool&lt;/h3&gt;
	&lt;p&gt;My HTML to CSS tool will parse through your HTML structure, pull out IDs, classes and any inline CSS and create a basic stylesheet for you. 
	To see this article in action, feel free to skip right to the &lt;b&gt;&lt;a href="/tech/resources/63/"&gt;live demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;I find myself converting Photoshop files to HTML &amp;amp; CSS quite frequently. Whenever I find myself repeating a task I look for ways to make that task more 
efficient and therefore waste less of my time. One way my time is wasted during this process is when I rip out all of my inline CSS into an external stylesheet (or 
most likely an embedded stylesheet in the HTML document temporarily). Usually this involves identifying the IDs and class names of all my HTML elements as well as any inline styles I may have 
applied in the short-term.&lt;/p&gt;

&lt;p&gt;Because of this, I set out to write some javascript that would parse my HTML, look for any elements with and ID or class name. The code also pulls out the inline styles and sorts them by property name. 
Finally, it also builds unordered list's CSS because whenever I have a unordered list within my template, it almost always needs further styling (think, navbar, footer etc.)&lt;/p&gt;

&lt;h3&gt;Import jQuery&lt;/h3&gt;

&lt;p&gt;As with any project, I import Google's hosted jQuery library. This will hopefully be cached in a users browser already:&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;jQuery Pseudo Code&lt;/h3&gt;

&lt;p&gt;Below is a quick overview of the jQuery:&lt;/p&gt;

&lt;code&gt;
//Dim variables
//Check in DOM is ready to be used
//Select elements with an ID or CLASS

	//Select unique CLASSES

	//Create UL-LI placeholder CSS

	//Extract inline style CSS

//Push results to TEXTAREA
&lt;/code&gt;

&lt;h3&gt;Variables&lt;/h3&gt;

&lt;p&gt;Below are globally scoped variables which are outside the &lt;samp&gt;$(document).ready&lt;/samp&gt; function. &lt;samp&gt;output&lt;/samp&gt; is used for the final CSS. &lt;samp&gt;selector&lt;/samp&gt; 
is really just a helper variable which can used to narrow the search for IDs and classes. This means you could look for elements &lt;b&gt;only&lt;/b&gt; within another element i.e 
&lt;samp&gt;#content [id], #content [class]&lt;/samp&gt;. Finally &lt;samp&gt;tclasses&lt;/samp&gt; is used to store the names of classes so there are not duplicate class names in the stylesheet.&lt;/p&gt;

&lt;code&gt;
var output = "";
var selector = "";
var tclasses = new Array();
&lt;/code&gt;

&lt;p&gt;The rest of the code is wrapped within the &lt;samp&gt;$(document).ready&lt;/samp&gt; function below. This basically checks to see if the DOM is loaded. Next it loops through elements that have an ID or class and finally 
sends the output to a textarea.&lt;/p&gt;

&lt;code&gt;
$(document).ready(function(){
	$(selector + " [id]," + selector + "[class]").each(function(i){
	});
	
	//Code here
		
	$(&amp;quot;body&amp;quot;).append(&amp;quot;&amp;lt;textarea id='output'&amp;gt;&amp;quot;+output+&amp;quot;&amp;lt;\/textarea&amp;gt;&amp;quot;);
	$("#output").css({height: 400, width: 800});
});
&lt;/code&gt;

&lt;h3&gt;Weed Out Duplicate Classes&lt;/h3&gt;

&lt;p&gt;Next up, the ID/class names are pulled from the element list being looped through. Class names are then added to a global array. Finally since I find myself styling &lt;samp&gt;UL&lt;/samp&gt; 
and &lt;samp&gt;LI&lt;/samp&gt; elements frequently, I added some code in to create placeholder CSS for these i.e:&lt;/p&gt;

&lt;code&gt;
#parent ul
{
}

#parent li
{
}
&lt;/code&gt;

&lt;p&gt;Here's the code that creates that:&lt;/p&gt;

&lt;code&gt;
	var tmp = "", childOutput = "";
	var tid = $(this).attr("id");
	var tclass = $(this).attr("class");
	var tstyle = $(this).attr("style");

	//Avoids adding duplicate CLASSES to stylesheet
	if(jQuery.inArray(tclass, tclasses) == -1)
	{
		//Adds current CLASS to array
		if(tclass) tclasses.push(tclass);

		//Adds UL and LI placeholder styles if they are children of a CLASS or ID
		$(this).children("ul").each(function() {
			if(tid)
			{
				childOutput = "#" + tid;
			} else {
				childOutput = "." + tclass;
			}
			childOutput = childOutput + " ul\n{\n}\n\n" + childOutput + " li\n{\n}\n\n";
		});
&lt;/code&gt;

&lt;h3&gt;Extracting Inline CSS&lt;/h3&gt;

&lt;p&gt;Next, the inline CSS is extracted from the elements. I'll explain later why this is tricky between different browsers:&lt;/p&gt;

&lt;code&gt;
if(typeof(tstyle) != "undefined")
{
	properties = new Array();
	properties = tstyle.toLowerCase().split(";");

	//Raw input for testing
	//$("#test").html($("textarea").html() + "\n\n" + properties)

	//Loops through style attribute properties and trims them
	for ( var i=0, len=properties.length; i&lt;len; ++i )
	{
		if(properties[i] != "") properties[i] = jQuery.trim(properties[i]);
	}

	//Sorts array and finally merges it into a string with a seperator
	tmp = properties.sort().join(";\n") + ";";

	//First branch is for non-ie browsers, second is for IE			
	if(tmp.substring(0,1) == ";")
	{
		tstyle = tmp.substring(1,tmp.length);
	} else {
		if(tmp != "") tstyle = "\n" + tmp;
	}
} else {
	tstyle = "";
}
&lt;/code&gt;

&lt;h3&gt;Sending the Results to a Textarea&lt;/h3&gt;

&lt;p&gt;Finally the results of the above code is dropped in a &lt;samp&gt;textarea&lt;/samp&gt;:&lt;/p&gt;

&lt;code&gt;
//Creates output depending on if current element is a CLASS or an ID
if(tid)
{
	output = output + "#" + tid + "\n{" + tstyle + "\n}\n\n" + childOutput;
} else {
	output = output + "." + tclass + "\n{" + tstyle + "\n}\n\n" + childOutput;
}
&lt;/code&gt;

&lt;h3&gt;Browser Variances&lt;/h3&gt;

&lt;p&gt;I found the inline CSS returned from Javascript could vary by browser, especially when working with CSS shorthand notation. &lt;b&gt;Internet Explorer&lt;/b&gt; 
prefers to seperate out &lt;samp&gt;border: 1px solid #000;&lt;/samp&gt; to the following:&lt;/p&gt;

&lt;code&gt;
border-bottom: black 1px #000;
border-left: black 1px #000;
border-right: black 1px #000;
border-top: black 1px #000;
&lt;/code&gt;

&lt;p&gt;While &lt;b&gt;Firefox&lt;/b&gt; does the following:&lt;/p&gt;

&lt;code&gt;
border: 1px solid rgb(0, 0, 0);
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;Webkit&lt;/b&gt; based browsers such as Safari &amp;amp; Google Chrome seem to be more web developer friendly by leaving the original CSS intact:&lt;/p&gt;

&lt;code&gt;
border: 1px solid #000;
&lt;/code&gt;

&lt;h3&gt;Other Browser Variances&lt;/h3&gt;

&lt;p&gt;This gets further complicated when using the &lt;samp&gt;background&lt;/samp&gt; property especially in Firefox:&lt;/p&gt;

&lt;code&gt;
-moz-background-clip: border;
-moz-background-inline-policy: continuous;
-moz-background-origin: padding;
background: rgb(221, 221, 221) none repeat scroll 0% 0%;
&lt;/code&gt;

&lt;p&gt;Fortunately, Safari and Google Chrome again, keep the original CSS intact:&lt;/p&gt;

&lt;code&gt;
background-color: #f1f1f1;
&lt;/code&gt;

&lt;p&gt;Because of this, you may consider using my tool in Google Chrome or Safari as they seem to keep the original code the same.&lt;/p&gt;

&lt;p&gt;Check out the &lt;b&gt;&lt;a href="/tech/resources/63/"&gt;final results &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;h3&gt;A Bookmarklet&lt;/h3&gt;

&lt;p&gt;Finally, I created a &lt;a class="b" href='javascript:void(function(){ var s=document.createElement("script"); s.setAttribute("src","http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"); if(typeof jQuery!="undefined") { var msg="This page already using jQuery v" + jQuery.fn.jquery; } else { document.getElementsByTagName("head")[0].appendChild(s); }  alert("Click to proceed"); var output="";var selector="";var tclasses=new Array();$(selector+" [id],"+selector+"[class]").each(function(i){var tmp="",childOutput="";var tid=$(this).attr("id");var tclass=$(this).attr("class");var tstyle=$(this).attr("style");if(jQuery.inArray(tclass,tclasses)==-1){if(tclass)tclasses.push(tclass);$(this).children("ul").each(function(){if(tid){childOutput="#"+tid}else{childOutput="."+tclass}childOutput=childOutput+" ul\n{\n}\n\n"+childOutput+" li\n{\n}\n\n"});if(typeof(tstyle)!="undefined"){properties=new Array();properties=tstyle.toLowerCase().split(";");for(var i=0,len=properties.length;i&lt;len;++i){if(properties[i]!="")properties[i]=jQuery.trim(properties[i])}tmp=properties.sort().join(";\n")+";";if(tmp.substring(0,1)==";"){tstyle=tmp.substring(1,tmp.length)}else{if(tmp!="")tstyle="\n"+tmp}}else{tstyle=""}if(tid){output=output+"#"+tid+"\n{"+tstyle+"\n}\n\n"+childOutput}else{output=output+"."+tclass+"\n{"+tstyle+"\n}\n\n"+childOutput}}});$("body").prepend("&amp;lt;textarea&amp;gt;"+output+"&amp;lt;/textarea&amp;gt;"); $("textarea").css({height: 400, width: 800});  }())'&gt;Bookmarklet&lt;/a&gt; 
that can be used on any webpage or website on the internet. This means you can add this as a bookmark/favorite and run it on any website.&lt;/p&gt;

&lt;h3&gt;Thoughts?&lt;/h3&gt;

&lt;p&gt;So what do you think? Does this look like something that could help you speed up your development time? Leave your thoughts below &amp;gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=63"&gt;View Comments [7]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/c1b3tm-M9bI" height="1" width="1"/&gt;</description>
<pubDate>Sun, 17 Jan 2010 17:30:00 -0600</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=63</guid>
<author>Neal Grosskopf</author>
<category>html</category><category>css</category><category>jquery</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=63</feedburner:origLink></item>
<item>
<title>Creating Facebook Styled Photo Tagging With CSS &amp; jQuery</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/Skw54ScKepg/thread.php</link>
<description>&lt;div class="image-caption" style="margin: 20px 0px; width: 560px;"&gt;
	&lt;a href="/tech/resources/62/"&gt;&lt;img src="/tech/resources/62/example.jpg" alt="View the Facebook-esque Photo Tagging demo"&gt;&lt;/a&gt;
	&lt;h3&gt;Example vs. Facebook&lt;/h3&gt;
	&lt;p&gt;In this article I'll show you how to create a Facebook-like photo tagging feature. If you're like me you're probably more interested in a live example than digging through this 
	entire article so here is a &lt;b&gt;&lt;a href="/tech/resources/62/"&gt;live demo of the above example&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;Importing the jQuery Library&lt;/h3&gt;

&lt;p&gt;As with all my examples using jQuery, I link to Google's hosted version. If a user already has the file in their browser cache, it cuts down on another HTTP request thus 
saving your users time.&lt;/p&gt;

&lt;code&gt;
&amp;lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;


&lt;h3&gt;HTML Setup&lt;/h3&gt;

&lt;p&gt;Below is all the HTML needed for my image tagging example. I dynamically insert much of the other needed HTML via jQuery. Originally I planned to make this a jQuery plugin. This could still easily be accomplished by taking the code within 
&lt;samp&gt;$(document).ready&lt;/samp&gt; &amp;amp; adding it into a standard plugin code block.&lt;/p&gt;

&lt;code&gt;
&amp;lt;img src="image.jpg" style="width: 604px; height: 423px;"&amp;gt;
&lt;/code&gt;


&lt;h3&gt;CSS Setup&lt;/h3&gt;

&lt;p&gt;Unlike many of my other articles, there is a lot more code needed to achieve the desired effect. Because of this I probably won't walk you through line-by-line. Instead 
I'll give a brief description for some of the main elements in the DOM.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;#tag-wrapper&lt;/b&gt; - This is wrapped around the &lt;samp&gt;IMG&lt;/samp&gt; element and is given a relative position. This allows us to position other elements absolute.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;#tag-target&lt;/b&gt; - This is a &lt;samp&gt;DIV&lt;/samp&gt; which boxes in the target which a user has clicked on within the photo.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;#tag-input&lt;/b&gt; - This is a &lt;samp&gt;DIV&lt;/samp&gt; which contains a label, input box &amp;amp; submit/reset buttons. It is attached to the #tag-target &lt;samp&gt;DIV&lt;/samp&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;.hotspot&lt;/b&gt; - Finally after a tag has been assigned, a .hotspot &lt;samp&gt;DIV&lt;/samp&gt; is created and positioned over the desired location on the image.&lt;/p&gt;

&lt;code&gt;
html, body { margin: 0px; padding: 0px; }
body
{
color: #666;
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}

#tag-wrapper
{
border: 1px solid #ccc;
box-shadow: 0px 0px 10px #bbb;
-webkit-box-shadow: 0px 0px 10px #bbb;
-moz-box-shadow: 0px 0px 10px #bbb;
display: block;
padding: 10px;
position: relative;
}

	#tag-target, #tag-wrapper img { cursor: crosshair; }
	
	#tag-wrapper img { position: absolute; }
	
	#tag-target
	{
	display: none;
	border: 4px solid #fff;
	box-shadow: 0px 0px 20px #000;
	-webkit-box-shadow: 0px 0px 20px #000;
	-moz-box-shadow: 0px 0px 20px #000;
	height: 100px;
	width: 100px;
	position: absolute;
	top: 0px;
	left: 0px;
	z-index: 2;
	}
	
	#tag-input
	{
	background: #fff;
	display: none;
	padding: 5px;
	position: absolute;
	top: 0px;
	left: 0px;
	width: 137px;
	z-index: 2;
	}
	
		#tag-input label
		{
		display: block;
		font-weight: bold;
		}
		
		#tag-input input
		{
		border: 1px solid #ccc;
		color: #888;
		display: block;
		margin: 5px 0px;
		outline: 0px;
		padding: 3px;
		width: 124px;
		}
	
	.hotspot
	{
	border-width: 0px;
	box-shadow: 0px 0px 0px #000;
	-webkit-box-shadow: 0px 0px 0px #000;
	-moz-box-shadow: 0px 0px 0px #000;
	height: 100px;
	width: 100px;
	position: absolute;
	}
	
		.hotspot:hover, .hotspothover
		{
		border: 4px solid #fff;
		box-shadow: 0px 0px 20px #000;
		-webkit-box-shadow: 0px 0px 20px #000;
		-moz-box-shadow: 0px 0px 20px #000;
		z-index: 1;
		}
		
		.hotspot span { display: none; }
		.hotspot:hover span, .hotspothover span
		{
		background: #fff;
		display: block;
		font-weight: bold;
		padding: 3px 0px;
		text-align: center;
		}

.remove { color: #748950; cursor: pointer; text-decoration: underline; }
&lt;/code&gt;


&lt;h3&gt;Global Javascript Variables&lt;/h3&gt;

&lt;p&gt;Below are the global Javascript variables used. &lt;samp&gt;targetX&lt;/samp&gt; &amp;amp; &lt;samp&gt;targetY&lt;/samp&gt; plot coordinates for where the user clicks on the image. &lt;samp&gt;tagCounter&lt;/samp&gt; is used 
to give each of the tags a unique &lt;samp&gt;ID&lt;/samp&gt;&lt;/p&gt;

&lt;code&gt;
//Placed outside .ready for scoping
var targetX, targetY;
var tagCounter = 0;
&lt;/code&gt;


&lt;h3&gt;$(document).ready Javascript&lt;/h3&gt;

&lt;p&gt;In the main code block I've liberally added comments to explain each line of code:&lt;/p&gt;

&lt;code&gt;
$(document).ready(function(){
	//Dynamically wrap image
	$("img").wrap('&amp;lt;div id="tag-wrapper"&amp;gt;&amp;lt;/div&amp;gt;');
	
	//Dynamically size wrapper div based on image dimensions
	$("#tag-wrapper").css({width: $("img").outerWidth(), height: $("img").outerHeight()});
	
	//Append #tag-target content and #tag-input content
	$("#tag-wrapper").append('&amp;lt;div id="tag-target"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div id="tag-input"&amp;gt;&amp;lt;label for="tag-name"&amp;gt;Person\'s Name:&amp;lt;/label&amp;gt;&amp;lt;input type="text" id="tag-name"&amp;gt;&amp;lt;button type="submit"&amp;gt;Submit&amp;lt;/button&amp;gt;&amp;lt;button type="reset"&amp;gt;Cancel&amp;lt;/button&amp;gt;&amp;lt;/div&amp;gt;');
	
	//$("#tag-wrapper").click(function(e){
	$("img").click(function(e){		
		//Determine area within element that mouse was clicked
		mouseX = e.pageX - $("#tag-wrapper").offset().left;
		mouseY = e.pageY - $("#tag-wrapper").offset().top;
		
		//Get height and width of #tag-target
		targetWidth = $("#tag-target").outerWidth();
		targetHeight = $("#tag-target").outerHeight();
		
		//Determine position for #tag-target
		targetX = mouseX-targetWidth/2;
		targetY = mouseY-targetHeight/2;
		
		//Determine position for #tag-input
		inputX = mouseX+targetWidth/2;
		inputY = mouseY-targetHeight/2;
		
		//Animate if second click, else position and fade in for first click
		if($("#tag-target").css("display")=="block")
		{
			$("#tag-target").animate({left: targetX, top: targetY}, 500);
			$("#tag-input").animate({left: inputX, top: inputY}, 500);
		} else {
			$("#tag-target").css({left: targetX, top: targetY}).fadeIn();
			$("#tag-input").css({left: inputX, top: inputY}).fadeIn();
		}
		
		//Give input focus
		$("#tag-name").focus();	
	});
	
	//If cancel button is clicked
	$('button[type="reset"]').click(function(){
		closeTagInput();
	});
	
	//If enter button is clicked within #tag-input
	$("#tag-name").keyup(function(e) {
		if(e.keyCode == 13) submitTag();
	});	
	
	//If submit button is clicked
	$('button[type="submit"]').click(function(){
		submitTag();
	});

}); //$(document).ready
&lt;/code&gt;

&lt;h3&gt;Functions&lt;/h3&gt;

&lt;p&gt;Finally, here is a few functions I use for adding/removing tags:&lt;/p&gt;

&lt;code&gt;
function submitTag()
{
	tagValue = $("#tag-name").val();	
	
	//Adds a new list item below image. Also adds events inline since they are dynamically created after page load
	$("#tag-wrapper").after('&amp;lt;p id="hotspot-item-' + tagCounter + '"&amp;gt;' + tagValue + ' &amp;lt;span class="remove" onclick="removeTag(' + tagCounter + ')" onmouseover="showTag(' + tagCounter + ')" onmouseout="hideTag(' + tagCounter + ')"&amp;gt;(Remove)&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;');
	
	//Adds a new hotspot to image
	$("#tag-wrapper").append('&amp;lt;div id="hotspot-' + tagCounter + '" class="hotspot" style="left:' + targetX + 'px; top:' + targetY + 'px;"&amp;gt;&amp;lt;span&amp;gt;' + tagValue + '&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;');
	
	tagCounter++;
	closeTagInput();
}

function closeTagInput()
{
	$("#tag-target").fadeOut();
	$("#tag-input").fadeOut();
	$("#tag-name").val("");
}

function removeTag(i)
{
	$("#hotspot-item-"+i).fadeOut();
	$("#hotspot-"+i).fadeOut();
}

function showTag(i)
{
	$("#hotspot-"+i).addClass("hotspothover");
}

function hideTag(i)
{
	$("#hotspot-"+i).removeClass("hotspothover");
}
&lt;/code&gt;

&lt;h3&gt;Above &amp;amp; Beyond&lt;/h3&gt;

&lt;p&gt;I did add a few effects that Facebook does not have. For instance I added fading effects on pretty much everything I could. I often find that adding a fade or slide effect 
gives applications a more "polished look". I also added an animation if you click a new location for the target tag. Once again, here's a link to the 
&lt;b&gt;&lt;a href="/tech/resources/62/"&gt;finished product &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=62"&gt;View Comments [6]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/Skw54ScKepg" height="1" width="1"/&gt;</description>
<pubDate>Sun, 03 Jan 2010 17:05:00 -0600</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=62</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>jquery</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=62</feedburner:origLink></item>
<item>
<title>A jQuery Plugin To Create CSS3 Text-Shadows In Internet Explorer</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/ZaTH70Anefo/thread.php</link>
<description>&lt;p&gt;I was on the jQuery website the other day reading the documentation and as I neared end of the page I noticed one of the footer links appeared to have a text-shadow. 
For whatever reason I decided to inspect the element with &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;Firebug&lt;/a&gt;, only to discover it wasn't using &lt;a href="http://www.css3.info/preview/text-shadow/"&gt;CSS3's text-shadow property&lt;/a&gt;. 
What I found was the text was actually duplicated and layered on top of the exact same text, but slightly offset.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/61/jquery-footer.jpg" class="frame" alt="jQuery.com Footer"&gt;&lt;/p&gt;

&lt;p&gt;This isn't exactly a new technique, I mean check out &lt;a href="http://www.yourethemannowdog.com/"&gt;You're the Man Now Dog&lt;/a&gt; for probably one of the earliest examples. In any case, IE6, IE7 &amp;amp; 
IE8 do not support the CSS3 text-shadow property, and the only form of shadowing they support is the proprietary &lt;a href="http://msdn.microsoft.com/en-us/library/ms673539%28VS.85%29.aspx"&gt;shadow filter&lt;/a&gt;.
So I figured, why not make a jQuery plugin where you can just apply this to an element and have it automatically do all the work for you while still working in IE6, IE7 &amp;amp; IE8.&lt;/p&gt;

&lt;h3&gt;HTML Setup&lt;/h3&gt;

&lt;p&gt;Below is the HTML I'll apply the text shadow to:&lt;/p&gt;

&lt;code&gt;
&amp;lt;p&amp;gt;&amp;lt;span class="shadow-me"&amp;gt;Text Shadow&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Javascript Setup&lt;/h3&gt;

&lt;p&gt;Here is the basic plugin call. The first parameter is the color of the shadow, the second the x-offset and the third the y-offset.&lt;/p&gt;

&lt;code&gt;
$(document).ready(function(){
	$(".shadow-me").textShadow("#000",1,1);
});
&lt;/code&gt;

&lt;h3&gt;jQuery Plugin&lt;/h3&gt;

&lt;p&gt;Finally, below is the jQuery plugin I wrote. The &lt;samp&gt;parent&lt;/samp&gt; variable basically creates a random ID that I use to target the jQuery created element. I then wrap the target element in a &lt;samp&gt;DIV&lt;/samp&gt; which is 
used as a &lt;samp&gt;position: relative;&lt;/samp&gt; container. Next I set the height of that container so that it overflows correctly.&lt;/p&gt;

&lt;p&gt;After that, I create the additional HTML element to act as a faux shadow and position it according to the parameters.&lt;/p&gt;

&lt;code&gt;
(function ($) {
$.fn.textShadow = function(shadowcolor,x,y) {
	return this.each(function(i){	
		var parent = "tsw-" + Math.floor(Math.random()*100000);
		
		//Create container		
		$(this).wrap('&amp;lt;div class="text-shadow-wrapper" id="' + parent + '"&amp;gt;&amp;lt;/div&amp;gt;');

		//Set height of container so that it properly overflows
		$("#" + parent).css("height", $(this).css("font-size")); //Math.abs()??
		
		//Add text-shadow class to initial element
		$(this).addClass("text-shadow");
		
		//Adds shadow HTML element
		$(this).before('&amp;lt;span class="shadow"&amp;gt;' + $(this).text() + '&amp;lt;/span&amp;gt;');

		//Positions shadow HTML element
		$("#" + parent + " .shadow").css({left: x, top: y, color: shadowcolor});
	});
};
})(jQuery);
&lt;/code&gt;


&lt;h3&gt;Examples&lt;/h3&gt;

&lt;p&gt;Below are a few examples I created with this technique. You can also view these on my &lt;b&gt;&lt;a href="/tech/resources/61/"&gt;demo page to see what's going on behind the scenes&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="/tech/resources/61/"&gt;&lt;img src="/tech/resources/61/examples.png" class="frame" alt="View Examples"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Todos&lt;/h3&gt;

&lt;p&gt;There's a few things I'd need to improve on the plugin before it gets used in any production environment. First the shadow loses any specific font-styling applied directly to the original text. One could craft their selectors in a way that wouldn't make 
this a problem. Also the plugin could be improved to check against the original text's &lt;samp&gt;font&lt;/samp&gt; properties and apply those to the shadow. Finally this doesn't appear to work very well if placed in between a large amount of a text. It works best 
as a page heading or in a nav.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=61"&gt;View Comments [2]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/ZaTH70Anefo" height="1" width="1"/&gt;</description>
<pubDate>Mon, 07 Dec 2009 20:10:00 -0600</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=61</guid>
<author>Neal Grosskopf</author>
<category>jquery</category><category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=61</feedburner:origLink></item>
<item>
<title>Fix The Internet: Write You Own Custom Website CSS Rules With Stylish</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/JQGNviO_8HY/thread.php</link>
<description>&lt;p&gt;For those familiar with Greasemonkey, a Firefox addon for writing custom Javascript on websites, &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2108"&gt;Stylish&lt;/a&gt; alows you to write custom CSS for websites. Stylish makes it extremely easy to fix annoying 
websites (such as MySpace), hide advertisements and diagnose web design issues.&lt;/p&gt;

&lt;h4&gt;Fix The &lt;a href="http://www.youtube.com/watch?v=LKTH6f1JfX8"&gt;Internet(s)&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;One of best uses of Stylish is to override website's poor design choices. MySpace, a website that gives uneducated users control of the design is a great example of this. I spent roughly 2 minutes on the site 
&lt;a href="http://www.myspace.com/ktroclady"&gt;looking for an&lt;/a&gt; &lt;a href="http://www.myspace.com/abbylane_1"&gt;example&lt;/a&gt; and had no trouble finding a couple.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/ugly-myspace-examples.jpg"  class="frame" alt="Examples of poor design choices on Myspace"&gt;&lt;/p&gt;

&lt;h4&gt;Creating Custom CSS Rules&lt;/h4&gt;

&lt;p&gt;Stylish makes it really easy to fix a broken design. With a little CSS know-how you can fix MySpace and other offending sites by first clicking on the Stylish icon, then going to "write new style" and finally choosing whether you want to create a new rule 
for a single URL, domain or your own rule. I almost always pick domain to make the changes site-wide.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/example1.png"  class="frame" alt="Stylish menu example"&gt;&lt;/p&gt;

&lt;p&gt;After making your choice, you're presented with an input box. For those familiar with CSS, simply add in whatever CSS you want, give it a name and click "save". Within the two curly brackets you can insert any CSS rules you want.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/creating-rule.png" class="frame" alt="Creating rules with Stylish"&gt;&lt;/p&gt;

&lt;h4&gt;Pro Tips&lt;/h4&gt;

&lt;p&gt;This is a great chance to brush up on your &lt;b&gt;&lt;a href="http://www.nealgrosskopf.com"&gt;CSS Selector Specificity&lt;/a&gt;&lt;/b&gt; skills since you'll need to give your selectors more weight than the current ones on the website. The easiest way to achieve this is to 
use the &lt;samp&gt;!important&lt;/samp&gt; keyword like so:&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("myspace.com") {
html, body { background-image: none !important; }
}
&lt;/code&gt;

&lt;p&gt;Another great tool to add to your arsenal is &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;Firebug&lt;/a&gt;. With Firebug you can determine how to circumvent horrible designs by sifting through the design's stylesheet. Once you've 
determined what selector's properties are creating the ugliness it's easy to copy and paste that into to Stylish and add &lt;samp&gt;!important&lt;/samp&gt; to the end.&lt;/p&gt;

&lt;h4&gt;Other Uses?&lt;/h4&gt;

&lt;p&gt;Another great use for Stylish is to re-enable functionality on websites. I've noticed some websites using pop-up DIVs to force users into registering. With Stylish, you can hide these annoyances and continue using the site without giving away your 
information:&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/imeem.jpg" class="frame" alt="imeem's annoying registration box"&gt;&lt;/p&gt;

&lt;p&gt;In the screenshot above, the website imeem.com forces uses to register in order to listen to music for free. The CSS below hides the annoying DIV:&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("www.imeem.com") {
.mask, .bd { display: none !important; }
}
&lt;/code&gt;


&lt;h4&gt;HTML &amp;amp; CSS Diagnostics&lt;/h4&gt;

&lt;p&gt;Another excellent use of Stylish is &lt;b&gt;&lt;a href="/tech/thread.php?pid=17"&gt;CSS Diagnostics&lt;/a&gt;&lt;/b&gt;. If you're not familiar with CSS Diagnostics, they're basically CSS Selectors that highlight ugly parts of your HTML such as &lt;samp&gt;FONT&lt;/samp&gt; 

element or the use of &lt;samp&gt;TABLE&lt;/samp&gt; attributes 
such as &lt;samp&gt;BORDER&lt;/samp&gt;, &lt;samp&gt;CELLSPACING&lt;/samp&gt; etc.&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("example.com") {
font, table[cellspacing], table[border] { border: 1px solid red !important; }
}
&lt;/code&gt;

&lt;h4&gt;Hide Advertisements&lt;/h4&gt;

&lt;p&gt;Another great use of Stylish is to hide ads on webpages. While I realize that the Firefox addon &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1865"&gt;Adblock Plus&lt;/a&gt; already does this, occasionally it will 
miss an ad on website.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/noads.jpg" class="frame" alt="Hide advertisements on web pages"&gt;&lt;/p&gt;

&lt;p&gt;Notice how I hid the default Google search results ads above with a single selector below:&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("www.google.com") {
#mbEnd { display: none !important; }
}
&lt;/code&gt;

&lt;h4&gt;Conclusion&lt;/h4&gt;

&lt;p&gt;Stylish is a great tool for web designers and developers. Below are links to addons I mentioned in this article to get you started:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2108"&gt;Stylish&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;Firebug&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1865"&gt;Adblock Plus&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=60"&gt;View Comments [5]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/JQGNviO_8HY" height="1" width="1"/&gt;</description>
<pubDate>Thu, 08 Oct 2009 22:17:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=60</guid>
<author>Neal Grosskopf</author>
<category>firefox</category><category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=60</feedburner:origLink></item>
<item>
<title>Everything You Need To Know About CSS Selector Specificity</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/Zzh2GZjaxB0/thread.php</link>
<description>&lt;p&gt;There's an obscure topic of CSS that I think many people aren't aware of. It's called 'specificity'. I suppose it's not as glamorous as rounded corners, drop shadows or animations but it's still just 
as important in your day to day work as any other part of CSS.&lt;/p&gt;

&lt;p&gt;So what is CSS specificity? It's a weighted value system for &lt;b&gt;all&lt;/b&gt; of your selectors. Essentially, each piece of your selector has a value applied to it. This can be explained easiest in 
three separate groups: IDs, classes &amp;amp; elements. Perhaps one way to look at it is like a card games where face cards have a greater value than say, a 2,3, or 4.&lt;/p&gt;

&lt;img src="/tech/resources/59/article-image.png" class="frame" alt="CSS Specificity"&gt;

&lt;h3&gt;IDs&lt;/h3&gt;

&lt;p&gt;IDs are the most powerful type of selector you can use. Each ID in your selector will contribute 100 points to the selector's total value. Another thing to remember is IDs should be unique so there's really no 
reason you should be using more than one ID in your selector, unless you're trying to give your selector a higher point value than another one.&lt;/p&gt;

&lt;p&gt;The first example below has a point value of 100, while the second example has a point value of 300.&lt;/p&gt;

&lt;code&gt;
#content { }
#content #aside #caption { }
&lt;/code&gt;

&lt;h3&gt;Classes&lt;/h3&gt;

&lt;p&gt;Your second most important type is the class selector. Unlike IDs classes can, and should be used multiple times in a single HTML document. Classes occupy the 10's place in our point value system. 
This means that every instance of a class in your selector is worth 10 points. This means that a single ID will trump a 9 class selector.&lt;/p&gt;

&lt;p&gt;The two selectors below are of equal value. Notice how many classes were used compared to just a single ID, both which have a 100 point value.&lt;/p&gt;

&lt;code&gt;
#caption { }
.content-highlight .aside-type .float .bold .uppercase .quote .featured .etc .etc .etc { }
&lt;/code&gt;

&lt;h3&gt;Elements&lt;/h3&gt;

&lt;p&gt;Last but least are elements. An element selector is more generic than IDs and classes. They have the widest range of focus of all selectors. Because of this, element selectors occupy the ones position. Element 
selectors have a value of 1 point each.&lt;/p&gt;

&lt;p&gt;Again, both selectors below have the same point value. Notice how many elements were needed to equal a single class. Selectors inside the negation pseudo-class, :not(), are counted like any other, but the negation itself does not count as a pseudo-class.&lt;/p&gt;

&lt;code&gt;
.uppercase { }
html body div div blockquote span span span b i { }
&lt;/code&gt;

&lt;h3&gt;Odds &amp;amp; Ends&lt;/h3&gt;

&lt;p&gt;As we all know the 3 groups of selectors above does not encompass everything. Attributes selectors, and pseudo-classes both have the same value as classes which is 10 points each. The universal selector "*" has no point value.&lt;/p&gt;

&lt;h3&gt;Real World Usage&lt;/h3&gt;

&lt;p&gt;Okay, so far I've shown you some absolutely terrible examples of this in use. Almost none of the selectors above should be seen in a production environment. Lets take a look at some real world examples. How the system works 
is each type is tallied up, and then concatenated together. So 1 ID + 1 Classes + 1 Element would equal 111 points. See below for some more examples from my own stylesheet.&lt;/p&gt;

&lt;style type="text/css"&gt;
#content table tr td:first-child { text-align: left; }
&lt;/style&gt;

&lt;table class="data right"&gt;
&lt;caption&gt;CSS Selector Specificity Examples&lt;/caption&gt;
&lt;tr&gt;
	&lt;th&gt;Selector&lt;/th&gt;
	&lt;th style="width: 75px;"&gt;IDs&lt;/th&gt;
	&lt;th style="width: 75px;"&gt;Classes&lt;/th&gt;
	&lt;th style="width: 75px;"&gt;Elements&lt;/th&gt;
	&lt;th style="width: 75px;"&gt;Weight&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#header h2&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;101&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#content a[href$=".css"]&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;111&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#content input[type="text"]:focus &lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;121&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;.code li:before &lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;21&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#helper ul li a&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;3&lt;/td&gt;
	&lt;td&gt;103&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;.actions li:hover b &lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#content .comment:target &lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;120&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#content img.loading &lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;111&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;table tr:nth-child(odd)&lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;12&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;Why Is This !important&lt;/h3&gt;

&lt;p&gt;So now we know how to give our selectors a point value, so what? Why does this even matter? Specificity is extremely valuable if you're working on a website with multiple stylesheets. Perhaps it's a content management system that has a default stylesheet 
and your job is to overwrite its default values. The old MySpace layout is a great example where people would use specificity to modify their pages to their liking. Perhaps you're a beginner adding some new CSS to a 1000 line CSS file only to find your changes 
didn't change anything.&lt;/p&gt;

&lt;p&gt;Finally I couldn't talk about specificity without mentioning "!important". !important can be applied to individual properties to give them a super-value, thus trumping any prior property references.&lt;/p&gt;

&lt;code&gt;
#content { color: black; }
html .content { color: #333 !important; }
&lt;/code&gt;

&lt;h3&gt;Resources&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.w3.org/TR/css3-selectors/#specificity"&gt;CSS Specification: Calculating a selector's specificity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=59"&gt;View Comments [6]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/Zzh2GZjaxB0" height="1" width="1"/&gt;</description>
<pubDate>Thu, 17 Sep 2009 20:54:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=59</guid>
<author>Neal Grosskopf</author>
<category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=59</feedburner:origLink></item>
<item>
<title>Identify The Age Of Your Word &amp; PDF Files Using CSS &amp; jQuery</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/6nkH-zG3THM/thread.php</link>
<description>&lt;div class="image-caption" style="width: 260px; float: right; margin: 0px 0px 20px 20px;"&gt;	
	&lt;img src="/tech/resources/58/word-acrobat-boxshots.jpg" alt="Microsoft Word &amp;amp; Adobe Acrobat"&gt;	
	&lt;h3&gt;Word &amp;amp; Acrobat&lt;/h3&gt;	
	&lt;p&gt;Learn how to display a "new" icon next to your Word and PDF files.&amp;nbsp;&amp;nbsp;&lt;a href="/tech/resources/58/"&gt;Skip To Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;A request that often pops up at my workplace is the ability to tag files as "new" when we add them to our websites. The sites that I develop are usually littered with PDFs and Word documents so 
this can be a daunting task to manage whether a file is "new" or not since there are hundreds of files on the site.&lt;/p&gt;

&lt;p&gt;Ultimately what happened, is our .NET programmer added a field to the database for date which we enter in the last updated date and he does the logic server-side. That worked great for PDF and DOC files in the 
database but in reality, that only cover 50% of the files on our site.&lt;/p&gt;

&lt;h3&gt;CSS Only Solution?&lt;/h3&gt;

&lt;p&gt;My original idea was to solve this problem using only CSS. After all, CSS is my specialty. I was thinking around the lines of adding some metadata to my anchors like so:&lt;/p&gt;

&lt;code&gt;
&amp;lt;a href="august_2009_updates.pdf rel="2009-08-01"&amp;gt;August Updates&amp;lt;/a&amp;gt;
&lt;/code&gt;

&lt;p&gt;As you can see the above example is clearly time-sensitive. Normally what would happen is a month or two later, this file would be sitting on our site with the "new" icon still intact. My CSS only 
solution was to do something like this:&lt;/p&gt;

&lt;code&gt;
a[href^="2009-08"] { background: url(new.png) no-repeat left center; }
&lt;/code&gt;

&lt;p&gt;The problem with this is I don't have the ability to use variables or date-based logic in CSS so once it passes August, I'll need to update my CSS selector. &lt;i&gt;PS I'm aware that I could use some sort of server-side 
solution serving CSS up via ASP or PHP and then use variables. I hate mixing server-side code with static files like CSS or Javascript so I avoided this.&lt;/i&gt;&lt;/p&gt;

&lt;h3&gt;Enter jQuery and CSS&lt;/h3&gt;

&lt;p&gt;Next, I created a jQuery plugin that tags files by date with a new icon. It can be called with a selector that will narrow the focus of the search. Some parameters to this plugin 
are what attribute to search (I used the &lt;samp&gt;rel&lt;/samp&gt; attribute. The next parameter is the name of the class name that will be assigned. After that it takes a parameter for the number of days that have passed 
to determine if the link is "new" or not. Finally the last parameter is for debugging purposes.&lt;/p&gt;

&lt;code&gt;
$(document).ready(function(){
	$("#content a").newClass("rel","new",90,true);
});
&lt;/code&gt;

&lt;h3&gt;JQuery Plugin&lt;/h3&gt;

&lt;p&gt;Below is the corresponding jQuery plugin I wrote:&lt;/p&gt;

&lt;code&gt;
(function($){
	$.fn.newClass = function(attr,classname,offset,debug){
		var now = new Date();
		var day = 1000*60*60*24;
				
		return this.each(function(i){		
			var old = new Date($(this).attr(attr));	
			var diff = Math.floor((now.getTime() - old.getTime()) / day);			
			if(diff &lt; offset) $(this).addClass(classname);			
			if(debug) $(this).append(" - " + diff + " day(s)"); //testing
		});
	}
})(jQuery);
&lt;/code&gt;

&lt;p&gt;To see this in action &lt;b&gt;&lt;a href="/tech/resources/58/"&gt;view the demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=58"&gt;View Comments [0]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/6nkH-zG3THM" height="1" width="1"/&gt;</description>
<pubDate>Tue, 08 Sep 2009 21:49:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=58</guid>
<author>Neal Grosskopf</author>
<category>jquery</category><category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=58</feedburner:origLink></item>
<item>
<title>Easy Way To Get Your Twitter Followers Count/Custom Twitter Badge Using PHP</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/Ts84u3dDqps/thread.php</link>
<description>&lt;div class="image-caption" style="width: 240px; float: right; margin: 0px 0px 20px 20px;"&gt;	
	&lt;img src="/tech/resources/57/twitter-count.png" alt="Example Twitter Follower Counter"&gt;	
	&lt;h3&gt;Custom Twitter Badge&lt;/h3&gt;	
	&lt;p&gt;An example of what can be accomplished by creating your own Twitter Badge.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;So you're on Twitter now? Like back in high school, we all want to be popular on Twitter as well. Prove it by displaying your followers count with this simple PHP script.&lt;/p&gt;

&lt;p&gt;One thing that annoys me with &lt;i&gt;all&lt;/i&gt; third party web services is they feel the need to brand their widgets. I don't blame them for doing this but it deters me from ever using them. 
What usually results from this is I tinker around and figure out a way to get the data I need without all their ugly branding.&lt;/p&gt;

&lt;h3&gt;The Setup&lt;/h3&gt;

&lt;p&gt;First we'll need to use PHP's built-in &lt;samp&gt;curl&lt;/samp&gt; function. This will grab the output of other web pages, files, etc. &lt;i&gt;Note I lifted the script below from another website so feel free to 
correct me on it.&lt;/i&gt;&lt;/p&gt;

&lt;code&gt;
function curl($url)
{
	$ch = curl_init($url);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch,CURLOPT_HEADER, 0);	
	curl_setopt($ch,CURLOPT_USERAGENT,"www.YOURDOMAIN.com");
	curl_setopt($ch,CURLOPT_TIMEOUT,10);	
	$data = curl_exec($ch);
	curl_close($ch);
	return $data;
}
&lt;/code&gt;

&lt;h3&gt;Custom Twitter Badge Function&lt;/h3&gt;

&lt;p&gt;Next, we create the function that parses the &lt;samp&gt;curl&lt;/samp&gt; output. This uses the Twitter API. Simply call the function with your own Twitter username and it will return the number of followers you have:&lt;/p&gt;

&lt;code&gt;
function GetTwitterFollowerCount($username)
{
	$twitter_followers = curl("http://twitter.com/statuses/user_timeline/".$username.".xml?count=1");
	$xml = new SimpleXmlElement($twitter_followers, LIBXML_NOCDATA);
	return $xml-&gt;status-&gt;user-&gt;followers_count;
}

echo GetTwitterFollowerCount("YourTwitterName");
&lt;/code&gt;

&lt;h3&gt;Notes&lt;/h3&gt;

&lt;p&gt;Please take into consideration that you can only ping Twitter 150 times per hour. Because of this, it would be wise to create a text file and use it to cache your followers count. Also the function will 
only return a plain ol' number. Its up to your to think of a creative way to display this to your site's visitors. The more attractive you make it, the more likely your users will click it.&lt;/p&gt;

&lt;h3&gt;Related Posts:&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="/tech/thread.php?pid=36"&gt;How To Get Total Feedburner Subscribers With JQuery and ASP&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="/tech/thread.php?pid=35"&gt;How To Get Total Diggs Using JQuery And ASP&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="/tech/thread.php?pid=34"&gt;How To Get Delicious Bookmark Total Using JQuery And JSON&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=57"&gt;View Comments [10]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/Ts84u3dDqps" height="1" width="1"/&gt;</description>
<pubDate>Mon, 24 Aug 2009 21:09:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=57</guid>
<author>Neal Grosskopf</author>
<category>php</category><category>twitter</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=57</feedburner:origLink></item>
<item>
<title>Converting A Site From Classic ASP To PHP: Some Things To Consider</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/cvYU4-K2MGk/thread.php</link>
<description>&lt;p&gt;Well, after a month of spending my evenings coding till the wee hours of the night, I've finished converting my website NealGrosskopf.com from Classic ASP to PHP. After going through this grueling ordeal I thought 
I'd write up a quick article detailing my experience and perhaps save a fellow web developer some time should they ever endeavor this process.&lt;/p&gt;

&lt;img src="/tech/resources/56/asp-to-php.png" alt="ASP to PHP"&gt;

&lt;h3&gt;Learn The Basics&lt;/h3&gt;

&lt;p&gt;If you're not familiar with PHP like I was, I'd suggest you learn the basic syntax differences between ASP and PHP. I pretty much self taught myself PHP using the tutorial website 
&lt;a href="http://www.tizag.com/phpT/"&gt;Tizag&lt;/a&gt;. I feel like I'm a pretty competent ASP coder so learning the basics of PHP wasn't too hard for me. Here's a few observations I found.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;	
&lt;h4&gt;Built In Functions&lt;/h4&gt;
&lt;p&gt;PHP seems to like ordering parameters in built in functions slightly different than ASP. For instance in ASP you have:&lt;/p&gt;

&lt;code&gt;
replace("Input String","Find","Replace With")
&lt;/code&gt;

&lt;p&gt;In PHP the order is slightly different as well as having a slightly different function name:&lt;/p&gt;

&lt;code&gt;
str_replace("Find","Replace With","Input String")
&lt;/code&gt;

&lt;p&gt;Some other examples of this in PHP are &lt;samp&gt;str_len&lt;/samp&gt; (&lt;samp&gt;len&lt;/samp&gt; in ASP), &lt;samp&gt;strpos&lt;/samp&gt; (&lt;samp&gt;instr&lt;/samp&gt; in ASP) and &lt;samp&gt;explode&lt;/samp&gt; (&lt;samp&gt;split&lt;/samp&gt; in ASP)&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;h4&gt;Parse Errors&lt;/h4&gt;

&lt;p&gt;Forgetting to add a semi-colon ';' at the end of your PHP line = 'white screen of death'&lt;/p&gt;

&lt;p&gt;At least with my host's configuration (or possibly my own stupidity) parsing errors such as forgetting the semi-colon results in a very &lt;i&gt;not&lt;/i&gt;-useful white, blank, empty PHP error page. This 
can make troubleshooting the error very, very hard.&lt;/p&gt;	

&lt;p&gt;Fortunately I found a solution to this. &lt;a href="http://portableapps.com/apps/development/xampp"&gt;Portable XAMPP&lt;/a&gt;. 
I essentially ran web server locally which allowed me to test out my PHP pages (minus the My_SQL database). For whatever reason, my local copy did not give me the white screen of death and let me see the exact error message. 
This helped me find the error 10x faster. &lt;b&gt;I suggest if you're starting out with PHP, download Portable XAMMP and tinker with it locally, for free!&lt;/b&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;h4&gt;Code Order&lt;/h4&gt;

&lt;p&gt;One problem that I ran into was the placement of my functions within my code. In ASP I could include files at the end of my page, and even have functions within these includes be called even before the code 
has reached that area of the script. I suspect ASP pre-compiles the functions ahead of time while PHP does not. My solution to this was to re-organize my code so that all the functions appeared first 
within my include structure.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;h4&gt;Variable Scope, and isset()&lt;/h4&gt;	

&lt;p&gt;&lt;b&gt;Scope&lt;/b&gt; Another problem I ran into was variable scope. In Classic ASP I'd often something &lt;i&gt;like&lt;/i&gt; this:&lt;/p&gt;

&lt;code&gt;
FirstName = "Neal"	
...	
somefunction("Grosskopf")	
function somefunction(LastName)
	response.write FirstName &amp;amp; " " &amp;amp; LastName
end function
&lt;/code&gt;

&lt;p&gt;In PHP this will not work unless you use the &lt;samp&gt;$GLOBALS[]&lt;/samp&gt; array to your variable in the function like so:&lt;/p&gt;

&lt;code&gt;
$FirstName = "Neal";
...	
somefunction("Grosskopf");
function somefunction($LastName)
{
	$GLOBALS["FirstName"];
	echo $FirstName . " " . $LastName;
}
&lt;/code&gt;

&lt;p&gt;I'd also change global variables inside functions in Classic ASP. To fix this in PHP simply add the &lt;samp&gt;global&lt;/samp&gt; keyword to the variable:&lt;/p&gt;

&lt;code&gt;
function somefunction()
{
	global $FirstName";
	$FirstName = "Some Other Name";
}
&lt;/code&gt;

&lt;p&gt;&lt;i&gt;I'm sure these aren't good programming practices, but hey it works!&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;isset()&lt;/b&gt; In ASP you could do the following even if the variable has yet to be set:&lt;/p&gt;

&lt;code&gt;
if variable &amp;lt;&amp;gt; "" then
'do something
end if
&lt;/code&gt;

&lt;p&gt;In PHP this is not acceptable. Instead you'll need to use a built in function called isset(). This basically checks to see if the variable has been set yet:&lt;/p&gt;

&lt;code&gt;
if(isset($variable))
{
//do something
}
&lt;/code&gt;

&lt;p&gt;This isn't a huge difference, but since I was using the ASP method quite a bit, I needed to re-learn the new way to accomplish this in PHP.&lt;/p&gt;

&lt;/li&gt;

&lt;li&gt;
&lt;h4&gt;Redirects&lt;/h4&gt;

&lt;p&gt;Another common problem you'll run into when converting from ASP to PHP is redirects. In Classic ASP you could do a redirect using the following:&lt;/p&gt;	

&lt;code&gt;
response.redirect("thank-you-page.asp")
&lt;/code&gt;

&lt;p&gt;In PHP if you need to use the &lt;samp&gt;header&lt;/samp&gt; function&lt;/p&gt;

&lt;code&gt;
header("Location: thank-you-page.php");
&lt;/code&gt;

&lt;p&gt;Another thing to consider is if you place your &lt;samp&gt;header&lt;/samp&gt; function further down your page, possibly after you've already output content to your page. If this happens then you'll need to 
use the output buffer, at the top of your page:&lt;/p&gt;

&lt;code&gt;
ob_start();
&lt;/code&gt;

I'd also recommend saving your session data before you do a redirect in PHP like so:

&lt;code&gt;
session_write_close();
&lt;/code&gt;

&lt;h5&gt;Here's all the code at once:&lt;/h5&gt;

&lt;code&gt;
ob_start();

//Some other code here

session_write_close();
header("Location: thank-you-page.php");
&lt;/code&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Redirect Those Old ASP Pages To PHP&lt;/h3&gt;

&lt;p&gt;The great thing about switching to PHP is you now have the ability to use the much hailed .htaccess file. My very limited perception of this file is it acts as a gatekeeper between every file on your website 
and the end-user requesting the files. It allows you to intercept any request made to the server. One sweet rule I found for .htaccess is the ability to redirect my old ASP pages to their PHP equivalent:&lt;/p&gt;

&lt;code&gt;
RedirectMatch 301 /(.+)asp$ /$1php
&lt;/code&gt;

&lt;p&gt;Its sad but that one line takes care of it all for me. Google will now crawl my new PHP pages, and users with bookmarks to the old pages will still find them. It's almost too easy!&lt;/p&gt;


&lt;h3&gt;Final Thoughts&lt;/h3&gt;

&lt;p&gt;Those are just a &lt;i&gt;few&lt;/i&gt; of the differences I've experienced between PHP and ASP. I'm sure there's thousands more. Overall I'm very happy with my new PHP website and I'm happy I've finally taken the 
time to switch.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Anyone else convert an ASP site to PHP before? How was your experience?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=56"&gt;View Comments [9]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/cvYU4-K2MGk" height="1" width="1"/&gt;</description>
<pubDate>Wed, 19 Aug 2009 12:37:37 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=56</guid>
<author>Neal Grosskopf</author>
<category>asp</category><category>php</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=56</feedburner:origLink></item>
<item>
<title>A New Method To Target Internet Explorer In Javascript</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/McZKfNxaktQ/thread.php</link>
<description>&lt;p&gt;&lt;i&gt;Preface: It's quite possible that I'm not the first to discover this. But I did come up with this idea without finding a prior example of it before.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;I was working with JQuery at work last week and Internet Explorer was giving me some trouble, mainly due to it's sucky Javascript performance and some of it's flaky text+opacity issues. 
My solution to this was to remove animations from IE and change the element's CSS properties without an animation. I was now tasked with finding a way within Javascript to target IE.&lt;/p&gt;

&lt;img src="/tech/resources/55/demo.png" class="frame" alt="A New Method To Target Internet Explorer In Javascript"&gt;

&lt;p&gt;&lt;i&gt;An aside, I'm fully aware that IE's JScript engine contains a method at targeting IE using &lt;a href="http://msdn.microsoft.com/en-us/library/ahx1z4fs%28VS.80%29.aspx"&gt;JScripts conditional comments&lt;/a&gt;, but I've never been too impressed with these 
because they only allow me to target JScript versions, and not individual IE builds.&lt;/i&gt;&lt;/p&gt;

&lt;h3&gt;Enter: CSS Conditional Comments&lt;/h3&gt;

&lt;p&gt;Being a seasoned CSS veteran of the web standards wars (ok kidding) I turned to what I know best...&lt;a href="http://msdn.microsoft.com/en-us/library/ms537512%28VS.85%29.aspx"&gt;CSS Conditional Comments&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've seen most people use Conditional Comments (CC) to target IE in CSS hacks, but I seldom see people serve IE anything other than stylesheets with this method. I think a few people forget that you can actually wrap CCs
around any valid HTML elements (see &lt;a href="http://www.positioniseverything.net/articles/cc-plus.html"&gt;PositionIsEverything&lt;/a&gt; for a sweet method of doing this).&lt;/p&gt;

&lt;p&gt;CCs are pretty simple to use. They're pretty much HTML comment blocks that only IE recognizes. The example below will only show up to IE6 users.&lt;/p&gt;

&lt;code&gt;
&amp;lt;!--[if IE 6]&amp;gt;
Hello IE6!
&amp;lt;![endif]--&amp;gt;
&lt;/code&gt;

&lt;p&gt;We can also target previous browser releases with the following:&lt;/p&gt;

&lt;code&gt;
&amp;lt;!--[if lte IE 6]&amp;gt;
Hello IE6!
&amp;lt;![endif]--&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Enough Already! What About Javascript!&lt;/h3&gt;

&lt;p&gt;Using these same principles, we can wrap conditional comment blocks around our Javascript blocks. Then flag variables within these blocks to identify the browser as IE6, IE7 or plan ol' IE.&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
//By default, flag browser as not IE to non IE browsers
var ie6 = false;
var ie = false;
&amp;lt;/script&amp;gt;

&amp;lt;!--[if lte IE 6]&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
//Flag browser as IE in our conditional comment block
ie6 = true;
ie = true;
&amp;lt;/script&amp;gt;
&amp;lt;![endif]--&amp;gt;

&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
if(ie6 == false)
{
	alert(&amp;quot;You're cool, you're not using IE6&amp;quot;);
} else {
	alert(&amp;quot;Ahh! Why are you using IE6!?!?&amp;quot;);
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/55/"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;h3&gt;Target All Versions of IE In Javascript&lt;/h3&gt;

&lt;p&gt;We could also target all versions of IE with the following code:&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
var ie = false;
&amp;lt;/script&amp;gt;

&amp;lt;!--[if IE]&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
ie = true;
&amp;lt;/script&amp;gt;
&amp;lt;![endif]--&amp;gt;

&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
if(ie == false)
{
	alert(&amp;quot;You're cool, you're not using IE&amp;quot;);
} else {
	alert(&amp;quot;Ahh! Why are you using IE!?!?&amp;quot;);
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Drawbacks&lt;/h3&gt;

&lt;p&gt;There are a few drawbacks to this method. First, the conditional comment code will all have to appear inline on each page its used. I suppose one could create an external .js file and wrap 
it with the conditional comments. Second, we'll have to account for all the versions of IE we want to target or at least use LTE/GTE to target IE6/IE7 and its previous versions.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=55"&gt;View Comments [7]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/McZKfNxaktQ" height="1" width="1"/&gt;</description>
<pubDate>Tue, 14 Jul 2009 19:49:42 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=55</guid>
<author>Neal Grosskopf</author>
<category>javascript</category><category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=55</feedburner:origLink></item>
<item>
<title>Emulate C#'s AppendFormat Method In Javascript Or Classic ASP</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/M74Of1mza8I/thread.php</link>
<description>&lt;p&gt;Let me preface this article with the statement that I am by no means a 'good' C# programmer. I've used it a bit at work (we're currently transitioning to it) so I've seen it here and there. 
I know a fair amount about Classic ASP however, so when I noticed a neat little feature in C#/ASP.NET I wanted to see if I could mimic it in other languages.&lt;/p&gt;

&lt;h3&gt;AppendFormat Method&lt;/h3&gt;

&lt;p&gt;The method in C# is called AppendFormat. It belongs to the System.text namespace which contains the StringBuilder class and AppendFormat is a method of this. Here's the 
&lt;a href="http://msdn.microsoft.com/en-us/library/system.text.stringbuilder.appendformat.aspx"&gt;MSDN article&lt;/a&gt; if you'd like to find out more about it.&lt;/p&gt;

&lt;h3&gt;Old School Method&lt;/h3&gt;

&lt;p&gt;The neat thing about this method is it's an alternative to concatenation. Concatenation is basically the process of combining text and variables together like so:&lt;/p&gt;

&lt;code&gt;
var a = "lorem ipsum dolor"
var b = "adipiscing elit"
document.write(a + " sit amet consectetur " + b)
&lt;/code&gt;

&lt;p&gt;I think we're all pretty familiar with the code above. We're also probably familiar with some of the annoyances of the code above such as the fact that every time we combine text with a string variable, we need to start a quotation mark. 
Quotation marks are bothersome because sometimes (or rather often times in my case) we forget to properly close the ending quotation mark resulting in an error. More trouble can ensue when we have to start re-arranging variables and text 
within the concatenated string.&lt;/p&gt;

&lt;p&gt;Another problem is I often forget to include the concatenation symbol in between my text and variables. This, if anything, is probably the number one mistake I make.&lt;/p&gt;

&lt;h3&gt;Emulation Using Javascript&lt;/h3&gt;

&lt;p&gt;As I reviewed my co-workers C# code, I felt that perhaps C# had a good point so I set out to emulate this in other languages.&lt;/p&gt;

&lt;p&gt;First of all, below is the syntax we use for this alternative method. We use keyword itentifiers i.e. {NUMBER} to indicate an item should be placed in its spot. That number corresponds with the index of the array items on the right i.e NEAL, GROSSKOPF.
 The neat thing with this is we can easily move {0} arround without having to worry about closing the quotation marks and there is no need to use the concatenation symbol...ever!&lt;/p&gt;

&lt;code&gt;
AppendFormat("Lorem ipsum dolor sit {0} {1} amet, consectetur {0} adipiscing {0} elit.", ["NEAL", "GROSSKOPF"])
&lt;/code&gt;

&lt;p&gt;Below is the function I wrote to emulate this in Javascript. I pass the function an array, loop through it, and replace the placeholders with the array item in the same index.&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type="text/javascript"&amp;gt;
function AppendFormat(input,arr)
{
    for (i = 0; i &lt; arr.length; i++)
    {
		while (input.indexOf("{"+i+"}") != -1)
		{
			input = input.replace("{"+i+"}", arr[i]);
		}
    }
    return input;
}

document.write(AppendFormat("Lorem ipsum dolor sit {0} {1} amet, consectetur {0} adipiscing {0} elit.", ["NEAL", "GROSSKOPF"]));
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Easily Re-Arrange Items&lt;/h3&gt;

&lt;p&gt;The great thing about this, is we can easily re-arrange items simply by moving the placeholder around in the text block like so:&lt;/p&gt;

&lt;code&gt;
AppendFormat("Lorem ipsum dolor sit {1} {0} amet, consectetur {1} adipiscing {0} elit.", ["NEAL", "GROSSKOPF"]);
&lt;/code&gt;

&lt;h3&gt;Classic ASP Variant&lt;/h3&gt;

&lt;p&gt;I also wanted to create the same function but in Classic ASP, my language of choice:&lt;/p&gt;

&lt;code&gt;
function AppendFormat(input,arr)   
    for i = 0 to ubound(arr)
        input = replace(input,"{" &amp; i &amp; "}",arr(i))
    next   
    AppendFormat = input
end function

response.Write AppendFormat("Lorem ipsum dolor sit {0} {1} amet, consectetur {1} adipiscing {1} elit.", array("NEAL","GROSSKOPF"))
&lt;/code&gt;

&lt;p&gt;As you can see, this is pretty much the basic princple that we used for the Javascript version.&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;I'm sure this article isn't as exciting as some of my others, and for all I know, most my readers are much better programmers than myself but I thought it was a cool idea so I wrote about it.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=54"&gt;View Comments [4]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/M74Of1mza8I" height="1" width="1"/&gt;</description>
<pubDate>Thu, 09 Jul 2009 07:03:53 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=54</guid>
<author>Neal Grosskopf</author>
<category>asp</category><category>javascript</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=54</feedburner:origLink></item>
<item>
<title>How To Create CSS Text/Font Gradients With CSS</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/jXnr0Mqcew0/thread.php</link>
<description>&lt;p&gt;Something that CSS is currently lacking is the ability to add gradients to our text blocks. Currently we can add drop shadows to text or change the color of it but not add gradients. I suspect 
that in the coming years this will be a new property but until then here is a method to do it.&lt;/p&gt;

&lt;h3&gt;HTML Setup&lt;/h3&gt;

&lt;p&gt;The HTML Setup is pretty simple. Just place an empty SPAN element inside your heading element:&lt;/p&gt;

&lt;code&gt;
&amp;lt;h3&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;Text Here&amp;lt;/h3&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Using JQuery to Automatically Insert SPAN Elements&lt;/h3&gt;

&lt;p&gt;I think a few people might find the above code unsightly, so here's a method to leave the empty SPAN element out of your HTML and inject it via JQuery:&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
$(document).ready(function(){
	$(&amp;quot;h3&amp;quot;).prepend(&amp;quot;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;)
});
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;CSS Setup&lt;/h3&gt;

&lt;p&gt;The most important part of this code is setting the H3 element's position to relative. I'd also recommend setting the line-height to the same height as the font-size used and also reseting the margins back to zero.&lt;/p&gt;

&lt;code&gt;
h3
{
font-size: 25px;
line-height: 25px;
margin: 0px;
position: relative; 
}
&lt;/code&gt;

&lt;p&gt;Next, we position the empty SPAN element absolute and give it a height and width. Using this SPAN we can overlay various background-images over the H3 element.&lt;/p&gt;

&lt;code&gt;
h3 span
{
display: block;
height: 26px;
position: absolute;
width: 100%;
}
&lt;/code&gt;

&lt;h3&gt;Gradient Effect&lt;/h3&gt;

&lt;p&gt;The first effect I'll demonstrate is a simple gradient. To do this we use a simple &lt;a href="/tech/resources/53/gradient-white.png"&gt;white to transparent gradient image&lt;/a&gt; and set it as the SPAN element's background-image. We can then 
position the background-image higher or lower depending on how strong we want the effect to be.&lt;/p&gt;

&lt;code&gt;
h3 span { background: url(gradient-white.png) repeat-x left 0px; }
&lt;/code&gt;

&lt;div class="image-caption" style="width: 490px;"&gt;
	&lt;a href="/tech/resources/53/?demo=1"&gt;&lt;img src="/tech/resources/53/demo-1.png" alt="SPAN Element Overlay"&gt;&lt;/a&gt;
	&lt;p&gt;In the example above, the black transparent area represents the SPAN while the black border represents the bounds of the H3 element.&lt;/p&gt;
	&lt;h3&gt;Demo&lt;/h3&gt;
	&lt;p&gt;When viewing the demo, take your cursor and select the gradient text. This will give you a good understanding of how the gradient works - &lt;/p&gt;
	&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/53/?demo=1"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;Gradient Effect With Hover&lt;/h3&gt;

&lt;p&gt;We can also apply a color change on hover with our gradient. Since the color change happens on the layer &lt;b&gt;behind&lt;/b&gt; the gradient there is no additional CSS we must do other than change the H3's color when hovered.&lt;/p&gt;

&lt;code&gt;
h3 span { background: url(gradient-white.png) repeat-x left 0px; }
h3:hover { color: #990000; }
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/53/?demo=2"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;h3&gt;Two Tone Effect&lt;/h3&gt;

&lt;p&gt;Another effect we can do is apply a two toned text color to our text. To do this we use a white rectangle with it's opacity lowered and then position it over our H3.&lt;/p&gt;

&lt;code&gt;
h3 span { background: url(dual-white.png) repeat-x left 0px; }
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/53/?demo=3"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;h3&gt;Sliding Door Effect&lt;/h3&gt;

&lt;p&gt;Finally, my last effect uses JQuery to create an animation when the text is hovered. Using a little JQuery we can slide the SPAN's background-image up and down when hovered on
giving it sort of a 'garage door' effect.&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://jqueryjs.googlecode.com/svn/trunk/plugins/backgroundPosition/jquery.backgroundPosition.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
$(document).ready(function(){
	$(&amp;quot;h3 span&amp;quot;).hover(
		function () {
			$(this).stop().animate({backgroundPosition: &amp;quot;(0px -27px)&amp;quot;}, 400); 
		}, 
		function () {
			$(this).stop().animate({backgroundPosition: &amp;quot;(0px 0px)&amp;quot;}, 400);
		}
	);
});
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/53/?demo=4"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Got any other effects that could be accomplished using a background-image? Share them below!&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=53"&gt;View Comments [1]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/jXnr0Mqcew0" height="1" width="1"/&gt;</description>
<pubDate>Wed, 01 Jul 2009 20:04:44 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=53</guid>
<author>Neal Grosskopf</author>
<category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=53</feedburner:origLink></item>
<item>
<title>Firefox 3.5 Set To Be Released Tuesday. Here Are Some Exciting New CSS Features In 3.5</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/0v02CariXws/thread.php</link>
<description>&lt;div class="image-caption" style="width: 235px; float: right; margin: 0px 0px 20px 20px;"&gt;	
	&lt;img src="/tech/resources/52/firefox.jpg" alt="Firefox 3.5"&gt;	
	&lt;h3&gt;Firefox 3.5&lt;/h3&gt;	
	&lt;p&gt;Firefox 3.5 looks to have plenty of new features for web developers to play with. I'll go over some of new CSS features that are new to 3.5.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;For much of my web career I've been an Internet Explorer stooge but when Firefox 3 came out last summer, I made the switch and never looked back. Firefox is just so heavily oriented to 
web developers and designers that it's hard to rationalize using any other browser. Sure, Opera and Safari have slightly better support but their lack of developer tools make me opt for Firefox.&lt;/p&gt;

&lt;p&gt;Firefox 3.5, the latest version of the browser is set to be released this Tuesday. This intermediary release is probably aimed more at developers than end users and that's what excites me the most. After 
reviewing the &lt;a href="https://developer.mozilla.org/En/Firefox_3.5_for_developers"&gt;3.5 release notes&lt;/a&gt; I thought I'd point out a few of the new features that I'm most excited about.&lt;/p&gt;

&lt;h3&gt;@font-face Support&lt;/h3&gt;

&lt;p&gt;Since the inception of the web, we've been limited to about a dozen font types. With @font-face we're now able to choose from 1000's if not more. By embedding fonts our sites will be more accessible 
to people with screen readers, and it will also improve our search engine optimization by using pure text rather than images. This will also make our lives easier because we'll be able to change 
font properties via CSS rather than having to open up Photoshop or Fireworks to edit an image file.&lt;/p&gt;

&lt;p&gt;Currently browsers using Webkit also support @font-face and Opera 10 will support it. Internet Explorer has it's own proprietary method.&lt;/p&gt;

&lt;code&gt;
@font-face
{
font-family: "Bitstream Vera Serif Bold";
src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");
}

body { font-family: "Bitstream Vera Serif Bold", serif }
&lt;/code&gt;

&lt;h3&gt;Box Shadow &amp;amp; Text Shadow&lt;/h3&gt;

&lt;p&gt;A personal favorite of mine is the box-shadow property. Creating drop shadows on the web can be pretty painful, especially when the size of the box may vary from page to page. With the 
new box shadow property we won't need to worry about that anymore. Safari also supports box-shadow while Opera and IE do not. Firefox 3.5 will also support text-shadow (with no -mox prefix). This means that Opera, Safari and Firefox 
all support this while IE, again has it's own proprietary method.&lt;/p&gt;

&lt;code&gt;
div {  -moz-box-shadow: #000 10px 5px 5px; }
h2 { text-shadow: #000 1px 1px 2px; }
&lt;/code&gt;

&lt;h3&gt;CSS Transformations&lt;/h3&gt;

&lt;p&gt;Originally introduced by Safari/Webkit we now have the ability to use CSS Transformations. I haven't delved into this much but I have used CSS Transitions a few times on various projects which I wish 
they would have implemented instead.&lt;/p&gt;

&lt;h3&gt;New CSS Selectors&lt;/h3&gt;

&lt;p&gt;Probably the most important aspect of CSS is the ability to select elements. Firefox 3.5 gives us a few more tools to achieve this. Having used JQuery extensively for the past several months, I've 
found myself using almost all of these to circumvent browser's lack of support. With Firefox 3.5 we'll be able to natively use these selectors (and more):&lt;/p&gt;

&lt;code&gt;
/* Zebra Stripes */
tr:nth-child(odd) { background: #fff; }
tr:nth-child(even) { background: #eee }

/* Alternate Method for Zebra Stripes */
tr:nth-of-type(odd) { background: #fff; }
tr:nth-of-type(even) { background: #eee }

/* Last 5 LIs of a List */
li:nth-last-child(-n+5) { color: #ccc; }

/* Alternate Method */
li:nth-last-of-type(5) { color: #ccc; }
&lt;/code&gt;

&lt;h3&gt;CSS Media Queries&lt;/h3&gt;

&lt;p&gt;Media queries allows web developers to target certain scenarios that end users may have. For instance in the example below I'm adjusting the width of my #content DIV if 
the end user is on a PDA and has a screen size smaller than 300px.&lt;/p&gt;

&lt;code&gt;
@media handheld and (max-width: 300px)
{
#content { width: 300px; }
}
&lt;/code&gt;

&lt;p&gt;You could also take this a step further and mine for information about your end users by testing the size of elements on your page:&lt;/p&gt;

&lt;code&gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
@media handheld and (max-width: 300px)
{
#content { width: 300px; }
}
&amp;lt;/style&amp;gt;

&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
if ($(#content).width() = "300px")
{
//do something, i.e. email, write to text file etc.
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Other New CSS Features&lt;/h3&gt;

&lt;p&gt;Here's a list of a few other CSS features I didn't mention above.&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;opacity (no longer -moz-opacity)&lt;/li&gt;
	&lt;li&gt;word-wrap&lt;/li&gt;
	&lt;li&gt;-moz-border-image&lt;/li&gt;
	&lt;li&gt;-moz-column-rule&lt;/li&gt;
	&lt;li&gt;-moz-column-rule-width&lt;/li&gt;
	&lt;li&gt;-moz-column-rule-style&lt;/li&gt;
	&lt;li&gt;-moz-column-rule-color&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Further Reading:&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="https://developer.mozilla.org/En/Firefox_3.5_for_developers"&gt;Firefox 3.5 for Developers&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)"&gt;Comparison of Layout Engines (CSS) - Wikipedia&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.w3.org/TR/css3-selectors/"&gt;CSS 3 Selectors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=52"&gt;View Comments [0]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/0v02CariXws" height="1" width="1"/&gt;</description>
<pubDate>Sun, 28 Jun 2009 21:22:58 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=52</guid>
<author>Neal Grosskopf</author>

<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=52</feedburner:origLink></item>
<item>
<title>YouTube Hacking: How To Retrieve Video Screenshots From YouTube Videos</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/EbtZhDiCbH0/thread.php</link>
<description>&lt;p&gt;It is often useful to display a preview of an embedded YouTube video on your website rather than the long winded HTML object/embed code. Fortunately YouTube provides us with an undocumented way to retrieve video stills.&lt;/p&gt;

&lt;p&gt;Each video has three separate stills that you can choose from after you upload the video. YouTube, now also support high definition videos and because of that, provides higher quality stills as well. Below I will run through all the various 
YouTube images that are available for each video.&lt;/p&gt;

&lt;h3&gt;The Setup&lt;/h3&gt;

&lt;p&gt;Below is a break down of the YouTube URL. For all of my examples I have chosen my new favorite YouTube video &lt;a href="http://www.youtube.com/watch?v=nda_OSWeyn8"&gt;Leprechaun in Mobile, Alabama&lt;/a&gt;.&lt;/p&gt;

&lt;table class="data"&gt;
&lt;caption&gt;Breakdown Of URL&lt;/caption&gt;
&lt;tr&gt;
	&lt;th&gt;Domain&lt;/th&gt;
	&lt;th&gt;Folder&lt;/th&gt;
	&lt;th&gt;Video&lt;/th&gt;
	&lt;th&gt;Image&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;http://i.ytimg.com&lt;/td&gt;
	&lt;td&gt;/vi/&lt;/td&gt;
	&lt;td&gt;nda_OSWeyn8&lt;/td&gt;
	&lt;td&gt;default.jpg&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;The Default YouTube Image&lt;/h3&gt;

&lt;p&gt;YouTube's default video image, i.e. the image that the uploader has chosen, can be retrieved by using the default.jpg image. Its dimensions are 120px x 90px and its file size is 3.07KB. You may want to use this image when you want the exact image the 
original uploader intended.&lt;/p&gt;


&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/default.jpg" alt="default.jpg" class="frame"&gt;


&lt;h3&gt;Series Images 0 - 4 &lt;/h3&gt;

&lt;p&gt;Next YouTube provides us with images 0.jpg, 1.jpg, 2.jpg &amp;amp; 3.jpg. These 4 images are basically the 4 images the uploader can chose from after uploading a video.&lt;/p&gt;

&lt;p&gt;Image 0.jpg is larger, sized at 320px x 240px and its file size is 11.77KB.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/0.jpg" alt="0.jpg" class="frame"&gt;&lt;/p&gt;

&lt;p&gt;Images 1, 2, 3 are smaller images sized at 130px x 97px.&lt;/p&gt;

&lt;p&gt;
&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/1.jpg" alt="1.jpg" class="frame inline"&gt;
&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/2.jpg" alt="2.jpg" class="frame inline"&gt;
&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/3.jpg" alt="3.jpg" class="frame inline"&gt;
&lt;/p&gt;

&lt;h3&gt;High Quality Images&lt;/h3&gt;

&lt;p&gt;Next, YouTube provides us with what they label 'high quality' images. These are named hq1.jpg, hq2.jpg, hq3.jpg &amp;amp; finally hqdefault.jpg.&lt;/p&gt;

&lt;p&gt;Images 1, &amp;amp; 3 are smaller images sized at 130px x 97px. Even those these are prefixed with 'hq' the images appear to be of the same quality that images 1, 2, &amp;amp; 3 were.&lt;/p&gt;

&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/hq1.jpg" alt="hq1.jpg" class="frame inline"&gt;
&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/hq3.jpg" alt="hq3.jpg" class="frame inline"&gt;

&lt;p&gt;Image 2 is larger and sized at 480px x 360px. Its file size is 14.63KB. I'm not sure why this image is larger because it seems to break the pattern of the other images. It does appear to be the default image so perhaps that has something to do with it.&lt;/p&gt;

&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/hq2.jpg" alt="hq2.jpg" class="frame"&gt;

&lt;p&gt;Finally, the hqdefault.jpg is the largest and highest quality of all the images. It is sized at 480px x 360px. Its file size is 14.63KB. I would recommend using this image as your primary image due to its quality.&lt;/p&gt;

&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/hqdefault.jpg" alt="hqdefault.jpg" class="frame"&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;You now probably know more than you ever wanted to know about the available images YouTube provides us for each video. Feel free to bookmark this article as you'll probably need to refer back to it someday while working on a project.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=51"&gt;View Comments [8]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/EbtZhDiCbH0" height="1" width="1"/&gt;</description>
<pubDate>Wed, 10 Jun 2009 21:43:51 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=51</guid>
<author>Neal Grosskopf</author>
<category>youtube</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=51</feedburner:origLink></item>
<item>
<title>Quick &amp; Easy Ways To Spice Up Your Web Site's Font Styling</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/Z4bqRPQpuR0/thread.php</link>
<description>&lt;p&gt;One of the key elements of a good website design is the styling of the site's font. I think this is an area where many of the more 'mathematically inclined' web developers struggle. To help those out that 
are willing to take it, I'll show you how to take the default Times New Roman 16px font and make your design shine.&lt;/p&gt;

&lt;p&gt;By default browsers will apply the following settings to your font out of the box:&lt;/p&gt;

&lt;code&gt;
body
{
color: #000000;
font-family: "Times New Roman";
font-size: 16px;
letter-spacing: 0px;
line-height: 18px;
text-align: left;
}
&lt;/code&gt;

&lt;p&gt;We're all familiar with the appearance of this font, and often times, are turned off by this font styling because of how common and boring it looks.&lt;/p&gt;

&lt;h3&gt;Gray is the New Black&lt;/h3&gt;

&lt;p&gt;First lets get rid of that default and obnoxious font color #000000. I recommend you choose a value between #888888 and #333333 for your website's font color. If you need help picking a color I recommend 
using &lt;a href="http://meyerweb.com/eric/tools/color-blend/"&gt;Eric Meyer's Color Blend Tool&lt;/a&gt;. I would also like to point out that using a color lighter than #888888 will not have enough contrast on a 
white background and will be difficult for your users to read. On the flip side, a color darker than #333333 is starting to get into that loud and obnoxious range again. I personally like to 
choose #555555.&lt;/p&gt;

&lt;code&gt;
body
{
color: #555555;
}
&lt;/code&gt;

&lt;h3&gt;Times New What?&lt;/h3&gt;

&lt;p&gt;Next lets 'can' Times New Roman for a different, less 'plain' font. &lt;i&gt;A side note, Times New Roman is a great font, and there's a time and place for it, but being the browser default font, I tend to shy away from using 
it too often.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;Font types can also be broke into two different groups. Serif and Sans Serif. Sans serifs fonts do not have the small tails after letters. An example of a sans serif font is &lt;span style="font-family: Arial;"&gt;Arial&lt;/span&gt;. An example of a serif font is 
&lt;span style="font-family: 'Times New Roman';"&gt;Times New Roman&lt;/span&gt;. Below is a list of some of the more content-useful fonts to chose from when designing a website. Notice how some of the fonts take up more space than others:&lt;/p&gt; 

&lt;h4&gt;Sans Serif&lt;/h4&gt;

&lt;ol style="font-size: 20px;"&gt;
	&lt;li style="font-family: Arial;"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Arial&lt;/li&gt;
	&lt;li style="font-family: Verdana;"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Verdana&lt;/li&gt;
	&lt;li style="font-family: Tahoma;"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Tahoma&lt;/li&gt;	
	&lt;li style="font-family: 'Trebuchet MS';"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Trebuchet MS&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Serif&lt;/h4&gt;

&lt;ol style="font-size: 20px;"&gt;	
	&lt;li style="font-family: 'Times New Roman';"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Times New Roman&lt;/li&gt;
	&lt;li style="font-family: Georgia;"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Georgia&lt;/li&gt;
	&lt;li style="font-family: 'Palatino Linotype';"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Palatino Linotype&lt;/li&gt;
	&lt;li style="font-family: 'Lucida Sans';"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Lucida Sans&lt;/li&gt;	
&lt;/ol&gt;

&lt;p&gt;Of the choices above, I find Arial to be the easiest on the eyes. If you want to be a bit edgier you can chose fonts 2-4 which are used a bit less than the others.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Need help?&lt;/b&gt; Check out my extremely useful &lt;b&gt;&lt;a href="/tech/resources/50/font-comparison.asp"&gt;Font Comparison Page&lt;/a&gt;&lt;/b&gt; to see which font you like best.&lt;/p&gt;
 
&lt;h3&gt;Size Matters&lt;/h3&gt;

&lt;p&gt;By default browsers will assign your font a font-size of 16px. While 16px is big enough that most users will find it comfortable to read, 12px is really the internet's de facto font-size. Visit some of your favorite websites and you'll discover that almost all of them
use 12px as the main content's font-size. It's perfectly ok to use other font sizes, but for your main content I'd stick with 12px - 14px.&lt;/p&gt;

&lt;code&gt;
body
{
font-size: 12px;
}
&lt;/code&gt;

&lt;h3&gt;Give Your Font Some Breathing Room With Line-Height&lt;/h3&gt;

&lt;p&gt;Probably the single most easy CSS change you can make to your font, with the biggest impact, is to adjust your line-height. Line-Height is the spacing between the lines of text on your web pages. By default browsers set this to 18px. At 18px you will have about
9px of space between your top and bottom line.&lt;/p&gt;

&lt;div class="image-caption" style="width: 545px;"&gt;
	&lt;a href="/tech/resources/50/line-height.png"&gt;&lt;img src="/tech/resources/50/line-height.png" alt="Line Height Comparison"&gt;&lt;/a&gt;	
	&lt;h3&gt;Line Height Comparison&lt;/h3&gt;	
	&lt;p&gt;The first block of text has the default line-height of 18px while the second block has a line-height of 27px. Notice how the second block of text is easier to read.&lt;/p&gt;	
&lt;/div&gt;

&lt;h3&gt;Straighten Out With Text-Align: Justify&lt;/h3&gt;

&lt;p&gt;My final recommendation is to experiment with the CSS property text-align, specifically with the justify value. By default, browsers will assign the value of text-align: left; to your text. Using the value of 'justify' we can make all of our blocks of text 
have straight edges on the left and right.&lt;/p&gt;

&lt;div class="image-caption" style="width: 455px;"&gt;
	&lt;a href="/tech/resources/50/text-align.png"&gt;&lt;img src="/tech/resources/50/text-align.png" alt="Text Align Comparison"&gt;&lt;/a&gt;	
	&lt;h3&gt;Text Align Comparison&lt;/h3&gt;	
	&lt;p&gt;The first block has text-align: left; while the second block has text-align: justify; I find that the justified text helps reinforce the grid layout in your web design.&lt;/p&gt;	
&lt;/div&gt;

&lt;h3&gt;Putting It All Together&lt;/h3&gt;

&lt;p&gt;Below is a summary of everything I've just went through. Also check out my &lt;a href="/tech/resources/50/results.asp"&gt;step by step results page.&lt;/a&gt;&lt;/p&gt;

&lt;code&gt;
body
{
color: #555555;
font-family: Arial;
font-size: 12px;
line-height: 27px;
text-align: justify;
}
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/50/results.asp"&gt;View the metamorphoses from Times New Roman to my example above. &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=50"&gt;View Comments [3]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/Z4bqRPQpuR0" height="1" width="1"/&gt;</description>
<pubDate>Wed, 03 Jun 2009 21:41:27 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=50</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>font</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=50</feedburner:origLink></item>
<item>
<title>Browser Comparison of Available Print Area Width</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/ytDDyZYbAIU/thread.php</link>
<description>&lt;p&gt;This article is a companion article to my "&lt;a href="/tech/thread.asp?pid=43"&gt;Browser Comparision of Available Screen Width When Using 1024x768&lt;/a&gt;" which I think many people found useful. The other day at work a co-worker complained to me that
a webpage was getting cropped off when printing it. I then had to tinker with the width of a few different elements on the page to get it to fit. After finishing that I began to wonder, what the max-width is that can be used various browsers when printing.&lt;/p&gt;

&lt;p&gt;I ran a quick test of all the browsers I had installed to see at what width, would the browser's print preview window crop off my fixed width DIV. Here are the results I found:&lt;/p&gt;

&lt;table class="data"&gt;
&lt;caption&gt;Browser Comparision of Available Print Area Width&lt;/caption&gt;
&lt;tr&gt;
	&lt;th&gt;Browser&lt;/th&gt;
	&lt;th&gt;Max-Width&lt;/th&gt;
	&lt;th&gt;Default Settings&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Firefox 3 @ 100%&lt;/td&gt;
	&lt;td&gt;686px&lt;/td&gt;
	&lt;td&gt;Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Safari 4&lt;/td&gt;
	&lt;td&gt;718px&lt;/td&gt;
	&lt;td&gt;&gt; 718px Triggers Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Opera 9.5 @ 100%&lt;/td&gt;
	&lt;td&gt;730px&lt;/td&gt;
	&lt;td&gt;80% &amp; Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;IE8 @ 100%&lt;/td&gt;
	&lt;td&gt;670px&lt;/td&gt;
	&lt;td&gt;Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;IE7 @ 100%&lt;/td&gt;
	&lt;td&gt;670px&lt;/td&gt;
	&lt;td&gt;Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;IE6 @ 100%&lt;/td&gt;
	&lt;td&gt;670px&lt;/td&gt;
	&lt;td&gt;75%&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;h4&gt;Notes On My Results&lt;/h4&gt;

&lt;p&gt;You'll notice that many browser's default settings are set to 'shrink to fit'. This may solve the problem of extra-wide content when printing most of the time. I also decided, that when given the option, I would set the resize option to 100% to make all my 
browsers equal.&lt;/p&gt;

&lt;p&gt;Also when I ran the test, I did not modify the page's margins which I'm sure would have an affect on the results.  Safari also had an interesting feature that triggered shrink to fit when the content grew beyong it's max-width. 
I thought this was a pretty useful feature compared to most the other browsers.&lt;/p&gt;

&lt;p&gt;Other results we can see, is Internet Explorer has stayed tried and true throughout it's past three versions sticking with 670px each time as it's max-width. Opera provides the most real-estate at 730px.&lt;/p&gt;

&lt;h4&gt;Conclusion&lt;/h4&gt;

&lt;p&gt;When writing print stylesheets knowing that the lowest common deneminator is Internet Explorer at 670px will help you when creating print stylesheets.&lt;/p&gt;

&lt;h4&gt;Related Articles&lt;/h4&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="/tech/thread.asp?pid=43"&gt;Browser Comparision of Available Screen Width When Using 1024x768&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="/tech/thread.asp?pid=39"&gt;Go Green With CSS Print Stylesheets&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="/tech/thread.asp?pid=8"&gt;Using Media Targeting With CSS With @Media&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=49"&gt;View Comments [1]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/ytDDyZYbAIU" height="1" width="1"/&gt;</description>
<pubDate>Tue, 26 May 2009 18:35:04 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=49</guid>
<author>Neal Grosskopf</author>
<category>browser comparision</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=49</feedburner:origLink></item>
</channel>
</rss>
