<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en" xml:base="http://www.onlineaspect.com/wp-atom.php">
	<title type="text">Online Aspect by Josh Fraser</title>
	<subtitle type="text">a blog about building stuff on the web</subtitle>

	<updated>2009-07-12T20:12:02Z</updated>
	<generator uri="http://wordpress.org/" version="2.7.1">WordPress</generator>

	<link rel="alternate" type="text/html" href="http://www.onlineaspect.com" />
	<id>http://www.onlineaspect.com/feed/atom/</id>
	

	<link rel="hub" href="http://pubsubhubbub.appspot.com" />		<geo:lat>40.020885</geo:lat><geo:long>-105.296733</geo:long><link rel="self" href="http://feeds.feedburner.com/OnlineAspect" type="application/atom+xml" /><feedburner:emailServiceId>OnlineAspect</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FOnlineAspect" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FOnlineAspect" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FOnlineAspect" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/OnlineAspect" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FOnlineAspect" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FOnlineAspect" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FOnlineAspect" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[Happy Birthday Cohen]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/nwGGob2uYMQ/" />
		<id>http://www.onlineaspect.com/?p=345</id>
		<updated>2009-07-12T20:12:02Z</updated>
		<published>2009-07-12T20:12:02Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" />		<summary type="html">We&amp;#8217;re going to take a short break from our regular programming in honor of David Cohen.  David runs the TechStars program and honestly our company wouldn&amp;#8217;t be where it is now if it weren&amp;#8217;t for him. I know most of the other TechStars teams feel the same way.  Today is David&amp;#8217;s birthday, and [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/07/12/happy-birthday-cohen/">&lt;p&gt;We&amp;#8217;re going to take a short break from our regular programming in honor of &lt;a href="http://davidgcohen.com/"&gt;David Cohen&lt;/a&gt;.  David runs the &lt;a href="http://www.techstars.org/"&gt;TechStars&lt;/a&gt; program and honestly our company wouldn&amp;#8217;t be where it is now if it weren&amp;#8217;t for him. I know most of the other TechStars teams feel the same way.  Today is David&amp;#8217;s birthday, and a few of us wanted to take a minute to say thanks and wish him a great day.  Enjoy.&lt;/p&gt;
&lt;p&gt;&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5564797&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=5564797&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;p&gt;&lt;a href="http://vimeo.com/5564797"&gt;Happy Birthday David Cohen&lt;/a&gt; from &lt;a href="http://vimeo.com/user993116"&gt;Josh Fraser&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/nwGGob2uYMQ" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/07/12/happy-birthday-cohen/#comments" thr:count="4" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/07/12/happy-birthday-cohen/feed/atom/" thr:count="4" />
		<thr:total>4</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/07/12/happy-birthday-cohen/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[Queue events that occur before JavaScript is loaded]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/fQ5eG_7oP50/" />
		<id>http://www.onlineaspect.com/?p=307</id>
		<updated>2009-06-25T10:16:10Z</updated>
		<published>2009-06-25T05:17:24Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="code" /><category scheme="http://www.onlineaspect.com" term="javascript" /><category scheme="http://www.onlineaspect.com" term="performance" />		<summary type="html">One of the common recommendations for speeding up your website is to put your JavaScript at the bottom of your page instead of including it inside the head tag.  The difference this simple placement can have is impressive, especially if you are dealing with sizable JavaScript libraries that are usually 50k at best.
