<?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"
	>

<channel>
	<title>danforys.com</title>
	<atom:link href="http://www.danforys.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danforys.com</link>
	<description>Dan is a web developer in London. He is interested in all things Internet, Linux and Mac.</description>
	<pubDate>Wed, 06 Aug 2008 15:28:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Unsetting http headers in PHP</title>
		<link>http://www.danforys.com/2008/08/06/unsetting-http-headers-in-php/</link>
		<comments>http://www.danforys.com/2008/08/06/unsetting-http-headers-in-php/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 15:28:03 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
		
		<category><![CDATA[browsers]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[header]]></category>

		<category><![CDATA[ie7]]></category>

		<guid isPermaLink="false">http://www.danforys.com/?p=40</guid>
		<description><![CDATA[I just came across a subtle issue affecting Internet Explorer users (well, fancy that!) and HTTPS connections.
One of my clients has a site that downloads a series of results as a CSV file, which they open in Excel. Unfortunately, Internet Explorer was refusing to download the file, and was presenting an error message reading &#8220;Internet [...]]]></description>
			<content:encoded><![CDATA[<p>I just came across a subtle issue affecting Internet Explorer users (well, fancy that!) and HTTPS connections.</p>
<p>One of my clients has a site that downloads a series of results as a CSV file, which they open in Excel. Unfortunately, Internet Explorer was refusing to download the file, and was presenting an error message reading &#8220;Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found.&#8221;</p>
<p>To add to my confusion, this was happening on the live server (PHP4), but not on my dev server (PHP5) <em>which both use the same code</em>.</p>
<p>In the end, I happened upon a Microsoft Knowledge Base article that <a href="http://support.microsoft.com/kb/316431" onclick="javascript:pageTracker._trackPageview ('/outbound/support.microsoft.com');">explained the problem</a>. Basically, IE obeys any &#8220;no-cache&#8221; headers you send to the browser. Without caching the file, Office applications cannot open the file when served over HTTPS.</p>
<p>How to solve the issue? Remove the cache header(s) - but how?</p>
<p>The <a href="http://uk2.php.net/manual/en/function.header.php" onclick="javascript:pageTracker._trackPageview ('/outbound/uk2.php.net');">PHP manual</a> doesn&#8217;t make it entirely clear, and I found the solution by accident. To remove a header, use the same syntax as for setting a header, but only include a space after the colon.</p>
<p>For example, for the &#8220;Pragma&#8221; header:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="">'pragma: '</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p><strong>Note:</strong> You must include the space after the &#8220;:&#8221; or the header will not be unset.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danforys.com/2008/08/06/unsetting-http-headers-in-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Intermittent 1px gap in Firefox 3</title>
		<link>http://www.danforys.com/2008/07/30/intermittent-1px-gap-in-firefox-3/</link>
		<comments>http://www.danforys.com/2008/07/30/intermittent-1px-gap-in-firefox-3/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 12:36:56 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[browsers]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://www.danforys.com/?p=33</guid>
		<description><![CDATA[My work has just pushed out an update, upgrading our users to Firefox 3. Naturally, we&#8217;ve been busy looking through our internally produced sites to check all is fine in the new version.
In 99% of cases, all our sites look the same in Firefox 3, apart from one notable exception. In this one case, there [...]]]></description>
			<content:encoded><![CDATA[<p>My work has just pushed out an update, upgrading our users to Firefox 3. Naturally, we&#8217;ve been busy looking through our internally produced sites to check all is fine in the new version.</p>
<p>In 99% of cases, all our sites look the same in Firefox 3, apart from one notable exception. In this one case, there is a 1px gap between the left-hand margin (which is centred using &#8220;margin-left: auto&#8221;) and the header image. Being the perfectionists we are, we don&#8217;t want a 1px white gap in our nice header.</p>
<p>Oddly, this 1px gap would come and go as the browser window is horizontally resized. This behaviour set alarm bells ringing that it&#8217;s some kind of rounding error in the &#8220;auto&#8221; positioning vs the exact pixel dimensions of our centred container.</p>
<p>After a bit of searching, we found an entry in <a href="http://ejohn.org/blog/sub-pixel-problems-in-css/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/ejohn.org');">John Resig&#8217;s blog</a> (of <a href="http://jquery.com/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/jquery.com');">JQuery</a> fame), where he has stumbled upon the issue and developed a test case for the main browsers. Turns out that fixing it is a challenge, as all the browsers round the numbers differently. Problem is, there&#8217;s no standard for how the browsers should round the pixels, so fixing it in one browser will almost certainly break it in another.</p>
<p>Ho hum, here&#8217;s hoping for a future standard.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danforys.com/2008/07/30/intermittent-1px-gap-in-firefox-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Understanding Linux file permissions</title>
		<link>http://www.danforys.com/2008/07/29/understanding-linux-file-permissions/</link>
		<comments>http://www.danforys.com/2008/07/29/understanding-linux-file-permissions/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 09:37:20 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[permissions]]></category>

		<guid isPermaLink="false">http://www.danforys.com/?p=29</guid>
		<description><![CDATA[They&#8217;re funny things Linux file permissions - the moment you think you understand them, you discover some subtle piece of functionality that means you were wrong all-along&#8230;
In this three-part article, I give a brief introduction to file and directory permissions, as well as some of the common gotchas. This part shows you how to interpret [...]]]></description>
			<content:encoded><![CDATA[<p>They&#8217;re funny things Linux file permissions - the moment you think you understand them, you discover some subtle piece of functionality that means you were wrong all-along&#8230;</p>
<p>In this three-part article, I give a brief introduction to file and directory permissions, as well as some of the common gotchas. This part shows you how to interpret permissions on the command line and explains what they mean.</p>
<p><span id="more-29"></span></p>
<p>One of the best ways to get a feel for the permissions, is using the shell. So, if you launch a shell session and type the following: (the &#8220;-l&#8221; means the long-listing format)</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span></pre></div></div>

<p>You&#8217;ll see a listing of all the files in your home folder, something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">drwxr-xr-x  <span style="color: #000000;">2</span> dan <span style="color: #c20cb9; font-weight: bold;">users</span>    <span style="color: #000000;">4096</span> <span style="color: #000000;">2007</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">13</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">34</span> bin
drwx------  <span style="color: #000000;">5</span> dan <span style="color: #c20cb9; font-weight: bold;">users</span>    <span style="color: #000000;">4096</span> <span style="color: #000000;">2008</span>-07-<span style="color: #000000;">25</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">30</span> Desktop
drwx------ <span style="color: #000000;">15</span> dan <span style="color: #c20cb9; font-weight: bold;">users</span>    <span style="color: #000000;">4096</span> <span style="color: #000000;">2008</span>-07-<span style="color: #000000;">18</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">49</span> Documents
drwxr-xr-x  <span style="color: #000000;">2</span> dan <span style="color: #c20cb9; font-weight: bold;">users</span>    <span style="color: #000000;">4096</span> <span style="color: #000000;">2007</span>-<span style="color: #000000;">12</span>-<span style="color: #000000;">13</span> <span style="color: #000000;">11</span>:08 public_html
<span style="color: #660033;">-rw-r--r--</span>  <span style="color: #000000;">1</span> dan <span style="color: #c20cb9; font-weight: bold;">users</span>   <span style="color: #000000;">12094</span> <span style="color: #000000;">2008</span>-03-<span style="color: #000000;">10</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">22</span> readme.txt</pre></div></div>

<p>Of particular interest to us, is the first set of characters which represent the permissions: (numbered below, for reference)</p>
<pre>drwxr-xr-x
12345678910</pre>
<p>From left to right, the permissions are grouped into four parts:</p>
<ul>
<li><em>Character 1:</em> Indicates a directory (d), link (l) or normal file (-)</li>
<li><em>Characters 2-4:</em> The read (r), write (w) and execute (x) permissions for the file <em>owner</em> (&#8221;dan&#8221; in the example above)</li>
<li><em>Characters 5-7:</em> The read (r), write (w) and execute (x) permissions for the file <em>group</em> (&#8221;users&#8221; in the example above)</li>
<li><em>Characters 8-10:</em> The read (r), write (w) and execute (x) permissions for <em>everyone else</em> aka <em>others</em></li>
</ul>
<p>What these permissions mean, depends on what kind of file it is.<br />
For <strong>directories</strong>:</p>
<ul>
<li><em>Read (r)</em>: Users can view a listing of the directory contents (i.e. read its contents)</li>
<li><em>Write (w)</em>: Users can create / delete files in this directory (i.e. write to the directory&#8217;s contents).</li>
<li><em>Execute (x)</em>: Users can enter this directory using a &#8220;cd&#8221; command</li>
</ul>
<p>Note: If users have write access to a directory - they can delete its files <em>even if they are not the owner and/or do not have write permission to the individual file</em>. Watch out for this one, it has caught us out in the past!</p>
<p>For <strong>files</strong>:</p>
<ul>
<li><em>Read (r)</em>: Users can view the files&#8217; contents</li>
<li><em>Write (w)</em>: Users can modify the files&#8217; contents</li>
<li><em>Execute (x)</em>: Allows execution of the file as a program</li>
</ul>
<p>You should also be aware that Linux <em>only checks the most appropriate permissions</em> when deciding whether to grant access. For example, if you are the file owner, only the owner permission is checked (not the &#8220;group&#8221;, or &#8220;other&#8221; permissions). This means, if the permissions are &#8220;&#8212;-r&#8211;r&#8211;&#8221;, you won&#8217;t be able to read the file if you are the owner - whereas members of the file group and &#8220;others&#8221; will be able to read it.</p>
<p>That&#8217;s it for now! In the upcoming part two, I will detail how to set permissions, using the Linux command line. Part three will show you some of the more advanced permissions. Watch this space!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danforys.com/2008/07/29/understanding-linux-file-permissions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Step by step: Moving code between Subversion repositories</title>
		<link>http://www.danforys.com/2008/07/23/moving-svn-code-step-by-step/</link>
		<comments>http://www.danforys.com/2008/07/23/moving-svn-code-step-by-step/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 15:14:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[subversion]]></category>

		<category><![CDATA[svn]]></category>

		<category><![CDATA[svnadmin]]></category>

		<guid isPermaLink="false">http://www.danforys.com/?p=9</guid>
		<description><![CDATA[As many coders will tell you, there reaches a point where you realise that you absolutely, positively must keep your code in a a revision control system. In my working life, I&#8217;ve used Microsoft&#8217;s ageing SourceSafe and more recently the vastly superior SubVersion (SVN).
There&#8217;s many powerful GUIs out there which you can use to interact [...]]]></description>
			<content:encoded><![CDATA[<p>As many coders will tell you, there reaches a point where you realise that you absolutely, positively <em>must</em> keep your code in a a revision control system. In my working life, I&#8217;ve used Microsoft&#8217;s ageing SourceSafe and more recently the vastly superior SubVersion (SVN).</p>
<p>There&#8217;s many powerful GUIs out there which you can use to interact with SVN, and make the checking out and checking in very easy. If you primarily use a desktop GUI (like me), then chances are you use a SVN client GUI to interact with SVN on a day-to-day basis.</p>
<p>But what happens when you need to move code between repositories?</p>
<p><span id="more-9"></span></p>
<p>I first realised I needed to reorganise my repositories when my single &#8220;clients&#8221; repository was growing unwieldy. It was one large repository, with all my client work organised into folders by the project name. This method keeps things very tidy, but increments the version numbers with every commit on <em>every project</em> and means you have a very long root log.</p>
<p>A better way, I realised, is to keep the unrelated projects organised in their own repositories - but how to move the code out of my client repository into a new one?</p>
<p>To do this, you&#8217;ll need shell access to your SVN server (surely you do - otherwise, how do you create your repositories?)</p>
<p>SVN provides the <strong>svnadmin dump</strong> command to export data from your repository. In my case, to dump the contents of my entire clients repository, I did the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svnadmin</span> dump clients <span style="color: #000000; font-weight: bold;">&gt;</span> clients-dumpfile</pre></div></div>

<p>which creates a text file called clients-dumpfile containing all the revision data for my clients repository. Note that this can create a very large file, as it&#8217;s not stored in the ultra-efficient space-saving SVN database any longer.</p>
<p>Say I want to move all my code from a folder called client-1, and put it in its own repository. First thing I need to do, is to create the destination repository:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svnadmin</span> create client-<span style="color: #000000;">1</span>-repository</pre></div></div>

<p>Now - the dumpfile contains <em>all</em> the code for all the projects, so how do I filter out the other projects? (this is all one line)</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> clients-dumpfile | <span style="color: #c20cb9; font-weight: bold;">svndumpfilter</span> include client-<span style="color: #000000;">1</span> <span style="color: #660033;">--drop-empty-revs</span> <span style="color: #660033;">--renumber-revs</span> <span style="color: #000000; font-weight: bold;">&gt;</span> client-<span style="color: #000000;">1</span>-filtered-dumpfile</pre></div></div>

<p>What does this do? It takes the previously created clients-dumpfile and sends it through the svndumpfilter program. I&#8217;ve told it to <em>include</em> the client-1 folder (and throw away everything else). I&#8217;ve told it to drop the empty revisions left behind by the thrown away data, and renumber the rest of the revisions so my new repository is nicely sequentially numbered. The results from svndumpfilter are output into a new file called client-1-filtered-dumpfile.</p>
<p>Finally, you simply load the data into the new repository:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svnadmin</span> load client-<span style="color: #000000;">1</span>-repository <span style="color: #000000; font-weight: bold;">&lt;</span> client-<span style="color: #000000;">1</span>-filtered-dumpfile</pre></div></div>

<p>Hopefully, you now have a populated repository with your clients&#8217; code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danforys.com/2008/07/23/moving-svn-code-step-by-step/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Novell client on OpenSuse 10.3</title>
		<link>http://www.danforys.com/2007/10/08/novell-client-on-opensuse-103/</link>
		<comments>http://www.danforys.com/2007/10/08/novell-client-on-opensuse-103/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 14:50:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[novell]]></category>

		<category><![CDATA[novell client]]></category>

		<category><![CDATA[opensuse]]></category>

		<category><![CDATA[opensuse 10.3]]></category>

		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://www.danforys.com/2007/10/08/novell-client-on-opensuse-103/</guid>
		<description><![CDATA[The latest (10.3) version of OpenSuse was released a few days ago. As I use Suse as my main development environment at work, I eagerly downloaded it as soon as I could, and installed it on a virtual machine.
First impressions are very good - very quick startup time, easy 1-click installs and a bright and [...]]]></description>
			<content:encoded><![CDATA[<p>The latest (10.3) version of <a href="http://www.opensuse.org/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.opensuse.org');">OpenSuse</a> was released a few days ago. As I use Suse as my main development environment at work, I eagerly downloaded it as soon as I could, and installed it on a virtual machine.</p>
<p>First impressions are very good - very quick startup time, easy 1-click installs and a bright and cheery colour scheme.</p>
<p>Unfortunately, I can&#8217;t switch for real as the Novell Client doesn&#8217;t work yet, and I need to client to access my shared drives at work. (Although I could use WebDAV, it doesn&#8217;t work so well). Attempting to install the <a href="http://beta.novell.com/" onclick="javascript:pageTracker._trackPageview ('/outbound/beta.novell.com');">Beta 2.0 version</a> yields a single dependency error (wrong version of binutils). Satisfying the dependency results in the Novell Client loading - but not connecting at all. Seemingly, the public Beta 2.0 of the client is no longer available for download.</p>
<p>There was quite a wait on Suse 10.2 for a working Novell Client - which was released in beta form a couple of months ago (and it works very nicely too). I&#8217;ll eagerly await and hope that Novell release a new client soon, then I will more than happily switch to the new version.</p>
<p><strong>UPDATE 29th Nov 2007</strong></p>
<p>I&#8221;ve just spotted that Novell have posted a way to run the 10.2 client on 10.3, over at <a href="http://www.novell.com/coolsolutions/tip/19968.html" onclick="javascript:pageTracker._trackPageview ('/outbound/www.novell.com');">coolsolutions.</a></p>
<p>It has a simple step-by-step guide that just involves entering a few commands into the shell.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danforys.com/2007/10/08/novell-client-on-opensuse-103/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Removing Windows from Apple&#8217;s Bootcamp</title>
		<link>http://www.danforys.com/2007/10/01/removing-windows-from-bootcamp/</link>
		<comments>http://www.danforys.com/2007/10/01/removing-windows-from-bootcamp/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 08:30:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Apple]]></category>

		<category><![CDATA[bootcamp]]></category>

		<category><![CDATA[delete windows]]></category>

		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://www.danforys.com/2007/10/01/7/</guid>
		<description><![CDATA[Having tried Windows Vista on my shiny new iMac and having a few issues (stuttering sound, slower loading times), I decided to revert back to using Windows XP.
Now, Bootcamp is supposed to make this easy - you just launch the Bootcamp assistant, and click &#8220;Restore the startup disk to a single volume&#8221;. A few moments [...]]]></description>
			<content:encoded><![CDATA[<p>Having tried Windows Vista on my shiny new iMac and having a few issues (stuttering sound, slower loading times), I decided to revert back to using Windows XP.</p>
<p>Now, Bootcamp is supposed to make this easy - you just launch the Bootcamp assistant, and click &#8220;Restore the startup disk to a single volume&#8221;. A few moments later, all seemed well, and I was prompted to reboot.</p>
<p>After the reboot, the Windows XP drive is still visible, and it seems nothing has happened. After trying this multiple times and getting quickly fed up, I ruled out a few other ways to delete Windows:</p>
<ul>
<li>I couldn&#8217;t run the Windows XP installer disk - rebooting the iMac with the disk in the drive caused a &#8220;Press any key to boot from CD&#8230;&#8221; prompt. Unfortunately, the iMac keyboard doesn&#8217;t work at that point.</li>
<li>Attempting to run the XP installer from within Vista - the &#8220;Install Windows XP&#8221; option is greyed out and not selectable</li>
<li>OS X&#8217;s disk utility wouldn&#8217;t let me unmount or erase the Windows parition</li>
<li>I was too scared to use fdisk from the command line, just in case I nuked my OS X partition (and didn&#8217;t want to reformat the whole lot for the same reason)</li>
</ul>
<p>So, how did I fix it in the end?</p>
<p>If you can&#8217;t delete Windows from your Mac&#8217;s bootcamp installation:</p>
<ul>
<li>Drag the Windows parition  to the Trash to unmount it</li>
<li>Run the Bootcamp assistant and choose &#8220;Restore the startup disk to a single volume&#8221;</li>
</ul>
<p>Guess that&#8217;s the risk you take when you use Beta software eh? <img src='http://www.danforys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.danforys.com/2007/10/01/removing-windows-from-bootcamp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>HTTP Authentication in PHP</title>
		<link>http://www.danforys.com/2007/06/12/http-authentication-in-php/</link>
		<comments>http://www.danforys.com/2007/06/12/http-authentication-in-php/#comments</comments>
		<pubDate>Tue, 12 Jun 2007 14:08:45 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
		
		<category><![CDATA[browsers]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.danforys.com/2007/06/12/http-authentication-in-php/</guid>
		<description><![CDATA[I&#8217;ve just discovered, totally by accident, how to get HTTP Authentication (when the browser pops up a dialog asking for the username and password - usually set with a .htaccess file) values within PHP. Previously, I&#8217;d just assumed that the authentication was a &#8220;black box&#8221; and I was unable to use it within my scripts. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just discovered, totally by accident, how to get <a href="http://en.wikipedia.org/wiki/Basic_authentication_scheme" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">HTTP Authentication</a> (when the browser pops up a dialog asking for the username and password - usually set with a .htaccess file) values within PHP. Previously, I&#8217;d just assumed that the authentication was a &#8220;black box&#8221; and I was unable to use it within my scripts. I had done some experimentation to see if any of the information was present in the _POST or _COOKIE arrays to no avail.</p>
<p><span id="more-5"></span>At work, we were using some software which, somewhat curiously, seemed to automatically log users in without them supplying the correct credentials. After much digging, inserting debug messages and experimentation, I found that PHP had the authentication values in the superglobal $_REQUEST array. The values you can use are as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Superglobal showing the username supplied</span>
<span style="color: #990000;">print</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="">'PHP_AUTH_USER'</span><span style="color: #009900;">&#93;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// Superglobal showing the password</span>
<span style="color: #990000;">print</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="">'PHP_AUTH_PW'</span><span style="color: #009900;">&#93;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// Authentication type (Basic or digest in PHP5)</span>
<span style="color: #990000;">print</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="">'AUTH_TYPE'</span><span style="color: #009900;">&#93;</span>;</pre></td></tr></table></div>

<p>This is immensely useful for me, because it opens all sorts of possibilities for single sign-on style systems. It also means I can work with non PHP files, without having to authenticate twice or rely on PHP sessions alone.</p>
<p>Of course, perhaps I should have looked at the <a href="http://uk.php.net/manual/en/features.http-auth.php" onclick="javascript:pageTracker._trackPageview ('/outbound/uk.php.net');">PHP manual on HTTP authentication</a> first! <img src='http://www.danforys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.danforys.com/2007/06/12/http-authentication-in-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Microformats and me</title>
		<link>http://www.danforys.com/2007/06/11/microformats-and-me/</link>
		<comments>http://www.danforys.com/2007/06/11/microformats-and-me/#comments</comments>
		<pubDate>Mon, 11 Jun 2007 13:10:37 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
		
		<category><![CDATA[atmedia]]></category>

		<category><![CDATA[atmedia07]]></category>

		<category><![CDATA[atmedia2007]]></category>

		<category><![CDATA[microformats]]></category>

		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://www.danforys.com/2007/06/11/microformats-and-me/</guid>
		<description><![CDATA[Having attended the greatly motivational @media conference last week, I&#8217;ve come away feeling more enthusiastic about the up and coming microformats movement.
Last year, during @media 2006, I was introduced to the concept for the first time. In its simplest form, it&#8217;s a way of wrapping web content within a set of standardised class names. The [...]]]></description>
			<content:encoded><![CDATA[<p>Having attended the greatly motivational <a href="http://www.vivabit.com/atmedia2007/" title="@media homepage" onclick="javascript:pageTracker._trackPageview ('/outbound/www.vivabit.com');">@media</a> conference last week, I&#8217;ve come away feeling more enthusiastic about the up and coming <a href="http://microformats.org/" onclick="javascript:pageTracker._trackPageview ('/outbound/microformats.org');">microformats</a> movement.</p>
<p>Last year, during @media 2006, I was introduced to the concept for the first time. In its simplest form, it&#8217;s a way of wrapping web content within a set of standardised class names. The idea being that if <em>everyone</em> uses these class names, it makes it very simple for other systems to parse and pluck out the data.  The example given was marking up personal details as an <a href="http://microformats.org/wiki/hcard" onclick="javascript:pageTracker._trackPageview ('/outbound/microformats.org');">hCard</a> which could then be linked to the <a href="http://technorati.com/contacts/" onclick="javascript:pageTracker._trackPageview ('/outbound/technorati.com');">Technorati contact generator</a>. The generator will parse the page and offer you a vCard file for download, which you can then import into Outlook or some other address book software.</p>
<p><span id="more-3"></span>For example, I may have some contact detail about myself:</p>
<blockquote><p>Name: Dan Forys , website: http://www.danforys.com</p></blockquote>
<p>To &#8220;microformat&#8221; it, I could do this:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;vcard&quot;</span>&gt;</span>
Name: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fn&quot;</span>&gt;</span>Dan Forys<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>,
website: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.danforys.com/&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span>&gt;</span>http://www.danforys.com/<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Simply by applying the classes &#8220;vcard&#8221;, &#8220;fn&#8221; and &#8220;url&#8221;, I have specified that the information contained within is in the &#8220;hCard&#8221; format. Now, the browser, another website, or some other software could read this page and fetch that information - perhaps offering to put it in the user&#8217;s address book. Simple!</p>
<p>At the time, I was somewhat skeptical - since it seemed very much a developer-centric technology. Unless the site developer had the foresight to embed something in the page (like a link to the Technorati generator), the user would not be able to do anything with the data. Basically, <em>microformats depend 100% on the site developers marking up their code appropriately.</em></p>
<p>Fast forward to 2007, and I&#8217;d more-or-less forgotten about microformats until the @media talk by the massively intelligent <a href="http://www.tantek.com/" onclick="javascript:pageTracker._trackPageview ('/outbound/www.tantek.com');">Tantek Çelik</a>. This time, I&#8217;m much more enthusiastic about the whole idea, this is why:</p>
<ul>
<li>Firefox 3 will have support for microformats built-in</li>
<li>(and this is mainly what&#8217;s converted me to the idea&#8230;) The <a href="https://addons.mozilla.org/en-US/firefox/addon/4106" onclick="javascript:pageTracker._trackPageview ('/outbound/addons.mozilla.org');">Operator extension for Firefox</a> automatically highlights microformatted information and offers you ways of working with it (download a vCard for example) - No linking necessary!</li>
<li>There&#8217;s a set of open-source tools that can be used to interpret microformats that can be installed on your own site - or you can link to externally hosted ones like at Technorati</li>
<li>There are tools allowing you to perform SQL-like queries on microformatted pages (I guess through XSLT or just parsing the pages&#8230;). Although rather complex, it lets developer do wonderful queries on pages to extract exactly the data they require. Effectively, it lets developers mash-up microformatted websites.</li>
<li>By using (X)HTML class names, there is no need to change the meaning (semantics) of the markup used - it also lends itself very well to applying CSS to the information (of course, CSS has its own class selectors for you to use&#8230;)</li>
</ul>
<p>I firmly believe that once the browser support is there, this is an excellent way of doing things. I wonder if Microsoft will follow Firefox&#8217;s lead with this?</p>
<p>Working in an academic institution, microformats are a great tool for us - we have hundreds of <a href="http://www.lshtm.ac.uk/its/staff/dforys.html" onclick="javascript:pageTracker._trackPageview ('/outbound/www.lshtm.ac.uk');">personal profile pages</a> for the staff here. It would be great if they could be marked up to let visitors easily add the information into their address book. It just so happens that we&#8217;re needing to rewrite the profile pages anyway to better organise them. Also, we have an events system that would lend itself very well to the <a href="http://microformats.org/wiki/hcalendar" onclick="javascript:pageTracker._trackPageview ('/outbound/microformats.org');">hCalendar implementation</a> - which we are also looking at rewriting.</p>
<p>In our case, there&#8217;s a couple of teeny barriers to implementation that need some thought though:</p>
<ul>
<li>Staff are (understandably) twitchy about publishing their personal information on the web and microformats make it <em>much easier</em> to harvest that information. In reality though, their information is already on the web - but the perceived problem is that they might get pestered more from the outside world (eek!)</li>
<li> Calendar events are not implemented consistently across the major players (MS Outlook, Google calendar etc.). After some initial experimentation, my line manager found that a different event download needs to be offered <em>for each calendar application</em>. Of course, this is certainly not the fault of the microformats spec. Can we have a consistent and quirk-free calendar file format please?</li>
</ul>
<p>Still, these are relatively minor issues and microformats have been developed to encompass a lot of useful data  types (events, contacts, resumes, reviews to name a few). So I think this is something we&#8217;ll be incorporating here as much as we can.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danforys.com/2007/06/11/microformats-and-me/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
