<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>bradt.ca</title>
	
	<link>http://bradt.ca</link>
	<description>I'm a freelance web developer, web designer, and entrepreneur living in Halifax, Canada.</description>
	<lastBuildDate>Mon, 15 Mar 2010 22:12:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/bradtca/posts" /><feedburner:info uri="bradtca/posts" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Portfolio: A Place of Mind</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/1QqZJbSzcpE/</link>
		<comments>http://bradt.ca/archives/a-place-of-mind/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 10:02:16 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[Wordpress Theme]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1883</guid>
		<description><![CDATA[A Place of Mind is a web site created for the University of British Columbia to aggregate their content from a variety of online sources like YouTube, Flickr, Twitter, and blogs. The site is configured to pull feeds from these sources and import specially tagged posts. The impressive creative work was produced by Fjord Interactive, who delivered [...]]]></description>
			<content:encoded><![CDATA[<p>A Place of Mind is a web site created for the University of British Columbia to aggregate their content from a variety of online sources like YouTube, Flickr, Twitter, and blogs. The site is configured to pull feeds from these sources and import specially tagged posts. The impressive creative work was produced by <a href="http://www.fjordwest.com/">Fjord Interactive</a>, who delivered wireframes and a PSD. I was charged with converting the PSD to a working Wordpress theme and coding the custom Contribute form and feed importer. <a class="read-more" href="http://www.aplaceofmind.ubc.ca/">Visit the site »</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/a-place-of-mind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/a-place-of-mind/</feedburner:origLink></item>
		<item>
		<title>Firefox Error Message: “Well, this is embarrassing.”</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/v_E8YLyrBOM/</link>
		<comments>http://bradt.ca/archives/firefox-error-message-well-this-is-embarrassing/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 23:52:44 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[software error]]></category>
		<category><![CDATA[web browser]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1853</guid>
		<description><![CDATA[I received this amusing Firefox error message when opening Firefox this morning. The strange thing is that Firefox still let me load all my tabs from the previous browsing session, so I&#8217;m not sure if there was actually a problem. I upgraded an extension as I was opening, but I&#8217;m not sure if it was [...]]]></description>
			<content:encoded><![CDATA[<p>I received this amusing Firefox error message when opening Firefox this morning. The strange thing is that Firefox still let me load all my tabs from the previous browsing session, so I&#8217;m not sure if there was actually a problem. I upgraded an extension as I was opening, but I&#8217;m not sure if it was related.</p>
<p>I&#8217;ve been very happy with Firefox 3.5 and enjoying the speed improvements.</p>
<p><img class="alignnone size-full wp-image-1854" title="firefox-error-embarrassing" src="http://bradt.ca/wp/wp-content/uploads/2009/09/firefox-error-embarrassing.png" alt="firefox-error-embarrassing" width="837" height="654" /></p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/firefox-error-message-well-this-is-embarrassing/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/firefox-error-message-well-this-is-embarrassing/</feedburner:origLink></item>
		<item>
		<title>Portfolio: Pirate Party of Canada</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/o_-ujjfD25s/</link>
		<comments>http://bradt.ca/archives/pirate-party-of-canada/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 00:38:02 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Wordpress Theme]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1910</guid>
		<description><![CDATA[I got involved with the Pirate Party of Canada simply by participating in the discussion forums early on. I then took on the role of establishing the brand, creating a web site design, and developing a Wordpress theme. Visit the site »
]]></description>
			<content:encoded><![CDATA[<p>I got involved with the Pirate Party of Canada simply by participating in the discussion forums early on. I then took on the role of establishing the brand, creating a web site design, and developing a Wordpress theme. <a class="read-more" href="http://www.pirateparty.ca/">Visit the site »</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/pirate-party-of-canada/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/pirate-party-of-canada/</feedburner:origLink></item>
		<item>
		<title>Fix Wordpress “Missed schedule” error on Media Temple (dv) / Plesk</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/kNEetgsYOyA/</link>
		<comments>http://bradt.ca/archives/fix-wordpress-missed-schedule-error-on-media-temple-dv-plesk/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 12:37:30 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[bug fix]]></category>
		<category><![CDATA[media temple]]></category>
		<category><![CDATA[plesk]]></category>
		<category><![CDATA[server admin]]></category>
		<category><![CDATA[web-development]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1746</guid>
		<description><![CDATA[After a lot of debugging, I was able to figure out that Media Temple&#8217;s (dv) configuration was responsible for the &#8220;Missed schedule&#8221; errors I was getting in Wordpress.  By default, the /etc/hosts file looks like this:
127.0.0.1  yourdomain.com yourdomain localhost localhost.localdomain
To execute cron tasks, Wordpress needs to post to the URL http://yourdomain.com/wp-cron.php?doing_wp_cron. This isn&#8217;t usually a problem, [...]]]></description>
			<content:encoded><![CDATA[<p>After a lot of debugging, I was able to figure out that Media Temple&#8217;s (dv) configuration was responsible for the &#8220;Missed schedule&#8221; errors I was getting in Wordpress.  By default, the /etc/hosts file looks like this:</p>
<pre>127.0.0.1  yourdomain.com yourdomain localhost localhost.localdomain</pre>
<p>To execute cron tasks, Wordpress needs to post to the URL http://yourdomain.com/wp-cron.php?doing_wp_cron. This isn&#8217;t usually a problem, but with the above hosts file and Plesk&#8217;s Apache configuration, that URL will actually result in a 404 error.</p>
<p>I tried removing yourdomain.com and youdomain from the hosts file:</p>
<pre>127.0.0.1  localhost localhost.localdomain</pre>
<div>Unfortunately, when you restart the VPS using Virtuozzo in Plesk, yourdomain.com and yourdomain will just be added back in.  However, after some exhausting Google searching I <a href="http://www.fdcservers.net/vbulletin/archive/index.php/t-1018.html">found</a> out that you can just move them down to the next line with the proper IP address:</div>
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">127.0.0.1  localhost localhost.localdomain
xxx.xxx.xxx.xxx yourdomain.com yourdomain</pre>
<p>Now when you restart the VPS, these changes to the hosts file will remain.</p>
<p>I looked at several other possible solutions to fix the &#8220;Missed schedule&#8221; problem.  One solution was setting the &#8220;ALTERNATE_WP_CRON&#8221; constant in the wp-config.php:</p>
<pre>define('ALTERNATE_WP_CRON', true);</pre>
<p>This activated some very messy redirecting for the user as they browsed the site though.  Not a great solution.  Another solution I was considering was just executing wp-cron.php from a cronjob every hour. Something like this:</p>
<pre>0 * * * * /home/yourdomain/htdocs/wp-cron.php &gt;/dev/null</pre>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/fix-wordpress-missed-schedule-error-on-media-temple-dv-plesk/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/fix-wordpress-missed-schedule-error-on-media-temple-dv-plesk/</feedburner:origLink></item>
		<item>
		<title>Portfolio: SmokinApps</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/Mzdv2EBzS1k/</link>
		<comments>http://bradt.ca/archives/smokinapps/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 02:29:35 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[UX Design]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[Wordpress Theme]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1873</guid>
		<description><![CDATA[I was contacted through this web site by Ash Conway and quickly started working with him to help shape what has become SmokinApps.com, a web site featuring mobile app reviews and ratings. Although Ash handled the majority of the design work, I helped him refine it, providing feedback to improve the user experience.  My [...]]]></description>
			<content:encoded><![CDATA[<p>I was contacted through this web site by Ash Conway and quickly started working with him to help shape what has become SmokinApps.com, a web site featuring mobile app reviews and ratings. Although Ash handled the majority of the design work, I helped him refine it, providing feedback to improve the user experience.  My primary role however, was to develop a custom Wordpress theme and integrate Wordpress plugins into the site. <a class="read-more" href="http://smokinapps.com/">Visit the site »</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/smokinapps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/smokinapps/</feedburner:origLink></item>
		<item>
		<title>Developing SharURL: Lessons learned developing a new startup</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/7Kgv3J6tlEk/</link>
		<comments>http://bradt.ca/archives/developing-sharurl-lessons-learned-developing-a-new-startup/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 03:15:00 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[advice]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[file sharing service]]></category>
		<category><![CDATA[launch]]></category>
		<category><![CDATA[lessons learned]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[web-design]]></category>
		<category><![CDATA[web-development]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1687</guid>
		<description><![CDATA[Last year around this time I decided to pursue an idea for a simple file sharing service without any real planning. Although it shouldn&#8217;t have taken more than a few months of part-time work, I just managed to launch SharURL today (you will need this invite code to signup: p9q1h). I made a lot of mistakes [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sharurl.com/"><img class="alignleft size-full wp-image-1702 photo" title="sharurl" src="http://bradt.ca/wp/wp-content/uploads/2009/07/sharurl.jpg" alt="sharurl" width="302" height="202" /></a>Last year around this time I decided to pursue an idea for a simple file sharing service without any real planning. Although it shouldn&#8217;t have taken more than a few months of part-time work, I just managed to <a href="http://sharurl.com/blog/2009/06/introducing-sharurl/">launch SharURL</a> today (you will need this invite code to signup: <a href="http://sharurl.com/invite/p9q1h">p9q1h</a>). I made a lot of mistakes along the way and the following are a few of the lessons I learned.</p>
<h3>Define requirements</h3>
<p>I must have thought it would be a waste of time defining the requirements of such a simple system. I was wrong. At least half of the time I spent developing SharURL involved adding, removing, and reworking features. Features that could have been thought out and fully defined in writing from the beginning.</p>
<p>No matter how simple the project appears to be, define it in detail before jumping into design and development. After all, if the project is so simple, it won&#8217;t take long to write out the requirements.</p>
<h3>Avoid scope creep</h3>
<p>Even if you have defined requirements, it&#8217;s a slippery slope when you start making exceptions mid project. It&#8217;s surprisingly easy to believe that the project will fail if such and such a feature isn&#8217;t incorporated. Then another feature becomes essential to success, then another. With user experience carrying so much weight these days, these feelings can be difficult to ignore.</p>
<p>&#8220;It&#8217;s going to annoy users if we don&#8217;t have this feature.&#8221;</p>
<p>It&#8217;s important to accept that the system will never be perfect. Establish requirements from the beginning and stick to them. When you get the feeling that a feature outside the scope is essential to success, write it down. Make it a &#8220;Phase 2&#8243; feature. It will help alleviate the feeling and allow you to continue focusing on the initial requirements.</p>
<h3 style="font-size: 1.17em;">Decide on a business model</h3>
<p>Getting bought out by Google is not a business model. But it is the backward mentality I started with. The plan was simple: give everything away for free, gain a massive user base, and get bought by some conglomerate or at least get the attention of investors. If it worked for Facebook, YouTube, and MySpace it can work for me.</p>
<p>Around the end of 2008, I listened to <a href="http://www.37signals.com/svn/posts/981-the-secret-to-making-money-online">a talk by David Heinemeier</a> (Ruby on Rails / 37signals) that really opened my eyes. I realized I had gotten caught up in the hype of getting bought out instead of figuring out the value of the service and charging a price.</p>
<p>The free model is an especially bad plan when the service involves giving away storage space and bandwidth. It&#8217;s expensive. Who is going to front the cash in the beginning? As Heinemeier says, &#8220;It&#8217;s not rocket surgery.&#8221; If your app is great, people will pay to use it. Just charge a price.</p>
<h3 style="font-size: 1.17em;">Design is important</h3>
<p>Usually I start a project with design. Work things out in Photoshop then jump into coding. When I started building SharURL I decided to ignore design and go right into coding. This was a mistake.</p>
<p>It turns out the design phase really helps flush out bad ideas, reshape poorly thought out ideas, and generate new ideas that can be shelved for later.  It is especially helpful when there is no established requirements.</p>
<h3>One project at a time</h3>
<p>&#8220;Bah, I think I&#8217;ll write a framework too.&#8221; On a whim I decided that as I was coding SharURL, I would build a framework that would appeal to Wordpress developers. It turns out writing a tidy, generic framework ready for public consumption as part of a project is very distracting to that project. Juggling two different sets of priorities splits focus, hinders progress, and likely sacrifices quality. Prioritize the sets of priorities. Focus on one set of priorities until they are complete and tackle the rest later.</p>
<p>During SharURL&#8217;s development, I <a href="http://bradt.ca/archives/introducing-vote-swap-canada-for-facebook/">built and released a Facebook application</a> and made some progress redesigning <a href="http://thesimpsonstrivia.com/">thesimpsonstrivia.com</a> (still in progress). If you&#8217;re as spastic as myself, the urge to start a new project can be difficult to control. If you build web sites as your day job, you just have to keep reminding yourself that you don&#8217;t have enough spare time for multiple projects. When you get the urge to start something new, it may help to take a deep breath or get off the computer for a bit.</p>
<h3>Don&#8217;t be afraid of launch</h3>
<p>Every time I thought about launching SharURL I worried. I worried that people would think its a dumb idea. I was worried no one would use it. Fear of rejection and failure is something every entrepreneur faces sooner or later. But good entrepreneurs persevere. They reassure themselves it is a great idea. It will succeed. By all means welcome constructive criticism, but ignore the naysayers.</p>
<p>While building SharURL, I also worried that I wouldn&#8217;t be able to afford to pay the bills as I gained a massive user base. If it is ridiculous to worry about failing, its even more ridiculous to worry about being too successful. You&#8217;re in control. You can turn off signups whenever you like. You can control the growth of the service with an invite-only system.  If you&#8217;re app is great, slowing down growth is not going to result in failure.</p>
<p>Despite being unhappy with the design, unsatisfied with the user experience, and the fact that users can&#8217;t even update their account details yet I have launched.  There&#8217;s probably three dozen other things that I would like to have done before launching, but the reality is they aren&#8217;t necessary to launch. SharURL works great for sharing files.  The rest of the features are nice-to-have.</p>
<h3><strong>About SharURL</strong></h3>
<p>SharURL is a convenient way to share files with friends and family. You simply open your web browser to <a href="http://sharurl.com">sharurl.com</a>, click the big blue button, and select files from your computer. Then you watch as your files are uploaded, packed into a zip file, and a short, unique URL is created for you to share.</p>
<p>The idea was born when I asked a friend to send me their photos, to which they replied &#8220;I&#8217;ll just burn you a CD.&#8221; It seemed ridiculous they would need to burn a CD, but when I looked into it there weren&#8217;t great alternatives. There were file sharing services that allowed you to upload a single file at a time and others that involved installing software, but nothing as convenient as what I had in mind. So, with plenty of room in the file sharing market, I dove in and here we are a year later.</p>
<p>Be sure to subscribe to the <a href="http://sharurl.com/blog/">SharURL blog</a> or <a href="http://twitter.com/sharurl">follow @sharurl on Twitter</a> for feature announcements, etc. I won&#8217;t be cross posting here.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/developing-sharurl-lessons-learned-developing-a-new-startup/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/developing-sharurl-lessons-learned-developing-a-new-startup/</feedburner:origLink></item>
		<item>
		<title>Portfolio: SharURL</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/qeiXKeriDXs/</link>
		<comments>http://bradt.ca/archives/sharurl/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 22:57:19 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Branding]]></category>
		<category><![CDATA[Concept]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[UX Design]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1891</guid>
		<description><![CDATA[After about a year in sporadic development, I finally managed to launch a startup called SharURL, enabling people to easily share large files like photos or video. I came up with the concept for SharURL after hearing a friend say they would burn a photo CD to share photos. SharURL was built on a custom PHP/MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>After about a year in sporadic development, I finally managed to launch a startup called SharURL, enabling people to easily share large files like photos or video. I came up with the concept for SharURL after hearing a friend say they would burn a photo CD to share photos. SharURL was built on a custom PHP/MySQL framework I developed for the project. For more details behind the development of SharURL, see my blog post <a href="http://bradt.ca/archives/developing-sharurl-lessons-learned-developing-a-new-startup/">Developing SharURL: Lessons learned developing a new startup</a>. The site is currently in invite-only beta, so the following invite code is needed to signup: <a href="http://sharurl.com/invite/p9q1h">p9q1h</a>. <a class="read-more" href="http://sharurl.com/">Visit the site »</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/sharurl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/sharurl/</feedburner:origLink></item>
		<item>
		<title>Toxic Subcultures</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/HVXpWtnjRcA/</link>
		<comments>http://bradt.ca/archives/toxic-subcultures/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 06:57:09 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[Management]]></category>
		<category><![CDATA[Organizational Behavior]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1640</guid>
		<description><![CDATA[The latest article by Rands, &#8220;A Toxic Paradox&#8220; struck a cord with me.  It describes three basic types of personalities/relationships in the office: those that are natural, those that require work, and those that are toxic.
When asked a simple question, a toxic person would burst out:
THIS ISN’T A SMALL CHANGE. YOU HAVEN’T THOUGHT THIS THROUGH. WHY [...]]]></description>
			<content:encoded><![CDATA[<p>The latest article by <a href="http://www.randsinrepose.com/">Rands</a>, &#8220;<a href="http://www.randsinrepose.com/archives/2009/06/21/a_toxic_paradox.html">A Toxic Paradox</a>&#8220; struck a cord with me.  It describes three basic types of personalities/relationships in the office: those that are natural, those that require work, and those that are toxic.</p>
<p>When asked a simple question, a toxic person would burst out:</p>
<blockquote><p>THIS ISN’T A SMALL CHANGE. YOU HAVEN’T THOUGHT THIS THROUGH. WHY WASN’T I CONSULTED EARLIER? HOW COULD WE CONSIDER THIS GIVEN WHAT I SAID 14 MONTHS AGO ON THIS VERY TOPIC WHEN I WAS IGNORED…</p></blockquote>
<p>You just have to scroll down to the comments to see that this resonates with a lot of people.  But not managers. People who believe they are or have been the toxic offender.  People who thought they fit the culture of an organization, started out great, then went sour and burst out with similar statements.</p>
<p>This reminded me of a tricky thing about organizations that I&#8217;ve experienced: subcultures.  Often times the subcultures appear between business units.  You could find yourself in a group of creative, novelty t-shirt wearing, environmentally conscious people who share the same ideals.  Yet 70% of your time is devoted to dealing directly with the members of another business unit and their distinct subculture.  Your group really values going out for Friday lunch and relaxing after working hard all week, yet the other group periodically schedules meetings around noon on Fridays.  The other group frowns upon your novelty t-shirts as inappropriate office attire and you scoff at their sweater vests.  They love their gas guzzling SUV and you love the cycle home from work.</p>
<p>It can be difficult for members of these groups to spend 70% of their time interacting with one another and in such situations it is a good idea to put a distance between them.  Maybe appoint a liaison from each group, someone who is responsible for communication between the two groups and funneling all communication through them.  Putting a physical distance between the groups may help as well.</p>
<p>When looking at an organization from the outside, it can be very difficult to spot subcultures as well.  You could accept a job offer at company that you believe aligns with a majority of your ideals, only to end up in a group that doesn&#8217;t.  It is most important to know the people who you will be dealing with daily and focus on them. Interview them, Google them, do to what it takes to find out what culture they belong to.  Don&#8217;t assume you know the people because you know the company.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/toxic-subcultures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/toxic-subcultures/</feedburner:origLink></item>
		<item>
		<title>Portfolio: Flippa</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/Nueag2T1Uio/</link>
		<comments>http://bradt.ca/archives/flippa/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 07:27:15 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Branding]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[UX Design]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=1571</guid>
		<description><![CDATA[Flippa is an online auction house for buying and selling web sites and domain names.  Although Flippa is sort of a startup, it is actually a spinoff of the SitePoint Marketplace.  Working directly with SitePoint co-founder Mark Harbottle, I was charged with developing a new brand and designing the interface for the new [...]]]></description>
			<content:encoded><![CDATA[<p>Flippa is an online auction house for buying and selling web sites and domain names.  Although Flippa is sort of a startup, it is actually a spinoff of the <a href="http://marketplace.sitepoint.com/">SitePoint Marketplace</a>.  Working directly with SitePoint co-founder Mark Harbottle, I was charged with developing a new brand and designing the interface for the new web application. In 13 days, I produced 32 mockups and refined the user experience for the entire application.</p>
<p>My role in this project was strictly user experience design. I handed off Photoshop files and a style guide and the SitePoint team handled the rest.  Check out the mockups above and compare with <a href="http://www.flippa.com/">the live site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/flippa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/flippa/</feedburner:origLink></item>
		<item>
		<title>Micro templates in PHP</title>
		<link>http://feedproxy.google.com/~r/bradtca/posts/~3/VHiCNp72g74/</link>
		<comments>http://bradt.ca/archives/micro-templates-in-php/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 05:36:31 +0000</pubDate>
		<dc:creator>bradt</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web-development]]></category>

		<guid isPermaLink="false">http://bradt.ca/?p=345</guid>
		<description><![CDATA[Have you ever had the pleasure of reading PHP code with lines and lines of HTML jammed into strings and a ton of escape characters? I have. In fact, a lot of Wordpress plugins are guilty of this. Perhaps you&#8217;re guilty of it yourself?
This article will show you how to separate your HTML markup from [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever had the pleasure of reading PHP code with lines and lines of HTML jammed into strings and a ton of escape characters? I have. In fact, a lot of Wordpress plugins are guilty of this. Perhaps you&#8217;re guilty of it yourself?</p>
<p>This article will show you how to separate your HTML markup from your PHP code using only a few simple lines of PHP — something I&#8217;ve been calling &#8220;micro templates.&#8221;<br />
<span id="more-345"></span></p>
<p>For this article, I rummaged through my ancient projects to find an authentically bad snippet of code.  It didn&#8217;t take long to find.  The following snippet I pulled from Uncultured.com, a custom blogging system I built nine years ago:</p>
<h4>Snippet #1</h4>
<pre lang="enc__php">&lt;?php
function printMenu($menu_items) {
    echo "
    &lt;table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"&gt;
    &lt;tr&gt;
        &lt;td class=\"borders\"&gt;
            &lt;table border=\"0\" cellpadding=\"3\" cellspacing=\"1\"&gt;";

            for ($i = 0; $i &lt; count($menu_items[0]); $i++) {
                echo "
                &lt;tr&gt;
                    &lt;td class=\"buttons\"&gt;»&lt;/td&gt;
                    &lt;td class=\"buttons\"&gt;&lt;a href=\"" . $menu_items[0][$i] . "\"&gt;" . $menu_items[1][$i] . "&lt;/a&gt;&lt;/td&gt;
                &lt;/tr&gt;";
            }

            echo "
            &lt;/table&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;";

} // end printMenu
?&gt;</pre>
<p>The above PHP code isn&#8217;t too awful, but it does violate a best practice rule that I&#8217;ve adopted since: <strong>Avoid placing blocks of HTML in a string.</strong> Placing HTML in a string as demonstrated in the code above is unmanageable.  All the double quotes need to be escaped, embedding variables is not very elegant, and it&#8217;s just ugly to read.</p>
<p>Of course, the alternative to echo&#8217;ing strings is simply to use PHP&#8217;s embed tags &lt;?php ?&gt; In fact, that&#8217;s what they were designed for!  Using PHP embed tags, the above code becomes the following:</p>
<h4>Snippet #2</h4>
<pre lang="enc__php">&lt;?php
function printMenu($menu_items) {
    ?&gt;
    &lt;table border="0" cellpadding="0" cellspacing="0"&gt;
    &lt;tr&gt;
        &lt;td class="borders"&gt;
            &lt;table border="0" cellpadding="3" cellspacing="1"&gt;

            &lt;?php
            for ($i = 0; $i &lt; count($menu_items[0]); $i++) {
                ?&gt;
                &lt;tr&gt;
                    &lt;td class="buttons"&gt;»&lt;/td&gt;
                    &lt;td class="buttons"&gt;&lt;a href="&lt;?php echo $menu_items[0][$i] ?&gt;"&gt;&lt;?php echo $menu_items[1][$i] ?&gt;&lt;/a&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;?php
            }
            ?&gt;

            &lt;/table&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;?php
} // end printMenu
?&gt;</pre>
<p>Much better!  Now, let&#8217;s say our requirements have changed and our <code>printMenu</code> function is now a <code>getMenu</code> function and needs to return the HTML as a string. My former self (from nine years ago) probably would have just replaced the <code>echo</code> statements from the first snippet with a string concatenation, like this:</p>
<h4>Snippet #3</h4>
<pre lang="enc__php">&lt;?php
function getMenu($menu_items) {
    $out = "
    &lt;table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"&gt;
    &lt;tr&gt;
        &lt;td class=\"borders\"&gt;
            &lt;table border=\"0\" cellpadding=\"3\" cellspacing=\"1\"&gt;";

            for ($i = 0; $i &lt; count($menu_items[0]); $i++) {
                $out .= "
                &lt;tr&gt;
                    &lt;td class=\"buttons\"&gt;»&lt;/td&gt;
                    &lt;td class=\"buttons\"&gt;&lt;a href=\"" . $menu_items[0][$i] . "\"&gt;" . $menu_items[1][$i] . "&lt;/a&gt;&lt;/td&gt;
                &lt;/tr&gt;";
            }

            $out =. "
            &lt;/table&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;";

    return $out;
} // end printMenu
?&gt;</pre>
<p>Unfortunately, this has the same problems as the first snippet plus it suffers from the inefficiencies associated with string concatenation.  From my limited experience with C programming, I know that every time a string is concatenated, a memory reallocation operation is executed which is a relatively expensive operation. Some programmers would do something even worse (I&#8217;ve seen it many times), building a string for each line of HTML, like this:</p>
<h4>Snippet #4</h4>
<pre lang="enc__php">&lt;?php
function getMenu($menu_items) {
    $out = "&lt;table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"&gt;\n";
    $out .= "&lt;tr&gt;\n&lt;td class=\"borders\"&gt;\n";
    $out .= "&lt;table border=\"0\" cellpadding=\"3\" cellspacing=\"1\"&gt;\n";

    for ($i = 0; $i &lt; count($menu_items[0]); $i++) {
        $out .= "&lt;tr&gt;\n&lt;td class=\"buttons\"&gt;»&lt;/td&gt;\n";
        $out .= "&lt;td class=\"buttons\"&gt;&lt;a href=\"" . $menu_items[0][$i] . "\"&gt;" . $menu_items[1][$i] . "&lt;/a&gt;&lt;/td&gt;\n";
        $out .= "&lt;/tr&gt;\n";
    }

    $out =. "&lt;/table&gt;\n&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/table&gt;\n";

    return $out;
} // end printMenu
?&gt;</pre>
<p>This code just gives me the urge to smack the developer who wrote it.  They&#8217;re trying to &#8220;clean up&#8221; the code by adding even more string concatenations.  This code is just awful.  In addition to being a nightmare to read, with an increased number of string concatenations, it is horribly inefficient.</p>
<p>So, ideally we want to use embed tags &lt;?php ?&gt; (Snippet #2) and somehow return a string of the output.  But how do we do that?  <a href="http://www.php.net/outcontrol">Output buffering</a> is the answer.  And the surprising thing is that it is painfully simple.  Basically, we just take Snippet #2 and add <code><a href="http://www.php.net/manual/en/function.ob-start.php">ob_start()</a></code> to the beginning of our function and <code><a href="http://www.php.net/manual/en/function.ob-end-clean.php">ob_get_clean()</a></code> at the end.</p>
<h4>Snippet #5</h4>
<pre lang="enc__php">&lt;?php
function getMenu($menu_items) {
    ob_start();
    ?&gt;
    &lt;table border="0" cellpadding="0" cellspacing="0"&gt;
    &lt;tr&gt;
        &lt;td class="borders"&gt;
            &lt;table border="0" cellpadding="3" cellspacing="1"&gt;

            &lt;?php
            for ($i = 0; $i &lt; count($menu_items[0]); $i++) {
                ?&gt;
                &lt;tr&gt;
                    &lt;td class="buttons"&gt;»&lt;/td&gt;
                    &lt;td class="buttons"&gt;&lt;a href="&lt;?php echo $menu_items[0][$i] ?&gt;"&gt;&lt;?php echo $menu_items[1][$i] ?&gt;&lt;/a&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;?php
            }
            ?&gt;

            &lt;/table&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;?php
    return ob_get_clean();
} // end printMenu
?&gt;</pre>
<p>Adding <code><a href="http://www.php.net/manual/en/function.ob-start.php">ob_start()</a></code> starts the output buffer before any of the HTML in our function has been output.  Now anything we try output (using echo or embed tags) gets stored in the output buffer.  After we&#8217;ve captured all our output we can retrieve it from the output buffer using the <code><a href="http://www.php.net/manual/en/function.ob-get-contents.php">ob_get_contents()</a></code> function or <code><a href="http://www.php.net/manual/en/function.ob-end-clean.php">ob_get_clean()</a></code> which gets the buffer contents and clears the buffer.</p>
<p>Output buffering is also a handy way of creating &#8220;micro templates&#8221; in your PHP applications that don&#8217;t have the luxury of a full fledged template engine.  The following function simply takes a file as an argument and returns a string containing the output generated by that file:</p>
<h4>Micro Template Function</h4>
<pre lang="enc__php">&lt;?php
function get_template($file, $vars = array()) {
    ob_start();
    if (file_exists($file)) {
        include($file);
    }
    return ob_get_clean();
}
?&gt;</pre>
<p>Because we&#8217;re including the template file within a function, variables from the caller are not available.  The optional argument <code>$vars</code> allows you to pass in an array of values from the caller for use in the template file.</p>
<p>I often use micro templates when developing <a href="http://wordpress.org/">Wordpress</a> plugins.  They work great in these situations where one of the goals is to keep the overhead low.  For large applications I would still recommend using a strong template system like <a href="http://www.smarty.net/">Smarty</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradt.ca/archives/micro-templates-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bradt.ca/archives/micro-templates-in-php/</feedburner:origLink></item>
	</channel>
</rss>
