<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ardamis &#187; javascript</title>
	<atom:link href="http://www.ardamis.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ardamis.com</link>
	<description>Ardamis is a blog about web development and technology in general.</description>
	<lastBuildDate>Sat, 04 Feb 2012 15:26:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Ardamis in 2012 &#8211; new look, more microdata, faster code</title>
		<link>http://www.ardamis.com/2012/01/22/ardamis-2012/</link>
		<comments>http://www.ardamis.com/2012/01/22/ardamis-2012/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 05:50:02 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1863</guid>
		<description><![CDATA[Ardamis.com is starting out 2012 with a new look, better structured data markup, and a revamped anti-spam system.]]></description>
			<content:encoded><![CDATA[<p>Just a few weeks behind schedule, but a long time in the works, I&#8217;ve finally pushed the new WordPress theme for Ardamis live.  Basic and elegant (I&#8217;m trying to establish a trend here), the theme also should outperform its predecessors in both page load times and SEO-potential.  The index and archive pages should appear more consistent, and all pages should provide more complete structured data markup (<a href="http://schema.org/">schema.org</a> as well as <a href="http://microformats.org/wiki/existing-classes">microformats.org</a>).  The comment form has been outfitted with <a href="http://www.ardamis.com/2011/08/27/a-cache-proof-method-for-reducing-comment-spam/">an improved approach to reducing comment spam</a>.</p>
<p>The new theme is pretty light on the graphics, due to increased browser support for and subsequently greater use of CSS3 goodness for box shadows and gradients.  I&#8217;ve reduced the number of image files to two: a background and a sprites file.</p>
<p>Only half-implemented in the previous theme, the new look, &#8220;Joy&#8221;, makes much better use of structured data markup, or <a href="http://en.wikipedia.org/wiki/Microdata_(HTML)">microdata</a>.  Google is absolutely looking for ways to display your pages&#8217; semantic markup in its results, so you may as well get on board.</p>
<p>The frequency of spam comments increased dramatically over the past two months, according to my Akismet stats, so I&#8217;ve gone back to the drawing board and developed a better front-line defense against them.  The new method should be more opaque to bots that parse JavaScript while still being invisible to human visitors leaving legitimate comments.</p>
<p>In sum, I think Ardamis should be leaner, faster, and smarter (and maybe prettier) in 2012 than ever before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2012/01/22/ardamis-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A PHP MySQL snippet for looking up names</title>
		<link>http://www.ardamis.com/2011/10/16/a-php-mysql-snippet-for-looking-up-names/</link>
		<comments>http://www.ardamis.com/2011/10/16/a-php-mysql-snippet-for-looking-up-names/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 00:26:35 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Nonsense]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1775</guid>
		<description><![CDATA[A PHP snippet and MySQL query for an Ajax autocompleter lookup of people names by either "Firstname Lastname" or "Lastname, Firstname" from a single input field.]]></description>
			<content:encoded><![CDATA[<p>For a recent project, I needed to create a form that would perform a look up of people names in a MySQL database, but I wanted to use a single input field.  To make it easy on the users of the form, I wanted the input field to accept names in either &#8220;Firstname Lastname&#8221; or &#8220;Lastname, Firstname&#8221; format, and I wanted it to autocomplete matches as the users typed, including when they typed both names separated by a space or a comma followed by a space.</p>
<p>The Ajax lookup was quick work with <a href="http://jqueryui.com/demos/autocomplete/">jQuery UI&#8217;s Autocomplete widget</a>.  The harder part was figuring out the most simple table structure and an appropriate SQL query.</p>
<h2>A flawed beginning</h2>
<p>My people table contains a &#8220;first_name&#8221; column and a &#8220;last_name&#8221; column, nothing uncommon there.  To get the project out the door, I wrote a PHP function that ran two ALTER TABLE queries on the people table to create two additional columns for pre-formatted strings (column &#8220;firstlast&#8221;, to be formatted as &#8220;Firstname Lastname&#8221;, and column &#8220;lastfirst&#8221;, to be formatted as &#8220;Lastname, Firstname&#8221;), added indexes on these columns, and then walked through each record in the table, populating these new fields.  I then wrote a very straight forward SQL query to perform a lookup on both fields.  The PHP and query looked something like this:</p>
<pre class="brush: php; title: ; notranslate">
// The jQuery UI Autocomplete widget passes the user input as a value for the parameter &quot;name&quot;
$name= $_GET['name'];

// This SQL query uses argument swapping
$query = sprintf(&quot;SELECT * FROM people WHERE (`firstlast` LIKE '%1\$s' OR `lastfirst` LIKE '%1\$s') ORDER BY `lastfirst` ASC&quot;,
mysql_real_escape_string($name. &quot;%&quot;, $link));
</pre>
<p>This was effective, accurate, and pretty fast, but the addition of columns bothered me and I didn&#8217;t like that I needed to run a process to generate those pre-formatted fields each time a record was added to the table (or if a change was made to an existing record).  One possible alternative was to watch the input and match either lastname or firstname until the user entered a comma or a space, then explode the string on the comma or space and search more precisely.  Once a comma or a space was encountered, I felt pretty sure that I would be able to accurately determine which part of the input was the first name and which was the last name.  But this had that same inefficient, clunky bad-code-smell as the extra columns.  (Explode is one of those functions that I try to avoid using.)  Writing lots of extra PHP didn&#8217;t seem necessary or right.</p>
<p>I&#8217;m much more comfortable with PHP than with MySQL queries, but I realize that one can do some amazing things within the SQL query, and that it&#8217;s probably faster to use SQL to perform some functions.  So, I decided that I&#8217;d try to work up a query that solved my problem, rather than write more lines of PHP.</p>
<h2>CONCAT_WS to the rescue</h2>
<p>I Googled around for a bit and settled on using <code><a href="http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_concat-ws">CONCAT_WS</a></code> to concatenate the first names and last names into a single string be matched, but found it a bit confusing to work with.  I kept trying to use it to create an alias, &#8220;lastfirst&#8221;, and then use the alias in the WHERE clause, which doesn&#8217;t work, or I was getting the literal column names back instead of the values.  Eventually, I hit upon the correct usage.</p>
<p>The PHP and query now looks like this:</p>
<pre class="brush: php; title: ; notranslate">
// The jQuery UI Autocomplete widget passes the user input as a value for the parameter &quot;name&quot;
$name= $_GET['name'];

// This SQL query uses argument swapping
$query = sprintf(&quot;SELECT *, CONCAT_WS(  ', ',  `last_name`,  `first_name` ) as lastfirst FROM people WHERE (CONCAT_WS(  ', ',  `last_name`,  `first_name` ) LIKE '%1\$s' OR CONCAT_WS(  ' ',  `first_name`,  `last_name` ) LIKE '%1\$s') ORDER BY lastfirst ASC&quot;,
mysql_real_escape_string($name. &quot;%&quot;, $link));
</pre>
<p>The first instance of CONCAT_WS isn&#8217;t needed for the lookup.  The first instance allows me to order the results alphabetically and provides me an array key of &#8220;lastfirst&#8221; with a value of the person&#8217;s name already formatted as &#8220;Lastname, Firstname&#8221;, so I don&#8217;t have to do it later with PHP.  The lookup comes from the two instances of CONCAT_WS in the WHERE clause.  I haven&#8217;t done any performance measuring here, but the results of the lookup get back to the user plenty fast enough, if not just as quickly as the method using dedicated columns.</p>
<p>The result of the query is output back to the page as JSON-formatted data for use in the jQuery Autocomplete.</p>
<p>The end result works exactly as I had hoped.  A user of the form is able to type a person&#8217;s name in whatever way is comfortable to them, as &#8220;Bob Smith&#8221; or &#8220;Smith, Bob&#8221;, and the matches are found either way.  The only thing it doesn&#8217;t do is output the matches back to the autocompleter in the same format that the user is using.  But I can live with that for now. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/10/16/a-php-mysql-snippet-for-looking-up-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A cache-friendly method for reducing WordPress comment spam</title>
		<link>http://www.ardamis.com/2011/08/27/a-cache-proof-method-for-reducing-comment-spam/</link>
		<comments>http://www.ardamis.com/2011/08/27/a-cache-proof-method-for-reducing-comment-spam/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 08:34:53 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Nonsense]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1673</guid>
		<description><![CDATA[A safe-for-cached-pages method of filtering out spam comments by requiring at least some time to have passed between the time the page is loaded and the form is submitted.]]></description>
			<content:encoded><![CDATA[<p>In the endless battle against WordPress comment spam, I&#8217;ve developed and then refined a few different methods for preventing spam from getting to the database to begin with.  My philosophy has always been that a human visitor and a spam bot behave differently (after all, we&#8217;re not dealing with <a href="http://en.wikipedia.org/wiki/Do_Androids_Dream_of_Electric_Sheep%3F#Androids">Nexus-6 model androids</a> here), and an effective spam-prevention method should be able to recognize the differences.  I also have a dislike for CAPTCHA methods that require a human visitor to <em>prove</em>, via an intentionally difficult test, that they aren&#8217;t a bot.  The ideal method, I feel, would be invisible to a human visitor, but still accurately identify comments submitted by bots.</p>
<h2>A history of spam fighting</h2>
<p>The most successful and simple method I found was a server-side system for <a href="http://www.ardamis.com/2007/12/15/using-timestamps-to-reduce-wordpress-comment-spam/">reducing comment spam by using a handshake method involving timestamps</a> on hidden form fields.  The general idea was that a bot would submit a comment more quickly than a human visitor, so if the comment was submitted too soon after the page was loaded, it was rejected.  A human caught in this trap would be able to click the Back button on the browser to resubmit.  This had proven to be very effective on ardamis.com, cutting the number of <a href="http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/">spam comments intercepted by Akismet per day to nearly zero</a>.  For a long time, the only problem was that it required modifying a core WordPress file, <strong>wp-comments-post.php</strong>.  Each time WordPress was updated, the core file was replaced.  If I didn&#8217;t then go back and make my modifications again, <a href="http://www.ardamis.com/2011/01/18/a-chart-illustrating-the-reduction-in-comment-spam-at-ardamis-com/">I would lose the spam protection</a> until I made the changes.  As it became easier to update WordPress (via the admin panel) and I updated it more frequently, editing the core file became more of a nuisance.</p>
<h2>A huge facepalm</h2>
<p>When Google began weighting page load times as part of its ranking algorithm, I implemented the <a href="http://wordpress.org/extend/plugins/wp-super-cache/" title="WP Super Cache">WP Super Cache</a> caching plugin on ardamis.com and configured it to use .htaccess and mod_rewrite to serve cache files.  Page load times certainly decreased, but the amount of spam detected by Akismet increased.  After a while, I realized that this was because the spam bots were submitting comments from static, cached pages, and the timestamps on those pages, which had been generated server-side with PHP, were already minutes old when the page was requested.  The form processing script, which normally rejects comments that are submitted too quickly to be written by a human visitor, happily accepted the timestamps.  Even worse, a second function of my anti-spam method also rejected comments that were submitted 10 minutes or more after the page was loaded.  Of course, most of the visitors were being served cached pages that were already more than 10 minutes old, so even legitimate comments were being rejected.  Using PHP to generate my timestamps obviously was not going to work if I wanted to keep serving cached pages.</p>
<h2>JavaScript to the rescue</h2>
<p>Generating real-time timestamps on cached pages requires JavaScript.  But instead of a reliable server clock setting the timestamp, the time is coming from the visitor&#8217;s system, which can&#8217;t be trusted to be accurate.  Merely changing the comment form to use JavaScript to generate the first timestamp wouldn&#8217;t work, because verifying a timestamp generated on the client-side against one generated with a server-side language would be disastrous.</p>
<p>Replacing the PHP-generated timestamps with JavaScript-generated timestamps would require substantial changes to the system.</p>
<p>Traditional client-side form validation using JavaScript happens when the form is submitted.  If the validation fails, the form is not submitted, and the visitor typically gets an alert with suggestions on how to make the form acceptable.  If the validation passes, the form submission continues without bothering the visitor.  To get our two timestamps, we can generate a first timestamp when the page loads and compare it to a second timestamp generated when the form is submitted.  If the visitor submits the form too quickly, we can display an alert showing the number of seconds remaining until the form can be successfully submitted.  This should hopefully be invisible to most visitors who choose to leave comments, but at the very least, far less irritating than a CAPTCHA system.</p>
<p>It took me two tries to get it right, but I&#8217;m going to discuss the less successful method first to point out its flaws.</p>
<h3>Method One (not good enough)</h3>
<p>Here&#8217;s how the original system flowed.</p>
<ol>
<li>Generate a first JS timestamp when the page is loaded.</li>
<li>Generate a second JS timestamp when the form is submitted.</li>
<li>Before the form is submitted, compare the two, and if enough time has passed, write a pre-determined passcode to a hidden INPUT element, then submit the form.</li>
<li>On the form processing page, use server-side logic to verify that the passcode is present and valid.</li>
</ol>
<p>The problem was that it seemed that certain bots could parse JavaScript enough to drop the pre-determined passcode into the hidden form field before submitting the form, circumventing the timestamps completely and defeating the system.  </p>
<p>It also failed to adhere to one of the basic tenants of form validation &#8211; that the input must be checked on both the client-side and the server-side.</p>
<h3>Method Two (better)</h3>
<p>Rather than having the server-side validation be merely a check to confirm that the passcode is present, method two goes back to comparing the timestamps a second time on the server side. Instead of a single hidden input, we now have two &#8211; one for each timestamp.  This is intended to prevent a bot from figuring out the ultimate validation mechanism by simply parsing the JavaScript.  Finally, the hidden fields are added to the form via jQuery, which makes it easier to implement and may act as another layer of obfuscation. </p>
<ol>
<li>Generate a first JS timestamp when the page is loaded and write it to a hidden form field.</li>
<li>Generate a second JS timestamp when the form is submitted and write it to a hidden form field.</li>
<li>Before the form is submitted, compare the two, and if enough time has passed, submit the form (client-side validation).</li>
<li>On the form processing page, use server-side logic to compare the timestamps a second time (server-side validation).</li>
</ol>
<p>The timestamp handshake works more like it did in the server-side-only method.  We still have to pass something from the comment form to the processing script, but it&#8217;s not too obvious from the HTML what is being done with it.</p>
<h2>The same downside plagues me</h2>
<p>Unfortunately, if we want to have any server-side validation at all, and we do, the core file <strong>wp-comments-post.php</strong> will still have to be modified.  In my experience, the system is not sufficiently effective using just client-side validation.  </p>
<h2>The code</h2>
<p>Two files must be modified to implement the validation.</p>
<p><strong>File 1: The theme&#8217;s comments.php file (older themes) or wp-includes\comment-template.php (newer themes)</strong></p>
<p>Your comment form lives somewhere.  My theme is based on Kubrick, the old default WordPress theme, and my comment form is in my theme folder, in a file named <strong>comments.php</strong>.  If your theme is newer and based on the current default theme, twentyeleven, the form is in <strong>wp-includes\comment-template.php</strong>.  If your theme isn&#8217;t based on either of these, all bets are off.  I know it&#8217;s confusing.  Sorry.</p>
<p>Add the JavaScript that creates and populates the timestamp fields.  Be sure to confirm that your comment form has an ID of <strong>commentform</strong>.  I&#8217;m using jQuery to help fire functions when the page loads.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function(){
	ardGenTS1();
});

function ardGenTS1() {
	// prepare the form
	$('#commentform').append('&lt;input type=&quot;hidden&quot; name=&quot;ardTS1&quot; id=&quot;ardTS1&quot; value=&quot;1&quot; /&gt;');
	$('#commentform').append('&lt;input type=&quot;hidden&quot; name=&quot;ardTS2&quot; id=&quot;ardTS2&quot; value=&quot;1&quot; /&gt;');
	$('#commentform').attr('onsubmit', 'return validate()');
	// set a first timestamp when the page loads
	var ardTS1 = (new Date).getTime();
	document.getElementById(&quot;ardTS1&quot;).value = ardTS1;
}

function validate() {
	// read the first timestamp
	var ardTS1 = document.getElementById(&quot;ardTS1&quot;).value;
//	alert ('ardTS1: ' + ardTS1);
	// generate the second timestamp
	var ardTS2 = (new Date).getTime();
	document.getElementById(&quot;ardTS2&quot;).value = ardTS2;
//	alert ('ardTS2: ' + document.getElementById(&quot;ardTS2&quot;).value);
	// find the difference
	var diff = ardTS2 - ardTS1;
	var elapsed = Math.round(diff / 1000);
	var remaining = 10 - elapsed;
//	alert ('diff: ' + diff + '\n\nelapsed:' + elapsed);
	// check whether enough time has elapsed
	if (diff &gt; 10000) {
		// submit the form
		return true;
	}else{
		// display an alert if the form is submitted within 10 seconds
		alert(&quot;This site is protected by an anti-spam feature that requires 10 seconds to have elapsed between the page load and the form submission.\n\nPlease close this alert window.  The form may be resubmitted successfully in &quot; + remaining + &quot; seconds.&quot;);
		// prevent the form from being submitted
		return false;
	}
}
&lt;/script&gt;
</pre>
<p><strong>File 2: The wp-comments-post.php file</strong></p>
<p>The wp-comments-post.php file lives in the root of WordPress and handles the form processing.  We need to add a few lines that check the contents of our new validation input field.</p>
<p>Somewhere after line 53 or so (where <em>$comment_content</em> is defined), insert the following code.</p>
<pre class="brush: php; title: ; notranslate">
$ardTS1 = ( isset($_POST['ardTS1']) ) ? trim($_POST['ardTS1']) : 1;
$ardTS2 = ( isset($_POST['ardTS2']) ) ? trim($_POST['ardTS2']) : 2;
$ardTS = $ardTS2 - $ardTS1;

if ( $ardTS &lt; 10000 ) {
// If the difference of the timestamps is not more than 10 seconds, exit
    wp_die( __('&lt;strong&gt;ERROR&lt;/strong&gt;:  This site uses JavaScript validation to reduce comment spam.  Either your browser has JavaScript disabled, or the comment was not legitimately submitted.') );
}
</pre>
<p>That&#8217;s it.  Not so bad, right?</p>
<h2>Final thoughts</h2>
<p>One advantage to this method over the old PHP-only method is that even if the core file is replaced and the server-side validation is lost, the client-side validation continues to work, perhaps providing some measure of protection.</p>
<p>The method is safe for use with caching systems that create purely static, HTML pages.  I&#8217;ll follow up later and report on how effective it seems to be at stopping spam comments before they get to Akismet (and into the WordPress database).</p>
<p>Now, for a little extra protection, you can rename the <strong>wp-comments-post.php</strong> file and change the path in the comment form&#8217;s action attribute.  I&#8217;ve <a href="http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/">posted logs</a> showing that some bots just try to post spam directly to the <strong>wp-comments-post.php</strong> file, so renaming that file is an easy way to cut down on spam.  Just remember to come back and delete the <strong>wp-comments-post.php</strong> file each time you update WordPress.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/08/27/a-cache-proof-method-for-reducing-comment-spam/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Jealous of The Social Network</title>
		<link>http://www.ardamis.com/2011/06/12/jealous-of-the-social-network/</link>
		<comments>http://www.ardamis.com/2011/06/12/jealous-of-the-social-network/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 02:46:50 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Nonsense]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[downloads]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1467</guid>
		<description><![CDATA[A short list of my programming accomplishments.]]></description>
			<content:encoded><![CDATA[<p>So I finally watched <a href="http://en.wikipedia.org/wiki/The_Social_Network"><em>The Social Network</em></a> over the weekend, and it&#8217;s made me feel jealous and a bit guilty.</p>
<p>In a meager effort to console myself for so far failing to be a billionaire, I&#8217;m assembling the short list of web-application type things I&#8217;ve built here.</p>
<ol>
<li>A dice roller: <a href="http://alephstudios.com/rollforit/">rollforit</a>. Enter a name, create a room, invite your friends, and start rolling dice.  For people who want to play pen and paper, table-top RPG dice games with their distant friends.</li>
<li>A URL shortener: <a href="http://minifi.de/">Minifi.de</a>.  Minifi.de comes with an API and a bookmarklet.  It really works, too!  The <a href="http://minifi.de/technical.php">technical explanation</a> has more details.</li>
<li>A social networking site: <a href="http://alephstudios.com/snapbase/">Snapbase</a>.  Snapbase is a social site that shows you what&#8217;s going on in your city or anywhere in the world as pictures are uploaded by your friends and neighbors.  The application extracts location information from the EXIF data embedded in images and displays recent images taken near your present location.</li>
<li>A <a href="http://alephstudios.com/helpdesk/">trouble-ticketing system</a> for an IT help desk or technical support center.  It&#8217;s really pretty extensive, with asset management, user accounts, salted encrypted passwords, and all sorts of nifty things.  I really must write a full description of it at some point, but until then, the <a href="http://alephstudios.com/helpdesk/documentation/">documentation</a> is the next best thing.</li>
<li>An <a href="http://alephstudios.com/ias/">account-based invoice tracking and access system</a> for grouping invoices according to clients, then sharing invoice history with those clients and allowing them to easily pay outstanding invoices via Paypal.</li>
<li>An <a href="http://alephstudios.com/ias/">account-based invoice access system</a> where clients can view paid and unpaid invoices, and even easily pay an outstanding invoice via Paypal. I actually use this almost every day.</li>
<li>A simple method for <a href="http://www.ardamis.com/2008/06/11/protecting-a-download-using-a-unique-url/">protecting a download using a unique URL</a> that can be emailed to authorized users. The URL can be set to expire after a certain amount of time or any number of downloads.</li>
<li>An update to the above download protection script to <a href="http://www.ardamis.com/2009/06/26/protecting-multiple-downloads-using-unique-urls/">protect multiple downloads</a>, generate batches of keys, leave notes about who received the key, the ability to specify per-key the allowable number of downloads and age, and some basic reporting.</li>
<li>An HTML auction template generator called <a href="http://simpleauctionwizard.com/">Simple Auction Wizard</a>.  It helps you create HTML auction templates for eBay, and uses SWFUpload and tinyMCE.</li>
</ol>
<p>I have another project in the works that promises to be more financially viable, but the most clever thing on that list is Snapbase.  It&#8217;s in something akin to alpha right now; barely usable.  I really wish I had the time to pursue it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/06/12/jealous-of-the-social-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Online tools for testing web page performance</title>
		<link>http://www.ardamis.com/2011/04/10/online-tools-for-testing-web-page-performance/</link>
		<comments>http://www.ardamis.com/2011/04/10/online-tools-for-testing-web-page-performance/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 02:49:53 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=816</guid>
		<description><![CDATA[A collection of online tools for measuring the performance of web pages, including time to first byte.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a few tutorials lately on how to reduce page load times.  While I use Google&#8217;s Page Speed Firefox/Firebug plugin for evaluating pages for load times, there are times when I want a second opinion, or want to point a client to a tool.  This post is a collection of links to online tools for testing web page performance.</p>
<h2>Page Speed Online</h2>
<p><a href="http://pagespeed.googlelabs.com/">http://pagespeed.googlelabs.com/</a></p>
<p>Google&#8217;s wonderful Page Speed tool, once only available as a Firefox browser Add-on, finally arrives as an online tool.  Achieving a high score (ardamis.com is a 96/100) should be on every web developer&#8217;s list of things to do before the culmination of a project.</p>
<p>Enter a URL and Page Speed Online will run performance tests based on a set of best practices known to reduce page load times.</p>
<p>Optimizing caching &#8211; keeping your application&#8217;s data and logic off the network altogether<br />
Minimizing round-trip times &#8211; reducing the number of serial request-response cycles<br />
Minimizing request overhead &#8211; reducing upload size<br />
Minimizing payload size &#8211; reducing the size of responses, downloads, and cached pages<br />
Optimizing browser rendering &#8211; improving the browser&#8217;s layout of a page</p>
<h2>WebPagetest</h2>
<p><a href="http://www.webpagetest.org/">http://www.webpagetest.org/</a></p>
<p>WebPagetest is an excellent application for users who want the same sort of detailed reporting that one gets with Page Speed.</p>
<p>Load time speed test on first view (cold cache) and repeat view (hot cache), first byte and start render<br />
Optimization checklist<br />
Enable keep-alive, HTML compression, image compression, cache static content, combine JavaScript and CSS, and use of CDN<br />
Waterfall<br />
Response headers for each request</p>
<h2>Load Impact</h2>
<p><a href="http://loadimpact.com/pageanalyzer.php">http://loadimpact.com/pageanalyzer.php</a></p>
<p>Load Impact is an online load testing service that lets you load- and stress test your website over the Internet.  The page analyzer analyzes your web page performance by emulating how a web browser would load your page and all resources referenced in it. The page and its referenced resources are loaded and important performance metrics are measured and displayed in a load-bar diagram along with other per-resource attributes such as URL, size, compression ratio and HTTP status code.</p>
<h2>ByteCheck</h2>
<p><a href="http://www.bytecheck.com/">http://www.bytecheck.com/</a></p>
<p>ByteCheck is a super minimal site that return your page&#8217;s all-important time to first byte (TTFB). Time to first byte is the time it takes for a browser to start receiving information after it has started to make the request to the server, and is responsible for a visitor&#8217;s first impression that a page is fast- or slow-loading.</p>
<h2>Web Page Analyzer</h2>
<p><a href="http://websiteoptimization.com/services/analyze/">http://websiteoptimization.com/services/analyze/</a></p>
<p>My opinion is that the Web Page Analyzer report is good for beginners without much technical knowledge of things like gzip compression and Expires headers.  It&#8217;s a bit dated, and is primarily concerned with basics like how many images a page contains.  It tells you how fast you can expect your page to load for dial-up visitors, which strikes me as quaint and not particularly useful.</p>
<p>Total HTTP requests<br />
Total size<br />
Total size per object type (CSS, JavaScript, images, etc.)<br />
Analysis of number of files and file size as compared to recommended limits.</p>
<h2>The Performance Grader</h2>
<p><a href="http://www.joomlaperformance.com/component/option,com_performance/Itemid,52/">http://www.joomlaperformance.com/component/option,com_performance/Itemid,52/</a></p>
<p>This is another simplistic analysis of a site, like Web Page Analyzer, that returns its analysis in the form of pass/fail grades on about 14 different tests.  I expect that it would be useful for developers who want to show a client a third-party&#8217;s analysis of their work, if the third-party is not terribly technically savvy.  </p>
<p>One unique thing about this tool, though, is that it totals up the size of all images referenced in CSS files (even those that the current page isn&#8217;t using).</p>
<p>HTML Size<br />
Total Size<br />
Total Requests<br />
Generation Time<br />
Number of Hosts<br />
Number of Images<br />
Size of Images<br />
Number of CSS Files<br />
Size of CSS Files<br />
Number of Script Files<br />
Size of Script Files<br />
HTML Encoding<br />
Valid HTML<br />
Frames</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/04/10/online-tools-for-testing-web-page-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web development tools</title>
		<link>http://www.ardamis.com/2010/08/15/web-development-tools/</link>
		<comments>http://www.ardamis.com/2010/08/15/web-development-tools/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 03:39:17 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[script.aculo.us]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=842</guid>
		<description><![CDATA[A collection of web development tools for building better sites more easily.]]></description>
			<content:encoded><![CDATA[<p>A collection of web development tools for building better sites more easily.</p>
<h3>Frameworks and scripts</h3>
<p><a href="http://html5boilerplate.com/">HTML5 Boilerplate</a> is the professional badass&#8217;s base HTML/CSS/JS template for a fast, robust and future-proof site.</p>
<p><a href="http://scriptsrc.net/">scriptsrc.net</a> is a collection of script tags of the latest versions of a range of JavaScript libraries.</p>
<p><a href="http://www.modernizr.com/">Modernizr</a> adds classes to the &lt;html&gt; element which allow you to target specific browser functionality in your stylesheet. You don&#8217;t actually need to write any Javascript to use it.</p>
<h3>Images</h3>
<p><a href="http://placehold.it/">placehold.it</a> is a quick and simple image placeholder service.</p>
<h3>Text manipulation</h3>
<p><a href="http://www.textfixer.com/tools/">TextFixer</a> is a collection of online text tools. Remove line breaks from text, alphabetize text, capitalize the first letter of sentences, remove whitespaces, and uppercase text or lowercase text.</p>
<h3>XHTML</h3>
<p><a href="http://willpeavy.com/minifier/">HTML Minifier</a> will minify HTML (or XHTML), and any CSS or JS included in your markup.</p>
<h3>CSS</h3>
<p><a href="http://css3generator.com/">CSS3 Generator</a> is an awesome code generator for CSS3 snippets, and shows the minimum browser versions required to display the effects.</p>
<p><a href="http://procssor.com/">proCSSor</a> is an advanced CSS prettifier with tons of formatting options.</p>
<h3>JavaScript</h3>
<p><a href="http://jsbeautifier.org/">Online javascript beautifier</a> will reformat and reindent bookmarklets, ugly javascript, unpack scripts packed by the popular <a href="http://dean.edwards.name/packer/">Dean Edward&#8217;s packer,</a> as well as deobfuscate scripts processed by javascriptobfuscator.com.  The source code for the latest version is always available on <a href="http://github.com/einars/js-beautify">github</a>, and you can download the beautifier for local use (<a href="http://github.com/einars/js-beautify/zipball/master">zip</a>, <a href="http://github.com/einars/js-beautify/tarball/master">tar.gz</a>) as well.</p>
<h3>Fonts and Typography</h3>
<p>Fontshop.com has written <a href="http://www.fontshop.com/education/">A Field Guide to Typography</a> to get you excited about fonts and typography.</p>
<p><a href="http://www.typetester.org/">Typetester</a> is an online app for comparing different fonts for the screen, you can test up to three fonts at a time and choose the one you like. Its primary role is to make web designer’s life easier.</p>
<p>A quick chart of the <a href="http://www.ampsoft.net/webdesign-l/WindowsMacFonts.html">fonts common to all versions of Windows and the Mac equivalents</a>, or a more extensive <a href="http://media.24ways.org/2007/17/fontmatrix.html">matrix of fonts bundled with Mac and Windows operating systems, Microsoft Office and Adobe Creative Suite</a>.</p>
<p><a href="http://html-ipsum.com/">&lt;html&gt;ipsum</a> has Lorem ipsum already wrapped in HTML tags.  Pre-made paragraphs, lists, etc&#8230;</p>
<p>More resources at: <a href="http://www.smashingmagazine.com/2009/01/27/css-typographic-tools-and-techniques/">50 Useful Design Tools For Beautiful Web Typography</a> and <a href="http://speckyboy.com/2009/01/12/21-typography-and-font-web-apps-you-cant-live-without/">21 Typography and Font Web Apps You Can&#8217;t Live Without</a>.</p>
<h3>Colors</h3>
<p><a href="http://colorschemedesigner.com/">Color Scheme Designer</a>.</p>
<h3>Markup</h3>
<p>Google Webmaster Tools&#8217; <a href="http://www.google.com/webmasters/tools/richsnippets">Rich Snippets Testing Tool</a>.</p>
<p>Use the Rich Snippets Testing Tool to check that Google can correctly parse your structured data markup and display it in search results.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2010/08/15/web-development-tools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to speed up WordPress</title>
		<link>http://www.ardamis.com/2010/08/03/how-to-speed-up-wordpress/</link>
		<comments>http://www.ardamis.com/2010/08/03/how-to-speed-up-wordpress/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 05:35:14 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=811</guid>
		<description><![CDATA[How to speed up WordPress by reducing HTTP requests and database look ups, using a faster mod_rewrite code, and shrinking the size of the database.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a few posts on how to speed up web sites by <a href="http://www.ardamis.com/2010/07/17/sending-headers-to-leverage-browser-caching/">sending the correct headers to leverage browser caching</a> and <a href="http://www.ardamis.com/2010/07/11/compress-files-without-mod_gzip-or-mod_deflate/">compressing .php, .css and .js files without mod_gzip or mod_deflate</a>.</p>
<p>The intended audience for this post is developers who have already applied most or all of Google&#8217;s <a href="http://code.google.com/speed/page-speed/docs/rules_intro.html">Web Performance Best Practices</a> and Yahoo&#8217;s <a href="http://developer.yahoo.com/performance/rules.html">Best Practices for Speeding Up Your Web Site</a> and are wondering how to speed up WordPress sites in particular.</p>
<p>I assume you&#8217;re familiar with <a href="http://codex.wordpress.org/WordPress_Optimization/Caching">WordPress caching</a> and are already using a caching plugin, such as <a href="http://wordpress.org/extend/plugins/wp-super-cache/">WP Super Cache</a>, <a href="http://wordpress.org/extend/plugins/w3-total-cache/">W3 Total Cache</a> or the like.  </p>
<h2>Reduce HTTP requests</h2>
<p>Reducing HTTP requests should be the very first thing step in speeding up any site.  If you are using plugins, watch them carefully for inefficiencies like added CSS and JavaScript files.  Combine, minify and compress these files.  Some plugins allow you to turn off their bundled CSS in the plugin&#8217;s settings page.  Where possible, copy the plugin&#8217;s CSS into the current theme&#8217;s style.css and turn off the extra file.</p>
<h2>Delete deactivated plugins</h2>
<p>Remove any plugins you&#8217;re not using.  Deactivated plugins can be deleted from the Plugins page.</p>
<h2>Speed up the mod_rewrite code</h2>
<p><a href="http://www.webmasterworld.com/profilev4.cgi?action=view&#038;member=jdMorgan">jdMorgan</a> from WebmasterWorld.com has written a replacement for the .htaccess rewrite rule used by WordPress.  This will speed up the WordPress mod_rewrite code by a factor of more than two.</p>
<blockquote><p>This is a total replacement for the code supplied with WP as bounded by the &#8220;Begin WP&#8221; and &#8220;End WP&#8221; comments, and fixes several performance-affecting problems. Notably, the unnecessary and potentially-problematic <IfModule> container is completely removed, and code is added and re-structured to both prevent completely-unnecessary file- and directory- exists checks and to reduce the number of necessary -exists checks to one-half the original count (due to the way mod_rewrite behaves recursively in .htaccess context).</p>
<p><a href="http://www.webmasterworld.com/apache/4053973.htm">http://www.webmasterworld.com/apache/4053973.htm</a>
</p></blockquote>
<p>The following code is adapted from the original to add png, flv and swf to the list of static file formats:</p>
<pre class="brush: plain; title: ; notranslate">
# BEGIN WordPress
# adapted from http://www.webmasterworld.com/apache/4053973.htm
#
RewriteEngine on
#
# Unless you have set a different RewriteBase preceding this point,
# you may delete or comment-out the following RewriteBase directive
# RewriteBase /
#
# if this request is for &quot;/&quot; or has already been rewritten to WP
RewriteCond $1 ^(index\.php)?$ [OR]
# or if request is for image, css, or js file
RewriteCond $1 \.(gif|jpg|png|ico|css|js|flv|swf)$ [NC,OR]
# or if URL resolves to existing file
RewriteCond %{REQUEST_FILENAME} -f [OR]
# or if URL resolves to existing directory
RewriteCond %{REQUEST_FILENAME} -d
# then skip the rewrite to WP
RewriteRule ^(.*)$ - [S=1]
# else rewrite the request to WP
RewriteRule . /index.php [L]
#
# END wordpress
</pre>
<h2>Only load the comment-reply.js when needed</h2>
<p>In the default WordPress template, the <strong>comment-reply.js</strong> script is included on all single post pages, regardless of whether nested/threaded comments is enabled.  A simple tweak changes the theme to only include <strong>comment-reply.js</strong> on single post pages only when it makes sense to do so: if threaded comments are enabled, commenting on that post is allowed, and a comment already exists.</p>
<p>Remove the following line from your theme&#8217;s <strong>header.php</strong>:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?&gt;
</pre>
<p>Add the following lines to your theme&#8217;s <strong>functions.php</strong>.</p>
<pre class="brush: php; title: ; notranslate">
// Don't add the wp-includes/js/comment-reply.js?ver=20090102 script to single post pages unless threaded comments are enabled
// adapted from http://bigredtin.com/behind-the-websites/including-wordpress-comment-reply-js/
function theme_queue_js(){
  if (!is_admin()){
    if (is_singular() &amp;&amp; (get_option('thread_comments') == 1) &amp;&amp; comments_open() &amp;&amp; have_comments())
      wp_enqueue_script('comment-reply');
  }
}
add_action('wp_print_scripts', 'theme_queue_js');
</pre>
<h2>Only load the l10n.js when needed</h2>
<p>In WordPress 3.1, a <strong>l10n.js</strong> script is loaded.  It is &#8220;mostly used for scripts that send over localization data from PHP to the JS side using <em>wp_localize_script()</em>.&#8221; Whether it&#8217;s safe to remove this file seems to be a matter of debate, but should you decide you want to remove it&#8230;</p>
<p>Add the following lines to your theme&#8217;s <strong>functions.php</strong>.</p>
<pre class="brush: php; title: ; notranslate">
// Don't add the wp-includes/js/l10n.js?ver=20101110 script to non-admin pages
// adapted from http://wordpress.stackexchange.com/questions/5451/what-does-l10n-js-do-in-wordpress-3-1-and-how-do-i-remove-it
function remove_l10n_js(){
  if (!is_admin()){
    wp_deregister_script('l10n');
  }
}
add_action('wp_print_scripts', 'remove_l10n_js');
</pre>
<h2>Replace unecessary code executions and database queries</h2>
<p>WordPress saves settings specific to your blog in the database.  These settings include what language your blog is written in, whether text is read left-to-right or vice versa, the path to the template directory, etc.</p>
<p>The default WordPress theme contains a number of database queries in order to figure out these things and build the correct page.  The default theme needs this flexibility, but your theme does not.  Joost de Valk recommends replacing these database queries with static text in your theme files in his post <a href="http://yoast.com/speed-up-wordpress/">Speed up WordPress, and clean it up too!</a></p>
<p>An easy way to do this is to browse to your web site and then view the source code.  Copy the content that won&#8217;t change from page to page and paste it into your theme, overwriting the PHP with the generated HTML.</p>
<p>For example, my theme&#8217;s header.php file contains this line:</p>
<pre class="brush: php; title: ; notranslate">
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &lt;?php language_attributes(); ?&gt;&gt;
</pre>
<p>The source code of the rendered page displays this line:</p>
<pre class="brush: php; title: ; notranslate">
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; dir=&quot;ltr&quot; lang=&quot;en-US&quot;&gt;
</pre>
<p>On my blog, this HTML output is never going to be anything different, so why make WordPress look these settings up in the database each time a page is loaded?  This line is an excellent candidate for replacement.  The footer.php file contains a handful more opportunities for replacement, but go through each of your theme&#8217;s files and look for references to the template directory and other data that won&#8217;t change as long as you&#8217;re using the theme.  All told, I was able to replace 12 database queries with static HTML.</p>
<p>Joost also recommends checking for unnecessary or slow database queries, and installing a helpful debugging plugin, in his post on <a href="http://yoast.com/wordpress-performance-optimization/">Optimizing WordPress database performance</a>.</p>
<h2>Clean out your MySQL database</h2>
<h3>Delete spam comments</h3>
<p>From the Dashboard, click Comments, then click on Empty Spam.</p>
<h3>Delete post revisions</h3>
<p>If you don&#8217;t use post revisions, you may want to delete them from the <code>wp_posts</code> table.  Back up your database, then run the following SQL query:</p>
<pre class="brush: sql; title: ; notranslate">
DELETE FROM wp_posts WHERE post_type = &quot;revision&quot;;
</pre>
<p>Before: 683 records<br />
After: 165 records</p>
<p>This does not delete the latest draft of unpublished posts.  It&#8217;s a good idea to optimize the table after deleting the revisions.</p>
<p>You can stop WordPress from saving post revisions by adding the following code to wp-config.php:</p>
<pre class="brush: php; title: ; notranslate">
define('WP_POST_REVISIONS', false );
</pre>
<h2>Optimize your MySQL database</h2>
<p>Optimizing your MyISAM tables is comparable to defragmenting your hard drive.  It&#8217;s probably been a while since you&#8217;ve done that, too.</p>
<p>If you&#8217;re using phpMyAdmin, browse to your WordPress database.  Under the Structure tab, at the bottom of the list of tables, click on the link &#8220;Check all&#8221;.  In the &#8220;With selected&#8221; menu, choose &#8220;Optimize table&#8221;.  (I would have recommended just optimizing tables that have overhead, but the <code>wp_posts</code> table can be optimized even when it doesn&#8217;t show any overhead.</p>
<blockquote><p>For MyISAM tables, OPTIMIZE TABLE works as follows:</p>
<ul>
<li>If the table has deleted or split rows, repair the table.</li>
<li>If the index pages are not sorted, sort them.</li>
<li>If the table&#8217;s statistics are not up to date (and the repair could not be accomplished by sorting the index), update them.</li>
</ul>
<p><a href="http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html">http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html</a></p></blockquote>
<h2>Flush the Buffer Early</h2>
<blockquote><p>When users request a page, it can take anywhere from 200 to 500ms for the backend server to stitch together the HTML page. During this time, the browser is idle as it waits for the data to arrive. In PHP you have the function <code><a href="http://php.net/flush">flush()</a></code>. It allows you to send your partially ready HTML response to the browser so that the browser can start fetching components while your backend is busy with the rest of the HTML page. The benefit is mainly seen on busy backends or light frontends.</p>
<p><a href="http://developer.yahoo.com/performance/rules.html#flush">http://developer.yahoo.com/performance/rules.html#flush</a></p></blockquote>
<p>Add <code>flush()</code> between the closing <code></head></code> tag and the opening <code><body></code> tag in <strong>header.php</strong>.</p>
<pre class="brush: php; title: ; notranslate">
&lt;/head&gt;
&lt;?php flush(); // http://developer.yahoo.com/performance/rules.html#flush ?&gt;
&lt;body&gt;
</pre>
<p>OK, so this isn&#8217;t technically a WordPress-specific tweak, but it&#8217;s a good idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2010/08/03/how-to-speed-up-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to send the correct headers to leverage browser caching</title>
		<link>http://www.ardamis.com/2010/07/17/sending-headers-to-leverage-browser-caching/</link>
		<comments>http://www.ardamis.com/2010/07/17/sending-headers-to-leverage-browser-caching/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 23:23:39 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[godaddy]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=794</guid>
		<description><![CDATA[How to use .htaccess to send the correct HTTP headers in order to leverage browser caching and reduce page load times for returning visitors.]]></description>
			<content:encoded><![CDATA[<p>As a follow-up to my post on <a href="http://www.ardamis.com/2010/07/11/compress-files-without-mod_gzip-or-mod_deflate/">compressing .php, .css and .js files without mod_gzip or mod_deflate</a>, I&#8217;m documenting the changes I made to the .htaccess file on ardamis.com in order to speed up page load times for returning visitors and satisfy the <a href="http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching">Leverage browser caching</a> recommendation of Google&#8217;s <a href="http://code.google.com/speed/page-speed/">Page Speed</a> Firefox/Firebug Add-on. </p>
<p>A great explanation of why browser caching helps the web deliver a better user experience is at <a href="http://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/">betterexplained.com</a>.</p>
<p>Two authoritative articles on the subject are Google&#8217;s <a href="http://code.google.com/speed/page-speed/docs/caching.html">Performance Best Practices | Optimize caching</a> and Yahoo&#8217;s <a href="http://developer.yahoo.com/performance/rules.html#expires">Best Practices for Speeding Up Your Web Site | Add an Expires or a Cache-Control Header</a>.</p>
<p>I&#8217;d like to point out that in researching browser cashing, I came across a lot of information that contradicted the rather clear instructions from Google:</p>
<blockquote><p>It is important to specify one of <code>Expires</code> or <code>Cache-Control max-age</code>, <i>and</i> one of <code>Last-Modified</code> or <code>ETag</code>, for all cacheable resources. It is redundant to specify both <code>Expires</code> and <code>Cache-Control: max-age</code>, or to specify both <code>Last-Modified</code> and <code>ETag</code>.</p></blockquote>
<p>I&#8217;m not sure that this recommendation is entirely correct, as the W3C states that Expires and Cache-Control max-age are used in different situations, with Cache-Control max-age overriding Expires in the event of conflicts.</p>
<blockquote><p>If a response includes both an Expires header and a max-age directive, the max-age directive overrides the Expires header, even if the Expires header is more restrictive. This rule allows an origin server to provide, for a given response, a longer expiration time to an HTTP/1.1 (or later) cache than to an HTTP/1.0 cache.</p>
<p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a></p></blockquote>
<p>It would seem that Cache-Control is the preferred method of controlling browser caching going forward.</p>
<blockquote><p>HTTP 1.1 clients will honour &#8220;Cache-Control&#8221; (which is easier to use and much more flexible).<br />
HTTP 1.0 clients will ignore &#8220;Cache-Control&#8221; but honour &#8220;Expires&#8221;. With &#8220;Expires&#8221; you get thus at least a bit control for these old clients.</p>
<p><a href="http://www.peterbe.com/plog/cache-control_or_expires">http://www.peterbe.com/plog/cache-control_or_expires</a></p></blockquote>
<p>In any event, Page Speed won&#8217;t protest if you do end up sending both Expires and Cache-Control max-age, or if you remove both Last-Modified and ETag, but I was able to get the best results with just setting Cache-Control max-age and removing the ETag.</p>
<h2>Setting the headers in .htaccess</h2>
<p>On Apache, configuring the proper headers can be done in the .htaccess file, using the <code>Header</code> directive.  The <code>Header</code> directive requires the <code>mod_headers</code> module to be enabled.</p>
<p>I&#8217;m choosing to set a far future Expires header of one year on my images files, because I tweak the CSS and JavaScript pretty often, and don&#8217;t want those file types to be cached as long.</p>
<p>Add the following code to your .htaccess file to set your Cache-Control and Expires headers, adjusting the date to be one year from today.</p>
<pre class="brush: plain; title: ; notranslate">
# Set Cache-Control and Expires headers
&lt;filesMatch &quot;\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$&quot;&gt;
Header set Cache-Control &quot;max-age=2592000, private&quot;
Header set Expires &quot;Sun, 17 July 2011 20:00:00 GMT&quot;
&lt;/filesMatch&gt;
&lt;filesMatch &quot;\\.(css|css.gz)$&quot;&gt;
Header set Cache-Control &quot;max-age=604800, private&quot;
&lt;/filesMatch&gt;
&lt;filesMatch &quot;\\.(js|js.gz)$&quot;&gt;
Header set Cache-Control &quot;max-age=604800, private&quot;
&lt;/filesMatch&gt;
&lt;filesMatch &quot;\\.(xml|txt)$&quot;&gt;
Header set Cache-Control &quot;max-age=216000, private, must-revalidate&quot;
&lt;/filesMatch&gt;
&lt;filesMatch &quot;\\.(html|htm)$&quot;&gt;
Header set Cache-Control &quot;max-age=7200, private, must-revalidate&quot;
&lt;/filesMatch&gt;
</pre>
<h2>Removing ETags in .htaccess</h2>
<p>Most sources recommend simply removing ETags if they are not required.</p>
<blockquote><p>Entity tags (ETags) are a mechanism that web servers and browsers use to determine whether the component in the browser&#8217;s cache matches the one on the origin server.<br />
&#8230;<br />
If you&#8217;re not taking advantage of the flexible validation model that ETags provide, it&#8217;s better to just remove the ETag altogether.</p>
<p><a href="http://developer.yahoo.com/performance/rules.html#etags">http://developer.yahoo.com/performance/rules.html#etags</a>
</p></blockquote>
<p>Add the following code to your .htaccess file to remove ETag headers.</p>
<pre class="brush: plain; title: ; notranslate">
# Turn off ETags
FileETag None
Header unset ETag
</pre>
<h2>Set Expires headers with ExpiresByType (optional)</h2>
<p>If your host has the <code>mod_expires</code> module enabled, you can specify Expires headers by file type.  Godaddy does not have this module enabled.</p>
<pre class="brush: plain; title: ; notranslate">
# Set Expires headers
ExpiresActive On
ExpiresDefault &quot;access plus 1 year&quot;
ExpiresByType text/html &quot;access plus 1 second&quot;
ExpiresByType image/gif &quot;access plus 2592000 seconds&quot;
ExpiresByType image/jpeg &quot;access plus 2592000 seconds&quot;
ExpiresByType image/png &quot;access plus 2592000 seconds&quot;
ExpiresByType image/x-icon &quot;access plus 2592000 seconds&quot;
ExpiresByType text/css &quot;access plus 604800 seconds&quot;
ExpiresByType text/javascript &quot;access plus 604800 seconds&quot;
ExpiresByType application/x-javascript &quot;access plus 604800 seconds&quot;
</pre>
<h2>Removing the Last-Modified header in .htaccess (optional)</h2>
<p>I&#8217;m following Google&#8217;s instructions and not removing the Last-Modified header, but if you wanted to do so, you could use:</p>
<pre class="brush: plain; title: ; notranslate">
# Remove Last-Modified header
Header unset Last-Modified
</pre>
<h2>Busting the cache when files change</h2>
<p>What happens when you change files and need to force browsers to load the new files? Christian Johansen offers two methods in his post on <a href="http://cjohansen.no/en/apache/using_a_far_future_expires_header">Using a far future expires header</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2010/07/17/sending-headers-to-leverage-browser-caching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to compress .php, .css and .js files without mod_gzip or mod_deflate</title>
		<link>http://www.ardamis.com/2010/07/11/compress-files-without-mod_gzip-or-mod_deflate/</link>
		<comments>http://www.ardamis.com/2010/07/11/compress-files-without-mod_gzip-or-mod_deflate/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 04:42:27 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[downloads]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[godaddy]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=753</guid>
		<description><![CDATA[How to speed up page load times by compressing .php, .css and .js files on Apache web hosts that do not have mod_gzip or mod_deflate enabled.]]></description>
			<content:encoded><![CDATA[<p>File compression is possible on Apache web hosts that do not have mod_gzip or mod_deflate enabled, and it&#8217;s easier than you might think.</p>
<p>A great explanation of why compression helps the web deliver a better user experience is at <a href="http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/">betterexplained.com</a>.</p>
<p>Two authoritative articles on the subject are Google&#8217;s <a href="http://code.google.com/speed/page-speed/docs/payload.html#GzipCompression">Performance Best Practices documentation | Enable compression</a> and Yahoo&#8217;s <a href="http://developer.yahoo.com/performance/rules.html#gzip">Best Practices for Speeding Up Your Web Site | Gzip Components</a>.</p>
<h2>Compressing PHP files</h2>
<p>If your Apache server does not have mod_gzip or mod_deflate enabled (Godaddy and JustHost shared hosting, for example), you can use PHP to compress pages on-the-fly.  This is still preferable to sending uncompressed files to the browser, so don&#8217;t worry about the additional work the server has to do to compress the files at each request.  </p>
<h3>Option 1: PHP.INI using zlib.output_compression</h3>
<p>The zlib extension can be used to transparently compress PHP pages on-the-fly if the browser sends an &#8220;Accept-Encoding: gzip&#8221; or &#8220;deflate&#8221; header.  Compression with zlib.output_compression seems to be disabled on most hosts by default, but can be enabled with a custom php.ini file:</p>
<pre class="brush: plain; title: ; notranslate">
[PHP]

zlib.output_compression = On
</pre>
<p>Credit: <a href="http://php.net/manual/en/zlib.configuration.php">http://php.net/manual/en/zlib.configuration.php</a></p>
<p>Check with your host for instructions on how to implement this, and whether you need a php.ini file in each directory.</p>
<h3>Option 2: PHP using ob_gzhandler</h3>
<p>If your host does not allow custom php.ini files, you can add the following line of code to the top of your PHP pages, above the DOCTYPE declaration or first line of output:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start(&quot;ob_gzhandler&quot;); else ob_start(); ?&gt;
</pre>
<p>Credit: <a href="http://help.godaddy.com/article/4485">GoDaddy.com</a></p>
<p>For WordPress sites, this code would be added to the top of the theme&#8217;s header.php file.</p>
<p>According to php.net, <a href="http://php.net/manual/en/function.ob-gzhandler.php">using zlib.output_compression is preferred over ob_gzhandler()</a>.</p>
<p>For WordPress or other CMS sites, an advantage of zlib.output_compression over the ob_gzhandler method is that all of the .php pages served will be compressed, not just those that contain the global include (eg.: header.php, etc.).</p>
<p>Running both ob_gzhandler and zlib.output_compression at the same time will throw a warning, similar to:</p>
<p><em>Warning: ob_start() [ref.outcontrol]: output handler &#8216;ob_gzhandler&#8217; conflicts with &#8216;zlib output compression&#8217; in /home/path/public_html/ardamis.com/wp-content/themes/mytheme/header.php on line 7</em></p>
<h2>Compressing CSS and JavaScript files</h2>
<p>Because the on-the-fly methods above only work for PHP pages, you&#8217;ll need something else to compress CSS and JavaScript files.  Furthermore, these files typically don&#8217;t change, so there isn&#8217;t a need to compress them at each request.  A better method is to serve pre-compressed versions of these files.  I&#8217;ll describe a few different ways to do this, but in both cases, you&#8217;ll need to add some lines to your .htaccess file to send user agents the gzipped versions if they support the encoding.  This requires that Apache&#8217;s mod_rewrite be enabled (and I think it&#8217;s almost universally enabled).</p>
<h3>Option 1: Compress locally and upload</h3>
<p>CSS and JavaScript files can be gzipped on the workstation, then uploaded along with the uncompressed files.  Use a utility like <a href="http://www.7-zip.org/">7-Zip</a> (quite possibly the best compression software around, and it&#8217;s free) to compress the CSS and JavaScript files using the gzip format (with extension *.gz), then upload them to your server.</p>
<p>For Windows users, here is a handy command to compress all the .css and .js files in the current directory and all sub directories (adjust the path to the 7-Zip executable, Zz.exe, as necessary):</p>
<pre class="brush: plain; title: ; notranslate">
for /R %i in (*.css *.js) do &quot;C:\Program Files (x86)\7-Zip\7z.exe&quot; a -tgzip &quot;%i.gz&quot; &quot;%i&quot; -mx9
</pre>
<p>Note that the above command is to be run from the command line.  The batch file equivalent would be:</p>
<pre class="brush: plain; title: ; notranslate">
for /R %%i in (*.css *.js) do &quot;C:\Program Files (x86)\7-Zip\7z.exe&quot; a -tgzip &quot;%%i.gz&quot; &quot;%%i&quot; -mx9
</pre>
<h3>Option 2: Compress on the server</h3>
<p>If you have shell access, you can run a command to create a gzip copy of each CSS and JavaScript file on your site (or, if you are developing on Linux, you can run it locally):</p>
<pre class="brush: plain; title: ; notranslate">
find . -regex &quot;.*\(css\|js\)$&quot; -exec bash -c 'echo Compressing &quot;{}&quot; &amp;&amp; gzip -c --best &quot;{}&quot; &gt; &quot;{}.gz&quot;' \;
</pre>
<p>This may be a bit too technical for many people, but is also much more convenient.  It is particularly useful when you need to compress a large number of files (as in the case of a WordPress installation with multiple plugins).  Remember to run it every time you automatically update WordPress, your theme, or any plugins, so as to replace the gzip&#8217;d versions of any updated CSS and JavaScript files.</p>
<h3>The .htaccess (for both options)</h3>
<p>Add the following lines to your .htaccess file to identify the user agents that can accept the gzip encoded versions of these files.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;files *.js.gz&gt;
  AddType &quot;text/javascript&quot; .gz
  AddEncoding gzip .gz
&lt;/files&gt;
&lt;files *.css.gz&gt;
  AddType &quot;text/css&quot; .gz
  AddEncoding gzip .gz
&lt;/files&gt;
RewriteEngine on
#Check to see if browser can accept gzip files.
ReWriteCond %{HTTP:accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Safari
#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$
#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f
#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [QSA,L]
</pre>
<p>Credit: <a href="http://www.opensourcetutor.com/2009/06/01/how-to-compress-css-javascript-an-alternative-to-mod_deflate-or-mod_gzip/">opensourcetutor.com</a></p>
<p>I&#8217;m not sure it&#8217;s still necessary to exclude Safari.</p>
<p>For added benefit, minify the CSS and JavaScript files before gzipping them.  Google&#8217;s excellent <a href="http://code.google.com/speed/page-speed/">Page Speed</a> Firefox/Firebug Add-on makes this very easy.  Yahoo&#8217;s <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a> is also quite good.</p>
<h2>Verify that your content is being compressed</h2>
<p>Use the nifty Web Page Content Compression Verification tool at <a href="http://www.whatsmyip.org/http_compression/">http://www.whatsmyip.org/http_compression/</a> to confirm that your server is sending the compressed files.</p>
<h2>Speed up page load times for returning visitors</h2>
<p>Compression is only part of the story.  In order to further speed page load times for your returning visitors, you will want to <a href="http://www.ardamis.com/2010/07/17/sending-headers-to-leverage-browser-caching/">send the correct headers to leverage browser caching</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2010/07/11/compress-files-without-mod_gzip-or-mod_deflate/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The Compete.com tracking code is not for traffic</title>
		<link>http://www.ardamis.com/2010/07/04/compete-is-not-for-traffic/</link>
		<comments>http://www.ardamis.com/2010/07/04/compete-is-not-for-traffic/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 05:11:59 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Nonsense]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=724</guid>
		<description><![CDATA[How the Compete tracking code shares your visitor information with FOX / News Corp. and why it doesn't do you any good when it comes to gathering analytic information.]]></description>
			<content:encoded><![CDATA[<p>I had noticed mentions of <em>analytic information provided by Compete.com</em> often enough that I was curious about what it could do for me.  </p>
<p>Compete already had some <a href="http://www.compete.com/m/profiles/site/ardamis.com/">information about ardamis.com</a>, but it was stunningly wrong.  For example, it was telling me that the phrase &#8220;godaddy referral program&#8221; was responsible for 20.35% of the total traffic sent to my site by search engines.  Until recently, I did have a page that mentioned godaddy referral programs, but according to Google Analytics, it was barely ever visited (7 page views in the last 30 days &#8211; it was the 78th most popular page on my site, which does get a few thousand visitors a month).  Even more strange, it told me that I was getting traffic for the search phrase &#8220;myspace&#8221;.  I have never written anything about myspace before.</p>
<p>I figured that once I installed their JavaScript tracking code, the analytics information would be much more accurate.  So I installed the code, confirmed it appeared at the bottom of the home page, and attempted to verify my site at http://www.ardamis.com/, but was unable to.  I had read somewhere that the free account does not support tracking subdomains, and the verification process seemed to get hung up on the use of .htaccess to redirect non-www traffic to www.ardamis.com.  I was mystified that Compete apparently could not recognize this was happening via a 301 redirect header and compensate.</p>
<blockquote><p>Sorry,</p>
<p>It looks like the CompeteXL code has not been correctly placed on the homepage of your site.</p>
<p>This could be because either the code was not copied over correctly, or because it has been placed on the wrong page.</p>
<p>We think your homepage is</p>
<p>ardamis.com</p></blockquote>
<p>I went so far as to email my amazement to their support staff, who promptly and politely wrote me back.  (Thumbs up to the guys answering the emails.)</p>
<p>I had made a few other changes to my site at the same time, so I ran a <a href="http://code.google.com/speed/page-speed/">Page Speed</a> check on it.  Page Speed told me that I was linking to a resource at trgc.opt.fimserve.com that was throwing a 404 error.  I was pretty sure I didn&#8217;t intentionally link to anything at that domain, so I Googled it.  Surprisingly, there&#8217;s not much out there on trgc.opt.fimserve.com other than <a href="http://wordpress.org/support/topic/337084">this</a> and <a href="http://www.webmasterworld.com/analytics/4038221.htm">this</a>.  As it turns out, fimserve.com is part of something called the <a rel="nofollow" href="http://www.foxaudiencenetwork.com/">FOX Audience Network</a>, and FAN&#8217;s parent company is News Corporation, which also owns myspace.com.</p>
<p>Here&#8217;s the WHOIS on fimserve.com:</p>
<pre>
Domain Name: FIMSERVE.COM
Registrar: REGISTER.COM, INC.
Whois Server: whois.register.com
Referral URL: http://www.register.com
Name Server: NS1.MYSPACE.COM
Name Server: NS2.MYSPACE.COM
Status: clientTransferProhibited
Updated Date: 17-oct-2006
Creation Date: 17-oct-2006
Expiration Date: 17-oct-2011
</pre>
<p>And here&#8217;s the WHOIS on foxaudiencenetwork.com:</p>
<pre>
Domain Name: FOXAUDIENCENETWORK.COM
Registrar: MARKMONITOR INC.
Whois Server: whois.markmonitor.com
Referral URL: http://www.markmonitor.com
Name Server: NS1.MYSPACE.COM
Name Server: NS2.MYSPACE.COM
Status: clientDeleteProhibited
Status: clientTransferProhibited
Status: clientUpdateProhibited
Updated Date: 03-may-2010
Creation Date: 03-jun-2008
Expiration Date: 03-jun-2011
</pre>
<p>I didn&#8217;t like the idea that information about my visitors was being shared with anyone but the site I had signed up for, so I started looking through the Compete FAQs and found this:</p>
<blockquote><p>Currently, the CompeteXL code tracks ONLY self-reported Audience Profile data through a partnership with the FOX Audience Network.</p>
<p>The CompeteXL code DOES NOT track traffic or user engagement metrics, that information continues to be provided through our multi-sourced panel and requires NO addition of code to your site.</p>
<p><a rel="nofollow" href="http://www.compete.com/help/q225">http://www.compete.com/help/q225</a></p></blockquote>
<p><em>What the hell?</em>  Why am I installing a tracking code if it&#8217;s not used to track traffic?</p>
<p>Oh, and this was a fun discovery, too:</p>
<blockquote><p>The FOX Audience Network (FAN) is a unit of News Corporation that supports monetization efforts across the company&#8217;s online content portfolio, as well as third-party publisher sites.</p>
<p>FAN leverages proprietary advertising technology to create highly-targeted advertising campaigns for a wide range of marketers, while also delivering cutting-edge tools and services to third-party publisher partners. FAN works directly with hundreds of advertisers to develop customized marketing programs that optimize both branded and performance-based strategies.</p>
<p><a rel="nofollow" href="http://www.foxaudiencenetwork.com/aboutus.php">http://www.foxaudiencenetwork.com/aboutus.php</a>
</p></blockquote>
<p>I use a very popular <a href="http://www.mvps.org/winhelp2002/hosts.htm">HOSTS file</a> to block a huge number of servers that are known to host advertisements, tracking scripts (including Google Analytics), parasites, hijackers and unwanted Adware/Spyware programs.  The 404 error in Page Speed was caused by the inclusion of trgc.opt.fimserve.com in this custom HOSTS file, which then led me to finding all this out the next day.  I&#8217;ve removed the tracking code because the information I wanted was on traffic &#8211; who&#8217;s coming to my site, why, and through what means &#8211; and not user demographics.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2010/07/04/compete-is-not-for-traffic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

