<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
	<channel>
		<title>Pushing Buttons</title> 
		<link>http://www.pushingbuttons.net</link> 
		<description>A blog for web designers, developers and programmers.</description>
		<language>en</language>
		<generator>Custom Engine</generator>
		
		<pubDate>Sun, 18 Jul 2010 07:41:55 -0400</pubDate>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/pushingbuttonsblog" /><feedburner:info uri="pushingbuttonsblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
			<title>New Blog, New Domain</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/gKfaymqdLws/</link>
			<description>Pushing Buttons has moved to a new location, with a new name. It is now MindlessFollower.com</description>
			<content:encoded><![CDATA[<p>Mindless Follower has moved to a new domain. And has changed names. A lot has changed. But for the better. The new site is called Mindless Follower, and is located at <a href='http://www.mindlessfollower.com'>MindlessFollower.com</a>.</p><p>This site will be regularly updated, covering all-things-web-development. If you are subscribing to this blog be sure to update your RSS feed. The link to the new feed is available on the new site.</p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/gKfaymqdLws" height="1" width="1"/>]]></content:encoded>
			<pubDate>Sun, 18 Jul 2010 07:41:55 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?New_Site</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?New_Site</feedburner:origLink></item>
		<item>
			<title>Applying CSS to Any Custom HTML Tag</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/hwYORz_oii8/</link>
			<description>There is a really great screencast available at Nettuts+ which demonstrates how you can 'make all browsers render HTML5 mark-up correctly.' It is a really simple trick that allows you to apply CSS for HTML5 elements.To quickly cover what Jeffrey Way (the editor of Nettuts+) discussed, HTML5 has certain tags like &amp;lt;header&amp;gt; that are not standard in HTML4. Certain browsers like Chrome or Firefox are up-to-date and will consider this a valid element. Thus, it will then accept CSS statements for the &amp;lt;header&amp;gt; tag.IE will show text within &amp;lt;header&amp;gt; but will not reflect anything written in the CSS for &amp;lt;header&amp;gt;. This is because it does not consider &amp;lt;header&amp;gt; a valid element and, more or less, ignores it.In this post I discuss how Way goes about solving this problem, and how it can be extended further.</description>
			<content:encoded><![CDATA[<p>There is <a href="http://net.tutsplus.com/videos/screencasts/how-to-make-all-browsers-render-html5-mark-up-correctly-screencast/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed:+nettuts+(NETTUTS)">a really great screencast</a> available at <a href="http://net.tutsplus.com/">Nettuts+</a> which demonstrates how you can 'make all browsers render HTML5 mark-up correctly.' It is a really simple trick that allows you to apply CSS for HTML5 elements.<br><br>To quickly cover what <a href="http://jeffrey-way.com/">Jeffrey Way</a> (the editor of Nettuts+) discussed, HTML5 has certain tags like &lt;header&gt; that are not standard in HTML4. Certain browsers like Chrome or Firefox are up-to-date and will consider this a valid element. Thus, it will then accept CSS statements for the &lt;header&gt; tag. So something like the following will be accepted:<br><br><code>header <span style="color: #00AA00;">&#123;</span><br />
     <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">40px</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#171717</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></code><br>IE will show text within &lt;header&gt; but will not reflect anything written above. This is because it does not consider &lt;header&gt; a valid element and, more or less, ignores it.<br><br>To fix that Way shows that putting the following JavaScript in the header solves this problem:<br><br><code>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'header'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>You don't even have to inject the element into the page. Simply creating a DOM node with the &lt;header&gt; tag name creates a valid reference to such a tag in the browser's rendering engine. So, now the CSS for header applies. As he points out the one downfall is that the user must have JavaScript enabled.<br><br>Now this is where it gets interesting. Say you want to throw in your own tag names. Let's say something like the following:<br><br><code><span style="color: #009900;">&lt;cloud&gt;</span><br />
     <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span> Sample Text <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>cloud&gt;</span></code><br>And with the following CSS:<br><br><code>cloud <span style="color: #00AA00;">&#123;</span><br />
     <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">40px</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span>gold<span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#171717</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></code><br>Now you have the same problem you had with HTML5 elements and CSS. This will work in Chrome and Firefox but not IE. And the same solution works:<br><br><code>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cloud'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>This, placed in the header, fixes the CSS in IE. So you can throw custom-named tags into the document and have they styled as you wish.<br></p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/hwYORz_oii8" height="1" width="1"/>]]></content:encoded>
			<pubDate>Thu, 21 Jan 2010 13:27:35 -0500</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Applying_CSS_to_Any_Custom_HTML_Tag</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Applying_CSS_to_Any_Custom_HTML_Tag</feedburner:origLink></item>
		<item>
			<title>Working with Elements in Deft</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/awVOiEGdEsk/</link>
			<description>Lately I've been working on a personal project, Deft, which is a JavaScript framework. Like everyone else I've been using existing frameworks to develop with. But over time I have gained a better understanding of the language and an idea of what methods a framework should offer. Deft is my effort to bring that idea to reality.The following is an extremely quick glimpse of the functionality offered by Deft-0.5.js, an early build. In this post I will be focusing on working with elements. The framework is not complete so there will be more to come. But there is already a great deal of functionality.$&amp;#40;'header'&amp;#41;
     .attr&amp;#40;'style', &amp;#123;
          'color': 'red',
          'font-weight': 'bold'
     &amp;#125;&amp;#41;
     .$&amp;#40;'nav'&amp;#41;
          .attr&amp;#40;'style', &amp;#123;
               'opacity': 0.5
          &amp;#125;&amp;#41;
     .back&amp;#40;&amp;#41;
     .addClass&amp;#40;'ready'&amp;#41;;In this example the element with an ID of 'header' is selected and its color and font-weight styles are set. An element within 'header' with an ID of 'nav' is then selected and a 50% opacity is applied. The chain then uses back() which returns to $('header') to which we end with adding a class of 'ready.'</description>
			<content:encoded><![CDATA[<p>Lately I've been working on a personal project, <a href="http://www.deftjs.com/">Deft</a>, which is a JavaScript framework. Like everyone else I've been using <a href="http://mootools.net/">existing</a> <a href="http://jquery.com/">frameworks</a> to develop with. But over time I have gained a better understanding of the language and an idea of what methods a framework should offer. Deft is my effort to bring that idea to reality.<br><br>The following is an extremely quick glimpse of the functionality offered by <a href="http://www.deftjs.com/_js/deft-0.5.js">Deft-0.5.js</a>, an early build. In this post I will be focusing on working with elements. The framework is not complete so there will be more to come. But there is already a great deal of functionality.<br><br><code>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'header'</span><span style="color: #009900;">&#41;</span><br />
     .<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'style'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><br />
          <span style="color: #3366CC;">'color'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'red'</span><span style="color: #339933;">,</span><br />
          <span style="color: #3366CC;">'font-weight'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'bold'</span><br />
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><br />
     .$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'nav'</span><span style="color: #009900;">&#41;</span><br />
          .<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'style'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><br />
               <span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">0.5</span><br />
          <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><br />
     .<span style="color: #000066;">back</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
     .<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ready'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>In this example the element with an ID of 'header' is selected and its color and font-weight styles are set. An element within 'header' with an ID of 'nav' is then selected and a 50% opacity is applied. The chain then uses back() which returns to $('header') to which we end with adding a class of 'ready.' <br><br><code>$$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'span.good'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     o.<span style="color: #660066;">identify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>In this example all spans with a class of 'good' are selected. We then loop through them and use identify() to assign a unique ID if one does not already exist.<br><br><code>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'nav'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">purge</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>In this example the element with an ID of 'nav' is removed.<br><br><code>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'dataset'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">store</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'limit'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">15</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'dataset'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">store</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
     page<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><br />
     useFilter<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'dataset'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'limit'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// alerts '15'</span><br />
<br />
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'dataset'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'useFilter'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// alerts 'false'</span></code><br>Above is a quick overview of how to store information in an element and fetch it later when needed.</p><p>&nbsp;</p><p>If you are interested in taking a deeper look at the framework be sure to look at the <a href="http://www.deftjs.com/">official website</a>. Right now the site is pretty basic. A blog and documentation section are in the works.</p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/awVOiEGdEsk" height="1" width="1"/>]]></content:encoded>
			<pubDate>Sun, 29 Nov 2009 16:16:48 -0500</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Working_with_Elements_in_Deft</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Working_with_Elements_in_Deft</feedburner:origLink></item>
		<item>
			<title>Good SEO Practices</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/Vd2gEMxaFqQ/</link>
			<description>Search Engine Optimization (SEO) is an interesting topic. There are a lot of ways people claim you can improve your search results. Some of them work. Some just don't. The problem is that there is one real search engine everyone always focuses on; Google. And Google is pretty secretive about how they rank websites. At first their algorithms were pretty straight-forward. If you linked to a bunch of other sites and inject hordes of keywords in your &amp;lt;body&amp;gt; then you would likely move upward in ranking. But then black-hat search engine optimizers figured out that Google was doing this. These optimizers began to use it to their advantage. You may recall, years ago, coming across a page that seemed to have an obscene amount of 'dead space' at the bottom of the page. These optimizers would place large amounts of keywords usually using the same color as the background to hide them. Long story short Google has continually caught on to optimizers taking advantage of their ranking algorithms and have tweaked them to avoid these types of situations, thus enforcing legitimate results. So, over time Google has become very cryptic as to how they rank sites. By leaving optimizers in the dark they are avoiding any misuse of their service. Yet, there are some well-known ways in which you can improve your pages to improve their ranking. This is what I will be covering for the remainder of this post.</description>
			<content:encoded><![CDATA[<p>Search Engine Optimization (SEO) is an interesting topic. There are a lot of ways people claim you can improve your search results. Some of them work. Some just don't. The problem is that there is one real search engine everyone always focuses on; Google. And Google is pretty secretive about how they rank websites.<br><br>At first their algorithms were pretty straight-forward. If you linked to a bunch of other sites and inject hordes of keywords in your &lt;body&gt; then you would likely move upward in ranking. But then black-hat search engine optimizers figured out that Google was doing this. These optimizers began to use it to their advantage. You may recall, years ago, coming across a page that seemed to have an obscene amount of 'dead space' at the bottom of the page. These optimizers would place large amounts of keywords usually using the same color as the background to hide them.<br><br>Long story short Google has continually caught on to optimizers taking advantage of their ranking algorithms and have tweaked them to avoid these types of situations, thus enforcing legitimate results. So, over time Google has become very cryptic as to how they rank sites. By leaving optimizers in the dark they are avoiding any misuse of their service. Yet, there are some well-known ways in which you can improve your pages to improve their ranking. This is what I will be covering for the remainder of this post.<br><br></p><h3>Content is King</h3><br><br>Content is and always will be king. Remember that. There is no better way to improve your ranking. If your page does not have much to it then it will fall behind. If you are making a site for yourself, or your business, then be sure to put a good amount of content on it. If you are designing a page for a client you should educate them of this fact, since they will likely be responsible for filling in the blanks.<br><br>This does not mean that you should fill your page with garbage. You want there to be a good amount of content but it should be of high quality and related to the website. Also, a blog is always a good way to add content to a site. If you ever use a service like <a href="http://websitegrader.com/">HubSpot's Website Grader</a> you will see a check for a blog on your site. It is arguable if Google cares that you have a blog but it is true that a blog will help in respect to content.<br><br><h3>Hiding Text via text-indent</h3><br><br>Developers often put icons or logos on a site by using a &lt;div&gt; or &lt;span&gt; and then employing CSS to set its height, width and background to match that of the image. To the user this works well. But as Google's web spider crawls your page it doesn't take into account any CSS. So what the &lt;div&gt; does not benefit the page in terms of ranking.<br><br>Now, let's say that you have this &lt;div&gt; at the top of your page and it displays a company logo. You could put the company name within the &lt;div&gt; so that Google recognizes it. While doing this give the &lt;div&gt; a class that will be used to hide the text from users.<br><br><code><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'logo'</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'notext'</span>&gt;</span>Company Name Here<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></code><br>Now for the CSS that does the hiding (the class of 'notext'):<br><br><code><span style="color: #cc00cc;">#logo</span> <span style="color: #00AA00;">&#123;</span><br />
     <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span><br />
     <span style="color: #000000; font-weight: bold;">background</span><span style="color: #3333ff;">:<span style="color: #993333;">transparent</span> </span>url<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">logo.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.notext</span> <span style="color: #00AA00;">&#123;</span><br />
    <span style="color: #000000; font-weight: bold;">text-indent</span><span style="color: #00AA00;">:</span><span style="color: #933;">-9999px</span><span style="color: #00AA00;">;</span><br />
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></code><br>The text-indent of -9999px bumps the text way to the left, setting it off of the viewable page. This works on all browsers. The text color of transparent is not really needed, and doesn't work in some browsers like IE. I usually add it in as an extra precaution.<br><br><h3>Domain Expiration</h3><br><br>This one is a bit arguable, but I do believe it helps. Many people suggest that if your domain is set to expire within a year then search engines like Google will rank it lower since the chance of the site becoming unavailable is greater. Correcting this is pretty straight forward. Make sure your domain is renewed for a number of years.<br><br><h3>Meta Tags</h3><br><br>Meta tags are interesting. Some are important, others are not. To start, consider the title tag. Your title tag is important to your ranking. It should be short and sweet. One problem I see all too often is a website putting its name first on all page titles. If you go to the blog on Pushing Buttons the title should not be "Pushing Buttons - Blog." It should just be "Blog." Search engines, as well as the users doing the searching, can tell what site they are looking at. You don't have to throw it at them every time.<br><br>The description tag is also useful. Honestly I'm not sure to what degree Google cares about it. But it should still be taken seriously since users using Google will see it displayed under the page title. And SEO doesn't mean anything if it doesn't pull in users.<br><br>As for the keyword tag, <a href="http://mashable.com/2009/09/21/google-meta-keywords/">Google has stated that they do not take this into account</a>. For a very long time optimizers pushed use of the keyword tag. Now that Google has stated their position it has changed drastically. I continue to use the tag at times but knowing that Google doesn't use it and users never see it gives me little to no incentive.<br><br><h3>Use Headers Properly</h3><br><br>Use header tags (&lt;h1&gt; through &lt;h6&gt;) properly. You should never have more than one &lt;h1&gt; tag on a page. Having multiple brings the strength of it down severely. I usually set the website name or company name as an &lt;h1&gt;.<br><br>From &lt;h2&gt; to &lt;h6&gt; you can add multiple occurrences. Any major headers should be an &lt;h2&gt;, sub-headers should be an &lt;h3&gt; and so on.<br><br><h3>Link Building</h3><br><br>I usually find this the most useful when writing a blog. But you cannot force clients to do this on their own posts. When writing a post, or even on a normal page, you should wrap any text referencing a company or website with a link to it. Search engines will detect that the links are relevant to your content, thus improving your content's relevancy, thus improving your ranking.<br><h3><br>Avoid Flash</h3><br><br>Until recently search engines could not crawl through flash (or similar) content. Google has added support for crawling flash but it still does not compare to traditional content. Flash should be left to banners and other features that annoyingly alienate users.<br><br><h3>Keep Content Fresh</h3><br><br>Another aspect that Google takes into account is how often your site is updated. If you have a blog but never write any posts Google will gradually decrease the time between crawls. Since Google has a lot of sites it must crawl it chooses to crawl sites that change often more often.<br><br>So if you have a website and never update it then Google will take its sweet time to check back in. Let's say you then make a big update and you really want it to reach your audience. Since Google has put you late in the queue you will have to wait some time. If you had been making periodical additions to your site then you really wouldn't have to wait long for it to show up on results.<br><br>Another point to stress is that if you put up a "coming soon" or "under construction" landing page that is static for a long period of time Google will consider the site to be dead. Then when you launch the actual site it will take a bit of time for Google to regain its trust and check for updates regularly. Some optimizers argue that you should avoid using these landing pages altogether, and that no page is better than a "coming soon" page.<br><br>If your page has been static for a long period of time and you do make an update you can also re-submit your site to Google. This will likely bring you upward in the crawl queue, but it will not correct the issue altogether.<img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/Vd2gEMxaFqQ" height="1" width="1"/>]]></content:encoded>
			<pubDate>Fri, 13 Nov 2009 08:32:45 -0500</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Good_SEO_Practices</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Good_SEO_Practices</feedburner:origLink></item>
		<item>
			<title>How to trim() in JavaScript</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/h-MsTMY0gn8/</link>
			<description>String trimming has become a standard in APIs. In JavaScript there is no standard method to do this. So, most libraries like jQuery and MooTools add in their own trim functionality. Adding a simple trim method is easy. All you need is the following code:String.prototype.trim = function&amp;#40;&amp;#41; &amp;#123;
     return this.replace&amp;#40;/^\s*|\s*$/g, ''&amp;#41;;
&amp;#125;; Now you can do the following:&amp;quot;     asdf    &amp;quot;.trim&amp;#40;&amp;#41;;
// &amp;quot;asdf&amp;quot;

&amp;quot;asdf&amp;quot;.trim&amp;#40;&amp;#41;;
// &amp;quot;asdf&amp;quot; This proves really useful. But it could be better. In PHP you can send an optional second parameter to their trim function that allows you to define characters to be trimmed. By default the function trims white space.</description>
			<content:encoded><![CDATA[<p>String trimming has become a standard in APIs. In JavaScript there is no standard method to do this. So, most libraries like <a href="http://jquery.com/">jQuery</a> and <a href="http://mootools.net/">MooTools</a> add in their own trim functionality.<br><br>Adding a simple trim method is easy. All you need is the following code:<br><br><code>String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">trim</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^\s*|\s*$/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></code><br>Now you can do the following:<br><br><code><span style="color: #3366CC;">&quot;     asdf    &quot;</span>.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;asdf&quot;</span><br />
<br />
<span style="color: #3366CC;">&quot;asdf&quot;</span>.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;asdf&quot;</span></code><br>This proves really useful. But it could be better. In PHP you can send an optional second parameter to <a href="http://php.net/manual/en/function.trim.php">their trim function</a> that allows you to define characters to be trimmed. By default the function trims white space.<br><br>You can implement a few String prototypes in JavaScript to achieve similar results. Though, instead of sending a string of characters to be trimmed as in PHP you can send a regular expression to the trimming methods to be applied.<br><br><code>String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">ltrim</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>what<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>arguments.<span style="color: #660066;">length</span> <span style="color: #339933;">===</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><br />
          <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^\s*/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     what <span style="color: #339933;">=</span> what.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     what <span style="color: #339933;">=</span> what.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> what.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     what <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'^['</span> <span style="color: #339933;">+</span> what <span style="color: #339933;">+</span> <span style="color: #3366CC;">']*'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'g'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span>what<span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">rtrim</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>what<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>arguments.<span style="color: #660066;">length</span> <span style="color: #339933;">===</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><br />
          <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s*$/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     what <span style="color: #339933;">=</span> what.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     what <span style="color: #339933;">=</span> what.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> what.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     what <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'['</span> <span style="color: #339933;">+</span> what <span style="color: #339933;">+</span> <span style="color: #3366CC;">']*$'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'g'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span>what<span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">trim</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>what<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><br />
          .<span style="color: #660066;">ltrim</span><span style="color: #009900;">&#40;</span>what<span style="color: #009900;">&#41;</span><br />
          .<span style="color: #660066;">rtrim</span><span style="color: #009900;">&#40;</span>what<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></code><br>This allows you to do the following:<br><br><code><span style="color: #3366CC;">&quot;    Pushing Buttons    &quot;</span>.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;Pushing Buttons&quot;</span><br />
<br />
<span style="color: #3366CC;">&quot;    Pushing Buttons    &quot;</span>.<span style="color: #660066;">ltrim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;Pushing Buttons    &quot;</span><br />
<br />
<span style="color: #3366CC;">&quot;    Pushing Buttons    &quot;</span>.<span style="color: #660066;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;    Pushing Buttons&quot;</span><br />
<br />
<span style="color: #3366CC;">&quot;    november    &quot;</span>.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s/</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;november&quot;</span><br />
<br />
<span style="color: #3366CC;">&quot;    november    &quot;</span>.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s|n|o|r/</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;vembe&quot;</span><br />
<br />
<span style="color: #3366CC;">&quot;designed&quot;</span>.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/d|e/</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;sign&quot;</span><br />
<br />
<span style="color: #3366CC;">&quot;designed&quot;</span>.<span style="color: #660066;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/d|e/</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;design&quot;</span><br />
<br />
<span style="color: #3366CC;">&quot;Late2009&quot;</span>.<span style="color: #660066;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\d/</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// &quot;Late&quot;</span></code></p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/h-MsTMY0gn8" height="1" width="1"/>]]></content:encoded>
			<pubDate>Tue, 10 Nov 2009 12:30:00 -0500</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?How_to_trim_in_JavaScript</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?How_to_trim_in_JavaScript</feedburner:origLink></item>
		<item>
			<title>Array Has Function in ASP</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/fg8rHAZMw9Y/</link>
			<description>I'm often stuck working with ASP and wishing I were working with PHP. PHP has a great deal of methods available that make life a lot easier. And in ASP you find yourself writing custom functions to do something that would be trivial in a better language.Checking to see if a value exists within an array is one example. ASP does not offer any quick or easy solution. In fact, ASP is pretty much a nightmare when it comes to working with arrays. It's usually easier to use scripting dictionaries.</description>
			<content:encoded><![CDATA[<p>I'm often stuck working with ASP and wishing I were working with PHP. PHP has a great deal of methods available that make life a lot easier. And in ASP you find yourself writing custom functions to do something that would be trivial in a better language.<br><br>Checking to see if a value exists within an array is one example. ASP does not offer any quick or easy solution. In fact, ASP is pretty much a nightmare when it comes to working with arrays. It's usually easier to use scripting dictionaries.<br><br>In order to check an array for a given value you can implement the following function.<br><br><code><span style="color: #0000ff; font-weight: bold;">Function</span> has<span style="color: #006600; font-weight:bold;">&#40;</span>arr, val<span style="color: #006600; font-weight:bold;">&#41;</span><br />
     has <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #0000ff; font-weight: bold;">False</span><br />
     <span style="color: #990099; font-weight: bold;">dim</span> v <span style="color: #006600; font-weight: bold;">:</span> <span style="color: #990099; font-weight: bold;">For</span> <span style="color: #990099; font-weight: bold;">Each</span> v <span style="color: #990099; font-weight: bold;">In</span> arr<br />
          <span style="color: #990099; font-weight: bold;">If</span> val <span style="color: #006600; font-weight: bold;">=</span> v <span style="color: #990099; font-weight: bold;">Then</span><br />
               has <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #0000ff; font-weight: bold;">True</span><br />
          <span style="color: #990099; font-weight: bold;">End</span> <span style="color: #990099; font-weight: bold;">If</span><br />
     <span style="color: #990099; font-weight: bold;">Next</span><br />
<span style="color: #990099; font-weight: bold;">End</span> <span style="color: #0000ff; font-weight: bold;">Function</span></code><br>Now you can do the following.<br><br><code><span style="color: #990099; font-weight: bold;">If</span> has<span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #330066;">Array</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #800000;">2</span>, <span style="color: #800000;">4</span>, <span style="color: #800000;">6</span>, <span style="color: #800000;">8</span><span style="color: #006600; font-weight:bold;">&#41;</span>, <span style="color: #800000;">4</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #0000ff; font-weight: bold;">True</span> <span style="color: #990099; font-weight: bold;">Then</span><br />
     <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span> <span style="color: #cc0000;">&quot;Hello&quot;</span><br />
<span style="color: #990099; font-weight: bold;">End</span> <span style="color: #990099; font-weight: bold;">If</span><br />
<span style="color: #008000;">' Will write &quot;Hello&quot;</span><br />
<br />
<span style="color: #990099; font-weight: bold;">If</span> has<span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #330066;">Array</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #800000;">1</span>, <span style="color: #800000;">3</span>, <span style="color: #800000;">5</span>, <span style="color: #800000;">7</span>, <span style="color: #800000;">9</span><span style="color: #006600; font-weight:bold;">&#41;</span>, <span style="color: #800000;">4</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #0000ff; font-weight: bold;">True</span> <span style="color: #990099; font-weight: bold;">Then</span><br />
     <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span> <span style="color: #cc0000;">&quot;World!&quot;</span><br />
<span style="color: #990099; font-weight: bold;">End</span> <span style="color: #990099; font-weight: bold;">If</span><br />
<span style="color: #008000;">' Will not write</span></code><br>This makes If statements a lot cleaner and easier to work with.<br></p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/fg8rHAZMw9Y" height="1" width="1"/>]]></content:encoded>
			<pubDate>Mon, 19 Oct 2009 08:04:09 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Array_Has_Function_in_ASP</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Array_Has_Function_in_ASP</feedburner:origLink></item>
		<item>
			<title>Eight Great Photoshop Tutorials</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/dchekb4241M/</link>
			<description>A quick list of eight extremely useful and fun Photoshop tutorials. Including how to correct banding, creating inset typography, applying the tilt-shift technique and how to create a clean modern website design.Check them out!</description>
			<content:encoded><![CDATA[<p>Here is a list of eight really useful and fun Photoshop tutorials.<br><br></p><h3><a href="http://sixrevisions.com/tutorials/photoshop-tutorials/how-to-create-inset-typography-in-photoshop/">Create Inset Typography</a></h3><a href="http://sixrevisions.com/tutorials/photoshop-tutorials/how-to-create-inset-typography-in-photoshop/"><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/tuts/1/insetTyp.jpg" alt=""></a><br><br><h3><a href="http://slodive.com/photoshop/how-to-correct-banding-in-your-gradients-using-photoshop/">Correct Banding in Your Gradients</a></h3><a href="http://slodive.com/photoshop/how-to-correct-banding-in-your-gradients-using-photoshop/"><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/tuts/1/banding.jpg" alt=""></a><br><br><h3><a href="http://line25.com/tutorials/create-a-clean-modern-website-design-in-photoshop">Create a Clean Modern Website Design</a></h3><a href="http://line25.com/tutorials/create-a-clean-modern-website-design-in-photoshop"><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/tuts/1/cleanmodernsite.jpg" alt=""></a><br><br><h3><a href="http://abduzeedo.com/awesome-digital-bokeh-effect-photoshop">Awesome Digital Bokeh Effect</a></h3><a href="http://abduzeedo.com/awesome-digital-bokeh-effect-photoshop"><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/tuts/1/bokeh.jpg" alt=""></a><br><br><h3><a href="http://digital-photography-school.com/how-to-make-digital-photos-look-like-lomo-photography">Make Digital Photos Look Like Lomo Photography</a></h3><a href="http://digital-photography-school.com/how-to-make-digital-photos-look-like-lomo-photography"><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/tuts/1/lomoPhoto.jpg" alt=""></a><br><br><h3><a href="http://www.photographyjam.com/articles/52/the-tilt-shift-miniature-fake-technique-in-photoshop-cs-a-simple-how-to">The Tilt-Shift Technique</a></h3><a href="http://www.photographyjam.com/articles/52/the-tilt-shift-miniature-fake-technique-in-photoshop-cs-a-simple-how-to"><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/tuts/1/tiltShift.jpg" alt=""></a><br><br><h3><a href="http://www.photoshopessentials.com/photo-effects/infrared-photo/">Ifrared Photo Effect</a></h3><a href="http://www.photoshopessentials.com/photo-effects/infrared-photo/"><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/tuts/1/infrared.jpg" alt=""></a><br><br><h3><a href="http://www.photoshoplady.com/tutorial/3d-pixel-stretch-effects/584">3D Pixel Stretch Effect</a></h3><a href="http://www.photoshoplady.com/tutorial/3d-pixel-stretch-effects/584"><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/tuts/1/pixelStretch.jpg" alt=""></a><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/dchekb4241M" height="1" width="1"/>]]></content:encoded>
			<pubDate>Fri, 16 Oct 2009 07:45:32 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Eight_Great_Photoshop_Tutorials</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Eight_Great_Photoshop_Tutorials</feedburner:origLink></item>
		<item>
			<title>Array.insensitiveSort in MooTools</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/oWK77yDOx_g/</link>
			<description>In JavaScript there is a sort function for arrays. Though, the result will take into account the case of each character. Therefore you can have something like the following happen.var a = &amp;#91;&amp;quot;john&amp;quot;, &amp;quot;April&amp;quot;, &amp;quot;tim&amp;quot;, &amp;quot;Zoe&amp;quot;&amp;#93;;

a = a.sort&amp;#40;&amp;#41;;

// a is now [&amp;quot;April&amp;quot;, &amp;quot;Zoe&amp;quot;, &amp;quot;john&amp;quot;, &amp;quot;tim&amp;quot;]Using MooTools you add a method to the Array object which will allow you to sort while being insensitive to case.</description>
			<content:encoded><![CDATA[<p>In JavaScript there is a <a href="http://www.w3schools.com/jsref/jsref_sort.asp">sort</a> function for arrays. Though, the result will take into account the case of each character. Therefore you can have something like the following happen.<br><br><code><span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;john&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;April&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;tim&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Zoe&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
a <span style="color: #339933;">=</span> a.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #006600; font-style: italic;">// a is now [&quot;April&quot;, &quot;Zoe&quot;, &quot;john&quot;, &quot;tim&quot;]</span></code><br>Using MooTools you add a method to the <a href="http://mootools.net/docs/core/Native/Array">Array object</a> which will allow you to sort while being insensitive to case.<br><br><code>Array.<span style="color: #660066;">implement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
     insensitiveSort<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
          <span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> tmp <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> tmpH <span style="color: #339933;">=</span> $H<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
          <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
               tmp.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>val.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
               tmpH.<span style="color: #660066;">include</span><span style="color: #009900;">&#40;</span>val<span style="color: #339933;">,</span> val.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
          <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
          tmp <span style="color: #339933;">=</span> tmp.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
          tmp.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
               result.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>tmpH.<span style="color: #660066;">keyOf</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
          <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
          <span style="color: #000066; font-weight: bold;">return</span> result<span style="color: #339933;">;</span><br />
      <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>Now you can do the following.<br><br><code><span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;john&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;April&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;tim&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Zoe&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
a <span style="color: #339933;">=</span> a.<span style="color: #660066;">insensitiveSort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #006600; font-style: italic;">// a is now [&quot;April&quot;, &quot;john&quot;, &quot;tim&quot;, &quot;Zoe&quot;]</span></code></p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/oWK77yDOx_g" height="1" width="1"/>]]></content:encoded>
			<pubDate>Fri, 09 Oct 2009 08:13:51 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?ArrayinsensitiveSort_in_MooTools</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?ArrayinsensitiveSort_in_MooTools</feedburner:origLink></item>
		<item>
			<title>Transparent GIFs in IE6</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/5omcGbq4Flg/</link>
			<description>IE6 is a constant burden for web developers. It really is impressive to see how many ways it continues to aggravate. To put it lightly, it is the devil.One common issue is the lack of support for transparency in images. Most web developers would prefer to use PNG images while dealing with transparency. Just about every browser, including later versions of IE, support transparency in this image format. With the exception of IE6. IE6 will display the PNG with gray where the transparency should be.There are a number of ways to get around this. Such as the popular belated PNG script which applies a filter to the image to resolve the issue. One problem with this script is that visitors will still see gray until the script runs and re-renders the images, causing a flicker effect. There is also the PNG Alpha Fix script which takes a similar approach, but uses an htc file.Sometimes it's easier to use GIF images to get things looking right in IE6. Yet, IE6 has its issues with this format as well. When rendering the image it will decide if pixels are completely opaque or completely transparent. If you want certain pixels to have 50% transparency you will run into this problem. It causes the images to look blocky, as if traced.</description>
			<content:encoded><![CDATA[<p>IE6 is a constant burden for web developers. It really is impressive to see how many ways it continues to aggravate. To put it lightly, it is the devil.<br><br>One common issue is the lack of support for transparency in images. Most web developers would prefer to use PNG images while dealing with transparency. Just about every browser, including later versions of IE, support transparency in this image format. With the exception of IE6. IE6 will display the PNG with gray where the transparency should be.<br><br>There are a number of ways to get around this. Such as the popular <a href="http://www.dillerdesign.com/experiment/DD_belatedPNG/">belated PNG script</a> which applies a filter to the image to resolve the issue. One problem with this script is that visitors will still see gray until the script runs and re-renders the images, causing a flicker effect. There is also the <a href="http://www.twinhelix.com/css/iepngfix/">PNG Alpha Fix script</a> which takes a similar approach, but uses an htc file.<br><br>Sometimes it's easier to use GIF images to get things looking right in IE6. Yet, IE6 has its issues with this format as well. When rendering the image it will decide if pixels are completely opaque or completely transparent. If you want certain pixels to have 50% transparency you will run into this problem. It causes the images to look blocky, as if traced.<br><br>So, what I normally do is take the PNG and convert it to a GIF while attempting to preserve the partly transparent portions as much as possible. Let's assume you are going to be placing the GIF in an area with a consistent color scheme. For simplicity we will assume this background is white.</p><p>&nbsp;</p><p>Let's say we have the following PNG.</p><p>&nbsp;</p><p><img src="http://assets.pushingbuttons.net/_img/ps_tuts/pngtogif/star.jpg" alt=""></p><p><br>First open your PNG in Photoshop.</p><p>&nbsp;</p><p><img src="http://assets.pushingbuttons.net/_img/ps_tuts/pngtogif/starstep1.jpg" alt=""></p><p>&nbsp;</p><p>Now make a new layer, beneath the original, filled with the expected background color (in this case white).</p><p>&nbsp;</p><p><img src="http://assets.pushingbuttons.net/_img/ps_tuts/pngtogif/starstep2.jpg" alt=""></p><br>After merging the two layers zoom into the image so that you can work on a pixel by pixel basis.<br><br><p><img src="http://assets.pushingbuttons.net/_img/ps_tuts/pngtogif/starstep3.jpg" alt=""></p><br>Add a vector mask to the layer. We will use this to get rid of as much background as possible. I like to create a new layer, filled with something vibrant like red, and place it beneath the main layer. This way it is easier to see what pixels have been erased. Now select vector mask and use the pencil (1px block, 100% opaque) to hide as much as the background as possible. In this case we will hide any white or nearly white pixels.<br><br><p><img src="http://assets.pushingbuttons.net/_img/ps_tuts/pngtogif/starstep4.jpg" alt=""></p><br>Once finished with the vector mask hide the red layer (if you had added it) and save the image as a GIF. When you add it onto of an area with the expected color you should not see the blocky effect.<br><br><p><img src="http://assets.pushingbuttons.net/_img/ps_tuts/pngtogif/starresult1.jpg" alt=""></p><br>This will also work well on top of a gradient, as long as the gradient is not too severe.<br><br><p><img src="http://assets.pushingbuttons.net/_img/ps_tuts/pngtogif/starresult2.jpg" alt=""></p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/5omcGbq4Flg" height="1" width="1"/>]]></content:encoded>
			<pubDate>Wed, 07 Oct 2009 14:00:45 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Transparent_GIFs_in_IE6</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Transparent_GIFs_in_IE6</feedburner:origLink></item>
		<item>
			<title>Easy Rounded Edges in Photoshop</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/NBA6KXFO8gA/</link>
			<description>There are several methods you can use to create rounded edges in Photoshop. This is a step-by-step guide on how to quickly and easily create rounded edges in Photoshop.First start off by creating a new document. I created a 400 by 400 pixel document, and set the initial layer to white.</description>
			<content:encoded><![CDATA[<p>There are several methods you can use to create rounded edges in Photoshop. This is a step-by-step guide on how to quickly and easily create rounded edges in Photoshop.<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step1.jpg" alt=""><br>First start off by creating a new document. I created a 400 by 400 pixel document, and set the initial layer to white.<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step2.jpg" alt=""><br>Now create the shape you will want rounded. Add this as its own layer. In this example I've created a 200 by 200 pixel square. The layer should be all black, which you can change later using layer masks.<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step3.jpg" alt=""><br>Add guides around your object (this part is easy if it's a rectangle). Now, assuming that I want a five pixel radius for my edge I have added guides accordingly.<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step4.jpg" alt=""><br>The next step is to erase the content between the guides. If you are rounding a shape that is not as easy to do this with then you can do the following instead: Right click on the layer and select "Select Pixels." Then go to Select &rsaquo; Modify &rsaquo; Contract. Enter the amount of pixels, in this case five. Now invert your selection by pressing Shift + Ctrl + I (windows) or Shift + Cmd + I (OS X). Delete the selection.<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step5.jpg" alt=""><br>Now right click on the layer and select "Blending Options."<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step6.jpg" alt=""><br>Add a five pixel (or your own size) stroke to the layer using black.<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step6c.jpg" alt=""><br>Create a new blank layer and merge it with the layer containing your rounded shape.<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step7.jpg" alt=""><br>This will result in a layer containing your rounded shape without any blending options / effects applied.<br><br><img src="http://assets.pushingbuttons.net/_img/ps_tuts/rounded_edges/step8.jpg" alt=""><br>The best part is that your rounded edges are anti-aliased.</p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/NBA6KXFO8gA" height="1" width="1"/>]]></content:encoded>
			<pubDate>Tue, 29 Sep 2009 11:20:26 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Easy_Rounded_Edges_in_Photoshop</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Easy_Rounded_Edges_in_Photoshop</feedburner:origLink></item>
		<item>
			<title>An Introduction to JavaScript Functions</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/eS8yo6lObWY/</link>
			<description>I often notice web developers misunderstanding the syntax of JavaScript functions. Even after a few years of experience. It can be a bit difficult to understand the different ways in which you can implement functions. Take a look at the following code.function addOne&amp;#40;val&amp;#41; &amp;#123;
     return val + 1;
&amp;#125;

var addTwo = function&amp;#40;val&amp;#41; &amp;#123;
     return val + 2;
&amp;#125;;

window.addThree = function&amp;#40;val&amp;#41; &amp;#123;
     return val + 3;
&amp;#125;;

window&amp;#91;&amp;quot;addFour&amp;quot;&amp;#93; = function&amp;#40;val&amp;#41; &amp;#123;
     return val + 4;
&amp;#125;;All of these will work. The first declaration, for addOne, is usually the most familiar. It is pretty straight-forward. The declaration of addTwo achieves the same end result. You start by defining a variable, addTwo. Then you set addTwo equal to a function. In both cases you end up with a variable which are set equal to a function.With addThree we are setting window.addThree equal to a function. In reality, window.addOne and window.addTwo are already set as well. You can think of window as the root object in which all else stem from.The declaration of addFour is virtually the same as addThree except that you are using a slightly different syntax to define the child node of the window object.</description>
			<content:encoded><![CDATA[<p>I often notice web developers misunderstanding the syntax of JavaScript functions. Even after a few years of experience. It can be a bit difficult to understand the different ways in which you can implement functions. Take a look at the following code.<br><br><code><span style="color: #003366; font-weight: bold;">function</span> addOne<span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000066; font-weight: bold;">return</span> val <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> addTwo <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000066; font-weight: bold;">return</span> val <span style="color: #339933;">+</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
window.<span style="color: #660066;">addThree</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000066; font-weight: bold;">return</span> val <span style="color: #339933;">+</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;addFour&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000066; font-weight: bold;">return</span> val <span style="color: #339933;">+</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></code><br>All of these will work. The first declaration, for <strong>addOne</strong>, is usually the most familiar. It is pretty straight-forward. The declaration of <strong>addTwo</strong> achieves the same end result. You start by defining a variable, <strong>addTwo</strong>. Then you set <strong>addTwo</strong> equal to a function. In both cases you end up with a variable which are set equal to a function.<br><br>With <strong>addThree</strong> we are setting <strong>window.addThree</strong> equal to a function. In reality, <strong>window.addOne</strong> and <strong>window.addTwo</strong> are already set as well. You can think of <strong>window</strong> as the root object in which all else stem from.<br><br>The declaration of <strong>addFour</strong> is virtually the same as <strong>addThree</strong> except that you are using a slightly different syntax to define the child node of the <strong>window</strong> object.<br><br>It is important to know that these functions are considered <em>named</em> function since they are assigned to variables and can be called later in your code. If you do not assign a variable name to a function then the function is considered <em>anonymous</em>. As in the following example.<br><br><code><span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span><br />
<br />
x <span style="color: #339933;">=</span> addOne<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// x = 1</span><br />
<br />
x <span style="color: #339933;">=</span> addTwo<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// x = 3</span><br />
<br />
x <span style="color: #339933;">=</span> addThree<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// x = 6</span><br />
<br />
x <span style="color: #339933;">=</span> addFour<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// x = 10</span></code><br>You can also add functions as members of an object.<br><br><code><span style="color: #003366; font-weight: bold;">var</span> bird <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
     chirp<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
          <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;chirp!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></code><br>Now you can call on <strong>bird.chirp</strong>.<br><br>Another way to use functions is with <em>self-executing</em> functions. These are extremely useful and widely misunderstood. Check out the following example.<br><br><code><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
    <span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Hello!&quot;</span><span style="color: #339933;">;</span><br />
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>In this example the function will execute automatically and "Hello!" will be alerted to the user. Since this function is encapsulated the variable <strong>x</strong> will not be accessible from outside. If you take a look at the source code for <a href="http://jquery.com/">jQuery</a> you will notice that the developers use this often. In doing so only the functions they assign to the <strong>window</strong> object are accessible outside of their code. Which keeps the document tidy.<br></p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/eS8yo6lObWY" height="1" width="1"/>]]></content:encoded>
			<pubDate>Tue, 29 Sep 2009 08:05:59 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?An_Introduction_to_JavaScript_Functions</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?An_Introduction_to_JavaScript_Functions</feedburner:origLink></item>
		<item>
			<title>Get Browser Function in ASP</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/_lfP8mJ6Oow/</link>
			<description>In an earlier post I explained how to create a custom function in PHP to retrieve visitor browser information. The same can be done in ASP.</description>
			<content:encoded><![CDATA[<p>In <a href="http://www.pushingbuttons.net/?Custom_Get_Browser_Function_in_PHP">an earlier post</a> I explained how to create a custom function in PHP to retrieve visitor browser information. The same can be done in ASP.<br><br><code><span style="color: #0000ff; font-weight: bold;">Function</span> getBrowser<span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
     <span style="color: #990099; font-weight: bold;">Dim</span> regex, hits <span style="color: #006600; font-weight: bold;">:</span> <span style="color: #990099; font-weight: bold;">Set</span> regex <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #0000ff; font-weight: bold;">New</span> regexp <span style="color: #006600; font-weight: bold;">:</span> regex.<span style="color: #990099; font-weight: bold;">Global</span> <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #0000ff; font-weight: bold;">True</span> <span style="color: #006600; font-weight: bold;">:</span> regex.<span style="color: #9900cc;">IgnoreCase</span> <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #0000ff; font-weight: bold;">True</span><br />
     <span style="color: #990099; font-weight: bold;">Dim</span> versmatch <span style="color: #006600; font-weight: bold;">:</span> versmatch <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #cc0000;">&quot;(\);)?(\w*[\/|\s|-]\d+[\.\w]*(\s\[\w+\])?(\sMobile)?)?&quot;</span><br />
     <span style="color: #990099; font-weight: bold;">Dim</span> check, checks, agent <span style="color: #006600; font-weight: bold;">:</span> agent <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #990099; font-weight: bold;">Request</span>.<span style="color: #330066;">ServerVariables</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;HTTP_USER_AGENT&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
     <span style="color: #990099; font-weight: bold;">Set</span> checks <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #990099; font-weight: bold;">server</span>.<span style="color: #330066;">createobject</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Scripting.Dictionary&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
     <span style="color: #990099; font-weight: bold;">With</span> checks<br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;AOL&quot;</span>, <span style="color: #cc0000;">&quot;(AOL)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Avant Browser&quot;</span>, <span style="color: #cc0000;">&quot;(Avant Browser)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;MSIE&quot;</span>, <span style="color: #cc0000;">&quot;(IE)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Chrome&quot;</span>, <span style="color: #cc0000;">&quot;(Chrome)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Navigator&quot;</span>, <span style="color: #cc0000;">&quot;(Netscape|Navigator)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Iceweasel&quot;</span>, <span style="color: #cc0000;">&quot;(Iceweasel)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;SeaMonkey&quot;</span>, <span style="color: #cc0000;">&quot;(SeaMonkey)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Firefox&quot;</span>, <span style="color: #cc0000;">&quot;(Firefox)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Safari&quot;</span>, <span style="color: #cc0000;">&quot;(Version|Safari)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Nintendo Wii&quot;</span>, <span style="color: #cc0000;">&quot;(Opera)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Opera&quot;</span>, <span style="color: #cc0000;">&quot;(Opera)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Firebird&quot;</span>, <span style="color: #cc0000;">&quot;(Firebird)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Kazehakase&quot;</span>, <span style="color: #cc0000;">&quot;(Kazehakase)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Iceape&quot;</span>, <span style="color: #cc0000;">&quot;(Iceape)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Phoenix&quot;</span>, <span style="color: #cc0000;">&quot;(Phoenix)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Playstation 3&quot;</span>, <span style="color: #cc0000;">&quot;(Playstation 3)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;PSP&quot;</span>, <span style="color: #cc0000;">&quot;(Playstation Portable)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Googlebot&quot;</span>, <span style="color: #cc0000;">&quot;(Googlebot)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;msnbot&quot;</span>, <span style="color: #cc0000;">&quot;(msnbot-Products|msnbot)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Yahoo! Slurp China&quot;</span>, <span style="color: #cc0000;">&quot;(Yahoo! Slurp China)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Yahoo! Slurp&quot;</span>, <span style="color: #cc0000;">&quot;(Yahoo! Slurp)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Ask Jeeves&quot;</span>, <span style="color: #cc0000;">&quot;(Ask Jeeves)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Cuil&quot;</span>, <span style="color: #cc0000;">&quot;(Twiceler)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;Mozilla&quot;</span>, <span style="color: #cc0000;">&quot;(Mozilla)&quot;</span><br />
          .<span style="color: #9900cc;">add</span> <span style="color: #cc0000;">&quot;BlackBerry&quot;</span>, <span style="color: #cc0000;">&quot;(BlackBerry)&quot;</span><br />
     <span style="color: #990099; font-weight: bold;">End</span> <span style="color: #990099; font-weight: bold;">With</span><br />
<br />
     getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #cc0000;">&quot;unknown&quot;</span><br />
     <span style="color: #990099; font-weight: bold;">For</span> <span style="color: #990099; font-weight: bold;">Each</span> check <span style="color: #990099; font-weight: bold;">IN</span> checks<br />
          regex.<span style="color: #9900cc;">Pattern</span> <span style="color: #006600; font-weight: bold;">=</span> check<br />
          <span style="color: #990099; font-weight: bold;">Set</span> hits <span style="color: #006600; font-weight: bold;">=</span> regex.<span style="color: #330066;">Execute</span><span style="color: #006600; font-weight:bold;">&#40;</span>agent<span style="color: #006600; font-weight:bold;">&#41;</span><br />
          <span style="color: #990099; font-weight: bold;">if</span> hits.<span style="color: #9900cc;">count</span> <span style="color: #006600; font-weight: bold;">&gt;</span> <span style="color: #800000;">0</span> <span style="color: #990099; font-weight: bold;">then</span><br />
               regex.<span style="color: #9900cc;">Pattern</span> <span style="color: #006600; font-weight: bold;">=</span> checks.<span style="color: #9900cc;">item</span><span style="color: #006600; font-weight:bold;">&#40;</span>check<span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #006600; font-weight: bold;">&amp;</span> versmatch<br />
               <span style="color: #990099; font-weight: bold;">Set</span> hits <span style="color: #006600; font-weight: bold;">=</span> regex.<span style="color: #330066;">Execute</span><span style="color: #006600; font-weight:bold;">&#40;</span>agent<span style="color: #006600; font-weight:bold;">&#41;</span><br />
               getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span>hits.<span style="color: #9900cc;">item</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #800000;">0</span><span style="color: #006600; font-weight:bold;">&#41;</span>, <span style="color: #cc0000;">&quot;/&quot;</span>, <span style="color: #cc0000;">&quot; &quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span>, <span style="color: #cc0000;">&quot;);&quot;</span>, <span style="color: #cc0000;">&quot;&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span>, <span style="color: #cc0000;">&quot;-&quot;</span>, <span style="color: #cc0000;">&quot; &quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
               <span style="color: #990099; font-weight: bold;">Select</span> <span style="color: #990099; font-weight: bold;">Case</span> check<br />
                    <span style="color: #990099; font-weight: bold;">Case</span> <span style="color: #cc0000;">&quot;Safari&quot;</span><br />
                         getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span>getBrowser, <span style="color: #cc0000;">&quot;Version&quot;</span>, <span style="color: #cc0000;">&quot;Safari&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
                    <span style="color: #990099; font-weight: bold;">Case</span> <span style="color: #cc0000;">&quot;Navigator&quot;</span><br />
                         getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span>getBrowser, <span style="color: #cc0000;">&quot;Navigator&quot;</span>, <span style="color: #cc0000;">&quot;Netscape&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
                    <span style="color: #990099; font-weight: bold;">Case</span> <span style="color: #cc0000;">&quot;msnbot&quot;</span><br />
                         getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span>getBrowser, <span style="color: #cc0000;">&quot;Products&quot;</span>, <span style="color: #cc0000;">&quot;&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
                         getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span>getBrowser, <span style="color: #cc0000;">&quot;msnbot&quot;</span>, <span style="color: #cc0000;">&quot;Windows Live&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
                    <span style="color: #990099; font-weight: bold;">Case</span> <span style="color: #cc0000;">&quot;Cuil&quot;</span><br />
                         getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span>getBrowser, <span style="color: #cc0000;">&quot;Twiceler&quot;</span>, <span style="color: #cc0000;">&quot;Cuil&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
                    <span style="color: #990099; font-weight: bold;">Case</span> <span style="color: #cc0000;">&quot;Nintendo Wii&quot;</span><br />
                         getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span>getBrowser, <span style="color: #cc0000;">&quot;Opera&quot;</span>, <span style="color: #cc0000;">&quot;Nintendo Wii (Opera)&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
                    <span style="color: #990099; font-weight: bold;">Case</span> <span style="color: #cc0000;">&quot;BlackBerry&quot;</span><br />
                         getBrowser <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #330066;">replace</span><span style="color: #006600; font-weight:bold;">&#40;</span>getBrowser, <span style="color: #cc0000;">&quot;BlackBerry&quot;</span>, <span style="color: #cc0000;">&quot;BlackBerry &quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><br />
               <span style="color: #990099; font-weight: bold;">End</span> <span style="color: #990099; font-weight: bold;">Select</span><br />
               Exit <span style="color: #990099; font-weight: bold;">For</span><br />
          <span style="color: #990099; font-weight: bold;">End</span> <span style="color: #990099; font-weight: bold;">If</span><br />
     <span style="color: #990099; font-weight: bold;">Next</span><br />
<span style="color: #990099; font-weight: bold;">End</span> <span style="color: #0000ff; font-weight: bold;">Function</span></code></p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/_lfP8mJ6Oow" height="1" width="1"/>]]></content:encoded>
			<pubDate>Wed, 23 Sep 2009 11:44:04 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Get_Browser_Function_in_ASP</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Get_Browser_Function_in_ASP</feedburner:origLink></item>
		<item>
			<title>Custom Get Browser Function in PHP</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/mohkzLDeFfs/</link>
			<description>A while back I was trying to use PHP's get_browser function, which should return an array of information. It takes the visitor's user agent value and parses it to do this. It turns out that in order to use get_browser you must have browscap configured correctly in your php.ini file. In my case this wasn't really an option since the server I was working on does not allow access to the ini file.So, if you find yourself in a similar case then the best option will be to parse the user agent yourself.</description>
			<content:encoded><![CDATA[<p>A while back I was trying to use PHP's <a href="http://us2.php.net/manual/en/function.get-browser.php">get_browser</a> function, which should return an array of information. It takes the visitor's <a href="http://en.wikipedia.org/wiki/User_agent">user agent</a> value and parses it to do this. It turns out that in order to use get_browser you must have <a href="http://us2.php.net/manual/en/misc.configuration.php#ini.browscap">browscap</a> configured correctly in your php.ini file. In my case this wasn't really an option since the server I was working on does not allow access to the ini file.<br><br>So, if you find yourself in a similar case then the best option will be to parse the user agent yourself. The following function is something I threw together to do just this. It will return a string revealing the visitor's browser and version.<br><br><code><span style="color: #000000; font-weight: bold;">function</span> getBrowser<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000088;">$versmatch</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'(\);)?(\w*[\/|\s|-]\d+[\.\w]*(\s\[\w+\])?(\sMobile)?)?'</span><span style="color: #339933;">;</span><br />
     <span style="color: #000088;">$agent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
     <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'unknown'</span><span style="color: #339933;">;</span><br />
     <span style="color: #000088;">$checks</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">Array</span></a><span style="color: #009900;">&#40;</span><br />
          <span style="color: #0000ff;">'AOL'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'AOL'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Avant Browser'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Avant Browser'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'MSIE'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'IE'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Chrome'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Chrome'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Navigator'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Netscape Navigator'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Iceweasel'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Iceweasel'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'SeaMonkey'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'SeaMonkey'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Firefox'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Firefox'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Safari'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Version Safari'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Nintendo Wii'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Opera'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Opera'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Opera'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Firebird'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Firebird'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Kazehakase'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Kazehakase'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Iceape'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Iceape'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Phoenix'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Phoenix'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Playstation 3'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Playstation 3'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'PSP'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Playstation Portable'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Googlebot'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Googlebot'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'msnbot'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'msnbot-Products msnbot'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Yahoo! Slurp China'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Yahoo! Slurp China'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Yahoo! Slurp'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Yahoo! Slurp'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Ask Jeeves'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Ask Jeeves'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Cuil'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Twiceler'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'Mozilla'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Mozilla'</span><span style="color: #339933;">,</span><br />
          <span style="color: #0000ff;">'BlackBerry'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'BlackBerry'</span><br />
     <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
     <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$checks</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$check</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
          <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/('</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$check</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">')/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$agent</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
               <a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$versmatch</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$agent</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
               <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">');'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
               <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$check</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
                    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Safari'</span><span style="color: #339933;">:</span><br />
                         <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Version'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Safari'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
                         <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Navigator'</span><span style="color: #339933;">:</span><br />
                         <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Navigator'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Netscape'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
                         <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'msnbot'</span><span style="color: #339933;">:</span><br />
                         <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Products'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'msnbot'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Windows Live'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
                         <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Cuil'</span><span style="color: #339933;">:</span><br />
                         <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Twiceler'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Cuil'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
                         <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Nintendo Wii'</span><span style="color: #339933;">:</span><br />
                         <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Opera'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Nintendo Wii (Opera)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
                         <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'BlackBerry'</span><span style="color: #339933;">:</span><br />
                         <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'BlackBerry'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'BlackBerry '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
                         <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
               <span style="color: #009900;">&#125;</span><br />
          <span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span><br />
          <span style="color: #009900;">&#125;</span><br />
     <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></code><br>Some examples of its return value are 'MSIE 7.0,' 'Firefox 3.0.10,' 'Chrome 2.0.172.33' and 'Safari 525.20.' It may not be the most efficient way to do this, but it gets the job done.</p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/mohkzLDeFfs" height="1" width="1"/>]]></content:encoded>
			<pubDate>Wed, 23 Sep 2009 06:04:44 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Custom_Get_Browser_Function_in_PHP</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Custom_Get_Browser_Function_in_PHP</feedburner:origLink></item>
		<item>
			<title>Prototype's Element.identify() in MooTools</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/nGkQqASJr1U/</link>
			<description>Prototype.js has a method, Element.identify(), that can be very useful. It is used to retrieve the ID of a given element. If one does not exist it first generates and assigns one and then returns that.&amp;nbsp;To implement this in MooTools you can add the following code.&amp;nbsp;Element.implement&amp;#40;&amp;#123;
     identify: function&amp;#40;&amp;#41; &amp;#123;
          if&amp;#40;!$type&amp;#40;this.get&amp;#40;'id'&amp;#41;&amp;#41;&amp;#41;
               this.set&amp;#40;'id', genID&amp;#40;0&amp;#41;&amp;#41;;
          return this.get&amp;#40;'id'&amp;#41;;

          function genID&amp;#40;num&amp;#41; &amp;#123;
               num++;
               if&amp;#40;!$type&amp;#40;$&amp;#40;num.toString&amp;#40;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
                    return num;
               return genID&amp;#40;num&amp;#41;;
          &amp;#125;
     &amp;#125;
&amp;#125;&amp;#41;;</description>
			<content:encoded><![CDATA[<p><a href="http://www.prototypejs.org/">Prototype.js</a> has a method, <a href="http://api.prototypejs.org/dom/element.html#identify-class_method">Element.identify()</a>, that can be very useful. It is used to retrieve the ID of a given element. If one does not exist it first generates and assigns one and then returns that.</p><p>&nbsp;</p><p>To implement this in <a href="http://www.mootools.net/">MooTools</a> you can add the following code.</p><p>&nbsp;</p><code>Element.<span style="color: #660066;">implement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
     identify<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
          <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>$type<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
               <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'id'</span><span style="color: #339933;">,</span> genID<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
          <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
          <span style="color: #003366; font-weight: bold;">function</span> genID<span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
               num<span style="color: #339933;">++;</span><br />
               <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>$type<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>num.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
                    <span style="color: #000066; font-weight: bold;">return</span> num<span style="color: #339933;">;</span><br />
               <span style="color: #000066; font-weight: bold;">return</span> genID<span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
          <span style="color: #009900;">&#125;</span><br />
     <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>So, if you have the following elements<br><br><code><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'xyz'</span>&gt;</span>Lorem<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'xyz'</span>&gt;</span>Ipsum<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'2'</span>&gt;</span>Dolor<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></code><br>and you execute the following in MooTools which applies identify() on each span<br><br><code>window.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'domready'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     $$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'span.xyz'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>span<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
          span.<span style="color: #660066;">identify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>then you will end up with the following HTML.<br><br><code><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'xyz'</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'1'</span>&gt;</span>Lorem<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'xyz'</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'3'</span>&gt;</span>Ipsum<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'2'</span>&gt;</span>Dolor<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></code><br>As simple as this is, it becomes very useful when dealing with dynamic content. You can now use the <a href="http://mootools.net/docs/core/Element/Element#dollar">$</a> function to select distinct elements. But, beware that in CSS trying something like<br><br><code><span style="color: #cc00cc;">#1</span> <span style="color: #00AA00;">&#123;</span><br />
     <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #993333;">red</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></code><br>won't work in most browsers. When applying style to an element the element's ID should start with a letter. But you can still use JavaScript to apply any attributes.<br><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/nGkQqASJr1U" height="1" width="1"/>]]></content:encoded>
			<pubDate>Tue, 22 Sep 2009 11:29:38 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Prototypes_Elementidentify_in_MooTools</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Prototypes_Elementidentify_in_MooTools</feedburner:origLink></item>
		<item>
			<title>Utilizing PHP's Trim</title>
			<link>http://feedproxy.google.com/~r/pushingbuttonsblog/~3/YLipEYZOA04/</link>
			<description>PHP's trim() is often underused. Usually web developers throw it in simply to prevent leading and trailing white spaces, but that's about it. What a lot of people seem to overlook is the fact that there is an optional second parameter which can make things a whole lot more useful.A simple use of trim() would be something like this$s = &amp;quot;   There are some white spaces around me    &amp;quot;;

echo trim&amp;#40;$s&amp;#41;;You can expect that this will result in "There are some white spaces around me." Pretty simple. Now, let's assume that you are looping through an array of strings and have produced a single comma separated string.</description>
			<content:encoded><![CDATA[<p>PHP's <strong>trim()</strong> is often underused. Usually web developers throw it in simply to prevent leading and trailing white spaces, but that's about it. What a lot of people seem to overlook is the fact that there is an optional second parameter which can make things a whole lot more useful.<br><br>A simple use of <strong>trim()</strong> would be something like this<br><br><code><span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;   There are some white spaces around me    &quot;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://www.php.net/echo"><span style="color: #990000;">echo</span></a> <a href="http://www.php.net/trim"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>You can expect that this will result in "There are some white spaces around me." Pretty simple. Now, let's assume that you are looping through an array of strings and have produced a single comma separated string.<br><br><code><span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">Array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'green'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'purple'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'gold'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'orange'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000088;">$s</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">', '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<a href="http://www.php.net/echo"><span style="color: #990000;">echo</span></a> <span style="color: #000088;">$s</span><span style="color: #339933;">;</span></code><br>This will output ", green, purple, gold, orange." But we don't want that leading comma and space. If you applied <strong>trim()</strong> like we did above it wouldn't change the string at all. But by passing a second parameter which defines what characters you will be trimming you can get the results you are looking for.<br><br><code><span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">Array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'green'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'purple'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'gold'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'orange'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
     <span style="color: #000088;">$s</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">', '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<a href="http://www.php.net/echo"><span style="color: #990000;">echo</span></a> <a href="http://www.php.net/trim"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>This will output exactly what we want, "green, purple, gold, orange." It is important to understand that the second parameter ', ' is stating that any occurrence of either character at the beginning or end of the string will be trimmed, as you can see in the following.<br><br><code><span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Hello World!&quot;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://www.php.net/echo"><span style="color: #990000;">echo</span></a> <a href="http://www.php.net/trim"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;dH!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></code><br>Since this trims any occurrence of either 'd,' 'H,' or '!' we end up with "ello Worl."<br></p><img src="http://feeds.feedburner.com/~r/pushingbuttonsblog/~4/YLipEYZOA04" height="1" width="1"/>]]></content:encoded>
			<pubDate>Wed, 16 Sep 2009 13:13:52 -0400</pubDate>
			<guid isPermaLink="false">http://www.pushingbuttons.net/?Utilizing_PHPs_Trim</guid>
		<feedburner:origLink>http://www.pushingbuttons.net/?Utilizing_PHPs_Trim</feedburner:origLink></item>
	</channel>
</rss>

