<?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>Unlimited Edition &#187; Tip of the day</title>
	<atom:link href="http://michaelodden.com/category/tip-of-the-day/feed/" rel="self" type="application/rss+xml" />
	<link>http://michaelodden.com</link>
	<description>Unlimited views, cleverness and love</description>
	<lastBuildDate>Tue, 08 Mar 2011 20:33:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>URLs should express output-format, not source-format</title>
		<link>http://michaelodden.com/webdevelopment/urls-should-express-output-format-not-source-format/</link>
		<comments>http://michaelodden.com/webdevelopment/urls-should-express-output-format-not-source-format/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 23:14:42 +0000</pubDate>
		<dc:creator>michaelo</dc:creator>
				<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[User-experience]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[best practice]]></category>
		<category><![CDATA[file-extensions]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://michaelodden.com/?p=296</guid>
		<description><![CDATA[I&#8217;m the kind of guy who always tries to optimize my ways, especially when it comes programming. Over the last years I&#8217;ve worked on/against a multitude of CMS, frameworks and API&#8217;s, and quite often make some thoughts how things could be better, easier and more intuitive. One of these things are regarding how to format [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m the kind of guy who always tries to optimize my ways, especially when it comes programming. Over the last years I&#8217;ve worked on/against a multitude of <acronym title="Content Management System">CMS</acronym>, frameworks and <acronym title="Application Programming Interface">API</acronym>&#8217;s, and quite often make some thoughts how things could be better, easier and more intuitive.</p>
<p>One of these things are regarding how to format a <acronym title="Uniform Resource Locator">URL</acronym>.</p>
<p><span id="more-296"></span></p>
<p>This post isn&#8217;t really server-technically focused, as it is more a discussion of an idea. I&#8217;ll none the less assume that the reader has some familiarity with <a href="http://en.wikipedia.org/wiki/MIME_type">mime-types</a>, basic webserver-settings (<a href="http://technet.microsoft.com/en-us/library/cc771240(WS.10).aspx">like</a> <a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fhttpd.apache.org%2Fdocs%2F2.0%2Fhandler.html&amp;ei=eppKSsbyL5Ph-QbY3pnfBQ&amp;usg=AFQjCNGlmxT6bNAwOk5cEwUNLfQy5GSSMQ&amp;sig2=GlBSqGjdNkmybxQDDlwSNA">handlers</a> and <a href="http://learn.iis.net/page.aspx/460/using-url-rewrite-module/"><acronym title="Uniform Resource Locator">URL</acronym></a>-<a href="http://httpd.apache.org/docs/2.0/misc/rewriteguide.html">rewrite</a>-<a href="http://www.workingwith.me.uk/articles/scripting/mod_rewrite">techniques</a>).</p>
<h2>Why</h2>
<p>As far as I&#8217;m concerned, any <acronym title="Uniform Resource Locator">URL</acronym> should give a hint of what you will find there, and by stripping the file-extension and just sitting left with something that&#8217;ll look like a directory, or using the scripting-language&#8217;s extension, I believe that we works against this. File-extensions gives an important hint regarding what the content is. What do you expect when you see &#8220;.jpg&#8221;, &#8220;.gif&#8221; or &#8220;.png&#8221;? Yes, images. Then what about &#8220;.html&#8221;, &#8220;.txt&#8221; and &#8220;.odf&#8221;? It&#8217;s most likely some kind of text, perhaps formatted. So what does &#8220;.php&#8221;, &#8220;.py&#8221; and &#8220;.aspx&#8221; tell us? Not much &#8211; it mostly a directive to the webserver, telling it to use some kind of parser to compile/process the contents before outputting it. And it might output html, xml or pdf as well as anything else.</p>
<p>A couple of years ago it had a &#8220;coolism&#8221; about it, saying that &#8220;I know how to develop fancy websites&#8221;, but nowadays people mostly expect some kind of interactivity anyway.</p>
<h2>How</h2>
<p>All relevant webservers today have to possibility to map any kind of extensions to any kind of (supported) language-parsers. I.e. with Apache you can use the AddType-directive like this:</p>
<pre>addhandler php5-script html xml json</pre>
<p>- to  parse all .html-, .xml and .json-files in the given directory as <acronym title="Pre-Hypertext Processing">PHP</acronym> 5.</p>
<p>Now, let&#8217;s say you have an <acronym title="Application Programming Interface">API</acronym> which allows you (or perhaps other users), to query a service for information &#8211; and allows it to be delivered in xml, json and html. This is usually solved by adding some parameter like &#8220;of&#8221; (output-format) or something like that in the request to tell which format you&#8217;d like. I prefer to keep everything as logical and reducing the need to look up in manuals as far as reasonably possible, so instead of sending GET-requests like this:</p>
<pre>http://example.com/gateway.php?id=15&amp;key=11341&amp;of=xml

http://example.com/gateway.php?id=15&#038;key=11341&#038;of=json

http://example.com/gateway.php?id=15&#038;key=11341&#038;of=html</pre>
<p>I&#8217;d rather prefer:</p>
<pre>http://example.com/gateway.xml?id=15&amp;key=11341

http://example.com/gateway.json?id=15&#038;key=11341

http://example.com/gateway.html?id=15&#038;key=11341</pre>
<p>This applies just as much for those <a href="http://mallinson.ca/post/mod_rewrite/">sexy</a> <a href="http://www.highrockmedia.com/blog/web-development/search-engine-friendly-urls-a-key-piece-of-the-seo-pie/comment-page-1">search-friendly</a> URLs &#8211; just append .html to that pretty <acronym title="Uniform Resource Locator">URL</acronym>. <a href="http://www.youtube.com/watch?v=dSG6C33GwsE">Google says</a> that it atleast won&#8217;t affect negatively on your ranking &#8211; so why not?</p>
<h2>Possible problems</h2>
<p>There are some obvious problem to this approach:</p>
<p><strong>1: What if you want different parsers (let&#8217;s say php and python) for different files but which will serve the same kind of output? How do we tell the server which to use when?</strong></p>
<p>- Possible solutions to this is to either separate them in different folders (the cleanest approach), or expand the extension to ie. .php.html and .py.html. Perhaps in combination with some mod_rewrite-kind of tricks.</p>
<p><strong>2: What about the overhead for static files, which still is sent through an interpreter although nothing is changed?</strong></p>
<p>- If you are running a service which is sensitive to these kind of margins, you should just use dedicated servers or CDN&#8217;s to deliver the static content no matter what.</p>
<p><strong>3: How far shall we take it? Should we use extensions like .html5 and .xhtml etc?</strong></p>
<p>-  I do believe that these differences are mostly relevant to the software parsing them, so in these cases it may suffice with keeping with i.e. .html, and use the <acronym title="Multipurpose Internet Mail Extension">MIME</acronym>-type to send further details.</p>
<h2>Summary</h2>
<p>Although all my examples might not pinpoint all the benefits I do believe that there is an idea in keeping the file-extension, both to assist external users as well as might reduce some clutter.</p>
<p>What are the pros and cons of an approach like this? I&#8217;ve barely touched a few in this post, but I hope I was able to mention some of the most essential ones.</p><img src="http://michaelodden.com/?ak_action=api_record_view&id=296&type=feed" alt="" />

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://michaelodden.com/webdevelopment/urls-should-express-output-format-not-source-format/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Tip of the day: A good old SSH-timesaver</title>
		<link>http://michaelodden.com/tip-of-the-day/tip-of-the-day-a-good-old-ssh-timesaver/</link>
		<comments>http://michaelodden.com/tip-of-the-day/tip-of-the-day-a-good-old-ssh-timesaver/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 09:50:51 +0000</pubDate>
		<dc:creator>michaelo</dc:creator>
				<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[ssh tip]]></category>

		<guid isPermaLink="false">http://michaelodden.com/?p=256</guid>
		<description><![CDATA[Combining SSH-aliases with public key authentication, and then I reduced the amount of typing by about 34 chars (from 41 to 7) for each time I connect to one of my usual SSH-servers. In a day that&#8217;ll probably save enough time to go and get me a nice cold beer. Mmm! Ah, those little things No [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Combining <a href="http://fabien.potencier.org/article/19/quick-ssh-tip"><acronym title="Secure Shell">SSH</acronym>-aliases</a> with <a href="http://www.petefreitag.com/item/532.cfm">public key authentication</a>, and then I reduced the amount of typing by about <strong>34 chars</strong> (from 41 to 7) for each time I connect to one of my usual <acronym title="Secure Shell">SSH</acronym>-servers.</p>
<p>In a day that&#8217;ll probably save enough time to go and get me a nice cold beer. Mmm! Ah, those little things <img src='http://michaelodden.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p><img src="http://michaelodden.com/?ak_action=api_record_view&id=256&type=feed" alt="" />

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://michaelodden.com/tip-of-the-day/tip-of-the-day-a-good-old-ssh-timesaver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip of the day: Loose comparisons in PHP gives edgy behaviour</title>
		<link>http://michaelodden.com/webdevelopment/tip-of-the-day-loose-comparisons-in-php-gives-edgy-behaviour/</link>
		<comments>http://michaelodden.com/webdevelopment/tip-of-the-day-loose-comparisons-in-php-gives-edgy-behaviour/#comments</comments>
		<pubDate>Wed, 27 May 2009 09:23:11 +0000</pubDate>
		<dc:creator>michaelo</dc:creator>
				<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.michaelodden.com/?p=162</guid>
		<description><![CDATA[This is an occasionally recurring issue: Using loose comparison (i.e. &#8220;==&#8221;, &#8220;!=&#8221;), instead of strict (i.e. &#8220;===&#8221;, &#8220;!==&#8221;), in PHP can give some unexpected results. Some of those are pretty logical &#8211; like an empty array compared to 0 or false, returns true &#8211; but others not quite that logical. Example // returns true "string" [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>This is an occasionally recurring issue: Using loose comparison (i.e. &#8220;==&#8221;, &#8220;!=&#8221;), instead of strict (i.e. &#8220;===&#8221;, &#8220;!==&#8221;), in <acronym title="Pre-Hypertext Processing">PHP</acronym> can give some unexpected results.</p>
<p>Some of those are pretty logical &#8211; like an empty array compared to 0 or false, returns true &#8211; but others not quite that logical.</p>
<h2>Example</h2>
<pre name="code" class="c-sharp">
// returns true
"string" == 0;

// returns false, as probably expected of the above as well
"string" === 0;
</pre>
<p>I assume this is because the string is typecasted to integer, and <em>(int) &#8220;string&#8221;</em> will give <em>0</em>. So as we know how <acronym title="Pre-Hypertext Processing">PHP</acronym>&#8217;s typecasting is working, it&#8217;s easy to understand why <em>&#8220;123string&#8221; == 123</em> will return <em>true</em> as well.</p>
<h2>Related reading</h2>
<ul>
<li><a href="http://php.net/types.comparisons"><acronym title="Pre-Hypertext Processing">PHP</acronym> type comparison tables</a></li>
</ul><img src="http://michaelodden.com/?ak_action=api_record_view&id=162&type=feed" alt="" />

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://michaelodden.com/webdevelopment/tip-of-the-day-loose-comparisons-in-php-gives-edgy-behaviour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Little ad-bummer by komplett.no / Tip of the day</title>
		<link>http://michaelodden.com/humor/little-ad-bummer-by-komplettno/</link>
		<comments>http://michaelodden.com/humor/little-ad-bummer-by-komplettno/#comments</comments>
		<pubDate>Tue, 26 May 2009 20:15:08 +0000</pubDate>
		<dc:creator>michaelo</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://blog.michaelodden.com/?p=152</guid>
		<description><![CDATA[Just a little amusing notice. I came recently across some ads by Komplett.no via Google Ads. The title read &#8220;The Legend Of Zelda?&#8221;, which &#8211; when clicked &#8211; took the user to direct search in komplett&#8217;s catalog. Too bad the search returns zero hits. Rephrasing the query to &#8220;legend of zelda&#8221; instead of &#8220;the legend [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Just a little amusing notice.</p>
<p><a href="http://www.komplett.no/k/search.aspx?q=the%20legend%20of%20zelda"><img class="alignleft size-medium wp-image-153" title="Komplett.no's Google-ad" src="http://blog.michaelodden.com/wp-content/uploads/2009/05/google_komplett_loz-300x52.png" alt="Komplett.no's Google-ad" width="300" height="52" /></a>I came recently across some ads by <a href="http://komplett.no/">Komplett.no</a> via Google Ads. The title read &#8220;The Legend Of Zelda?&#8221;, which &#8211; when clicked &#8211; took the user to <a href="http://www.komplett.no/k/search.aspx?q=the%20legend%20of%20zelda">direct search in komplett&#8217;s catalog</a>. Too bad the search returns zero hits. Rephrasing the query to &#8220;<a href="http://www.komplett.no/k/search.aspx?q=legend+of+zelda">legend of zelda</a>&#8221; instead of &#8220;the legend of zelda&#8221;, though, will give results (an entry named &#8220;The Legend of Zelda: Twilight Princess&#8221;) <img src='http://michaelodden.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<p><strong>So, tip of the day:</strong></p>
<p>Make sure your ads are linking to something meaningful.</p><img src="http://michaelodden.com/?ak_action=api_record_view&id=152&type=feed" alt="" />

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://michaelodden.com/humor/little-ad-bummer-by-komplettno/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

