<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rick Guyer .com &#187; Web Development</title>
	<atom:link href="http://rickguyer.com/tag/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://rickguyer.com</link>
	<description>Information about the web, web development, and technology.</description>
	<lastBuildDate>Wed, 21 Sep 2011 13:50:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>WTF is a web browser?</title>
		<link>http://rickguyer.com/wtf-is-a-web-browser/</link>
		<comments>http://rickguyer.com/wtf-is-a-web-browser/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 02:24:15 +0000</pubDate>
		<dc:creator>ricog</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[web browser]]></category>

		<guid isPermaLink="false">http://rickguyer.com/?p=88</guid>
		<description><![CDATA[Sometimes it&#8217;s surprising how many web users don&#8217;t know what a web browser is. I don&#8217;t know how many times I&#8217;ve been helping a customer, relative, etc and said &#8220;open a web browser&#8221; and their reply is &#8220;what is a web browser&#8221;. My immediate thought is &#8220;DAMN, how in the heck am I ever going [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s surprising how many web users don&#8217;t know what a web browser is. I don&#8217;t know how many times I&#8217;ve been helping a customer, relative, etc and said &#8220;open a web browser&#8221; and their reply is &#8220;what is a web browser&#8221;. My immediate thought is &#8220;DAMN, how in the heck am I ever going to get them through converting a word doc into PDF and uploading it to the WordPress site I just created for them&#8221;.<em><strong> </strong></em></p>
<p><em><strong>Note:</strong> If you happen to be a customer, relative, etc and are reading this, don&#8217;t take offense. Trust me, if you were trying to walk me through stuff you do at work every day, you&#8217;d be saying &#8220;WTF, this guy is an idiot&#8221; too.</em></p>
<p>It usually turns out that they know more about the web than that first response reveals. Their intelligence isn&#8217;t the problem. There is a deeper cause. And a lot of times I can rephrase and say &#8220;open Internet Explorer&#8221;. Or amazingly, if they don&#8217;t know what IE is either, I can almost always get away with telling them to &#8220;get on the internet&#8221; or &#8220;go to Google&#8221; (or Yahoo, etc).</p>
<p>The problem I think is that the web browser is such an integral part of a web users<span id="more-88"></span> every day experience. It&#8217;s like a part of the operating system to them. It&#8217;s just there. And that creates another problem. Since many users don&#8217;t even know what a web browser is, how can they be expected to know &#8220;which&#8221; web browser to use. Or to keep it updated.</p>
<p>I guess as web developers, IT consultants, or whatever you call yourself, it is our job to educate the masses. We have to show them that there are choices, and make them aware enough to hopefully keep it up to date.</p>
<p>Below I describe three ways that can help web users understand web browsers and the choices they have.</p>
<h2>So what is a web browser, really?</h2>
<p>Sometimes you just need to explain to the user what a web browser is. Fortunately for us, Google has an excellent video that does just that.</p>
<p><iframe title="YouTube video player" class="youtube-player" type="text/html" width="425" height="344" src="http://www.youtube.com/embed/BrXPcaRlBqo&amp;hl" frameborder="0" allowFullScreen="true"> </iframe></p>
<h2>Which web browser should they use?</h2>
<p>Frequently when we interact with users, we like to give them a choice of which browser to use. Sure we have our preferences, but we shouldn&#8217;t force it on them. And most current browsers are great compared to the <a href="http://en.wikipedia.org/wiki/Internet_Explorer_6" target="_blank">demon of yesterday</a>. We typically provide the user with the following choices:</p>
<div>
<div class="browser-box first"><img class="size-thumbnail wp-image-692 aligncenter" title="WP Docs - Firefox Logo" src="http://www.dual-tech.com/wp-content/uploads/firefox-150x150.jpg" alt="WP Docs - Firefox Logo" width="150" height="150" /><strong><a href="http://www.mozilla.com/en-US/firefox/firefox.html" target="_blank">Mozilla Firefox</a></strong></div>
<div class="browser-box"><img class="size-thumbnail wp-image-690 aligncenter" title="WP Docs - Google Chrome Logo" src="http://www.dual-tech.com/wp-content/uploads/google-chrome-300x289-150x150.jpg" alt="WP Docs - Google Chrome Logo" width="150" height="150" /> <a href="http://www.google.com/chrome" target="_blank"><strong>Google Chrome</strong></a></div>
<div class="browser-box last"><img class="size-thumbnail wp-image-691 aligncenter" title="WP Docs - IE Logo" src="http://www.dual-tech.com/wp-content/uploads/Internet_Explorer_7_Logo-150x150.jpg" alt="WP Docs - IE Logo" width="150" height="150" /> <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx" target="_blank"><strong>Internet Explorer 8</strong></a></div>
</div>
<h2>Can you guide the user to a better web browser?</h2>
<p>Yes, you can. If you develop sites that are dependent on having current web browser technology, consider prompting the user if you detect an older or unsupported browser. Let them know that the site may not operate correctly, or block them completely if needed. Some modern AJAX interfaces can really screw up in unsupported browsers. So, it is better to be safe; know which browser is being used.</p>
<p>Here are some related resources that can help you detect and mitigate cross browser issues.</p>
<p><a href="https://developer.mozilla.org/en/Browser_Detection_and_Cross_Browser_Support">Browser Detection and Cross Browser Support</a> &#8211; in depth technical details of various detection methods</p>
<p><a href="http://www.browsercam.com">BrowserCam</a> &#8211; test your website in multiple browsers</p>
<p><a href="https://developer.mozilla.org/en/Browser_Detection_and_Cross_Browser_Support"></a></p>
<p><a href="http://www.dual-tech.com">DualTech</a> has a page devoted to helping users <a href="http://www.dual-tech.com/what-is-a-web-browser/">understand what a web browser is</a> in the hopes that they will use a current one.</p>
]]></content:encoded>
			<wfw:commentRss>http://rickguyer.com/wtf-is-a-web-browser/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reusing controller views in CakePHP</title>
		<link>http://rickguyer.com/reusing-controller-views-in-cakephp/</link>
		<comments>http://rickguyer.com/reusing-controller-views-in-cakephp/#comments</comments>
		<pubDate>Sat, 02 May 2009 15:50:36 +0000</pubDate>
		<dc:creator>ricog</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://rickguyer.com/?p=37</guid>
		<description><![CDATA[CakePHP makes it easy to reuse your small blocks of presentation code throughout your application by using Elements. You can read more about them here: http://book.cakephp.org/view/97/Elements Sometimes though you want to reuse a regular controller view without moving the code to an element. In fact, if the view code is specific to the controller, it [...]]]></description>
			<content:encoded><![CDATA[<p>CakePHP makes it easy to reuse your small blocks of presentation code throughout your application by using <a href="http://book.cakephp.org/view/97/Elements">Elements</a>. You can read more about them here:</p>
<p><a href="http://book.cakephp.org/view/97/Elements">http://book.cakephp.org/view/97/Elements</a></p>
<p>Sometimes though you want to reuse a regular controller view without moving the code to an element. In fact, if the view code is specific to the controller, it is good practice to keep it in the controller view.</p>
<p>Fortunately this is fairly simple. Just create the view and then reference it like this:</p>
<pre class="brush: php">
&lt;?php echo $this-&gt;element(&#039;../projects/menu&#039;); ?&gt;
</pre>
<p><em>In the example above, I&#8217;m accessing the following file: /views/projects/menu.ctp</em></p>
<p>As always, the element will have access to all existing view variables (t<em>he ones typically passed using $this-&gt;set()</em>).</p>
]]></content:encoded>
			<wfw:commentRss>http://rickguyer.com/reusing-controller-views-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP: One core, many apps</title>
		<link>http://rickguyer.com/cakephp-one-core-many-apps/</link>
		<comments>http://rickguyer.com/cakephp-one-core-many-apps/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 13:55:36 +0000</pubDate>
		<dc:creator>ricog</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://ricoguyer.com/?p=25</guid>
		<description><![CDATA[CakePHP allows you to use one set of core files while maintaining multiple applications. It only takes a few steps, but may not be completely straightforward the first time you try. In my example, I have my workspace in ~/dev. I would setup my project in ~/dev/client_name/project_name. I place my cake core files in separate [...]]]></description>
			<content:encoded><![CDATA[<p>CakePHP allows you to use one set of core files while maintaining multiple applications. It only takes a few steps, but may not be completely straightforward the first time you try. In my example, I have my workspace in ~/dev. I would setup my project in  ~/dev/client_name/project_name. I place my cake core files in separate folders for each version in ~/dev/lib/cakephp.</p>
<p><strong>The basics</strong></p>
<ol>
<li>Download and install the latest version of <a href="http://cakephp.org/">CakePHP</a> in a good location.<br /><i>Examples:</i>
<ul>
<li>Linux: /usr/lib/cakephp/cake_1.2.2.8120</li>
<li>Windows: C:\lib\cakephp\cake_1.2.2.8120</li>
</ul>
</li>
<li>Copy the contents of the app folder to your project root. This is typically your webserver root or a folder within.</li>
<li>Edit the following constants in webroot/index.php:
<ol>
<li>ROOT<br />You&#8217;ll want to change it so the root is one level back (your project root)
<pre class="brush: php">
	if (!defined(&#039;ROOT&#039;)) {
		define(&#039;ROOT&#039;, dirname(dirname(__FILE__)));
	}
</pre>
</li>
<li>APP_DIR<br />This one just gets set to blank since your root is also your app folder
<pre class="brush: php">
	if (!defined(&#039;APP_DIR&#039;)) {
		define(&#039;APP_DIR&#039;, &#039;&#039;);
	}
</pre>
</li>
<li>CAKE_CORE_INCLUDE_PATH<br />Set the path to your cake core files. This can either be relative (../../core) or absolute (/path/to/core)
<pre class="brush: php">
	if (!defined(&#039;CAKE_CORE_INCLUDE_PATH&#039;)) {
		define(&#039;CAKE_CORE_INCLUDE_PATH&#039;, &#039;..&#039;.DS.&#039;..&#039;.DS.&#039;..&#039;.DS.&#039;lib&#039;.DS.&#039;cakephp&#039;.DS.&#039;cake_1.2.2.8120&#039;);
	}
</pre>
<p>or</p>
<pre class="brush: php">
	if (!defined(&#039;CAKE_CORE_INCLUDE_PATH&#039;)) {
		define(&#039;CAKE_CORE_INCLUDE_PATH&#039;, DS.&#039;usr&#039;.DS.&#039;lib&#039;.DS.&#039;cakephp&#039;.DS.&#039;cake_1.2.2.8120&#039;);
	}
</pre>
</li>
</ol>
</li>
</ol>
<p>It may take a little work to get the paths right, but it is well worth it. If you try to access your project and you get PHP errors, it probably means something is wrong with the core path above. The next project you start, just copy the app folder again as above, and copy the same index.php into any new projects you start.</p>
<p><strong>Different paths for dev and live</strong><br />
The above example only covers one server configuration. Some developers may be developing in Windows while their production server runs Linux. In that case you will need to account for each server. A simple if/else statement will take care of this. In my case, I have &#8220;localdev&#8221; as the hostname for my local development server. Here is what my CAKE_CORE_INCLUDE_PATH configuration looks like:</p>
<pre class="brush: php">
	if (!defined(&#039;CAKE_CORE_INCLUDE_PATH&#039;)) {
		if ($_SERVER[&#039;SERVER_NAME&#039;] == &#039;localdev&#039;) {
			define(&#039;CAKE_CORE_INCLUDE_PATH&#039;, &#039;..&#039;.DS.&#039;..&#039;.DS.&#039;..&#039;.DS.&#039;lib&#039;.DS.&#039;cakephp&#039;.DS.&#039;cake_1.2.2.8120&#039;);
		} else {
			define(&#039;CAKE_CORE_INCLUDE_PATH&#039;, DS.&#039;usr&#039;.DS.&#039;lib&#039;.DS.&#039;cakephp&#039;.DS.&#039;cake_1.2.2.8120&#039;);
		}
	}
</pre>
<p><strong>Upgrading CakePHP</strong><br />
Upgrading CakePHP is pretty easy. Just install the latest version of CakePHP as described above. Then when you are ready to upgrade your app, change the core path again and start testing. If you run into issues with the latest version, it is really easy to switch back.</p>
]]></content:encoded>
			<wfw:commentRss>http://rickguyer.com/cakephp-one-core-many-apps/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Letting multiple CakePHP apps talk</title>
		<link>http://rickguyer.com/letting-multiple-cakephp-apps-talk/</link>
		<comments>http://rickguyer.com/letting-multiple-cakephp-apps-talk/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 02:38:50 +0000</pubDate>
		<dc:creator>ricog</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[webservice]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://ricoguyer.com/?p=21</guid>
		<description><![CDATA[CakePHP is getting really popular, so naturally, there are quite a few sites out there using it. If you&#8217;ve been using CakePHP long enough, sooner or later you will want to have 2 or more of those apps talk to each other. Setting CakePHP up to act as a webservice is pretty easy. Teaching the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cakephp.org">CakePHP</a> is getting really popular, so naturally, there are quite a few sites out there using it. If you&#8217;ve been using CakePHP long enough, sooner or later you will want to have 2 or more of those apps talk to each other. <a href="http://book.cakephp.org/view/477/The-Simple-Setup">Setting CakePHP up to act as a webservice</a> is pretty easy. Teaching the other apps to talk to that webservice takes a little more work. Jesse (over at <a href="http://techno-geeks.org">TechnoGeeks</a>) and I have been working on just that.</p>
<p>So far we have one app authenticating against the other. This can be very useful if you have a central user database, and don&#8217;t want to maintain users across every application you create. We used XML as the transport, so this could easily be used for applications that aren&#8217;t written in CakePHP. You can get all the details in Jesse&#8217;s article: <a href="http://techno-geeks.org/2009/03/authenticating-a-cakephp-app-against-a-cakephp-webservice/">Authenticating a CakePHP App Against a CakePHP Webservice</a>.</p>
<p>We hope to extend it and allow standardized CRUD functionality across the applications. During that time, we may move the code into a datasource. But who knows.</p>
]]></content:encoded>
			<wfw:commentRss>http://rickguyer.com/letting-multiple-cakephp-apps-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speeding up count queries with counterCache</title>
		<link>http://rickguyer.com/speeding-up-count-queries-with-countercache/</link>
		<comments>http://rickguyer.com/speeding-up-count-queries-with-countercache/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 01:18:42 +0000</pubDate>
		<dc:creator>ricog</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[model]]></category>

		<guid isPermaLink="false">http://ricoguyer.com/?p=8</guid>
		<description><![CDATA[Today while working in a CakePHP application, I needed to hide some records based on the number of associated records they had. I basically needed to get a count of associated records. Fortunately, CakePHP has a feature called counterCache that makes this really easy. It saves the record count in the database and updates the [...]]]></description>
			<content:encoded><![CDATA[<p>Today while working in a <a href="http://cakephp.org">CakePHP</a> application, I needed to hide some records based on the number of associated records they had. I basically needed to get a count of associated records. Fortunately, CakePHP has a feature called <a href="http://book.cakephp.org/view/490/counterCache-Cache-your-count">counterCache</a> that makes this really easy. It saves the record count in the database and updates the count any time you do a save or delete. The details can be found here:  <a href="http://book.cakephp.org/view/490/counterCache-Cache-your-count">http://book.cakephp.org/view/490/counterCache-Cache-your-count</a></p>
<p>Basically you do the following:</p>
<ol>
<li>Create an INT field on the parent table called &lt;childmodelname&gt;_count</li>
<li>In the $belongsTo array of the child model, add &#8220;&#8216;counterCache&#8217; =&gt; true&#8221; to the parent array</li>
<li>Enjoy!</li>
</ol>
<p>This works great for new installations. However, if you want to add it to an existing site, you&#8217;ll need to run through all the records and save the current count. Here is a sample method for doing just that.</p>
<pre class="brush: php">
function admin_update_counters() {
$this-&gt;Category-&gt;recursive = 0;
$categories = $this-&gt;Category-&gt;find(&#039;all&#039;);
foreach ($categories as $category) {
$question_count = $this-&gt;Category-&gt;Question-&gt;find(&#039;count&#039;, array(&#039;conditions&#039; =&gt; array(&#039;Question.category_id&#039; =&gt; $category[&#039;Category&#039;][&#039;id&#039;])));
if ($question_count) {
$this-&gt;Category-&gt;create();
$this-&gt;Category-&gt;id = $category[&#039;Category&#039;][&#039;id&#039;];
$this-&gt;Category-&gt;saveField(&#039;question_count&#039;, $question_count);
}
}

echo &quot;Counters updated&quot;; exit;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://rickguyer.com/speeding-up-count-queries-with-countercache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

