<?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>Indirecthit &#187; Tips</title>
	<atom:link href="http://www.indirecthit.com/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.indirecthit.com</link>
	<description>A Discussion on PHP, AJAX and Other Web Tools with a bit of startup talk</description>
	<lastBuildDate>Tue, 02 Mar 2010 14:34:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Media, Cookies &amp; Domains</title>
		<link>http://www.indirecthit.com/2010/03/02/media-cookies-domains/</link>
		<comments>http://www.indirecthit.com/2010/03/02/media-cookies-domains/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 14:34:41 +0000</pubDate>
		<dc:creator>clong</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[domains]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[static]]></category>

		<guid isPermaLink="false">http://www.indirecthit.com/?p=57</guid>
		<description><![CDATA[With all the brilliant tools (Google Page Speed, YSlow, etc.) out there, web professionals can now easily see a few basic things to improve page speed performance. One suggestion is to send static content from a cookieless domain. On most sites I&#8217;ve worked with, we serve static content from a media subdomain and then the [...]]]></description>
			<content:encoded><![CDATA[<p>With all the brilliant tools (<a title="Google Page Speed" href="http://code.google.com/speed/page-speed/">Google Page Speed</a>, <a title="YSlow" href="http://developer.yahoo.com/yslow/">YSlow</a>, etc.) out there, web professionals can now easily see a few basic things to improve page speed performance. One suggestion is to send static content from a cookieless domain. On most sites I&#8217;ve worked with, we serve static content from a media subdomain and then the real content from the main domain (without www). I know with cookies, if the domain is <strong>.indirecthit.com</strong> it would send that cookie to any subdomain on <strong>indirecthit.com</strong>, therefore the media subdomain would have a cookie. An easy change: remove the <strong>.</strong> from the cookie domain. But when I looked at the <a href="http://www.php.net" class="ubernym uttInitialism" onmouseover="domTT_activate(this, event, 'content', 'PHP: Hypertext Preprocessor' );"><abbr class="uttInitialism">PHP</abbr></a> manual for setcookie, I came across the following statement:</p>
<blockquote><p>The        <em>.</em> is not required but makes it compatible        with more browsers.</p></blockquote>
<p>That doesn&#8217;t sound very good, I want it to be compatible with all browsers&#8230;</p>
<p>I couldn&#8217;t find much on it, from what I did find I believe the reason it doesn&#8217;t work with all browsers is for security. If I had the domain <strong>er.com</strong>, and I set a cookie to the domain <strong>er.com</strong> (notice the missing <strong>.</strong>), the browser could match this with <strong>older.com</strong> or <strong>lesser.com</strong>. If the website at <strong>er.com</strong> set the cookie to <strong>er.com </strong>(without the first <strong>.</strong>), the web server on <strong>older.com </strong>or <strong>lesser.com</strong> can access this cookie&#8230;not good. Therefore, even if I remove the <strong>. </strong>from the domain, it still would match <strong>media.indirecthit.com</strong> and that domain wouldn&#8217;t be cookieless.Doesn&#8217;t solve my problem and isn&#8217;t compatible with most browsers.</p>
<p>The solution, is to split out your media server on a different domain such as <strong>indirecthitmedia.com</strong>. This is why when you visit some Google properties it loads media content from <strong>gstatic.com </strong>not<strong> media.google.com</strong> or <strong>google.com</strong>. And obviously you don&#8217;t set any cookies to this new media domain. You will now score a bit higher on <a title="Google Page Speed" href="http://code.google.com/speed/page-speed/">Google Page Speed</a> and <a title="YSlow" href="http://developer.yahoo.com/yslow/">YSlow</a>. Congrats!</p>]]></content:encoded>
			<wfw:commentRss>http://www.indirecthit.com/2010/03/02/media-cookies-domains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimizing SQL Select: Using &#8216;IN&#8217; in MySQL</title>
		<link>http://www.indirecthit.com/2008/04/10/optimizing-sql-select-using-in-in-mysql/</link>
		<comments>http://www.indirecthit.com/2008/04/10/optimizing-sql-select-using-in-in-mysql/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 15:16:29 +0000</pubDate>
		<dc:creator>clong</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[optimizing]]></category>

		<guid isPermaLink="false">http://www.indirecthit.com/?p=25</guid>
		<description><![CDATA[I&#8217;ve known for a bit that using the &#8216;IN&#8217; condition for MySQL queries is much much slower then it should be. I didn&#8217;t realize how much will I was browsing the website Common Queries for MySQL and came across the section called The unbearable slowness of IN().
According to this page, using IN is two times [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve known for a bit that using the &#8216;IN&#8217; condition for MySQL queries is much much slower then it should be. I didn&#8217;t realize how much will I was browsing the website <a href="http://www.artfulsoftware.com/infotree/queries.php#568">Common Queries for MySQL</a> and came across the section called <a href="http://www.artfulsoftware.com/infotree/queries.php#568">The unbearable slowness of IN()</a>.</p>
<p>According to this page, using IN is two times slower then using EXISTS which is 50 times slower then using a JOIN. Wow! I don&#8217;t think I&#8217;ll be using IN anymore.</p>
<p>Conclusion, if you want to make your query faster don&#8217;t use IN. Take a look at <a href="http://www.artfulsoftware.com/infotree/queries.php#568">The unbearable slowness of IN()</a> for how to write the query using an EXIST or, if possible, a JOIN.<a href="http://www.artfulsoftware.com/infotree/queries.php#568"><br />
</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.indirecthit.com/2008/04/10/optimizing-sql-select-using-in-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding Rural Postal Codes in Canada</title>
		<link>http://www.indirecthit.com/2008/03/28/finding-rural-postal-codes-in-canada/</link>
		<comments>http://www.indirecthit.com/2008/03/28/finding-rural-postal-codes-in-canada/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 13:57:09 +0000</pubDate>
		<dc:creator>clong</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Well.ca]]></category>

		<guid isPermaLink="false">http://www.indirecthit.com/2008/03/28/finding-rural-postal-codes-in-canada/</guid>
		<description><![CDATA[Yesterday, Alex, who handles marketing at Well.ca, asked for a list of top 50 rural customers in Canada. &#8220;Easy!&#8221; was my reply, then I thought about it. How to do it? Maybe if I get a list from Canadapost with all the postal codes and their population density I can use that. Maybe I can [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, Alex, who handles marketing at <a href="http://www.well.ca" class="ubernym uttJustLink" onmouseover="domTT_activate(this, event, 'content', 'An online health store, the place I work.','caption', 'Well.ca' );">Well.ca</a>, asked for a list of top 50 rural customers in Canada. &#8220;Easy!&#8221; was my reply, then I thought about it. How to do it? Maybe if I get a list from Canadapost with all the postal codes and their population density I can use that. Maybe I can write up some crazy application to determine it based on the number of cities/towns that share the postal code.</p>
<p>And then, just for the hell of it, I checked Wikipedia&#8217;s article on <a href="http://en.wikipedia.org/wiki/Canadian_postal_code">Postal Codes</a>&#8230;then the problem just became easier. According to the Wikipedia article, the first number in the postal code represents if the postal region is rural or urban. If the number is 0 (N0G2J3), the postal region is a rural area. If the number is anything else, 1-9, the postal region is an urban area. With this I wrote up a quick regular expression (^[a-zA-Z]{1}[0]{1}[a-zA-Z 0-9]+) and used the power of MySQLs regular expressions (have to remember MySQL can search w/ regular expressions) to write up a query to determine the top 50 rural customers. Easy!</p>
<p>Random fact: Wikipedia has all possible postal region codes (first 3 digits of the postal code) and their corresponding city/region. I wonder who took the time&#8230;<a href="http://en.wikipedia.org/wiki/Category:Postal_codes_in_Canada">The article is here.</a></p>
<p>Random fact II: The only provinces to have more then one letter as the first letter in a postal code is Quebec and Ontario. All the others have a specific letter to determine the province/territory. <a href="http://en.wikipedia.org/wiki/List_of_postal_codes_in_Canada">The map is here.</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.indirecthit.com/2008/03/28/finding-rural-postal-codes-in-canada/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
