<?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>MacdougalMedia</title>
	<atom:link href="http://macdougalmedia.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://macdougalmedia.com</link>
	<description>by Scott Macdougal Weaver</description>
	<lastBuildDate>Tue, 18 May 2010 10:56:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MrDiscountCoupons.com &#8211; We&#8217;ve Only Just Begun&#8230;</title>
		<link>http://macdougalmedia.com/2010/05/18/mrdiscountcoupons-com-weve-only-just-begun/</link>
		<comments>http://macdougalmedia.com/2010/05/18/mrdiscountcoupons-com-weve-only-just-begun/#comments</comments>
		<pubDate>Tue, 18 May 2010 10:54:54 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Coupons]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=211</guid>
		<description><![CDATA[
Mr. Discount Coupons is a project I'm currently developing. The idea is simple: create a way for people to save big bucks while making sure I profit a smidgen in the process.
Of course, there are a number of ways to do this and I'm sure this is just the beginning, but so far I have [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Mr. Discount Coupons" href="http://mrdiscountcoupons.com" target="_blank"><img class="size-full wp-image-212 alignnone" title="MrDiscountCoupons.com Snapshot" src="http://macdougalmedia.com/wp-content/uploads/2010/05/snapshot.png" alt="Mr. Discount Coupons" width="486" height="225" /></a></p>
<p><a title="Mr. Discount Coupons" href="http://mrdiscountcoupons.com" target="_blank">Mr. Discount Coupons</a> is a project I'm currently developing. The idea is simple: create a way for people to save big bucks while making sure I profit a smidgen in the process.</p>
<p>Of course, there are a number of ways to do this and I'm sure this is just the beginning, but so far I have three ways for people to save (a toolbar, actual daily updated coupons and a few affiliate offers that promote specific services). I got the idea from a buddy of mine who runs the <a title="Printable Coupons Guide" href="http://www.printablecouponsguide.com/" target="_blank">Printable Coupons Guide</a>. He gave me the thumbs up to create a "competitor" website, so this is my hack at it.</p>
<p>Thanks, buddy ... now let the games begin!</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2010/05/18/mrdiscountcoupons-com-weve-only-just-begun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dropbox &#8211; Web Developer&#8217;s Best Friend</title>
		<link>http://macdougalmedia.com/2010/04/15/dropbox-web-developers-best-friend/</link>
		<comments>http://macdougalmedia.com/2010/04/15/dropbox-web-developers-best-friend/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 15:56:58 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=195</guid>
		<description><![CDATA[Recently, I happened to see an ad for Dropbox while I was browsing. I'd seen the logo before but I didn't really have any idea of what it was besides the obvious implication, so I decided to check it out.
Dropbox starts you off with a free 2GB, which is nice, but will give you more [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://www.dropbox.com/referrals/NTYxMTk0NzM5"><img class="size-full wp-image-196 alignleft" style="margin: 0 25px 1px 0;" title="Dropbox" src="http://macdougalmedia.com/wp-content/uploads/2010/04/dropbox.png" alt="Dropbox" width="231" height="60" /></a>Recently, I happened to see an ad for Dropbox while I was browsing. I'd seen the logo before but I didn't really have any idea of what it was besides the obvious implication, so I decided to check it out.</p>
<p>Dropbox starts you off with a free 2GB, which is nice, but will give you more if you refer people (right now, it's 250MB per referral). At the moment, I'm up to 4GB and am trying to get up to the 10GB maximum for free accounts. Paid accounts allow you to get either 50GB ($9.99/month) or 100GB ($19.99/month).</p>
<p>In any case, as it turns out, Dropbox replicates the functionality of iDisk. If you aren't familiar with iDisk, the idea is that you have a hard drive on the web and can access it as a regular folder on your computer. Dropbox takes this a few steps further though.</p>
<p><strong>Cross-platform Support</strong></p>
<p>As I was surprised to find out, Dropbox works for Macs, PCs and they even have an iPhone app. As far as I know, they don't have an application for Windows mobile devices yet but they've got it on their to-do list. Incidentally, I already use it on all of my computers (work and home) and got my wife to start up an account for herself. So far, it has worked flawlessly across all of the devices it's been installed on.</p>
<p><strong>Revisions</strong></p>
<p>Everything you save to your Dropbox folder will have a 30-day history of revisions (change history), so you are able to revert back to older versions. They call it an 'undo history,' which makes sense. For developers, this is an indispensable feature.</p>
<p><strong>Shared Folders</strong></p>
<p>Not only does Dropbox support public folders (like iDisk does) so you can share your files with friends/family, it also gives you the option to have a shared folder. A shared folder will show up as a folder in the Dropboxes of all parties involved, just like all of their other folders. So if you're collaborating with other people on anything within reason, Dropbox makes for an excellent solution. It's as if you're both working on the same hard drive ... with a slight delay for sync.</p>
<p><strong>Back-up Solution</strong></p>
<p>Like iDisk, Dropbox is an excellent solution for back-ups. Currently, I use Mozy which is about $5/month per computer you back up but they offer unlimited space. I'm considering switching to the $9.99/month 50GB package just for the simple reason that I can back up any of my files and access them from anywhere (even my iPhone).</p>
<p>So far, I've been using the site as my 'local' folder on a few sites I develop and it works 99% flawlessly. Once in a great while, I'll try and save while it hasn't finished syncing yet and it will give me an "Unable to upload" error. But I just wait a second, upload again and everything works perfectly.</p>
<p>Needless to say, I highly recommend Dropbox as either a Web Development solution or a Back-up solution (or both). <a title="Dropbox" href="https://www.dropbox.com/referrals/NTYxMTk0NzM5" target="_blank">Click here to try Dropbox</a>. Oh and by the way, if you use my link, we both get an extra 250GB.</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2010/04/15/dropbox-web-developers-best-friend/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CheckBoxer for Google Chrome</title>
		<link>http://macdougalmedia.com/2010/04/13/checkboxer-for-google-chrome/</link>
		<comments>http://macdougalmedia.com/2010/04/13/checkboxer-for-google-chrome/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 07:38:37 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=185</guid>
		<description><![CDATA[CheckBoxer is an extension I wrote for Google Chrome. Based on the CheckBoxMate plugin for Firefox by nrlz, it does ... well.. exactly the same thing: you draw a rectangle around the check boxes you want to toggle on or off. Magic.
Here it is in action:

As you can see, it has selected all of the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://macdougalmedia.com/wp-content/uploads/2010/04/checkboxer.png"><img class="size-full wp-image-186 alignleft" style="margin-left: 0px; margin-right: 4px;" title="CheckBoxer" src="http://macdougalmedia.com/wp-content/uploads/2010/04/checkboxer.png" alt="CheckBoxer extension for Google Chrome" width="48" height="48" /></a>CheckBoxer is an extension I wrote for Google Chrome. Based on the CheckBoxMate plugin for Firefox by nrlz, it does ... well.. exactly the same thing: you draw a rectangle around the check boxes you want to toggle on or off. Magic.</p>
<p>Here it is in action:</p>
<p><a href="http://macdougalmedia.com/wp-content/uploads/2010/04/screenshot1-crop.png"><img class="alignnone size-full wp-image-189" title="CheckBoxer in action!" src="http://macdougalmedia.com/wp-content/uploads/2010/04/screenshot1-crop.png" alt="CheckBoxer in action!" width="403" height="39" /></a></p>
<p>As you can see, it has selected all of the check boxes within the selected area. No need to hold any other buttons as it only works when you've dragged over the starting checkbox.</p>
<p><a title="CheckBoxer" href="https://chrome.google.com/extensions/detail/hbcmphdngimjobnagjpaeckfeokalnce" target="_blank">Click here</a> to check it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2010/04/13/checkboxer-for-google-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CheckBoxMate for Greasemonkey</title>
		<link>http://macdougalmedia.com/2010/04/07/checkboxmate-for-greasemonkey/</link>
		<comments>http://macdougalmedia.com/2010/04/07/checkboxmate-for-greasemonkey/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 09:01:08 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Greasemonkey Scripts]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=177</guid>
		<description><![CDATA[
Ever had to check off a bunch of checkboxes one by one? It's a grueling and tedious process, especially when you have to do more than .. say .. five. Never fear! That's why nrlz came up with CheckBoxMate.
What Is CheckBoxMate? This script allows you to check multiple  checkboxes just by drawing a box [...]]]></description>
			<content:encoded><![CDATA[<div id="full_description">
<p>Ever had to check off a bunch of checkboxes one by one? It's a grueling and tedious process, especially when you have to do more than .. say .. five. Never fear! That's why nrlz came up with <a title="CheckBoxMate" href="https://addons.mozilla.org/en-US/firefox/addon/9740" target="_blank">CheckBoxMate</a>.</p>
<p><strong>What Is CheckBoxMate?</strong> This script allows you to check multiple  checkboxes just by drawing a box around them.</p>
<p>It doesn't get any more elegant than that and it's one of those tools you don't use every day but when you need it, it's a godsend. The trouble is, it doesn't seem to work at all (without tweaking) with Firefox 3.6+. That's where Greasemonkey comes in.</p>
<p>In a desperate attempt at making my precious CheckBoxMate work with my updated Firefox script, I decided to look under the hood to see if I could figure out the solution to the issue. After an hour of poking and prodding, I was able to troubleshoot and fix the problem using the Add-on's javascript in Greasemonkey (pretty handy way to diagnose Add-on problems in general, actually).</p>
<p><strong>Summary</strong>: CheckBoxMate stopped working, so I jammed it into Greasemonkey, fixed it and released it on userscripts.org.</p>
<p>I'm currently using <a title="CheckBoxMate for Greasemonkey" href="http://userscripts.org/scripts/show/73700" target="_blank">CheckBoxMate for Greasemonkey</a> with Firefox 3.6.3 on Mac OS X 10.6.3 with absolutely zero problems.</p>
<p>[<a href="http://userscripts.org/scripts/source/73700.user.js">Install CheckBoxMate for Greasemonkey</a>]</p>
</div>
<p>P.S. I've done all of this essentially without nrlz's permission at all,  so if he tells me to take this down, I will.</p>
<p><strong>*** UPDATE***</strong></p>
<p>I've tested this on my Windows 7 box at work (Firefox 3.6.3) and it works perfectly. Please let me know if you have any issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2010/04/07/checkboxmate-for-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ShareThis Sucks for Greasemonkey</title>
		<link>http://macdougalmedia.com/2010/03/13/sharethis-sucks-for-greasemonkey/</link>
		<comments>http://macdougalmedia.com/2010/03/13/sharethis-sucks-for-greasemonkey/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 07:59:13 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Greasemonkey Scripts]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=166</guid>
		<description><![CDATA[
After becoming repeatedly annoyed at how the ShareThis button would pop up and just stay there at any hint of a mouseover/hover, I wrote this short Greasemonkey script to banish ShareThis from my sight:
ShareThis Sucks
And here's a link directly to the file:
share_this_sucks.js
Enjoy!
-Scott
]]></description>
			<content:encoded><![CDATA[<p><a href="http://macdougalmedia.com/wp-content/uploads/2010/03/share.this_.sucks_1.png"><img class="alignnone size-full wp-image-170" title="ShareThis Sucks" src="http://macdougalmedia.com/wp-content/uploads/2010/03/share.this_.sucks_1.png" alt="ShareThis Sucks" width="350" height="58" /></a></p>
<p>After becoming repeatedly annoyed at how the ShareThis button would pop up and just stay there at any hint of a mouseover/hover, I wrote this short Greasemonkey script to banish ShareThis from my sight:</p>
<p><a title="ShareThis Sucks" href="http://userscripts.org/scripts/show/71281" target="_blank">ShareThis Sucks</a></p>
<p>And here's a link directly to the file:</p>
<p><a title="ShareThis Sucks Script" href="http://userscripts.org/scripts/source/71281.user.js" target="_blank">share_this_sucks.js</a></p>
<p>Enjoy!</p>
<p>-Scott</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2010/03/13/sharethis-sucks-for-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reddit Tabbed Links</title>
		<link>http://macdougalmedia.com/2010/03/10/reddit-tabbed-links/</link>
		<comments>http://macdougalmedia.com/2010/03/10/reddit-tabbed-links/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 22:02:53 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Greasemonkey Scripts]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Reddit]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=160</guid>
		<description><![CDATA[Put simply, I was just tired of shift+clicking the links on Reddit, so I made a Greasemonkey script that does it for all the main links and comment links:
Reddit Tabbed Links
Here's the direct link to the script:
reddit_tabbed_links.js
Enjoy.
http://userscripts.org/scripts/show/71070Reddit Tabbed Links
]]></description>
			<content:encoded><![CDATA[<p>Put simply, I was just tired of shift+clicking the links on <a title="Reddit" href="http://www.reddit.com" target="_blank">Reddit</a>, so I made a <a title="Greasemonkey for Firefox" href="https://addons.mozilla.org/en-US/firefox/addon/748" target="_blank">Greasemonkey</a> script that does it for all the main links and comment links:</p>
<p><a title="Reddit Tabbed Links" href="http://userscripts.org/scripts/show/71070" target="_blank">Reddit Tabbed Links</a></p>
<p>Here's the direct link to the script:</p>
<p><a href="http://userscripts.org/scripts/source/71070.user.js">reddit_tabbed_links.js</a></p>
<p>Enjoy.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">http://userscripts.org/scripts/show/71070Reddit Tabbed Links</div>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2010/03/10/reddit-tabbed-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MemcacheD + PHP + MySQL = Dream Team</title>
		<link>http://macdougalmedia.com/2010/02/25/memcached-php-mysql-dream-team/</link>
		<comments>http://macdougalmedia.com/2010/02/25/memcached-php-mysql-dream-team/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 01:37:55 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[MemcacheD]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=150</guid>
		<description><![CDATA[
When using development frameworks like CakePHP, Zend or even Smarty, I always took their ability to cache data for granted. After all, I hadn't built all of my applications using frameworks and those that were lacking didn't seem to be hurting too badly. It just seemed like a bonus for using their environments and while [...]]]></description>
			<content:encoded><![CDATA[<p><a title="memcached" href="http://memcached.org" target="_blank"><img class="alignnone size-full wp-image-154" title="memcached" src="http://macdougalmedia.com/wp-content/uploads/2010/02/memcached.jpg" alt="memcached" width="600" height="186" /></a></p>
<p>When using development frameworks like CakePHP, Zend or even Smarty, I always took their ability to cache data for granted. After all, I hadn't built all of my applications using frameworks and those that were lacking didn't seem to be hurting too badly. It just seemed like a bonus for using their environments and while I was very aware of the fact that caching reduces stress on the database, I hadn't really built anything that was in dire need of caching as a means of improving overall functionality.</p>
<p>Once I started learning about memcached, I actually started to think about my non-frameworked applications and whether there were any noticeable lags. It wasn't long before I had thought of a few glaringly obvious examples where (mem)caching could be used to significantly improve performance. But before I go into those examples, here is a brief explanation of what memcached does for you (taken directly from <a title="memcached" href="http://memcached.org" target="_blank">memcached.org</a>):</p>
<blockquote>
<div>
<div id="mc-is">
<h3>What is Memcached?</h3>
<p><strong>Free &amp; open source, high-performance, distributed  memory object caching system</strong>, generic in nature, but intended  for use in speeding up dynamic web applications by alleviating database  load.</p>
<p>Memcached is an in-memory key-value store for small chunks of  arbitrary data (strings, objects) from results of database calls, API  calls, or page         rendering.</p>
<p><strong>Memcached is simple yet powerful</strong>. Its simple  design promotes quick deployment, ease of development, and solves many  problems facing large data caches. Its <a href="http://code.google.com/p/memcached/wiki/Clients" target="_blank">API</a> is  available for most popular languages.</p>
</div>
</div>
</blockquote>
<p>So first on my list was <a title="Blogflare" href="http://www.blogflare.com" target="_blank">Blogflare.com</a>, with its MySQL-based statistical cruncher running on regular intervals and its PHP-based image tickers, the load on the database was strained on a very regular basis. I noticed if I just adjusted the simple database calls to push updates to memcached and then check memcached for data before I even touch the database, performance significantly increased on the front-end. Additionally, this same improvement was helpful in terms of serving out ticker images that are normally database-driven. With these two simple changes, load on the database dropped enough to make scaling much less of a pain. This is relevant, too, as the site has grown steadily over the past few months and shows no signs of stopping.</p>
<p>The next item on the list is one I can't actually link you to but an application that I've built for the <a title="Claire Trevor School of the Arts" href="http://www.arts.uci.edu" target="_blank">University's Art School</a> to handle finance planning and reporting for graduate students. After a few moments of thinking about its structure I realized the database is very read-heavy, particularly in the reporting area. Reports are generated from stored procedures and perform some pretty heavy calculations on each student's data in order to provide administrators with a very accurate picture of spending and planned spending. Updating the database calls for insert/update/delete methods to perform calls to memcached first proved to be ENORMOUSLY effective at speeding up use of the database. While this helps to reduce load on the server, the most important factor in this case was how much better the overall user experience was. Lagginess became intermittent rather than constant.</p>
<p>When I was researching memcached and wondering about how such a thing would scale, I found a clipping from this article entitled <a title="How to Dramatically Speed Up Your Web Application: An Introduction to memcached" href="http://www.majordojo.com/2007/03/memcached-howto.php" target="_blank">How to Dramatically Speed Up Your Web Application: An Introduction to memcached</a> very helpful-</p>
<blockquote><p>No doubt if you took Computer Science in school you were cautioned of  the temptation to abuse caches because there is a law of diminishing  returns in regards to the size of your cache: the larger your cache gets  the more costly it is retrieve and store information within it.  Memcache however is not heavily constrained in this way, because the  cache at large is made up of lots of little caches. This allows  memcached to be much more responsive even when the cache itself begins  to reach sizes that might be really inefficient in other circumstances.</p></blockquote>
<p>So this little bit managed to assuage my fears and give me the confidence to jump right in and start testing it with my lesser-applications. The results, even this early, have been astounding and I can now see how they are a very vital part of modern web application development.</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2010/02/25/memcached-php-mysql-dream-team/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use jQuery to Tally Forms</title>
		<link>http://macdougalmedia.com/2009/12/11/use-jquery-to-tally-forms/</link>
		<comments>http://macdougalmedia.com/2009/12/11/use-jquery-to-tally-forms/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 23:41:00 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=136</guid>
		<description><![CDATA[
Recently, I had the task of creating a simple form to be submitted to a specific department member here on campus. I felt this was a great opportunity to utilize jQuery and to see just how simple I could make adding new fields, since I wanted the form to be somewhat dynamic (adding/removing of inputs [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://macdougalmedia.com/wp-content/uploads/2009/12/travel_expenses.png"><img class="size-full wp-image-148 alignnone" title="Travel Expenses" src="http://macdougalmedia.com/wp-content/uploads/2009/12/travel_expenses.png" alt="Travel Expenses" width="616" height="245" /></a></p>
<p>Recently, I had the task of creating a simple form to be submitted to a specific department member here on campus. I felt this was a great opportunity to utilize jQuery and to see just how simple I could make adding new fields, since I wanted the form to be somewhat dynamic (adding/removing of inputs and such).</p>
<p>After trying a few methods here and there, I was able to utilize a few jQuery functions and a nice plugin (<a title="jQuery Format Currency" href="http://code.google.com/p/jquery-formatcurrency/" target="_blank">jquery-formatcurrency</a>) to make everything work as desired.</p>
<p>Here is what I came up with:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> total <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.currency'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		total <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.add'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span>obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			total <span style="color: #339933;">+=</span> $<span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.subtract'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span>obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			total <span style="color: #339933;">-=</span> $<span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#total'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>total<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.currency'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">formatCurrency</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>symbol<span style="color: #339933;">:</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>What's neat about this method is that it handles everything on the blur (loss of focus) of any element with the 'currency' class applied. That means it won't do anything to the field while a person is typing in it -- annoying for some people -- it waits until the user moves on to the next field or away from the field altogether.</p>
<p>The really cool part of what happens first is the mathematical operation. Notice the similarity between the following methods:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.add'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span>obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	total <span style="color: #339933;">+=</span> $<span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.subtract'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span>obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	total <span style="color: #339933;">-=</span> $<span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The first method looks at all elements with the 'add' class applied. The <strong>.each</strong> jQuery function cycles through each matched element and feeds two variables to the attached function: an incremented index and the object reference itself. This makes a tally extremely simple as jQuery will automagically cycle through all the elements you want to either add or subtract based on what class you have applied. The same applies to both classes and, of course, can be extended if you want to do more complex mathematics or formatting to your fields.</p>
<p>After these methods run, the <em>total</em> variable now holds the correct sum for all fields properly classed either 'add' or 'subtract.' This can now be applied to the input field with an id of 'total':</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#total'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>total<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This will set the 'total' input field's value to the sum of the fields.</p>
<p>Lastly, it will format all fields to currency using the <em>formatCurrency </em>function:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.currency'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">formatCurrency</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>symbol<span style="color: #339933;">:</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Notice I specify here that I do not want any currency symbol (e.g. '$') as I specify that outside the field itself to display to the user.</p>
<p>Again, all of this happens every time a field gets updated and loses focus. So yes, it's magic.</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2009/12/11/use-jquery-to-tally-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I am a Web Ninja</title>
		<link>http://macdougalmedia.com/2009/12/11/i-am-a-web-ninja/</link>
		<comments>http://macdougalmedia.com/2009/12/11/i-am-a-web-ninja/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 10:22:07 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[WebDev]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=133</guid>
		<description><![CDATA[I doubt I'll be applying for a job in Amsterdam anytime soon, but I thought I'd see if I could work my way through this test anyway. It doesn't really involve any sort of real web development prowess, really, but it does require some reasonable know-how with Firebug (one of my most favorite tools ever).
The [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_134" class="wp-caption alignleft" style="width: 310px"><a href="http://macdougalmedia.com/wp-content/uploads/2009/12/thesedays-webninja.png"><img class="size-medium wp-image-134 " title="thesedays-webninja" src="http://macdougalmedia.com/wp-content/uploads/2009/12/thesedays-webninja-300x125.png" alt="Are you Ninja enough?" width="300" height="125" /></a><p class="wp-caption-text">Click to Enlarge</p></div>
<p>I doubt I'll be applying for a job in Amsterdam anytime soon, but I thought I'd see if I could work my way through this test anyway. It doesn't really involve any sort of real web development prowess, really, but it does require some reasonable know-how with <a title="Firebug" href="http://getfirebug.com/" target="_blank">Firebug</a> (one of my most favorite tools ever).</p>
<p>The test took me about five minutes (four of which was spent on number three), the last minute was spent on the other questions. That's pretty decent in my mind, but who knows how well other people did?</p>
<p>I really like this style of interviewing though, and I think more companies should use it to weed out the riffraff. It does require a lot of creativity on the design end but, I'd imagine, reduces man hours (spent interviewing and processing) like crazy. If I ever hire more developers, I plan to come up with a puzzle test like this.</p>
<p>If you're interested in seeing how you'll do, <a title="Web Ninja Test" href="http://playground.thesedays.com/ninja/" target="_blank">click here to take the web ninja test</a>.</p>
<p>-Scott</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2009/12/11/i-am-a-web-ninja/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Death To Internet Explorer 6! [Internet Explorer]</title>
		<link>http://macdougalmedia.com/2009/08/10/death-to-internet-explorer-6-internet-explorer/</link>
		<comments>http://macdougalmedia.com/2009/08/10/death-to-internet-explorer-6-internet-explorer/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 21:32:29 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Boycott Internet Explorer]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[Internet Explorer 6]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=126</guid>
		<description><![CDATA[Well it's about time.
It's been nearly ten years of toiling over my CSS and Javascript, trying to give my websites a consistent look and feel across the board. Internet Explorer version 6 has been the bane of my existence and the thorn in my hide. My developer friends and I have discussed boycotting it at [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_127" class="wp-caption alignnone" style="width: 470px"><a href="http://www.cnn.com/2009/TECH/08/06/internet.explorer.six/index.html?iref=mpstoryview"><img class="size-full wp-image-127" title="Kill Internet Explorer 6" src="http://macdougalmedia.com/wp-content/uploads/2009/08/kill_ie6.jpg" alt="Kill Internet Explorer 6" width="460" height="332" /></a><p class="wp-caption-text">Kill Internet Explorer 6</p></div>
<p>Well it's about time.</p>
<p>It's been nearly ten years of toiling over my CSS and Javascript, trying to give my websites a consistent look and feel across the board. Internet Explorer version 6 has been the bane of my existence and the thorn in my hide. My developer friends and I have discussed boycotting it at the risk of losing the eyes of the uninformed millions unknowingly viewing the internet the way it was never meant to be seen. Sure, we might lose their eyes altogether but we'd prefer that over a negative experience.</p>
<p>More recent versions of Internet Explorer aren't as bad and they're getting better at adhering to web standards but there are still some annoying browser-specific quirks we have to deal with every day. All I ask is that people really follow through with this movement.</p>
<p>To read more, <a title="Boycott Internet Explorer" href="http://www.cnn.com/2009/TECH/08/06/internet.explorer.six/index.html?iref=mpstoryview" target="_blank">click here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2009/08/10/death-to-internet-explorer-6-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
