<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Boulder Information Services</title>
	<atom:link href="http://boulderinformationservices.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://boulderinformationservices.wordpress.com</link>
	<description>Web application programming, indexing</description>
	<lastBuildDate>Thu, 23 Feb 2012 02:11:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='boulderinformationservices.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Boulder Information Services</title>
		<link>http://boulderinformationservices.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://boulderinformationservices.wordpress.com/osd.xml" title="Boulder Information Services" />
	<atom:link rel='hub' href='http://boulderinformationservices.wordpress.com/?pushpress=hub'/>
		<item>
		<title>A CodeIgniter view does not run in the global scope</title>
		<link>http://boulderinformationservices.wordpress.com/2012/02/11/110/</link>
		<comments>http://boulderinformationservices.wordpress.com/2012/02/11/110/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 20:46:34 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Web programming]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[CodeIgniter View]]></category>
		<category><![CDATA[global]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[scope]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=110</guid>
		<description><![CDATA[In a regular PHP file, you can grab the value of a variable from the global scope using the keyword GLOBAL. So for example if you want to use a variable inside your function, you can do something like this&#8230; &#8230; <a href="http://boulderinformationservices.wordpress.com/2012/02/11/110/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=110&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In a regular PHP file, you can grab the value of a variable from the global scope using the keyword GLOBAL. So for example if you want to use a variable inside your function, you can do something like this&#8230;</p>
<pre>&lt;?php
$TODAY = date('Y-m-d');
function getEvents()
{
    GLOBAL $TODAY;
    if ($TODAY &gt; '2012-02-14')
    {
        //...
    }    
}
?&gt;</pre>
<p>I&#8217;m not saying you SHOULD write code this way, but there are times when this sort of option is cleaner than passing another parameter to your function, or faster than rewriting the existing code.</p>
<p>I tried to do this in a CodeIgniter view, which looks and behaves very much like a regular PHP file. But it wasn&#8217;t working. My variables (such as $TODAY, above) weren&#8217;t available inside my function, even after I used the GLOBAL keyword to grab them from the outer scope.</p>
<p>My mistake was thinking &#8220;&#8230; from the outer scope.&#8221; GLOBAL doesn&#8217;t pull variables from &#8220;outer&#8221; scopes, it only pulls variables from the top-level, global scope.</p>
<p>As it turns out, a CodeIgniter view doesn&#8217;t run in the global scope. It gets swallowed by the CodeIgniter engine. It is evaluated and run from within a CodeIgniter scope, which in turn runs within the global scope. (I haven&#8217;t actually traced how many layers there are between a view and the global scope &#8212; there could be more.)</p>
<p>The only option in this case is to pass the variable to the function as a parameter.</p>
<p>The scope of a CodeIgniter view file is not obvious, nor could I find it mentioned in the documentation. Hopefully this post will save someone else the trouble of tracing why the GLOBAL keyword doesn&#8217;t seem to be working in CodeIgniter.</p>
<p>And if you have dug even deeper than me and can draw a scope diagram for CodeIgniter, let me know!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=110&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2012/02/11/110/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>
	</item>
		<item>
		<title>A sensible naming scheme for backup files</title>
		<link>http://boulderinformationservices.wordpress.com/2012/02/02/a-sensible-naming-scheme-for-backup-files/</link>
		<comments>http://boulderinformationservices.wordpress.com/2012/02/02/a-sensible-naming-scheme-for-backup-files/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 02:19:45 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=107</guid>
		<description><![CDATA[It&#8217;s important to back up a database regularly. But how do balance being thorough with being reasonable? If you save a full backup, every day, indefinitely, you will need more and more storage space. And really, do you care if &#8230; <a href="http://boulderinformationservices.wordpress.com/2012/02/02/a-sensible-naming-scheme-for-backup-files/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=107&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s important to back up a database regularly. But how do balance being thorough with being reasonable? If you save a full backup, every day, indefinitely, you will need more and more storage space. And really, do you care if you have to go back to the Tuesday backup from a year and a half ago, rather than the Thursday backup? No.</p>
<p>What you want is a lot of recent backups, and a few older backups, saved regularly.</p>
<p>My strategy is this:</p>
<ol>
<li>Make a backup every day</li>
<li>Make a copy.</li>
<li>Give the two copies the following names: &#8220;Wednesday.sql&#8221; and &#8220;February.sql&#8221; (or whatever the current day and month are). Always overwrite any file with the same name.</li>
</ol>
<p><a href="http://boulderinformationservices.files.wordpress.com/2012/02/backup_naming_scheme.png"><img class="alignleft size-medium wp-image-108" title="backup_naming_scheme" src="http://boulderinformationservices.files.wordpress.com/2012/02/backup_naming_scheme.png?w=191&#038;h=300" alt="" width="191" height="300" /></a>What results is a manageable list of only 19 backup files. I have 7 backups that are less than a week old, and I have a backup every month going back one year.</p>
<p>So far, the only backup I&#8217;ve ever needed was the most recent one. But I feel good that I&#8217;m making backups and keeping some history, without bloating my server with near-duplicates of files I will never read.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=107&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2012/02/02/a-sensible-naming-scheme-for-backup-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>

		<media:content url="http://boulderinformationservices.files.wordpress.com/2012/02/backup_naming_scheme.png?w=191" medium="image">
			<media:title type="html">backup_naming_scheme</media:title>
		</media:content>
	</item>
		<item>
		<title>UTF-8 not working? Look for htmlentities.</title>
		<link>http://boulderinformationservices.wordpress.com/2011/12/31/utf-8-not-working-look-for-htmlentities/</link>
		<comments>http://boulderinformationservices.wordpress.com/2011/12/31/utf-8-not-working-look-for-htmlentities/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 17:17:17 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Character encoding]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Web programming]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=102</guid>
		<description><![CDATA[I converted all my sites to UTF-8 and it was relatively painless. However, on one of my sites, I kept seeing legal UTF-8 characters turning into gibberish. It happened after entering UTF-8, submitting a form and then redisplaying the values &#8230; <a href="http://boulderinformationservices.wordpress.com/2011/12/31/utf-8-not-working-look-for-htmlentities/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=102&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I converted all my sites to UTF-8 and it was relatively painless. However, on one of my sites, I kept seeing legal UTF-8 characters turning into gibberish. It happened after entering UTF-8, submitting a form and then redisplaying the values in an edit box.</p>
<p><a href="http://boulderinformationservices.files.wordpress.com/2011/12/utf8-before.png"><img class="alignnone size-medium wp-image-103" title="utf8-before" src="http://boulderinformationservices.files.wordpress.com/2011/12/utf8-before.png?w=300&#038;h=66" alt="" width="300" height="66" /></a></p>
<p><a href="http://boulderinformationservices.files.wordpress.com/2011/12/utf8.png"><img class="alignnone size-medium wp-image-104" title="utf8" src="http://boulderinformationservices.files.wordpress.com/2011/12/utf8.png?w=300&#038;h=69" alt="" width="300" height="69" /></a></p>
<p>I know that all my pages are using UTF-8, and also that my database stores the text as UTF-8.</p>
<p>The thing that I overlooked is that, because I&#8217;m writing text to an input box, I&#8217;m using PHP&#8217;s htmlentities function to handle special characters, and the default character set used by that function is ISO-8859-1. I had to change my PHP command from</p>
<pre>echo htmlentities($field);</pre>
<p>to</p>
<pre>echo htmlentities($field, ENT_COMPAT, 'UTF-8');</pre>
<p>Once I verified that worked, I searched my whole codebase for htmlentities and made sure they were all using &#8216;UTF-8&#8242;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=102&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2011/12/31/utf-8-not-working-look-for-htmlentities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>

		<media:content url="http://boulderinformationservices.files.wordpress.com/2011/12/utf8-before.png?w=300" medium="image">
			<media:title type="html">utf8-before</media:title>
		</media:content>

		<media:content url="http://boulderinformationservices.files.wordpress.com/2011/12/utf8.png?w=300" medium="image">
			<media:title type="html">utf8</media:title>
		</media:content>
	</item>
		<item>
		<title>HTML5 Application Cache always caches your home page</title>
		<link>http://boulderinformationservices.wordpress.com/2011/09/02/html5-application-cache-always-caches-your-home-page/</link>
		<comments>http://boulderinformationservices.wordpress.com/2011/09/02/html5-application-cache-always-caches-your-home-page/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 17:36:02 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=98</guid>
		<description><![CDATA[I built a mobile site for a client. One of the neat features is the ability to customize a secondary view of the home page. When I went to add a cache manifest to the site (so that images, styles, &#8230; <a href="http://boulderinformationservices.wordpress.com/2011/09/02/html5-application-cache-always-caches-your-home-page/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=98&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I built a mobile site for a client. One of the neat features is the ability to customize a secondary view of the home page.</p>
<p>When I went to add a cache manifest to the site (so that images, styles, and static pages could be viewed offline) I found that the application cache wouldn&#8217;t let go of the stored home page with its custom view, in spite of my having listed it in the online whitelist section of my cache manifest.</p>
<p>I think that this comment from <a href="http://www.w3.org/TR/html5/offline.html">the spec</a> describes it:</p>
<blockquote><p>&#8220;&#8230; in practice the page that referenced the manifest is automatically cached.&#8221;</p></blockquote>
<p>It doesn&#8217;t explain <em>why</em> that is the case, but apparently it is. That tells me two things:</p>
<ol>
<li>Any customizations to the home page should be handled via AJAX, or better yet, be handled on a page <em>other than</em> the home page, and</li>
<li>The manifest attribute of the HTML tag should probably only be included on the home page (or any other likely landing pages) &#8212; and not on every page of the site, as I had built it originally.</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=98&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2011/09/02/html5-application-cache-always-caches-your-home-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>
	</item>
		<item>
		<title>Print Avery labels using CSS and HTML</title>
		<link>http://boulderinformationservices.wordpress.com/2011/08/25/print-avery-labels-using-css-and-html/</link>
		<comments>http://boulderinformationservices.wordpress.com/2011/08/25/print-avery-labels-using-css-and-html/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 03:42:09 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=84</guid>
		<description><![CDATA[A client for whom I provide web services asked me if I could help her print barcode labels from their data. Now, I&#8217;ve created Avery labels using Office, Illustrator, even Photoshop &#8212; but never using web technologies. You just don&#8217;t &#8230; <a href="http://boulderinformationservices.wordpress.com/2011/08/25/print-avery-labels-using-css-and-html/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=84&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A client for whom I provide web services asked me if I could help her print barcode labels from their data.</p>
<p>Now, I&#8217;ve created Avery labels using Office, Illustrator, even Photoshop &#8212; but never using web technologies. You just don&#8217;t have a lot of control printing from your browser using CSS.</p>
<p>Or do you&#8230;? After all, we&#8217;ve always been able to specify real-world measurements such as &#8220;in&#8221; and &#8220;cm&#8221; using CSS.</p>
<p>I bought Avery 5160 labels because they seemed big enough to allow me to be a little sloppy while still providing many stickers per page.</p>
<p>A quick test proved that I could specify the page margins, label sizes, and gutter widths in inches. And both Firefox and IE allowed me to set the print margins to 0, leaving control of the layout to my CSS. Here&#8217;s what the print preview looks like from Firefox:</p>
<p><a href="http://boulderinformationservices.files.wordpress.com/2011/08/labels_print_preview.png"><img class="alignnone size-medium wp-image-85" title="labels_print_preview" src="http://boulderinformationservices.files.wordpress.com/2011/08/labels_print_preview.png?w=300&#038;h=243" alt="" width="300" height="243" /></a></p>
<p>It&#8217;s not perfect, but it&#8217;s good enough.</p>
<p>Printing multiple pages turned out to be trickier. First, to prevent pages from breaking halfway across my labels, I inserted an empty div with the style rule &#8220;page-break-after&#8221; set to &#8220;always&#8221;.</p>
<p>Also, I had used the HTML body to set the margins. But the top of &#8220;page 2&#8243; doesn&#8217;t know anything about the HTML body&#8217;s top margin. There is some documentation on &#8220;paged media&#8221; but it felt like uncharted territory. Rather than fight it, I decided to let the browser &#8212; rather than the CSS &#8212; set the top margin. I had to convey that in some friendly instructions on my client&#8217;s launch page:</p>
<blockquote><p>Before printing labels, use your browser&#8217;s print preview options to set the top print margin to 1/2 inch and all other print margins to 0 (zero).</p>
<p>Try printing a test page on plain paper first. Hold it up to the light behind a sheet of labels to make sure the bar codes line up with the stickers.</p></blockquote>
<p>It worked great in Firefox and Internet Explorer &#8212; good enough for my client.</p>
<p>Once the concept was proven, I built a controller page that lets my client print a test sheet, blocks of real data, individual data points, and even &#8220;blank&#8221; labels to push the data past previously peeled stickers so that nothing is wasted.</p>
<p>Here&#8217;s a one-page example of the HTML and CSS used to create Avery 5160 labels. (HTML corrected thanks to Halty.)</p>
<pre>&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;HTML &amp; CSS Avery Labels (5160) by MM at Boulder Information Services&lt;/title&gt;
    &lt;link href="labels.css" rel="stylesheet" type="text/css" &gt;
    &lt;style&gt;
    body {
        width: 8.5in;
        margin: 0in .1875in;
        }
    .label{
        /* Avery 5160 labels -- CSS and HTML by MM at Boulder Information Services */
        width: 2.025in; /* plus .6 inches from padding */
        height: .875in; /* plus .125 inches from padding */
        padding: .125in .3in 0;
        margin-right: .125in; /* the gutter */

        float: left;

        text-align: center;
        overflow: hidden;

        outline: 1px dotted; /* outline doesn't occupy space like border does */
        }
    .page-break  {
        clear: left;
        display:block;
        page-break-after:always;
        }
    &lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div class="label"&gt;&lt;img src="http://boulderinformationservices.files.wordpress.com/2011/08/barcode_sample.png" /&gt;&lt;br&gt;Human readable&lt;/div&gt;
&lt;div class="label"&gt;&lt;img src="http://boulderinformationservices.files.wordpress.com/2011/08/barcode_sample.png" /&gt;&lt;br&gt;Human readable&lt;/div&gt;
&lt;div class="label"&gt;&lt;img src="http://boulderinformationservices.files.wordpress.com/2011/08/barcode_sample.png" /&gt;&lt;br&gt;Human readable&lt;/div&gt;
&lt;div class="label"&gt;&lt;img src="http://boulderinformationservices.files.wordpress.com/2011/08/barcode_sample.png" /&gt;&lt;br&gt;Human readable&lt;/div&gt;
&lt;div class="label"&gt;(Repeat 30 times)&lt;/div&gt;
&lt;div class="page-break"&gt;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/84/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=84&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2011/08/25/print-avery-labels-using-css-and-html/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>

		<media:content url="http://boulderinformationservices.files.wordpress.com/2011/08/labels_print_preview.png?w=300" medium="image">
			<media:title type="html">labels_print_preview</media:title>
		</media:content>
	</item>
		<item>
		<title>A visual checksum for your PHP output</title>
		<link>http://boulderinformationservices.wordpress.com/2011/06/07/a-visual-checksum-for-your-php-output/</link>
		<comments>http://boulderinformationservices.wordpress.com/2011/06/07/a-visual-checksum-for-your-php-output/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 00:09:28 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[Web programming]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=80</guid>
		<description><![CDATA[Refactoring the code on my billing system, I was promoting a method to its parent object. If I did it right, the output from the code wouldn&#8217;t be any different before and after the refactor. Unfortunately, the output page was &#8230; <a href="http://boulderinformationservices.wordpress.com/2011/06/07/a-visual-checksum-for-your-php-output/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=80&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Refactoring the code on my billing system, I was promoting a method to its parent object. If I did it right, the output from the code wouldn&#8217;t be any different before and after the refactor.</p>
<p>Unfortunately, the output page was a large table of numbers, and it was difficult to detect a small change at a glance. If only there were some way to have the page spit out a checksum, I could quickly tell whether the refactor resulted in identical output.</p>
<p>SHA-1 is an encryption algorithm. It takes a string of any length as an input and returns a string of 20 hexadecimal characters. It&#8217;s easy to reduce a big HTML table full of numbers to a small string.</p>
<p>It was still a little difficult to tell the difference between, for example, the next two lines</p>
<pre>a847a906c9955734217c348eaa5b3b38abab0bdf
15b8fdd026c607e0b51b2d5e51103a77bf103354</pre>
<p>So I decided to take advantage of the fact that here was a nice long string of hex decimals. I grabbed the first 6 and the last 6 digits to create a colored box with a colored border. Now I could quickly glance at a big blob of color and tell whether anything had changed.</p>
<p>This difference is much easier to see:</p>
<pre><span style="background-color:#15b8fd;border:4px solid #103354;">15b8fdd026c607e0b51b2d5e51103a77bf103354</span>
<span style="background-color:#a847a9;border:4px solid #ab0bdf;">a847a906c9955734217c348eaa5b3b38abab0bdf</span></pre>
<p>Here is the PHP function:</p>
<pre>function getVisualChecksum($out)
{
 // from boulderinformationservices.wordpress.com
 $checksum = sha1($out);
 $checksumColor1 = substr($checksum, 0, 6);
 $checksumColor2 = substr($checksum, -6, 6);
 return sprintf(
  '&lt;span style="background-color: #%s; border: 4px solid #%s"&gt;%s&lt;/span&gt;',
  $checksumColor1,
  $checksumColor2,
  $checksum
 );
}</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=80&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2011/06/07/a-visual-checksum-for-your-php-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>
	</item>
		<item>
		<title>Share Eclipse snippets among workspaces, or even different computers</title>
		<link>http://boulderinformationservices.wordpress.com/2011/05/13/share-eclipse-snippets-among-workspaces-or-even-different-computers/</link>
		<comments>http://boulderinformationservices.wordpress.com/2011/05/13/share-eclipse-snippets-among-workspaces-or-even-different-computers/#comments</comments>
		<pubDate>Fri, 13 May 2011 22:39:06 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=76</guid>
		<description><![CDATA[I use Eclipse as my editor of choice. I also use multiple Workspaces (see File &#62; Switch Workspace). I also use Snippets for common code templates. I created some useful snippets in one workspace that I wanted to be able &#8230; <a href="http://boulderinformationservices.wordpress.com/2011/05/13/share-eclipse-snippets-among-workspaces-or-even-different-computers/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=76&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I use Eclipse as my editor of choice. I also use multiple Workspaces (see File &gt; Switch Workspace). I also use Snippets for common code templates.</p>
<p>I created some useful snippets in one workspace that I wanted to be able to use in another. Eclipse doesn&#8217;t provide an easy way to share snippets across workspaces. Using Eclipse, you would have to copy the snippet, switch workspaces (which requires restarting the program), and then paste it&#8230; for each snippet you want to reuse. And that&#8217;s awful.</p>
<h2>Phase 1: Copy the XML nodes</h2>
<p>One way to copy a bunch of snippets across workspaces is to merge the various snippet XML files into a master file. Your snippets are stored in</p>
<pre>C:\Users\YOURNAME\AppData\Roaming\Eclipse\workspace-YOUR_WS_NAME\.metadata\.plugins\org.eclipse.wst.common.snippets\user.xml</pre>
<p>I was able to use <a href="http://winmerge.org/" target="_blank">WinMerge</a> to compare my new snippets file with my older one. It was easy to use WinMerge&#8217;s Copy Left command to push just the new lines into my older file, and then save the merged master. Restarting Eclipse with the new master file confirmed that I successfully copied the snippets.</p>
<p>But wait a minute&#8230;. My snippets files are in sync, but there is nothing to prevent them from drifting out of sync again.</p>
<p>Hard links to the rescue.</p>
<h2>Phase 2: Make a hard link</h2>
<p>A hard link is a pointer. It looks like a file, but it doesn&#8217;t have any contents, it has a reference to another file, somewhere else on the file system. I can create a hard link called &#8220;user.xml&#8221; in each of my workspaces that points to a single, XML master file.</p>
<p>I saved my merged master XML file to a location outside of the Eclipse folder tree. Then I backed up my individual user.xml files by renaming them. Then I created the hard links.</p>
<p>To create a hard link,</p>
<ol>
<li>Open a command prompt.  You may have to open the command prompt as an administrator (on Windows 7, right-click the link to command prompt and choose &#8220;Run as administrator&#8221;).</li>
<li>Change directories into your workspace/(etc.)/org.eclipse.wst.common.snippets/ folder.</li>
<li>Make the link like so:</li>
</ol>
<pre>mklink /H user.xml "C:\path\to\your\master\user.xml"</pre>
<p>&#8230; and repeat steps 2 and 3 for each of your workspaces. Easy!</p>
<p>To carry the idea a step further, I decided to put my real master XML file in a folder that is shared via LiveMesh (you could do the same thing with Dropbox or a network drive). That way, I can sync my snippets between my laptop and my desktop computer.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=76&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2011/05/13/share-eclipse-snippets-among-workspaces-or-even-different-computers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>
	</item>
		<item>
		<title>CSS bug in IE8 (yes, 8) with generated content and z-index</title>
		<link>http://boulderinformationservices.wordpress.com/2011/04/22/72/</link>
		<comments>http://boulderinformationservices.wordpress.com/2011/04/22/72/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 23:16:57 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=72</guid>
		<description><![CDATA[I came up with a nice way to use the CSS selector &#8220;:after&#8221; for image replacement (more later perhaps). It works great in modern browsers from Firefox, Safari, and Opera&#8230; but not IE8. (Wasn&#8217;t IE8 supposed to fix all those &#8230; <a href="http://boulderinformationservices.wordpress.com/2011/04/22/72/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=72&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I came up with a nice way to use the CSS selector &#8220;:after&#8221; for image replacement (more later perhaps). It works great in modern browsers from Firefox, Safari, and Opera&#8230; but not IE8. (Wasn&#8217;t IE8 supposed to fix all those CSS bugs?)</p>
<p>I found confirmation on <a href="http://nicolasgallagher.com/css-typography-experiment/demo/bugs.html">Nicolas Gallagher&#8217;s site</a> that, indeed, IE8 fails to position the z-index of generated content correctly.</p>
<p>Time to look for a selector hack for IE8&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=72&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2011/04/22/72/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>
	</item>
		<item>
		<title>Converting to UTF-8</title>
		<link>http://boulderinformationservices.wordpress.com/2011/04/10/converting-to-utf-8/</link>
		<comments>http://boulderinformationservices.wordpress.com/2011/04/10/converting-to-utf-8/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 17:21:42 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Web programming]]></category>
		<category><![CDATA[Webmastering]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=69</guid>
		<description><![CDATA[Shamed and inspired by Joel Spolsky&#8217;s decade-old article on character encoding, and warned by another blog post (which I can&#8217;t find) that described a three-day ordeal fighting the issue, I cleared some time and sat down to make sure all &#8230; <a href="http://boulderinformationservices.wordpress.com/2011/04/10/converting-to-utf-8/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=69&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://boulderinformationservices.files.wordpress.com/2011/04/utf8-fail.png"><img class="alignleft size-full wp-image-70" title="utf8-fail" src="http://boulderinformationservices.files.wordpress.com/2011/04/utf8-fail.png?w=640" alt=""   /></a>Shamed and inspired by Joel Spolsky&#8217;s decade-old <a href="http://www.joelonsoftware.com/articles/Unicode.html" target="_blank">article on character encoding</a>, and warned by another blog post (which I can&#8217;t find) that described a three-day ordeal fighting the issue, I cleared some time and sat down to make sure all the pages on my site were using UTF-8, start to finish.</p>
<p>It wasn&#8217;t nearly as bad as I thought it would be. In fact, it probably took one or two hours. Here is what I did:</p>
<ul>
<li>For MySQL: make a backup, edit the backup file, replacing &#8220;latin1&#8243; with &#8220;utf8,&#8221; restore</li>
<li>For Browsers: add the utf-8 header (below) in my head tag. Luckily, all of my pages use the same template for drawing headers, so this was only a single change for the web site, and a single change for my admin pages.
<pre>&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;</pre>
</li>
<li>For static text: Change my code editor (Eclipse) to use UTF-8, and re-save some files that had hard-coded em-dashes. (I should have used HTML entities for those anyway.) The setting is under Window &gt; Preferences &gt; General &gt;  Workspace &gt; Text file encoding</li>
<li>For PHP/MySQL: this was the least obvious change. You have to specify the character set for the connection between PHP and MySQL. If you have a newer version of PHP (&gt;= 5.2.3), you can use mysql_set_charset. Otherwise, you need to send a SQL command directly:
<pre>// for PHP &gt;= 5.2.3
mysql_set_charset('utf8',$cn);

// for older versions (see also <a href="http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html" target="_blank">MySQL documentation for SET NAMES</a>):
mysql_query('SET NAMES "utf8"');</pre>
</li>
</ul>
<p>I don&#8217;t believe how easy it was – and I mean that. I expect to get burned somewhere along the way. But for now, it looks good and was pretty painless.</p>
<p>Since then I have found broken special characters here and there, but I&#8217;ve been able to find them and fix them as I go. Let&#8217;s hear it for incremental improvements!</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=69&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2011/04/10/converting-to-utf-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>

		<media:content url="http://boulderinformationservices.files.wordpress.com/2011/04/utf8-fail.png" medium="image">
			<media:title type="html">utf8-fail</media:title>
		</media:content>
	</item>
		<item>
		<title>Aw, Phoocs! That is to say&#8230; PHP + OOCSS</title>
		<link>http://boulderinformationservices.wordpress.com/2011/02/24/aw-phoocs-that-is-to-say-php-oocss/</link>
		<comments>http://boulderinformationservices.wordpress.com/2011/02/24/aw-phoocs-that-is-to-say-php-oocss/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 21:36:59 +0000</pubDate>
		<dc:creator>Martin Mapes</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://boulderinformationservices.wordpress.com/?p=66</guid>
		<description><![CDATA[When I first heard about OOCSS, I was skeptical. Here was another expert developer with her own pet system for building pages – didn&#8217;t we all have something like that in our snippet library? Plus, the &#8220;OO&#8221; component of OOCSS &#8230; <a href="http://boulderinformationservices.wordpress.com/2011/02/24/aw-phoocs-that-is-to-say-php-oocss/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=66&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When I first heard about <a href="http://oocss.org/">OOCSS</a>, I was skeptical. Here was another expert developer with her own pet system for building pages – didn&#8217;t we all have something like that in our snippet library?</p>
<p>Plus, the &#8220;OO&#8221; component of OOCSS seems like kind of a stretched metaphor. It&#8217;s not truly object-oriented in the way that many programming languages are.</p>
<p>Plus, if you buy into OOCSS, you don&#8217;t get control of <a title="Google search for HTML source order" href="http://www.google.com/search?q=html+source+order">source-code order</a>, which I thought was very important.</p>
<p>Nevertheless, I was tired of writing HTML by hand, and if <a href="http://www.stubbornella.org/content/">Nicole Sullivan</a> had a streamlined way to build one-, two-, and three-column layouts, with modules that magically worked, I was willing to listen. And the more I worked with OOCSS – particularly the templates and the modules – the more I was hooked.</p>
<p>It&#8217;s been about 2 years and I&#8217;ve never looked back. I always use OOCSS for new projects. Why <em>not</em> use a system that has been lovingly crafted, tested in the real world, and that works so cleanly?</p>
<p>Over the years I built wrappers in PHP for some of the sometimes-complex HTML structures required by OOCSS. After explaining to a friend why he should use OOCSS (and my PHP libraries that support it), I decided to make my libraries into an open-source project called <a href="http://phoocs.com/">Phoocs</a>. That&#8217;s <a href="http://phpoocss.com/">PHP + OOCSS</a>, shortened into something relatively pronounceable&#8230; &#8220;fooks!&#8221; &#8230; sounds a little swear-y, but it won&#8217;t make you swear, I promise. If you&#8217;re interested in using it, find the <a title="Phoocs (PHP + OOCSS) on github" href="https://github.com/mmapes/PHOOCS">source code on github</a>.</p>
<p>I hope you find the library easy and useful. By all means submit suggestions, improvements, or even kudos to the project or to me here at this blog.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boulderinformationservices.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boulderinformationservices.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boulderinformationservices.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boulderinformationservices.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boulderinformationservices.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boulderinformationservices.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boulderinformationservices.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boulderinformationservices.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boulderinformationservices.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boulderinformationservices.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boulderinformationservices.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boulderinformationservices.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boulderinformationservices.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boulderinformationservices.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boulderinformationservices.wordpress.com&amp;blog=15578682&amp;post=66&amp;subd=boulderinformationservices&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boulderinformationservices.wordpress.com/2011/02/24/aw-phoocs-that-is-to-say-php-oocss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/46e9bb8e12615bdcbf79ca9b0741d0a8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">boulderinformationservices</media:title>
		</media:content>
	</item>
	</channel>
</rss>