One downside [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/06/24/queue-events-that-occur-before-your-javascript-is-loaded/">&lt;p&gt;One of the &lt;a href="http://developer.yahoo.com/performance/rules.html#js_bottom"&gt;common recommendations&lt;/a&gt; for speeding up your website is to put your JavaScript at the bottom of your page instead of including it inside the head tag.  The difference this simple placement can have is impressive, especially if you are dealing with sizable JavaScript libraries that are usually 50k at best.&lt;/p&gt;
&lt;p&gt;One downside with putting your JavaScript at the bottom is that your fast clicking visitors may click on links that won&amp;#8217;t work.  The reason this happens is because the JavaScript that those links trigger hasn&amp;#8217;t been downloaded yet.  Usually those links will work on the second or third try, but it makes for a bad user experience and a poor first impression.&lt;/p&gt;
&lt;p&gt;I decided to fix it by queuing up those user-triggered actions and replaying them as soon as the document is ready.  I wrote a wrapper that I can use anytime I have code that depends on my JavaScript being downloaded and available.&lt;/p&gt;
&lt;p&gt;The concept is simple.  Instead of calling functions directly when a user triggers an action, I add the function call to a queue.  When the document is ready, I loop through the queue and execute each of the actions in the order that they occurred.  I put this code inline inside my head tag so it is available as soon possible.  The rest of my JavaScript can then be included right before the closing body tag without worrying about this race condition between the browser and website visitor.&lt;/p&gt;
&lt;div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="sy0"&gt;&amp;lt;&lt;/span&gt;script type&lt;span class="sy0"&gt;=&lt;/span&gt;&lt;span class="st0"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span class="sy0"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="kw2"&gt;var&lt;/span&gt; loaded &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="kw2"&gt;false&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw2"&gt;var&lt;/span&gt; action_queue &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="kw2"&gt;new&lt;/span&gt; Array&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="kw2"&gt;function&lt;/span&gt; when_ready&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;callback&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="co1"&gt;// skip the queue if the document has already loaded&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;if&lt;/span&gt; &lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;loaded &lt;span class="sy0"&gt;==&lt;/span&gt; &lt;span class="kw2"&gt;true&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;eval&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;callback&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;else&lt;/span&gt; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; action_queue.&lt;span class="me1"&gt;push&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;callback&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="kw2"&gt;function&lt;/span&gt; dequeue_actions&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;for&lt;/span&gt; &lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;i &lt;span class="kw1"&gt;in&lt;/span&gt; action_queue&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;eval&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;action_queue&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;i&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;delete&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;action_queue&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;i&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt; &lt;span class="co1"&gt;// cleanup after ourselves&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; loaded &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="kw2"&gt;true&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="sy0"&gt;&amp;lt;/&lt;/span&gt;script&lt;span class="sy0"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I then trigger dequeue_actions() as soon as the document is ready:&lt;/p&gt;
&lt;div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="co1"&gt;// using jQuery&lt;/span&gt;&lt;br /&gt;
$&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;document&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;.&lt;span class="me1"&gt;ready&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="kw2"&gt;function&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; dequeue_actions&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="co1"&gt;// this works too&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw3"&gt;onload&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; dequeue_actions&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;You can then safely make function calls using when_ready().  For example:&lt;/p&gt;
&lt;div class="codecolorer-container html4strict blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="html4strict codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="sc2"&gt;&amp;lt;&lt;span class="kw2"&gt;a&lt;/span&gt; &lt;span class="kw3"&gt;onclick&lt;/span&gt;&lt;span class="sy0"&gt;=&lt;/span&gt;&lt;span class="st0"&gt;&amp;quot;select('foo')&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;foo&lt;span class="sc2"&gt;&amp;lt;&lt;span class="sy0"&gt;/&lt;/span&gt;&lt;span class="kw2"&gt;a&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;becomes&lt;/p&gt;
&lt;div class="codecolorer-container html4strict blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="html4strict codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="sc2"&gt;&amp;lt;&lt;span class="kw2"&gt;a&lt;/span&gt; &lt;span class="kw3"&gt;onclick&lt;/span&gt;&lt;span class="sy0"&gt;=&lt;/span&gt;&lt;span class="st0"&gt;&amp;quot;when_ready('select(\'foo\')')&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;foo&lt;span class="sc2"&gt;&amp;lt;&lt;span class="sy0"&gt;/&lt;/span&gt;&lt;span class="kw2"&gt;a&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In my testing, the results have been very smooth with delays being almost unnoticeable.  Of course, your experience will vary depending on the size of your document and how long it takes for your document to be ready.&lt;/p&gt;
&lt;p&gt;This code is pure JavaScript and should work in every modern browser.  I&amp;#8217;ve tested it in IE6+, FF2+ and Safari 3+.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/fQ5eG_7oP50" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/06/24/queue-events-that-occur-before-your-javascript-is-loaded/#comments" thr:count="9" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/06/24/queue-events-that-occur-before-your-javascript-is-loaded/feed/atom/" thr:count="9" />
		<thr:total>9</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/06/24/queue-events-that-occur-before-your-javascript-is-loaded/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[Reading GET variables with JavaScript]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/KbJVA2J9NKE/" />
		<id>http://www.onlineaspect.com/?p=291</id>
		<updated>2009-06-10T08:42:45Z</updated>
		<published>2009-06-10T08:33:46Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="code" /><category scheme="http://www.onlineaspect.com" term="get variables" /><category scheme="http://www.onlineaspect.com" term="javascript" /><category scheme="http://www.onlineaspect.com" term="tips" />		<summary type="html">One of the things that isn&amp;#8217;t immediately obvious in JavaScript is how to access GET variables.  I&amp;#8217;ve seen lots of different implementations for this around the web, but the majority of them are bulkier than they need to be.  Here&amp;#8217;s my favorite way to do it:
&amp;#60;script type='text/javascript'&amp;#62;

function $_GET&amp;#40;q,s&amp;#41; &amp;#123;
&amp;#160; &amp;#160; s = &amp;#40;s&amp;#41; [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/06/10/reading-get-variables-with-javascript/">&lt;p&gt;One of the things that isn&amp;#8217;t immediately obvious in JavaScript is how to access GET variables.  I&amp;#8217;ve seen lots of different implementations for this around the web, but the majority of them are bulkier than they need to be.  Here&amp;#8217;s my favorite way to do it:&lt;/p&gt;
&lt;div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="sy0"&gt;&amp;lt;&lt;/span&gt;script type&lt;span class="sy0"&gt;=&lt;/span&gt;&lt;span class="st0"&gt;'text/javascript'&lt;/span&gt;&lt;span class="sy0"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="kw2"&gt;function&lt;/span&gt; $_GET&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;q&lt;span class="sy0"&gt;,&lt;/span&gt;s&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; s &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;s&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="sy0"&gt;?&lt;/span&gt; s &lt;span class="sy0"&gt;:&lt;/span&gt; window.&lt;span class="me1"&gt;location&lt;/span&gt;.&lt;span class="me1"&gt;search&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw2"&gt;var&lt;/span&gt; re &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="kw2"&gt;new&lt;/span&gt; RegExp&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="st0"&gt;'&amp;amp;amp;'&lt;/span&gt;&lt;span class="sy0"&gt;+&lt;/span&gt;q&lt;span class="sy0"&gt;+&lt;/span&gt;&lt;span class="st0"&gt;'=([^&amp;amp;amp;]*)'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st0"&gt;'i'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;return&lt;/span&gt; &lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;s&lt;span class="sy0"&gt;=&lt;/span&gt;s.&lt;span class="me1"&gt;replace&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="co2"&gt;/^\?/&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st0"&gt;'&amp;amp;amp;'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;.&lt;span class="me1"&gt;match&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;re&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="sy0"&gt;?&lt;/span&gt;s&lt;span class="sy0"&gt;=&lt;/span&gt;s&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="nu0"&gt;1&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt; &lt;span class="sy0"&gt;:&lt;/span&gt;s&lt;span class="sy0"&gt;=&lt;/span&gt;&lt;span class="st0"&gt;''&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="sy0"&gt;&amp;lt;/&lt;/span&gt;script&lt;span class="sy0"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;What this gives you is a JavaScript implementation of PHP&amp;#8217;s $_GET functionality.  I use a regular expression to keep the code to a minimum.  Here is a simple example of how to use it:&lt;/p&gt;
&lt;div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="co1"&gt;// this code would print &amp;quot;hello world&amp;quot; if it was at http://localhost/index.php?var1=hello&amp;amp;var2=world&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw2"&gt;var&lt;/span&gt; var1 &lt;span class="sy0"&gt;=&lt;/span&gt; $_GET&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="st0"&gt;'var1'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw2"&gt;var&lt;/span&gt; var2 &lt;span class="sy0"&gt;=&lt;/span&gt; $_GET&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="st0"&gt;'var2'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
document.&lt;span class="kw1"&gt;write&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;var1 &lt;span class="sy0"&gt;+&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot; &amp;quot;&lt;/span&gt; &lt;span class="sy0"&gt;+&lt;/span&gt; var2&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Another thing I like about this implementation is that it makes it easy to parse GET variables from arbitrary search strings (ex &amp;#8220;?var1=hello&amp;#038;var2=world&amp;#8221;).  This is handy if you need to access GET variables from an HTML src parameter such as an image or script tag.&lt;/p&gt;
&lt;div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="co1"&gt;// get the src parameter and split it down to the search query string&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw2"&gt;var&lt;/span&gt; src &lt;span class="sy0"&gt;=&lt;/span&gt; document.&lt;span class="me1"&gt;getElementById&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="st0"&gt;'example'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;.&lt;span class="me1"&gt;src&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
params &lt;span class="sy0"&gt;=&lt;/span&gt; src.&lt;span class="me1"&gt;split&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="st0"&gt;'?'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw2"&gt;var&lt;/span&gt; var1 &lt;span class="sy0"&gt;=&lt;/span&gt; $_GET&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="st0"&gt;'var1'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st0"&gt;'?'&lt;/span&gt;&lt;span class="sy0"&gt;+&lt;/span&gt;params&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="nu0"&gt;1&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/KbJVA2J9NKE" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/06/10/reading-get-variables-with-javascript/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/06/10/reading-get-variables-with-javascript/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/06/10/reading-get-variables-with-javascript/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[Looking for a job?  Don&#8217;t be this guy.]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/yW6pa2gJhxg/" />
		<id>http://www.onlineaspect.com/?p=280</id>
		<updated>2009-06-05T20:40:40Z</updated>
		<published>2009-06-05T19:22:13Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="hiring" /><category scheme="http://www.onlineaspect.com" term="pet peeves" /><category scheme="http://www.onlineaspect.com" term="tips" />		<summary type="html">I just received this email:
Hi,
Please see my attached resume.
I&amp;#8217;m very intelligent and creative. I have a very eclectic arsenals of skills for the solution of problems.
I&amp;#8217;ve worked in numerous startups, including several of my own.
Reed
The sad thing is, I get an email like that just about every day.  I thought I would share my [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/06/05/looking-for-a-job-dont-be-this-guy/">&lt;p&gt;I just received this email:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please see my attached resume.&lt;br /&gt;
I&amp;#8217;m very intelligent and creative. I have a very eclectic arsenals of skills for the solution of problems.&lt;br /&gt;
I&amp;#8217;ve worked in numerous startups, including several of my own.&lt;/p&gt;
&lt;p&gt;Reed&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The sad thing is, I get an email like that just about every day.  I thought I would share my response in hopes that it will help someone from making the same mistakes.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;We&amp;#8217;re not hiring right now, but here are a few free tips:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;#8220;I&amp;#8217;m very intelligent and creative.&amp;#8221; doesn&amp;#8217;t come off as confident, it comes off as cocky&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt; If you had spent 2 minutes looking at our site you would have known that my email address is josh@eventvue.com not careers, not jobs&amp;#8230;  just josh.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt; No mention about what excites you about EventVue?  Keep in mind I get several resumes in my inbox EVERY DAY.  It&amp;#8217;s not hard to get my attention.  Comment on my blog.  Send me an engaging question.  &lt;a href="http://twitter.com/home?status=@joshfraser"&gt;@me on twitter&lt;/a&gt;.  I&amp;#8217;ll respond.  Just don&amp;#8217;t send me something that has been copied and pasted to a dozen different companies.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt; &amp;#8220;FW: about me&amp;#8221; is your subject line?  I&amp;#8217;d work on that one a bit.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;We&amp;#8217;re a startup trying to build cutting edge stuff.  The fact that you sent me an email from a Hotmail account communicates that you aren&amp;#8217;t much of an early adopter.  That&amp;#8217;s too bad, because I bet you&amp;#8217;re a smart guy.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;I understand that startups are different.  Your career center probably didn&amp;#8217;t tell you this stuff.  That&amp;#8217;s why I am.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update.&lt;/strong&gt; Reed responded:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Don&amp;#8217;t worry I&amp;#8217;m very creative and intelligent. It&amp;#8217;s not a boast. It&amp;#8217;s who I am.&lt;/p&gt;
&lt;p&gt;If you read my resume then you know that I&amp;#8217;m also an internationally known composer.&lt;br /&gt;
I can write top level music in any style you can think of, including the most modern remix and such.&lt;br /&gt;
I attached a song from one of my Cds. All my Cds have been in or near the 10 ten the country on jazz radio.&lt;/p&gt;
&lt;p&gt;I  have not only hotmail but gmail and facebook and twitter and others.&lt;/p&gt;
&lt;p&gt;Anyway, I&amp;#8217;ll keep your advice in mind.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ll check out your blog.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Not sure that helped, but at least now I know he&amp;#8217;s a good composer.  The music was pretty.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/yW6pa2gJhxg" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/06/05/looking-for-a-job-dont-be-this-guy/#comments" thr:count="16" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/06/05/looking-for-a-job-dont-be-this-guy/feed/atom/" thr:count="16" />
		<thr:total>16</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/06/05/looking-for-a-job-dont-be-this-guy/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[How to use variable variables in PHP]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/Y0LuIc5snUU/" />
		<id>http://www.onlineaspect.com/?p=255</id>
		<updated>2009-05-31T22:19:46Z</updated>
		<published>2009-05-31T22:07:13Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="code" /><category scheme="http://www.onlineaspect.com" term="php" /><category scheme="http://www.onlineaspect.com" term="tricks" /><category scheme="http://www.onlineaspect.com" term="tutorial" /><category scheme="http://www.onlineaspect.com" term="variable variables" />		<summary type="html">One of the biggest time-savers in PHP is the ability to use variable variables.  While often intimidating for newcomers to PHP, variable variables are extremely powerful once you get the hang of them.
Variable variables are just variables whose names can be programatically set and accessed.  For example, the code below creates a variable called $hello [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/">&lt;p&gt;One of the biggest time-savers in PHP is the ability to use variable variables.  While often intimidating for newcomers to PHP, variable variables are extremely powerful once you get the hang of them.&lt;/p&gt;
&lt;p&gt;Variable variables are just variables whose names can be programatically set and accessed.  For example, the code below creates a variable called $hello and outputs the string &amp;#8220;world&amp;#8221;.  The double dollar sign declares that the value of $a should be used as the name of newly defined variable.&lt;/p&gt;
&lt;div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="kw2"&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$a&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="st_h"&gt;'hello'&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$$a&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="st_h"&gt;'world'&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="re0"&gt;$hello&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="sy1"&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;When I started with PHP about 10 years ago, everyone was still using global variables.  That meant that anything you passed as a GET variable could be used as a local variable.  It was very convenient, but unfortunately not very secure.  For me, typing $HTTP_GET_VARS['count'] just wasn&amp;#8217;t as fun as being able to use $count.  I found myself adding long declaration lists to the top of my files that did nothing but convert my GET/POST variables to local variables.  My code started to look like this:&lt;/p&gt;
&lt;div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="kw2"&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$salutation&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="re0"&gt;$HTTP_GET_VARS&lt;/span&gt;&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="st_h"&gt;'salutation'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$fname&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="re0"&gt;$HTTP_GET_VARS&lt;/span&gt;&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="st_h"&gt;'fname'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$lname&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="re0"&gt;$HTTP_GET_VARS&lt;/span&gt;&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="st_h"&gt;'lname'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$email&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="re0"&gt;$HTTP_GET_VARS&lt;/span&gt;&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="st_h"&gt;'email'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="sy0"&gt;...&lt;/span&gt;&lt;br /&gt;
&lt;span class="sy1"&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Do that for a couple dozen variables and you&amp;#8217;ll start telling yourself there has to be a better way.  Nowadays you can use $_GET instead of $HTTP_GET_VARS, but the better solution is to use variable variables.  Now my code looks more like this:&lt;/p&gt;
&lt;div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="kw2"&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;
&lt;span class="co1"&gt;// create an array of all the GET/POST variables you want to use&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$fields&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="kw3"&gt;array&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="st_h"&gt;'salutation'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'fname'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'lname'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'email'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'company'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'job_title'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'addr1'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'addr2'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'city'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'state'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="st_h"&gt;'zip'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'country'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'phone'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="st_h"&gt;'work_phone'&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="co1"&gt;// convert each REQUEST variable (GET, POST or COOKIE) to a local variable&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw1"&gt;foreach&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="re0"&gt;$fields&lt;/span&gt; &lt;span class="kw1"&gt;as&lt;/span&gt; &lt;span class="re0"&gt;$field&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; $&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;span class="re0"&gt;$field&lt;/span&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; sanitize&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="re0"&gt;$_REQUEST&lt;/span&gt;&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="re0"&gt;$field&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="sy1"&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This has several benefits.  I reduced 14 lines of code down to 3.  I now have one place to sanitize all my external input.  And if I ever decide to change a variable name, I have one less place in my code to fix.&lt;/p&gt;
&lt;p&gt;This benefit of this technique increases as you use the $fields array throughout your code.  I now utilize the $fields array when saving my form data to the database.  I use it for loading existing user values from the database.  I use it for passing my form fields back to smarty:&lt;/p&gt;
&lt;div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="kw2"&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$form&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="kw3"&gt;array&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw1"&gt;foreach&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="re0"&gt;$fields&lt;/span&gt; &lt;span class="kw1"&gt;as&lt;/span&gt; &lt;span class="re0"&gt;$field&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="re0"&gt;$form&lt;/span&gt;&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt; &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="re0"&gt;$_REQUEST&lt;/span&gt;&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;&lt;span class="re0"&gt;$field&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="re0"&gt;$smarty&lt;/span&gt;&lt;span class="sy0"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="me1"&gt;assign&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="st_h"&gt;'form'&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt;&lt;span class="re0"&gt;$form&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="sy1"&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Variable variables have become one of my favorite features of PHP.  They&amp;#8217;ve allowed me to tighten up a lot of my code and made it a lot more maintainable.&lt;/p&gt;
&lt;p&gt;Have you done anything cool with variable variables?  What other PHP tricks have revolutionized the way you write code?&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/Y0LuIc5snUU" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/#comments" thr:count="5" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/feed/atom/" thr:count="5" />
		<thr:total>5</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[The protocols powering the real-time web]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/_Pnh265xj9g/" />
		<id>http://www.onlineaspect.com/?p=241</id>
		<updated>2009-05-26T05:59:40Z</updated>
		<published>2009-05-25T23:12:57Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="gnip" /><category scheme="http://www.onlineaspect.com" term="pubsubhubbub" /><category scheme="http://www.onlineaspect.com" term="real-time" /><category scheme="http://www.onlineaspect.com" term="sup" /><category scheme="http://www.onlineaspect.com" term="xmpp" />		<summary type="html">In the past few weeks there has been a lot of discussion around the rise of the real-time web, including posts from TechCrunch, GigaOm, ReadWriteWeb and Scoble.   A lot of the talk has been around Twitter, Facebook, Friendfeed, OneRiot and of course Google.  You don&amp;#8217;t have to be a genius to figure out that real-time [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/05/25/the-protocols-powering-the-real-time-web/">&lt;p&gt;In the past few weeks there has been a lot of discussion around the rise of the real-time web, including posts from &lt;a href="http://www.techcrunch.com/2009/05/17/jump-into-the-stream/"&gt;TechCrunch&lt;/a&gt;, &lt;a href="http://gigaom.com/2009/05/23/google-vs-the-real-time-web/"&gt;GigaOm&lt;/a&gt;, &lt;a href="http://www.readwriteweb.com/archives/times_wire_real_time_news.php"&gt;ReadWriteWeb&lt;/a&gt; and &lt;a href="http://scobleizer.com/2009/05/24/watch-the-google-anthill-move-toward-social-and-real-time/"&gt;Scoble&lt;/a&gt;.   A lot of the talk has been around Twitter, Facebook, Friendfeed, OneRiot and of course Google.  You don&amp;#8217;t have to be a genius to figure out that real-time is the future of the web.  I believe there is a huge need for the tech community to develop new protocols that will power this fundamental shift in how web apps work.&lt;/p&gt;
&lt;p&gt;The problem is our existing protocols are request driven instead of event driven.  The web we know and love wasn&amp;#8217;t built with real-time in mind.&lt;/p&gt;
&lt;p&gt;Tim O&amp;#8217;Reilly sent &lt;a href="http://twitter.com/timoreilly/statuses/866400327"&gt;a tweet&lt;/a&gt; from OSCON08 that really captures the essence of the polling problem:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;On monday friendfeed polled flickr nearly 3 million times for 45000 users, only 6K of whom were logged in. Architectural mismatch. #oscon08&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;At &lt;a href="http://www.eventvue.com"&gt;EventVue&lt;/a&gt; we have a dedicated server that does little more than poll for new blog posts from attendees.  We have a few tricks to reduce the pain, but we&amp;#8217;re still polling thousands of blogs every hour even though 99% of them haven&amp;#8217;t added any fresh content since the last time we checked.  With blog posts, people are used to having a small delay before they show up in Google Reader or other services.  We&amp;#8217;re not so forgiving when it takes 30 minutes for a tweet to show up in a client application, even though getting real-time data from twitter using polling is virtually impossible.&lt;/p&gt;
&lt;p&gt;So what is the solution?&lt;/p&gt;
&lt;p&gt;Some people have said that &lt;a href="http://xmpp.org/"&gt;XMPP&lt;/a&gt; holds the answer, but how many developers do you know who have set up an XMPP server before?  Right.  Me too.  XMPP may be a viable transport method but I think we&amp;#8217;d be better off using something that is simpler and more familiar to developers.&lt;/p&gt;
&lt;p&gt;Another prominent response to the polling problem is the &lt;a href="http://code.google.com/p/simpleupdateprotocol/"&gt;Simple Update Protocol&lt;/a&gt; (SUP) that was proposed by &lt;a href="http://paulbuchheit.blogspot.com/"&gt;Paul Buchheit &lt;/a&gt;from Friendfeed.  SUP is certainly an improvement over our current protocols, but what frustrates me is that it only reduces polling instead of eliminating it altogether.  It may make sense for FriendFeed, but it&amp;#8217;s not something I would add to my blog.&lt;/p&gt;
&lt;p&gt;My favorite approach is &lt;a href="http://code.google.com/p/pubsubhubbub/"&gt;PubSubHubbub&lt;/a&gt; that was proposed by &lt;a href="http://bradfitz.com/"&gt;Brad Fitzpatrick&lt;/a&gt; and Brett Slatkin from Google.  PubSubHubbub might have a horrible name, but the protocol is exactly what we need to fix our polling problems.  It&amp;#8217;s lightweight, simple to understand and built on top of basic HTTP.&lt;/p&gt;
&lt;p&gt;PubSubHubbub is a simple extension to ATOM that uses &lt;a href="http://webhooks.org"&gt;webhook callbacks&lt;/a&gt; to deliver practically instant notifications between servers when a feed is updated.  The protocol is decentralized and free.  Anyone can run a hub.  Anyone can be a publisher or a subscriber.  I like that it eliminates polling altogether and is incredibly simple to implement.  I took a stab at writing the PHP client library and was able to take it from protocol spec to code in less than 2 hours.&lt;/p&gt;
&lt;p&gt;If you&amp;#8217;re interested, you can check out my &lt;a href="http://code.google.com/p/pubsubhubbub-php/"&gt;PubSubHubbub PHP library&lt;/a&gt; and download and install the &lt;a href="http://wordpress.org/extend/plugins/pubsubhubbub/"&gt;PubSubHubbub Wordpress plugin&lt;/a&gt; I wrote as well.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s worth mentioning the role that &lt;a href="http://www.gnip.com/"&gt;Gnip&lt;/a&gt; plays in all of this.  Gnip has been leading the charge against the evils of polling.  I&amp;#8217;ve been a big fan of their service and have &lt;a href="http://www.eventvue.com/blog/2008/08/21/how-gnip-rescued-us-from-our-twitter-nightmare/"&gt;written before&lt;/a&gt; how they helped EventVue.   But at the end of the day, the winning technology shouldn&amp;#8217;t be in the hands of one company &amp;#8212; it should be open and distributed.   Open protocols don&amp;#8217;t eliminate the need for Gnip.  Trusted hubs like Gnip will play an important role in handling the flow of data between publishers and subscribers.  Companies will pay good money to off-load that work, and Gnip is already at the center of that opportunity.  I&amp;#8217;d love to see Gnip embrace the open protocols that are being developed and lead the drive for adoption of PubSubHubbub in particular.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m excited about PubSubHubbub for a few reasons.  First, it opens the door for a whole new range of real-time applications that simply aren&amp;#8217;t possible today.  It&amp;#8217;s also a chance for me to contribute to solving a really big problem and an opportunity for me to get in on the ground level of something I believe is going to be huge.  I wasn&amp;#8217;t able to contribute to the design of HTTP or sit in on the conversations that led to the development of the RSS protocol.  But one day I&amp;#8217;m going to be able to brag that Online Aspect was the very first blog on the web to support PubSubHubbub.   And for a geek like me, that&amp;#8217;s pretty cool.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/_Pnh265xj9g" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/05/25/the-protocols-powering-the-real-time-web/#comments" thr:count="27" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/05/25/the-protocols-powering-the-real-time-web/feed/atom/" thr:count="27" />
		<thr:total>27</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/05/25/the-protocols-powering-the-real-time-web/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[How to speed up your website]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/BeChN7fTh_g/" />
		<id>http://www.onlineaspect.com/?p=236</id>
		<updated>2009-06-07T23:10:25Z</updated>
		<published>2009-05-21T20:31:48Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="performance" /><category scheme="http://www.onlineaspect.com" term="video" /><category scheme="http://www.onlineaspect.com" term="web development" />		<summary type="html">There are few things as frustrating as having to wait for a website to load.  Not only do slow websites make for a poor user experience, they can also have a big impact on your bottom line:

Google discovered that adding 500ms to their load time resulted in a 20% loss in page views.
Amazon discovered that [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/05/21/how-to-speed-up-your-website/">&lt;p&gt;There are few things as frustrating as having to wait for a website to load.  Not only do slow websites make for a poor user experience, they can also have a big impact on your bottom line:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Google discovered that adding 500ms to their load time resulted in a 20% loss in page views.&lt;/li&gt;
&lt;li&gt;Amazon discovered that every 100ms they added resulted in a 1% loss of conversions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://stevesouders.com/"&gt;Steve Souders&lt;/a&gt; is the main thought leader on how to make websites splitting fast.  Steve works at Google, but before that he worked at Yahoo on an extremely useful project called &lt;a href="http://developer.yahoo.com/yslow/"&gt;YSlow&lt;/a&gt;.   I have used a lot of his research to speed up my own projects and he&amp;#8217;s taught me a lot of simple things that can make a big difference in web performance.&lt;/p&gt;
&lt;p&gt;Steve recently taught a class at Stanford on high performance websites and the videos are available online.   The full set costs $600, but you can &lt;a href="http://myvideos.stanford.edu/player/openslplayer.aspx?co=c6bb6bec-9b16-44ed-92b1-d591a92046d4&amp;amp;coll=980845e5-2dfe-49cd-890f-11948b38f835"&gt;watch the first 3 for free&lt;/a&gt;.  I would recommend anyone building stuff on the web to take the time to watch and learn.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 06/07/09:&lt;/strong&gt; Google recently announced their own version of YSlow called &lt;a href="http://code.google.com/speed/page-speed/"&gt;PageSpeed&lt;/a&gt;.  It&amp;#8217;s got some additional features that YSlow doesn&amp;#8217;t have &amp;#8212; like giving you optizimed images that can be saved directly from the plugin.  Check it out.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/BeChN7fTh_g" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/05/21/how-to-speed-up-your-website/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/05/21/how-to-speed-up-your-website/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/05/21/how-to-speed-up-your-website/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[Verifying domain name ownership]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/c4iZRvP_GFw/" />
		<id>http://www.onlineaspect.com/?p=228</id>
		<updated>2009-05-15T06:36:19Z</updated>
		<published>2009-05-15T06:36:19Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="hacks" /><category scheme="http://www.onlineaspect.com" term="kindle" /><category scheme="http://www.onlineaspect.com" term="random" />		<summary type="html">I got a nice shout-out on TechCrunch today for discovering an issue with the new Kindle Publisher program.  The vulnerability allowed anyone to claim a blog as their own and take advantage of the 30% rev-share that Amazon offers on their $1.99 subscription fee.  Erick Schonfeld did a nice job covering the issue and explaining [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/05/14/verifying-domain-name-ownership/">&lt;p&gt;I got a nice shout-out on &lt;a href="http://www.techcrunch.com"&gt;TechCrunch&lt;/a&gt; today for discovering an issue with the new&lt;a href="https://kindlepublishing.amazon.com/"&gt; Kindle Publisher program&lt;/a&gt;.  The vulnerability allowed anyone to claim a blog as their own and take advantage of the 30% rev-share that Amazon offers on their $1.99 subscription fee.  Erick Schonfeld did a nice job covering the issue and explaining the implications of the hack.  You can &lt;a href="http://www.techcrunch.com/2009/05/14/how-the-kindle-now-lets-you-steal-this-blog/?awesm=tcrn.ch_1x0&amp;amp;utm_medium=tcrn.ch-copypaste&amp;amp;utm_content=shorturl&amp;amp;utm_campaign=techcrunch&amp;amp;utm_source=direct-tcrn.ch"&gt;read about it on the TechCrunch article&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The interesting thing about this vulnerability is that there are already accepted methods in place for verifying that someone owns a domain name.  I understand that Amazon may have wanted to remove the friction from getting people started, but this stuff matters too much to get wrong &amp;#8212; especially when there is a large audience and money to be gained.&lt;/p&gt;
&lt;p&gt;For those who are interested in the best way to do domain name ownership (ahem, Amazon) Google would be a great role model for you to follow.  There is a nice explanation on &lt;a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;amp;answer=35179"&gt;how Google&amp;#8217;s domain verification process works&lt;/a&gt; on their help pages:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;To verify that you own a site, you can either add a meta tag to your home page (proving that you have access to the source files), or upload an HTML file with the name you specify to your server (proving that you have access to the server).&lt;/p&gt;
&lt;p&gt;Each verification method has its advantages. Verifying using a meta tag is ideal if you aren&amp;#8217;t able to upload a file to your server. If you have direct access to your server, you may find it easier and faster to upload an HTML file.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Amazon would do well to follow Google&amp;#8217;s lead.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/c4iZRvP_GFw" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/05/14/verifying-domain-name-ownership/#comments" thr:count="6" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/05/14/verifying-domain-name-ownership/feed/atom/" thr:count="6" />
		<thr:total>6</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/05/14/verifying-domain-name-ownership/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[Managing code releases]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/HnzxsaSpf2I/" />
		<id>http://onlineaspect.com/2009/03/25/managing-code-releases/</id>
		<updated>2009-04-08T08:13:39Z</updated>
		<published>2009-03-25T10:51:00Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="code" /><category scheme="http://www.onlineaspect.com" term="shell scripting" /><category scheme="http://www.onlineaspect.com" term="software development" />		<summary type="html">Recently I decided to streamline my code release process.  I use subversion for my source control which means I push code live by running svn up on each of our production servers.  I&amp;#8217;m lazy, so I wanted an easier way to do this all at once.  The end result is a simple [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/03/25/managing-code-releases/">&lt;p&gt;Recently I decided to streamline my code release process.  I use subversion for my source control which means I push code live by running &lt;em&gt;svn up&lt;/em&gt; on each of our production servers.  I&amp;#8217;m lazy, so I wanted an easier way to do this all at once.  The end result is a simple shell script that lets me run svn update commands on multiple servers at once.  It shows me the status of svn on each server and gives me chance to confirm that everything is okay before going ahead with the launch.&lt;/p&gt;
&lt;p&gt;This example assumes you have two servers (app1 and app2) that are using public key authentication.  Obviously, you&amp;#8217;ll need to modify this script to work in your own environment.  Make sure you replace &amp;#8220;/var/www/&amp;#8221; with your own document root and change appX.yourdomain.com to the IP address of each production server.&lt;/p&gt;
&lt;div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;&lt;span class="co0"&gt;#!/bin/sh&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="co0"&gt;# connect to each server and echo their current status&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;Connecting to app1...&lt;span class="es1"&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw2"&gt;ssh&lt;/span&gt; app1.yourdomain.com &lt;span class="st_h"&gt;'cd /var/www/; svn status --show-updates; exit'&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;&lt;span class="es1"&gt;\n&lt;/span&gt;Connecting to app2...&lt;span class="es1"&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw2"&gt;ssh&lt;/span&gt; app2.yourdomain.com &lt;span class="st_h"&gt;'cd /var/www/; svn status --show-updates; exit'&lt;/span&gt;&lt;br /&gt;
&lt;span class="co0"&gt;# add additional servers here as needed&lt;/span&gt;&lt;br /&gt;
tput smso&lt;br /&gt;
&lt;span class="co0"&gt;# confirm the release before publishing&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;&lt;span class="es1"&gt;\n&lt;/span&gt;Do you want to publish these changes to production? (y/n)&lt;span class="es1"&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;br /&gt;
tput rmso&lt;br /&gt;
&lt;span class="kw2"&gt;read&lt;/span&gt; answer&lt;br /&gt;
&lt;span class="kw1"&gt;if&lt;/span&gt; &lt;span class="br0"&gt;&amp;#91;&lt;/span&gt; &lt;span class="re1"&gt;$answer&lt;/span&gt; == &lt;span class="st0"&gt;&amp;quot;y&amp;quot;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;; &lt;span class="kw1"&gt;then&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="co0"&gt;# if &amp;quot;y&amp;quot;, proceed with the release&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;&lt;span class="es1"&gt;\n&lt;/span&gt;Publishing to production...&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;&lt;span class="es1"&gt;\n&lt;/span&gt;Publishing to app1...&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw2"&gt;ssh&lt;/span&gt; app1.yourdomain.com &lt;span class="st_h"&gt;'cd /var/www/; svn up; exit'&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;&lt;span class="es1"&gt;\n&lt;/span&gt;Publishing to app2...&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw2"&gt;ssh&lt;/span&gt; app2.yourdomain.com &lt;span class="st_h"&gt;'cd /var/www/; svn up; exit'&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="co0"&gt;# add additional servers here as needed&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;&lt;span class="es1"&gt;\n&lt;/span&gt;Done&amp;quot;&lt;/span&gt;&lt;br /&gt;
&lt;span class="kw1"&gt;else&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="co0"&gt;# if &amp;quot;n&amp;quot;, cancel the release.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw3"&gt;echo&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;&lt;span class="es1"&gt;\n&lt;/span&gt;Canceled&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class="kw3"&gt;exit&lt;/span&gt;;&lt;br /&gt;
&lt;span class="kw1"&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/HnzxsaSpf2I" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/03/25/managing-code-releases/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/03/25/managing-code-releases/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/03/25/managing-code-releases/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Josh Fraser</name>
						<uri>http://www.joshfraser.com</uri>
					</author>
		<title type="html"><![CDATA[Too many DNS lookups in an SPF record]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/OnlineAspect/~3/7J35ULitf1U/" />
		<id>http://onlineaspect.com/2009/03/20/too-many-dns-lookups-in-an-spf-record/</id>
		<updated>2009-03-29T08:39:53Z</updated>
		<published>2009-03-20T09:38:45Z</published>
		<category scheme="http://www.onlineaspect.com" term="Uncategorized" /><category scheme="http://www.onlineaspect.com" term="dns" /><category scheme="http://www.onlineaspect.com" term="email deliverability" /><category scheme="http://www.onlineaspect.com" term="spf records" />		<summary type="html">I recently noticed I was having new email deliverability issues.  It surprised me since things had been going well since switching to AuthSMTP for our outgoing mail.  The first thing I checked was my SPF record.   It looked like this:
v=spf1 a mx include:aspmx.googlemail.com include:authsmtp.com include:salesforce.com -all
At first glance everything seems okay. [...]</summary>
		<content type="html" xml:base="http://www.onlineaspect.com/2009/03/20/too-many-dns-lookups-in-an-spf-record/">&lt;p&gt;I recently noticed I was having new email deliverability issues.  It surprised me since things had been going well since switching to &lt;a href="http://www.authsmtp.com"&gt;AuthSMTP&lt;/a&gt; for our outgoing mail.  The first thing I checked was my SPF record.   It looked like this:&lt;/p&gt;
&lt;div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;v=spf1 a mx include:aspmx.googlemail.com include:authsmtp.com include:salesforce.com -all&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;At first glance everything seems okay.  Basically it says to include all A records, MX records, and to include the SPF records provided by Google Apps, AuthSMTP and Salesforce.  Since that covers every legitimate sender, I finish it off with the -all which indicates a hard fail.  Ok, so the syntax is good.  You can&amp;#8217;t tell that anything is wrong without digging a little deeper.  When you actually try to evaluate it you&amp;#8217;ll get this error message:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Results - PermError SPF Permanent Error: Too many DNS lookups&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After &lt;a href="http://en.wikipedia.org/wiki/Sender_Policy_Framework#Error_handling"&gt;a little research&lt;/a&gt; I found out that &lt;strong&gt;you are only allowed 10 DNS lookups&lt;/strong&gt; and &lt;strong&gt;fetching the TXT and SPF records count toward that total&lt;/strong&gt;.  That means after you add in the A and MX lookups, we&amp;#8217;re at 7 before we even look inside the includes.  Let&amp;#8217;s pull up the SPF record for Google Apps:&lt;/p&gt;
&lt;div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;v=spf1 redirect=_spf.google.com&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;That redirect counts as another DNS lookup.  That puts me up to 8 DNS lookups. Thankfully the Salesforce SPF record is nice and clean:&lt;/p&gt;
&lt;div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;v=spf1 ip4:204.14.232.0/25 ip4:204.14.234.0/25 ip4:63.150.46.16 ip4:207.126.144.0/20 ip4:64.18.0.0/20 mx ~all&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;That leaves AuthSMTP:&lt;/p&gt;
&lt;div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;v=spf1 include:spf-a.authsmtp.com include:spf-b.authsmtp.com include:spf-c.authsmtp.com include:spf-d.authsmtp.com ~all&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Ouch!  That&amp;#8217;s 4 more lookups and the worst part of it is that spf-d.authsmtp.com doesn&amp;#8217;t even do anything!&lt;/p&gt;
&lt;p&gt;The first thing I did was take out the MX lookup since it&amp;#8217;s redundant.  I also replaced aspmx.googlemail.com with _spf.google.com which is what it redirects to anyway.  Technically, this isn&amp;#8217;t a good idea since Google could change it on me &amp;#8212; but remember I don&amp;#8217;t have a lot of options here.  I&amp;#8217;m just happy to see my revised record pass the test:&lt;/p&gt;
&lt;div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:664px"&gt;&lt;div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace"&gt;v=spf1 a include:_spf.google.com include:authsmtp.com include:salesforce.com -all&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I also sent an email to the AuthSMTP team.  They responded within 30 minutes saying that they would remove the extra DNS record and look at how they can clean things up.&lt;/p&gt;
&lt;p&gt;I learned something tonight.  Remember to count the DNS lookups in your SPF record.  It turns out they can add up faster than points on a teenagers drivers license.  And if you&amp;#8217;re using a lot of includes like I am, remember to do periodic checks to make sure nothing has changed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Resources: &lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I wrote about &lt;a href="http://onlineaspect.com/2007/11/08/tutorial-sending-email-through-gmail/"&gt;Sending email through Gmail&lt;/a&gt; over a year ago.  While I absolutely don&amp;#8217;t recommend you try this anymore, it has some useful information on SPF records and email deliverability in general.&lt;/li&gt;
&lt;li&gt;Kitterman have a great tool to help &lt;a href="http://www.kitterman.com/spf/validate.html"&gt;validate your SPF records&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;img src="http://feeds.feedburner.com/~r/OnlineAspect/~4/7J35ULitf1U" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://www.onlineaspect.com/2009/03/20/too-many-dns-lookups-in-an-spf-record/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://www.onlineaspect.com/2009/03/20/too-many-dns-lookups-in-an-spf-record/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://www.onlineaspect.com/2009/03/20/too-many-dns-lookups-in-an-spf-record/</feedburner:origLink></entry>
	</feed>
