<?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>Ed Jeavons</title>
	<atom:link href="http://edjeavons.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://edjeavons.co.uk</link>
	<description>Mostly about web development</description>
	<lastBuildDate>Wed, 16 May 2012 21:02:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to create a Google+ vanity URL</title>
		<link>http://edjeavons.co.uk/2011/10/how-to-create-a-google-plus-vanity-url/</link>
		<comments>http://edjeavons.co.uk/2011/10/how-to-create-a-google-plus-vanity-url/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 13:49:02 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://edjeavons.co.uk/?p=3</guid>
		<description><![CDATA[I&#8217;ve been looking at G+ recently, in particular the traction it&#8217;s gained amongst photographers. I felt like giving it a proper try for myself an early annoyance was the much talked about issue with profile URLs. As you probably know, Google has (for now) decided not to go down the route of vanity URLs and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking at G+ recently, in particular the traction it&#8217;s gained amongst photographers. I felt like giving it a proper try for myself an early annoyance was the much talked about issue with profile URLs.</p>
<p>As you probably know, Google has (for now) decided not to go down the route of <em>vanity URLs</em> and instead use a numerical ID to identify users. So my G+ profile can be found at &#8220;https://plus.google.com/107139161496384775401/posts&#8221;. The drawback here is that it&#8217;s not practical to quote my G+ address to other people so their only option is to open the website and search for me. Now in practical terms that&#8217;s not too bad for me because my name isn&#8217;t so common but if you have a popular name it must make life very difficult.</p>
<p>My solution was to create a custom URL using my own domain. You can now find me at <a href="http://gplus.edjeavons.co.uk">http://gplus.edjeavons.co.uk</a>.</p>
<p><strong>Step 1: Domain DNS</strong></p>
<p>In my domain&#8217;s DNS settings I setup a new record for the &#8220;gplus&#8221; subdomain and pointed it towards my web server.</p>
<p>Note that some domain registrars may let you setup web forwarding directly in your domain&#8217;s setting but mine only does that for the &#8220;www&#8221; subdomain so I couldn&#8217;t do it there. Otherwise it would have been a one-step process.</p>
<p><strong>Step 2: Web redirect</strong></p>
<p>There are a number of ways you would do this, like adding a redirect within an Apache vhost, within a .htaccess file, or even within a PHP/HTML file. I chose to do it within the .htaccess file because it allows me to amend it in the future without messing with Apache&#8217;s config files again.</p>
<p>I didn&#8217;t think it was worth setting up a new vhost just to handle this special case so I added gplus.edjeavons.co.uk as a ServerAlias of this website.</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">ServerAlias</span> gplus.edjeavons.co.uk</pre></div></div>

<p>With that done I restarted Apache and opened up my website&#8217;s files, then in the .htaccess file I added the following two lines near the top:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteCond</span> %{http_host} gplus.edjeavons.co.uk [nc]
<span style="color: #00007f;">RewriteRule</span> . https://plus.google.com/<span style="color: #ff0000;">107139161496384775401</span>/posts [r=<span style="color: #ff0000;">301</span>,L]</pre></div></div>

<p>This basically tells the server so redirect visitors to my G+ page when it detects a request for gplus.edjeavons.co.uk.</p>
<p>One DNS entry and 3 lines of code &#8230; done!</p>
]]></content:encoded>
			<wfw:commentRss>http://edjeavons.co.uk/2011/10/how-to-create-a-google-plus-vanity-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OS X web development server</title>
		<link>http://edjeavons.co.uk/2010/08/os-x-web-development-server/</link>
		<comments>http://edjeavons.co.uk/2010/08/os-x-web-development-server/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 11:11:18 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://edjeavons.co.uk/?p=95</guid>
		<description><![CDATA[I think Mac based PHP developers most commonly install an application like MAMP to handle the perceived hard work when it comes to setting up their working environment. OS X does come preinstalled with most of what you need to develop PHP websites though and it’s pretty easy to get up and running. Why install [...]]]></description>
			<content:encoded><![CDATA[<p>I think Mac based PHP developers most commonly install an application like MAMP to handle the perceived hard work when it comes to setting up their working environment. OS X does come preinstalled with most of what you need to develop PHP websites though and it’s pretty easy to get up and running. Why install extra 3rd party software, taking up space and system resources, when Apple has done it already?</p>
<p>This guide starts with a clean installation of Mac OS X 10.6.4 (Snow Leopard) and walks through the steps of setting up your dev server. It finishes with a run through of an application called VirtualHostX which is by no means necessary but I think it helps give a smooth development experience.</p>
<h2>Start with Apache</h2>
<p>Obviously Apache is the cornerstone to the whole idea so it seems like a logical place to start this guide.</p>
<p>OS X uses Apache for it’s built-in web sharing feature so enabling it couldn’t be easier. Go to &#8220;System Preferences &gt; Sharing&#8221; then turn on &#8220;Web Sharing&#8221;.</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/web-sharing-prefs.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/web-sharing-prefs.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/web-sharing-prefs.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:302px;" class="aligncenter"><img class=" size-medium wp-image-237 shadow_curl colorbox-95" style="border: 1px solid #C0C0C0;; padding:0 !important; margin:0 !important; max-width:100% !important;" title="web-sharing-prefs" src="http://edjeavons.co.uk/wp-content/uploads/2010/08/web-sharing-prefs-300x245.jpg" alt="" width="300" height="245" /><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-95" style="margin:0 !important;height:10px;width:100%;"></div></a></p>
<p>You’ll be given an IP address that others can use to access your server but of course you can do so by visiting <a href="http://localhost/" target="_blank">http://localhost/</a> from your own machine. Try that now and you&#8217;ll be greeted by Apache&#8217;s familiar, if underwhelming, default page.</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/apache-it-works.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/apache-it-works.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:302px;" class="aligncenter"><img class=" size-medium wp-image-232 shadow_curl colorbox-95" style="border: 1px solid #C0C0C0;; padding:0 !important; margin:0 !important; max-width:100% !important;" title="apache-it-works" src="http://edjeavons.co.uk/wp-content/uploads/2010/08/apache-it-works-300x224.jpg" alt="" width="300" height="224" /><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-95" style="margin:0 !important;height:10px;width:100%;"></div></a></p>
<p>Apache&#8217;s default location (where&#8217;s you&#8217;ll find the page shown above) is /Library/WebServer/Documents and to get to your own Sites folder you&#8217;ll need to open http://localhost/~[username]/. If you&#8217;re the only person using your Mac and you&#8217;d find it more convenient if <a href="http://localhost/" target="_blank">http://localhost/</a> went directly to your own Sites folder, you can make a simple change to Apache. Run the following command in the system terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pico <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>httpd.conf</pre></div></div>

<p>Then find the <strong>DocumentRoot</strong> directive and change it to your Sites directory, i.e. <strong>DocumentRoot &#8220;/Users/[username]/Sites&#8221;</strong>. Note that throughout this guide I am assuming you store your websites your account&#8217;s &#8220;Sites&#8221; directory, if that&#8217;s not the case simply amend any paths you see.</p>
<p>Now restart the server (by disabling then re-enabling web sharing in the prefs pane) and refresh the localhost page. You should be greeted with your own home page now.</p>
<h2>Enabling PHP support</h2>
<p>Just like Apache, PHP is included with OS X although it’s not enabled by default. To get it working edit the httpd.conf file by running this line in the system terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pico <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>httpd.conf</pre></div></div>

<p>Find the line &#8220;<strong>LoadModule php5_module libexec/apache2/libphp5.so</strong>&#8221; and uncomment it then save the file and exit the editor.</p>
<p>Make a PHP configuration file by  running this in the system terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini.default <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini
<span style="color: #c20cb9; font-weight: bold;">sudo</span> pico <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini</pre></div></div>

<p>You should configure PHP for your own preferences but if you&#8217;re not familiar with the php.ini file just get yourself up and running by finding the directive &#8220;<strong>short_open_tag</strong>&#8221; and changing it&#8217;s value to &#8220;On&#8221;, and then uncomment the directive &#8221;<strong>date.timezone</strong>&#8221; and give it a suitable timezone &#8211; for me that would be &#8220;Europe/London&#8221; but there&#8217;s a full list at <a href="http://php.net/date.timezone" target="_blank">http://php.net/date.timezone</a>. As this is a development server you may also want to turn on &#8220;<strong>display_errors</strong>&#8221; to aid debugging. Save the file and exit the editor once you&#8217;re done editing.</p>
<p>Now restart the server again using the sharing prefs pane.</p>
<p>To test PHP make a new file in your Sites folder called info.php and include the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #990000;">phpinfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Open that file in your web browser and you will get an overview of PHP&#8217;s capabilities. If not double-check that the correct line has been uncommented in httpd.conf and that you have restarted Apache since enabling PHP.</p>
<p>All good so far! Now let&#8217;s add database support.</p>
<h2>Installing MySQL</h2>
<p>OS X doesn&#8217;t come with MySQL so it&#8217;s the one component you&#8217;ll need to install for yourself. Fortunately MySQL has an easy install process so run along to <a href="http://www.mysql.com/downloads/mysql/" target="_blank">http://www.mysql.com/downloads/mysql/</a> and download the DMG archive for your system.</p>
<p>You&#8217;ll find that they give you the main MySQL server, a prefs pane item and a startup item. I&#8217;d recommend install all three of these components. The following image shows their prefs pane.</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/mysql-prefs.jpg"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/mysql-prefs.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:302px;" class="aligncenter"><img class=" size-medium wp-image-233 shadow_curl colorbox-95" style="border: 1px solid #C0C0C0;; padding:0 !important; margin:0 !important; max-width:100% !important;" title="mysql-prefs" src="http://edjeavons.co.uk/wp-content/uploads/2010/08/mysql-prefs-300x159.jpg" alt="" width="300" height="159" /><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-95" style="margin:0 !important;height:10px;width:100%;"></div></a></a></p>
<p>By default MySQL won&#8217;t set a top-level password but that&#8217;s something you&#8217;ll want to do for increased security. On a development machine it may not seem necessary but it&#8217;s good practice so after everything&#8217;s installed run the following at the system terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mysqladmin <span style="color: #660033;">-u</span> root password <span style="color: #7a0874; font-weight: bold;">&#91;</span>newpassword<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>For some reason the installer doesn&#8217;t create a my.cnf configuration file either, which you&#8217;ll need if you ever want to customise the installation.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>support-files<span style="color: #000000; font-weight: bold;">/</span>my-large.cnf <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>my.cnf</pre></div></div>

<p>You might like to restrict the installation a little more but I&#8217;ll leave that admin up to you. This guide is really just about getting everything working.</p>
<p>By now MySQL is fully functional but PHP isn&#8217;t aware of it so we need to update a few lines in the php.ini configuration file. Using the system terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pico <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini</pre></div></div>

<p>Now uncomment the directives &#8220;<strong>extension=php_mysql.dll</strong>&#8221; and &#8220;<strong>extension=php_mysqli.dll</strong>&#8221; and amend the predefined MySQL socket paths to &#8220;<strong>mysql.default_socket = /tmp/mysql.sock</strong>&#8221; and &#8220;<strong>mysqli.default_socket = /tmp/mysql.sock</strong>&#8220;.</p>
<p>Restart the server again (using the sharing prefs pane) and if you refresh your info.php page you should see that MySQL has been enabled.</p>
<p>You&#8217;ve now got a fully functional Apache + PHP + MySQL development server on your Mac and all you&#8217;ve had to install is MySQL. You can stop here if that&#8217;s all you wanted to achieve but I&#8217;m going to carry on and introduce VirtualHostX to try and make life a little easier.</p>
<h2>Using VirtualHostX</h2>
<p>What VirtualHostX essentially does is automatically configure your system&#8217;s hosts file and Apache&#8217;s vhost file so that you can access your development websites using a simple url rather than localhost followed by one (or often more) nested directories.</p>
<p>VirtualHostX only costs about £16.50 ($25 at the time of writing) and the convenience it delivers makes that money well spent. You can run the trial version if you&#8217;re unsure whether or not you need it.</p>
<p><a href="http://clickontyler.com/virtualhostx/" target="_blank">http://clickontyler.com/virtualhostx/</a></p>
<p>So, download and install VirtualHostX now. When you run it for the first time it brings up the setup wizard.</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/virtualhostx-setup.jpg"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/virtualhostx-setup.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:253px;" class="aligncenter"><img class=" size-medium wp-image-235 shadow_curl colorbox-95" style="border: 1px solid #C0C0C0;; padding:0 !important; margin:0 !important; max-width:100% !important;" title="virtualhostx-setup" src="http://edjeavons.co.uk/wp-content/uploads/2010/08/virtualhostx-setup-251x300.jpg" alt="" width="251" height="300" /><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-95" style="margin:0 !important;height:10px;width:100%;"></div></a></a></p>
<p>The wizard will first create a backup of the operating system&#8217;s default Apache configuration, so you can always roll back if something breaks, and then it makes a minor change that tells Apache you want it to run virtual hosts. This is a perfectly safe change and is the way Apache would normally be run.</p>
<p>Before we go on to setup a vhost you need to have a target website on your computer. This can be any website, located anywhere on your Mac, but I like to keep all my websites within my Sites directory and for this demo I&#8217;m going to make <a href="http://sqlbuddy.com/" target="_blank">SQL Buddy</a> accessible from the convenient domain &#8220;dbadmin&#8221;.</p>
<p>Download SQL Buddy from the above link, extract it to a new folder called &#8220;sqlbuddy&#8221; within your Sites directory, and add your MySQL root password (defined earlier) to the SQL Buddy config.php script. With that the website will be accessible at the address http://localhost/~[username]/sqlbuddy/ but that&#8217;s a bit messy so open VirtualHostX and add a new host as per the following image.</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/virtualhostx.jpg"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/virtualhostx.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:302px;" class="aligncenter"><img class=" size-medium wp-image-236 shadow_curl colorbox-95" style="border: 1px solid #C0C0C0;; padding:0 !important; margin:0 !important; max-width:100% !important;" title="virtualhostx" src="http://edjeavons.co.uk/wp-content/uploads/2010/08/virtualhostx-300x228.jpg" alt="" width="300" height="228" /><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-95" style="margin:0 !important;height:10px;width:100%;"></div></a></a></p>
<p>Press &#8220;Apply Changes&#8221; once done and then you&#8217;ll able to quickly access your database administration by going to <a href="http://dbadmin/" target="_blank">http://dbadmin/</a> &#8211; that&#8217;s tidier isn&#8217;t it?</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/sql-buddy.jpg"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/08/sql-buddy.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:302px;" class="aligncenter"><img class=" size-medium wp-image-234 shadow_curl colorbox-95" style="border: 1px solid #C0C0C0;; padding:0 !important; margin:0 !important; max-width:100% !important;" title="sql-buddy" src="http://edjeavons.co.uk/wp-content/uploads/2010/08/sql-buddy-300x224.jpg" alt="" width="300" height="224" /><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-95" style="margin:0 !important;height:10px;width:100%;"></div></a></a></p>
<p>I generally use VirtualHostX to setup development website&#8217;s using the real domain but prefixing it with &#8220;dev&#8221; rather than &#8220;www&#8221; so I don&#8217;t have to remember directory paths from my web root, or handle them within the website&#8217;s scripts.</p>
<h2>That&#8217;s it!</h2>
<p>I&#8217;ve probably made this guide a little more wordy than necessary but hopefully you&#8217;ll see that setting up a development server in OS X 10.6 is really simple &#8211; really just a case of installing the MySQL package and editing two system files.</p>
<p>It&#8217;s worth pointing out that, with all the latest OS X updates at the time of writing this guide, the built-in Apache is version 2.2.14 and it is preconfigured with the popular rewrite module. PHP is version 5.3.1 and it supports the most commonly used modules plus &#8220;pear&#8221; is also supported from the system terminal.</p>
]]></content:encoded>
			<wfw:commentRss>http://edjeavons.co.uk/2010/08/os-x-web-development-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SXSW 2010 visual records</title>
		<link>http://edjeavons.co.uk/2010/03/sxsw-2010-visual-records/</link>
		<comments>http://edjeavons.co.uk/2010/03/sxsw-2010-visual-records/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 20:20:31 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[SXSW]]></category>

		<guid isPermaLink="false">http://edjeavons.co.uk/?p=91</guid>
		<description><![CDATA[I actually missed out on all but one of the keynotes at SXSW this year (because there always seemed to be something else I should be doing at the same time) but the organisers put these graphical records on display outside of the main exhibit hall and they caught my eye. Click the individual images [...]]]></description>
			<content:encoded><![CDATA[<p>I actually missed out on all but one of the keynotes at SXSW this year (because there always seemed to be something else I should be doing at the same time) but the organisers put these graphical records on display outside of the main exhibit hall and they caught my eye.</p>
<p>Click the individual images to see a larger version.</p>
<h2>Opening Remarks with Danah Boyd</h2>
<p>Saturday, 13th March 2010</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Danah-Boyd-1.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Danah-Boyd-1.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Danah-Boyd-1.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:550px;" class="aligncenter"><img class=" size-medium wp-image-255 shadow_curl colorbox-91" title="Danah-Boyd-1" src="http://edjeavons.co.uk/wp-content/uploads/2010/03/Danah-Boyd-1-550x277.jpg" alt="" width="550" height="277"  style="padding:0 !important; margin:0 !important; max-width:100% !important;"><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-91" style="margin:0 !important;height:10px;width:100%;"></div></a> <em>by Heather Willem (</em><a href="http://www.imagethink.net/" target="_blank"><em>imagethink.net</em></a><em>)</em></p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Danah-Boyd-2.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Danah-Boyd-2.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Danah-Boyd-2.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:550px;" class="aligncenter"><img class=" size-medium wp-image-256 shadow_curl colorbox-91" title="Danah-Boyd-2" src="http://edjeavons.co.uk/wp-content/uploads/2010/03/Danah-Boyd-2-550x277.jpg" alt="" width="550" height="277"  style="padding:0 !important; margin:0 !important; max-width:100% !important;"><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-91" style="margin:0 !important;height:10px;width:100%;"></div></a> <em>by Ty Wallis (</em><a href="http://www.theillustratedidea.com/" target="_blank"><em>theillustratedidea.com</em></a><em>)</em></p>
<h2>Sunday Keynote with Valerie Casey</h2>
<p>Sunday, 14th March 2010</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Valerie-Casey-1.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Valerie-Casey-1.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Valerie-Casey-1.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:550px;" class="aligncenter"><img class=" size-medium wp-image-261 shadow_curl colorbox-91" title="Valerie-Casey-1" src="http://edjeavons.co.uk/wp-content/uploads/2010/03/Valerie-Casey-1-550x277.jpg" alt="" width="550" height="277"  style="padding:0 !important; margin:0 !important; max-width:100% !important;"><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-91" style="margin:0 !important;height:10px;width:100%;"></div></a> <em>by Sunni Brown (</em><a href="http://sunnibrown.com/" target="_blank"><em>sunnibrown.com</em></a><em>)</em></p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Valerie-Casey-2.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Valerie-Casey-2.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Valerie-Casey-2.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:550px;" class="aligncenter"><img class=" size-medium wp-image-262 shadow_curl colorbox-91" title="Valerie-Casey-2" src="http://edjeavons.co.uk/wp-content/uploads/2010/03/Valerie-Casey-2-550x277.jpg" alt="" width="550" height="277"  style="padding:0 !important; margin:0 !important; max-width:100% !important;"><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-91" style="margin:0 !important;height:10px;width:100%;"></div></a> <em>by Varick Rosete (</em><a href="http://www.varickrosete.com/" target="_blank"><em>varickrosete.com</em></a><em>)</em></p>
<h2>Keynote Interview with Evan Williams and Umair Haque</h2>
<p>Monday, 15th March 2010</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Evan-Williams-1.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Evan-Williams-1.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:550px;" class="aligncenter"><img class=" size-medium wp-image-259 shadow_curl colorbox-91" title="Evan-Williams-1" src="http://edjeavons.co.uk/wp-content/uploads/2010/03/Evan-Williams-1-550x277.jpg" alt="" width="550" height="277"  style="padding:0 !important; margin:0 !important; max-width:100% !important;"><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-91" style="margin:0 !important;height:10px;width:100%;"></div></a><em>by Sunni Brown (</em><a href="http://sunnibrown.com/" target="_blank"><em>sunnibrown.com</em></a><em>)</em></p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Evan-Williams-2.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Evan-Williams-2.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:550px;" class="aligncenter"><img class=" size-medium wp-image-260 shadow_curl colorbox-91" title="Evan-Williams-2" src="http://edjeavons.co.uk/wp-content/uploads/2010/03/Evan-Williams-2-550x277.jpg" alt="" width="550" height="277"  style="padding:0 !important; margin:0 !important; max-width:100% !important;"><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-91" style="margin:0 !important;height:10px;width:100%;"></div></a> <em>by Karen Ingram (</em><a href="http://www.kareningram.com/" target="_blank"><em>kareningram.com</em></a><em>)</em></p>
<h2>Keynote Interview with Daniel Ek and Eliot Van Buskirk</h2>
<p>Tuesday, 16th March 2010</p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Daniel-Ek-1.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Daniel-Ek-1.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:550px;" class="aligncenter"><img class=" size-medium wp-image-257 shadow_curl colorbox-91" title="Daniel-Ek-1" src="http://edjeavons.co.uk/wp-content/uploads/2010/03/Daniel-Ek-1-550x277.jpg" alt="" width="550" height="277"  style="padding:0 !important; margin:0 !important; max-width:100% !important;"><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-91" style="margin:0 !important;height:10px;width:100%;"></div></a> <em>by Janie Underhill (</em><a href="http://www.idea-360.com/" target="_blank"><em>idea-360.com</em></a><em>)</em></p>
<p style="text-align: center;"><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Daniel-Ek-2.jpg"></a><a href="http://edjeavons.co.uk/wp-content/uploads/2010/03/Daniel-Ek-2.jpg"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:550px;" class="aligncenter"><img class=" size-medium wp-image-258 shadow_curl colorbox-91" title="Daniel-Ek-2" src="http://edjeavons.co.uk/wp-content/uploads/2010/03/Daniel-Ek-2-550x277.jpg" alt="" width="550" height="277"  style="padding:0 !important; margin:0 !important; max-width:100% !important;"><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-91" style="margin:0 !important;height:10px;width:100%;"></div></a> <em>by Stacy Weitzner (</em><a href="http://www.boldmusecreative.com/" target="_blank"><em>boldmusecreative.com</em></a><em>)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://edjeavons.co.uk/2010/03/sxsw-2010-visual-records/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beyond web-safe fonts with Typekit</title>
		<link>http://edjeavons.co.uk/2010/02/beyond-web-safe-fonts-with-typekit/</link>
		<comments>http://edjeavons.co.uk/2010/02/beyond-web-safe-fonts-with-typekit/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 22:02:29 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Typekit]]></category>
		<category><![CDATA[Web fonts]]></category>

		<guid isPermaLink="false">http://edjeavons.co.uk/?p=89</guid>
		<description><![CDATA[Custom fonts are a hot topic in the web design world at the moment because we&#8217;ve finally reached the point where all major browsers support their use via standard CSS. Now we can link to fonts of our choosing rather than relying on what is likely to be installed on the user&#8217;s computer. You would [...]]]></description>
			<content:encoded><![CDATA[<p>Custom fonts are a hot topic in the web design world at the moment because we&#8217;ve finally reached the point where all major browsers support their use via standard CSS. Now we can link to fonts of our choosing rather than relying on what is likely to be installed on the user&#8217;s computer.</p>
<p>You would expect the easiest, and maybe the best, way to get started with custom fonts is to find the typeface you want and then use CSS code similar to this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@font-face {</span>
  <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> MyFont<span style="color: #00AA00;">;</span>
  src<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">http://www.mysite.com/MyFont.ttf</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> MyFont<span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>There are three big drawbacks to this method though; (i) you must be really sure that you&#8217;re licensed to use the font on the web, (ii) the font file must be in format that&#8217;s supported by the user&#8217;s browser, and (iii) the font file will almost certainly be a very large by web standards. All of these concerns can be addressed with Typekit.</p>
<h3>What is Typekit?</h3>
<p>Typekit uses JavaScript to inject the necessary CSS into your web pages and makes your chosen font file(s) available for use by visitors. It offers a wide selection of high quality fonts and has free and paid packages.</p>
<p>Typekit degrades gracefully so that anyone without JavaScript, or with a browser that doesn&#8217;t support the necessary features, will simply revert to your standard CSS rules. The reliance on JavaScript may be considered a problem but these days it is safe to assume that all visitors will have JavaScript enabled.</p>
<p>The two big advantages of Typekit are that you can rest assured the fonts are being used legally, and you&#8217;re given the option to reduce the file sizes by only including the styles and characters that you need.</p>
<h3>How does it work?</h3>
<p>First you&#8217;ll need to register with Typekit at <a href="http://typekit.com/" target="_blank">typekit.com</a>. They do offer a free account which may be all you need, and it&#8217;ll certainly be enough try the service and to see if it suits you or not. The free account does require that you show the Typekit logo on your website but that&#8217;s fully understandable and their &#8216;Personal&#8217; plan isn&#8217;t a lot of money if you don&#8217;t want that restriction.</p>
<p>Once logged in, follow the guided process of adding your website and selecting your font(s). After adding each font you&#8217;ll be greeted with the option to define which CSS selectors it should be applied to, or you can manually add it to your own CSS file if you prefer. Next you should select only the specific styles and subsets you require to help reduce its size. After that click &#8216;Publish&#8217; and you&#8217;re about done &#8211; all that left is to copy the supplied JavaScript code into the <strong>&lt;head&gt;</strong> section of your website.</p>
<p>The code that&#8217;s supplied by Typekit handles all of the browser quirks to ensure your fonts are seen by as many people as possible. It calls font files that are stored on high performing servers with a claimed uptime of 100%.</p>
<p>The process probably couldn&#8217;t be simpler and the results can really help your website stand out. I&#8217;m using the system on this website so you can see the effect right now and it&#8217;s something that I could never have done using image or flash replacement techniques.</p>
<h3>Browser compatibility</h3>
<p>If you&#8217;re wondering which precise browser support this method, they are as follows:</p>
<ul>
<li>Internet Explorer: 5+</li>
<li>Firefox: 3.5+</li>
<li>Chrome: 4+</li>
<li>Safari: 3.1+</li>
<li>Opera: 10+</li>
</ul>
<p>Some browsers do behave slightly different to others, for example Firefox starts by displaying text in a standard font and then switches to your custom one once the file has downloaded, whereas Webkit browsers will wait until the font is ready before it renders anything.</p>
<p>Also remember that the user must have JavaScript enabled.</p>
<h3>My thoughts</h3>
<p>Typekit is the first service of it&#8217;s kind that I&#8217;ve tried and I&#8217;m so happy with it that I haven&#8217;t even bothered to look any further. I have to admit that I&#8217;ve always been sceptical about the use of non-standard fonts on websites because of licensing issues and overly-large download sizes; however Typekit tackles both of these concerns superbly.</p>
<p>As a developer Typekit offers me a one-stop shop to point web designers towards when they want to use a custom font. They&#8217;re offered a wide variety of quality options in Typekit&#8217;s library and I don&#8217;t have worry about sourcing (and maybe buying) whichever font they choose. If I could ask for one more Typekit feature though, it would be a downloadable PDF showing the entire library (grouped by style) that I could share with designers I deal with.</p>
<p>With tools like this, now the only thing we have to fear is bad designers abusing fonts and making websites with illegible scripts! Such websites are easily ignored though and the benefits to us professionals greatly outweigh that nuisance. If I were a teacher I&#8217;d be awarding Typekit an A+ grade.</p>
]]></content:encoded>
			<wfw:commentRss>http://edjeavons.co.uk/2010/02/beyond-web-safe-fonts-with-typekit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FirePHP: a quick start guide</title>
		<link>http://edjeavons.co.uk/2010/02/firephp-a-quick-start-guide/</link>
		<comments>http://edjeavons.co.uk/2010/02/firephp-a-quick-start-guide/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 14:43:45 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[FirePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://edjeavons.co.uk/?p=87</guid>
		<description><![CDATA[FirePHP is a useful tool that allows developers to output PHP debug messages directly into Firebug, so they&#8217;re displayed just like JavaScript console messages. This guide assumes you&#8217;re using Firefox with the Firebug extension already installed. Setting up FirePHP With Firefox open, click Tools &#62; Add-ons then search for &#8220;FirePHP&#8221; within the Get Add-ons tab [...]]]></description>
			<content:encoded><![CDATA[<p>FirePHP is a useful tool that allows developers to output PHP debug messages directly into Firebug, so they&#8217;re displayed just like JavaScript console messages.</p>
<p>This guide assumes you&#8217;re using Firefox with the Firebug extension already installed.</p>
<h2>Setting up FirePHP</h2>
<p>With Firefox open, click <em>Tools &gt; Add-ons</em> then search for &#8220;FirePHP&#8221; within the <em>Get Add-ons</em> tab and install the extension as usual.</p>
<p>Once it&#8217;s installed, and Firefox has restarted, open the Firebug window using the icon at the bottom-right of Firefox. Click on the <strong>Console</strong> and <strong>Net</strong> panels to ensure they&#8217;re both enabled. Also click on the blue FirePHP icon (near the top-left of Firebug) to make sure that&#8217;s enabled.</p>
<p>Now just make sure Firebug&#8217;s console is visible and you&#8217;re ready to start using FirePHP!</p>
<h2>Getting your scripts ready</h2>
<p>The FirePHP developers have written a library to make using their tool as easy as possible. Before you go any further download the FirePHPCore library from the <a href="http://www.firephp.org/HQ/Install.htm" target="_blank">this page</a> and copy the included &#8216;FirePHPCore&#8217; folder to somewhere that&#8217;s accessible by your website. Once you&#8217;ve done that you&#8217;re ready to include it in your PHP scripts.</p>
<p>The main thing to note about FirePHP is that it sends messages to Firebug using HTTP headers, so you cannot send anything to the browser (i.e. HTML output) until you&#8217;ve finished debugging with FirePHP. If you&#8217;ve got <em>output_buffering</em> enabled on your server this won&#8217;t be an issue but otherwise you will need to manually initiate a buffer from within your script using the <em>ob_start()</em> function.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FirePHPCore/fb.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Note: this guide assumes you are using PHP5. If you are running PHP4 please use the relevant files in FirePHPCore and refer the notes on FirePHP&#8217;s website if you run into problems.</p>
<h2>Simple debugging</h2>
<p>The simplest way to get debug messages into Firebug is by using the log method, which accepts a variable and a label as it&#8217;s respective parameters. FirePHP will automatically output it in a suitable way regardless of it&#8217;s type, even if it&#8217;s an array or an instance of an object.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">FB<span style="color: #339933;">::</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myvar</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'My variable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// the label is optional</span></pre></div></div>

<p>There are actually a few ways to call FirePHP&#8217;s methods but I find this approach the most straightforward. Don&#8217;t worry if you&#8217;re not familiar with the &#8216;FB::&#8217; operator, it&#8217;s essentially just a convenient way of access the FirePHP object on a global scope. If you&#8217;d prefer to use more traditional object notation, or procedural code, scroll down to my final notes.</p>
<h2>Specially formatted output</h2>
<p>You&#8217;ll probably find that the <em>log()</em> method accounts for 90% of your FirePHP usage but sometimes it&#8217;s helpful to format a message depending on it&#8217;s context, like if you want to highlight a genuine error. The following output types are available.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">FB<span style="color: #339933;">::</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Typical debug message'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
FB<span style="color: #339933;">::</span><span style="color: #004000;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Information message'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
FB<span style="color: #339933;">::</span><span style="color: #004000;">warn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Script warning'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
FB<span style="color: #339933;">::</span><span style="color: #004000;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Critical error'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p style="text-align: center;"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:522px;" class="aligncenter"><img class=" size-full wp-image-224 shadow_curl colorbox-87" style="border: 1px solid #C0C0C0;; padding:0 !important; margin:0 !important; max-width:100% !important;" title="FirePHP console output" src="http://edjeavons.co.uk/wp-content/uploads/2010/02/firephp-messages.jpg" alt="" width="520" height="209" /><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-87" style="margin:0 !important;height:10px;width:100%;"></div></p>
<p>FirePHP can also output tables which, amongst other things, can come in useful for debugging database work. Here&#8217;s an example of a simple table sent to Firebug but it could just as easily have been created from some database results.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$table</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$table</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'First name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Surname'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$table</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'James'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Smith'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$table</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Robert'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Johnson'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$table</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Mary'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Williams'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$table</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Linda'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Jones'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
FB<span style="color: #339933;">::</span><span style="color: #004000;">table</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Names'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$table</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p style="text-align: center;"><div style="overflow:hidden;display:table;line-height:0;text-align:center;width:522px;" class="aligncenter"><img class=" size-full wp-image-225 shadow_curl colorbox-87" style="border: 1px solid #C0C0C0;; padding:0 !important; margin:0 !important; max-width:100% !important;" title="FirePHP table display" src="http://edjeavons.co.uk/wp-content/uploads/2010/02/firephp-table.jpg" alt="" width="520" height="209" /><br/><img src="http://edjeavons.co.uk/wp-content/plugins/shadows/shadow_curl.png" class="shadow_img colorbox-87" style="margin:0 !important;height:10px;width:100%;"></div></p>
<p>It&#8217;s all very simple isn&#8217;t it!</p>
<h2>Final notes</h2>
<p>Debug information should never be visible on a live website so FirePHP makes to very simple to turn it&#8217;s output on and off. <strong>It&#8217;s important that you use this functionality as soon as you&#8217;ve finished debugging.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">FB<span style="color: #339933;">::</span><span style="color: #004000;">setEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you&#8217;re not comfortable using the &#8216;FB::&#8217; operator there are other ways of accessing FirePHP&#8217;s functionality. Very briefly these are as follows:</p>
<h3>Basic object oriented calls</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FirePHPCore/FirePHP.class.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firephp</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> FirePHP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firephp</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>log<span style="color: #009900;">&#40;</span><span style="color: #000088;">$myvar</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'My variable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Procedural calls</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FirePHPCore/fb.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
fb<span style="color: #009900;">&#40;</span><span style="color: #000088;">$myvar</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'My variable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
fb<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Query results'</span><span style="color: #339933;">,</span> FirePHP<span style="color: #339933;">::</span><span style="color: #004000;">TABLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That&#8217;s all there is to using FirePHP. It&#8217;s so easy to get up and running, and even easier to use within your code so I hope you&#8217;ll give it a go. For me it&#8217;s made development so much easier because I no longer rely on inline debug messages that mess up page layouts.</p>
]]></content:encoded>
			<wfw:commentRss>http://edjeavons.co.uk/2010/02/firephp-a-quick-start-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting your environment using server variables</title>
		<link>http://edjeavons.co.uk/2010/02/detecting-your-environment-using-server-variables/</link>
		<comments>http://edjeavons.co.uk/2010/02/detecting-your-environment-using-server-variables/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 21:54:34 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://edjeavons.co.uk/?p=85</guid>
		<description><![CDATA[This article explains how you can use server variables to run websites on multiple servers without having to manually reconfigure key settings. Like many web developers I use a single configuration file to define key website constants (file paths, database login etc.) and that file is included at the top of every page. Many of [...]]]></description>
			<content:encoded><![CDATA[<p>This article explains how you can use server variables to run websites on multiple servers without having to manually reconfigure key settings.</p>
<p>Like many web developers I use a single configuration file to define key website constants (file paths, database login etc.) and that file is included at the top of every page. Many of the constants can be sensitive to the working environment through so I may need one configuration for local development work and another when the website is uploaded to the live server.</p>
<p>If you’ve only ever done very basic server-side scripting you may be wondering why some settings need to vary. To show you the kind of things I’m taking about here’s an example of the first few lines of a typical configuration file in one of my websites.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$environment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'live'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$environment</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'live'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HTTPPATH'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ROOTPATH'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/home/sitedir/html/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'live_dbname'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'live_dbuser'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_PASS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'live_dbpass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HTTPPATH'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/sitedir/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ROOTPATH'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/home/ed/public_html/sitedir/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'dev_dbname'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'dev_dbuser'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_PASS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'dev_dbpass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>So that snippet of code shows an if-statement which loads the relevant website settings depending on the value of <strong>$environment</strong>. There are a few ways to switch between different configurations.</p>
<h3>Method 1: Manually set the correct configuration values</h3>
<p>The most obvious way of switching configurations this is to manually change<strong> $environment</strong> whenever you upload the configuration file to the server. This is just something else to remember while editing your site though and is easily overlooked when you do a bulk upload to the server. It would be far better to automate the procedure.</p>
<h3>Method 2: Rudimentary environment detection</h3>
<p>Why bother manually updating the <strong>$environment</strong> when PHP can do it automatically? To do that we need a method of detecting where the site is running and that&#8217;s where the predefined<strong> $_SERVER</strong> array comes in.</p>
<p>You&#8217;re probably already familiar with <strong>$_SERVER</strong> but if not, all you need to know is that it&#8217;s an associative array containing information passed to PHP from the server itself. In the context of this article it contains useful information about the server address and script paths, for example here&#8217;s a few elements from a typical <strong>$_SERVER</strong> array.<br />

<table id="wp-table-reloaded-id-1-no-1" class="wp-table-reloaded wp-table-reloaded-id-1">
<thead>
	<tr class="row-1 odd">
		<th class="column-1">Key</th><th class="column-2">Value</th>
	</tr>
</thead>
<tbody>
	<tr class="row-2 even">
		<td class="column-1">HTTP_HOST</td><td class="column-2">localhost</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1">SERVER_NAME</td><td class="column-2">localhost</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1">SERVER_ADDR</td><td class="column-2">::1</td>
	</tr>
	<tr class="row-5 odd">
		<td class="column-1">SERVER_PORT</td><td class="column-2">80</td>
	</tr>
	<tr class="row-6 even">
		<td class="column-1">REMOTE_ADDR</td><td class="column-2">::1</td>
	</tr>
	<tr class="row-7 odd">
		<td class="column-1">DOCUMENT_ROOT</td><td class="column-2">/Users/ed/Sites</td>
	</tr>
	<tr class="row-8 even">
		<td class="column-1">SCRIPT_FILENAME</td><td class="column-2">/Users/ed/Sites/index.php</td>
	</tr>
</tbody>
</table>
<br />
We can compare one or more of those array elements to a predictable value in order to deduce the website&#8217;s current location. For example if I know the development version of my website is always run from the HTTP location of &#8216;localhost&#8217; I could define <strong>$environment</strong> as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SERVER_NAME'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$environment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'dev'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$environment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'live'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Now it doesn&#8217;t matter whether this file is running on my local development server or on the live server, it will automatically define the correct constants without me having to manually alter it every time it&#8217;s moved from one location to another.</p>
<h3>Method 3: Environment detection using server variables</h3>
<p>Using the default data provided in <strong>$_SERVER</strong> isn&#8217;t always ideal though because if the environment you&#8217;re testing against ever changes the website may fail. Also it can become a bit of pain writing unique new conditions for every website you develop &#8211; wouldn&#8217;t it be good if there were consistent values within <strong>$_SERVER</strong> that we could rely for a given server regardless of the website that&#8217;s being loaded?</p>
<p>As a real world example I am currently developing a single piece of code that will drive multiple websites, each with their own domain and living within their own directory on the server. It&#8217;s further complicated because the code must run on a live server, my office PC and my laptop (the latter two being development environments).</p>
<p>The tidiest way I&#8217;ve found to solve this problem is to set my own server variables, which is actually really simple.</p>
<p>When I configure a server now, I put the following code into the main Apache configuration but it could also be added to a specific site&#8217;s vhost file, or even a .htaccess file (assuming that it&#8217;s not synchronised with the development version).</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">SetEnv</span> ENVIRONMENT devbox</pre></div></div>

<p>Now in my configuration file I can check this value just as if it was any other server variable.</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" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// select active environment</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ENVIRONMENT'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'devbox'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$environment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'devbox'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ENVIRONMENT'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'laptop'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$environment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'laptop'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$environment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'live'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>To make life a little easier you may find that you don&#8217;t even need to add this server variable to your live server. In most cases just having it defined on the development server(s) will be sufficient.</p>
<p>You may be able to think of other uses for these custom server variables but I think these is amongst the most useful of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://edjeavons.co.uk/2010/02/detecting-your-environment-using-server-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

