<?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"
	>

<channel>
	<title>Web 3.0, 6 Bladed Razors, 7 Minute Abs &#187; Projects</title>
	<atom:link href="http://www.zachleat.com/web/category/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web</link>
	<description></description>
	<pubDate>Thu, 21 Aug 2008 06:02:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>ALARMd 2 Beta, with Google Calendar Integration</title>
		<link>http://www.zachleat.com/web/2008/04/06/alarmd-2-beta-with-google-calendar-integration/</link>
		<comments>http://www.zachleat.com/web/2008/04/06/alarmd-2-beta-with-google-calendar-integration/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 07:31:59 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[Interface Design]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Alarmd]]></category>

		<category><![CDATA[Google Calendar]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[Youtube]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=111</guid>
		<description><![CDATA[Take a look: ALARMd 2 Beta
Update: added Metric and Unit Circle time formats.
I know, some of you are reading this and thinking to yourself &#8212; genital herpes is more appealing than yet another online alarm clock.  But to that I say, congratulations, that&#8217;s one of the new features in ALARMd 2!
Why did I make [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zachleat.com/Projects/alarmd-beta/">Take a look: ALARMd 2 Beta</a></p>
<p><em><strong>Update</strong>: added Metric and Unit Circle time formats.</em></p>
<p>I know, some of you are reading this and thinking to yourself &#8212; genital herpes is more appealing than yet another online alarm clock.  But to that I say, congratulations, that&#8217;s one of the new features in ALARMd 2!</p>
<p>Why did I make another online alarm clock?  Mostly due to missing features and limitations in the old version, but also because it&#8217;s a good exercise in JavaScript programming and User Interface design.  Everyone likes to hone their skills, and this is my publicly viewable work desk.  But the real reason I went back to rewrite the old version is that I&#8217;m hooked on <a href="http://jquery.com">jQuery</a>.  I can&#8217;t get enough of that sweet, sweet, source code, and couldn&#8217;t stand to see my old, crusty, handwritten DOM manipulations polluting web browsers across the world.  Users of the Yahoo User Interface Library (what I used for the original version of ALARMd) would do well to consider jQuery a nice plugin to be used alongside YUI.  It will clean up your code MAX_INT-fold.</p>
<p>Here are a few new features and addressed limitations in ALARMd 2.</p>
<ul>
<li>Easy Alarm Mode: No more fumbling around when you just want one simple easy-to-add alarm.</li>
<li>Google Calendar Alarm Mode: Customize your alarm schedule to your heart&#8217;s content, it will load your alarms straight from a publicly available Google Calendar.  There are some great features with this:
<ul>
<li>Load only the first calendar event of every day</li>
<li>Day Limiter (Example: Only load calendar events within the next 3 days)</li>
<li>Minute Adjuster (Example: Alarm me 90 minutes before work without adding a separate event)</li>
<li>Google does a nice job of normalizing dates as well, so you don&#8217;t have to worry about calendar time syncing.  If it says 8AM on your calendar, it&#8217;s going to alarm you at 8AM on your computer&#8217;s local time.</li>
</ul>
</li>
<li>New Clock Formats:
<ul>
<li>Human Readable Clock Format: Think &#8220;Half Past Two&#8221;, or &#8220;Quarter Til Twelve&#8221;.  This idea is from <a href="http://www.insightoutsight.co.uk/viewproject.php?cid=2&#038;pid=3&#038;iid=2">Laurence Willmott&#8217;s Project &#8220;It&#8217;s about Time&#8221;</a>.  I took some liberties with his labeling scheme, I hope he doesn&#8217;t mind too much.</li>
<li><a href="http://zapatopi.net/metrictime/">Metric Time Format</a>: Shows the measurement Centi-days in Local Metric Time.  Basically, it&#8217;s a percentage of much of the day has passed.  If it&#8217;s 80.000, 80 percent of the day has passed, which coincides with 7:12 PM.</li>
<li>Unit Circle Time Format: Displays the time in radians that would be shown if a clock were <a href="http://www.cafepress.com/poofietomato.49111330">pasted on top of a unit circle</a>.  If it&#8217;s 12 o&#8217;clock, it will read &pi;/2.  After programming this one, it&#8217;s starting to seem normal in my brain.  Oh, it&#8217;s 3&pi;/2?  Time to eat dinner.  How the hell did it get 2&pi;/3??</li>
</ul>
</li>
<li><a href="http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/">Human Readable Alarm Dates</a>: Think &#8220;29 Minutes&#8221;, &#8220;1 Hour&#8221;, &#8220;2 Days Ago&#8221;.</li>
<li>Much cleaner interface, using a jQuery accordion to display the options.</li>
<li>The old ALARMd required an internet connection for all sources, and provided no safeguard if your internet went down whilst you were sleeping.  ALARMd 2 preloads all Youtube videos in the background when the page loads using the new <a href="http://apiblog.youtube.com/2008/03/something-to-write-home-about.html">Youtube JavaScript API</a>.  A nice benefit of this is that the browser window no longer requires focus to play the YouTube video.</li>
<li>Less clunky interface for adding new alarm sources.</li>
<li>Repeat option for YouTube videos and MP3&#8217;s.  Turn infinite loop on or off.  Careful with this one.  Don&#8217;t leave ALARMd going if you&#8217;re not going to be home when it goes off.</li>
<li>CSS Skins, Use the really simple ones I&#8217;ve included for Red, Green, or Blue, or include your own URL to your own hosted CSS file.  Have a good skin?  I&#8217;ll include it in the select list and give you some props here, just link to it in the comments below.  Use some CSS class hooks to spice up your skins (they are mutually exclusive).  These are CSS classes that are added to the body tag to allow you to style the alarm differently depending on the alarm clock&#8217;s current state.  <em>Future enhancements</em> might include more than just alarm-based hooks: Year, day of the year, and hour of the day might be useful, that way you could style the clock to show a lighter background during the day and a darker background at night.
<ul>
<li>.alarmWithin30Minutes</li>
<li>.alarmWithin15Minutes</li>
<li>.alarmWithin5Minutes</li>
<li>.alarmWithin1Minute</li>
<li>.alarmActive (Alarm is being played)</li>
</ul>
</li>
<li>Still has all the old favorites:
<ul>
<li>Test Button to make sure the video or source is working and to check your volume.</li>
<li>Count Down mode to show the time between now and the first alarm.</li>
<li>Store your own list of alarm sources, using YouTube, MP3, Last.FM, or any URL (Pandora is included).</li>
<li>Military time (24 hour clock) and seconds toggle.</li>
<li>Naked mode (get rid of the extras)</li>
</ul>
</li>
</ul>
<p>Finished reading?  I&#8217;m surprised you didn&#8217;t click the link at the top: <a href="http://www.zachleat.com/Projects/alarmd-beta/">ALARMd 2 Beta</a></p>
<p>Remember, this is BETA.  That means it&#8217;s new.  I&#8217;ve done my best to test and code out all the kinks, but there may be a few that slipped through.  Try it out and please report any bugs.  And once again, this code is released under the BSD license.</p>
<p>I&#8217;ll probably move this to the main ALARMd.com domain shortly.</p>
<p>Alarmd has been personally tested with Firefox 2, Firefox 3, Internet Explorer 7, Safari 3.1, and Opera 9.27, all on Windows.  Google GDATA reports an unsupported browser error on Safari and Opera, which you can hide using custom CSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2008/04/06/alarmd-2-beta-with-google-calendar-integration/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Yet Another Pretty Date JavaScript</title>
		<link>http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/</link>
		<comments>http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 02:53:34 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Dates]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/</guid>
		<description><![CDATA[I can't let this Pretty Date thing go.  I decided to use a modification of John Resig's Pretty Date JavaScript implementation written by Dean Landolt and shared in the comments on John's page.  The script was an obvious choice for the next iteration of Alarmd, which is nearing completion as I type.
The more [...]]]></description>
			<content:encoded><![CDATA[<p>I can't let this Pretty Date thing go.  I decided to use a modification of <a href="http://ejohn.org/blog/javascript-pretty-date/">John Resig's Pretty Date JavaScript implementation</a> written by Dean Landolt and shared in the comments on John's page.  The script was an obvious choice for the next iteration of <a href="http://www.zachleat.com/web/2007/06/18/wake-up-to-youtube-on-my-internet-alarm-clock/">Alarmd</a>, which is nearing completion as I type.</p>
<p>The more I used <a href="http://deanlandolt.com/archives/163">Dean Landolt's script</a>, the more problems I began to see with his implementation.  It was a good start, but definitely had bugs.  His assumptions translating from integer second differences to human readable labels stretched too far at times (there is an error in logic to say anything between 24 hours and 48 hours from now can be labeled "Tomorrow"), and he was a bit loose with his difference categories (assumed average month length was 28 days, and always used Math.floor instead of rounding -- 47 hours from now would be labeled "1 Day").  It was great code otherwise, and I definitely liked the way he used the while loop to run through the comparisons.</p>
<p>So, I've cleaned up his great start, and am releasing it to the world in the spirit of cooperation and open sauce.  You just read that typo out loud didn't you?</p>
<p><strong>Download</strong>: <a href="http://www.zachleat.com/Lib/jquery/humane.js">Yet Another Pretty Date Implementation</a> (2 KB)</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/JavaScript" rel="tag">JavaScript</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ALARMd now supports URLs</title>
		<link>http://www.zachleat.com/web/2007/08/21/alarmd-now-supports-urls/</link>
		<comments>http://www.zachleat.com/web/2007/08/21/alarmd-now-supports-urls/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 00:28:22 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Alarmd]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/08/21/alarmd-now-supports-urls/</guid>
		<description><![CDATA[When you add an alarm source to ALARMd, the Internet Alarm Clock, it will now default to opening the input URL in a new window, if the URL is determined not to be an MP3, Youtube video, or a LAST.FM user or tag.
I added this to use maLArquee as an alarm.  For instance you [...]]]></description>
			<content:encoded><![CDATA[<p>When you add an alarm source to <a href="http://www.zachleat.com/Projects/alarmd/">ALARMd, the Internet Alarm Clock</a>, it will now default to opening the input URL in a new window, if the URL is determined not to be an MP3, Youtube video, or a LAST.FM user or tag.</p>
<p>I added this to use <a href="http://www.zachleat.com/Projects/Malarquee/">maLArquee</a> as an alarm.  For instance you can try adding this one to your ALARMd for a nice wake up message.</p>
<p><a href="http://www.zachleat.com/Projects/Malarquee/index.html?text=Jnxr%2520hc!!!">http://www.zachleat.com/Projects/Malarquee/index.html?text=Jnxr%2520hc!!!</a></p>
<p>Of course the obvious downfall of this approach is that your target website would need sound if you wanted to actually use it to wake up.  But you could also use it to open up a new window at a specific time to prank a friend, coworker, or loved one.  Try setting up ALARMd to use a naked lady website as a target url on your coworkers computer and set the time for right after lunch!  Or open ALARMd up on your colleague's computer and get it to open a competitor's website during a big presentation to the company president.</p>
<p>Fun to be had by all, I'm sure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/08/21/alarmd-now-supports-urls/feed/</wfw:commentRss>
		</item>
		<item>
		<title>maLArquee, Bringing Back the Marquee</title>
		<link>http://www.zachleat.com/web/2007/08/20/malarquee-bringing-back-the-marquee/</link>
		<comments>http://www.zachleat.com/web/2007/08/20/malarquee-bringing-back-the-marquee/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 02:41:51 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Malarquee]]></category>

		<category><![CDATA[Mootools]]></category>

		<category><![CDATA[NTP]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/08/20/malarquee-bringing-back-the-marquee/</guid>
		<description><![CDATA[What did you spend your Saturday afternoon on?  Did you kick up your feet in your hammock with a nice glass of lemonade in the shade of your favorite tree and read the HTML specification?  Me too!  Who knew that we'd have so much in common?  Since you're obviously like me, [...]]]></description>
			<content:encoded><![CDATA[<p>What did you spend your Saturday afternoon on?  Did you kick up your feet in your hammock with a nice glass of lemonade in the shade of your favorite tree and read the HTML specification?  Me too!  Who knew that we'd have so much in common?  Since you're obviously like me, you've probably wondered to yourself: where did the marquee tag go?  Why isn't the internet graced with scrolling text gently flowing like a babbling brook across the pixels of your web browser?  Well since you spent your Saturday reading the HTML specifications, you would know that the <code>&lt;marquee&gt;</code> tag was only supported by Internet Explorer, and wasn't even a part of the HTML spec.  Unbelievable right?  And to think the <code>&lt;blink&gt;</code> tag I came to know and love wasn't part of the spec either!  I'm just offended as you, let me reassure you.  </p>
<p>Well today, we're going to solve all of that.  Today, I'm going to show you a full screen web browser marquee that will both amaze and excite you.  Here we go:</p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/9OiF8Hd6Db0"></param><embed src="http://www.youtube.com/v/9OiF8Hd6Db0" type="application/x-shockwave-flash" width="425" height="350"></embed></object></p>
<p><a href="http://www.zachleat.com/Projects/Malarquee">http://www.zachleat.com/Projects/Malarquee</a></p>
<h2>What is it for?</h2>
<p>There are a few obvious uses, I suppose.  You can send someone a nice greeting in an email link (it does a ROT13 encoding to mask the text inside the link).  Try one of these:</p>
<p>For a spouse: <a href="http://www.zachleat.com/Projects/Malarquee/index.html?text=V%2520jnag%2520n%2520qvibepr.">I want a divorce.</a></p>
<p>For an employee: <a href="http://www.zachleat.com/Projects/Malarquee/index.html?text=Lbh'er%2520sverq.">You're fired.</a></p>
<p>For a doctor: <a href="http://www.zachleat.com/Projects/Malarquee/index.html?text=V'z%2520fbeel%257Cohg%2520lbh%2520unir%257Cnany%2520jnegf.">I'm sorry but you have anal warts.</a></p>
<p>For your son or daughter: <a href="http://www.zachleat.com/Projects/Malarquee/index.html?text=Lbh%2520jrer%2520nqbcgrq.">You were adopted.</a></p>
<h2>So, what else does it do?</h2>
<p>I knew you'd ask.  If you click the Options link in the top right corner, you can scroll your text across <strong>multiple web clients</strong>!  Input the number of clients you'd like to use and the number of your current client.  Hit the update and save button to refresh your page.  It will automatically parse your text accordingly (adding extra spaces at the end as blank slides if needed).  You can test this using one computer by bringing up the following two links in separate windows side by side (you can use a different web browser for each link if you'd like):</p>
<p><a href="/Projects/Malarquee/index.html?c=1&#038;n=2">maLArquee Client #1</a><br />
<a href="/Projects/Malarquee/index.html?c=2&#038;n=2">maLArquee Client #2</a></p>
<p>You could also go into a computer lab and scroll some text on a couple different computers.</p>
<h2>Why?</h2>
<p>I think it's fun to try new things on the web, experiment a bit.  That's also why I made <a href="http://www.zachleat.com/web/2007/06/18/wake-up-to-youtube-on-my-internet-alarm-clock/">ALARMd, an Internet Alarm Clock</a>.  For this project, I think it might be fun to try a new JavaScript library, just to get a little bit more experience with a range of different coding types.  So I decided to use <a href="http://www.mootools.net/">MooTools</a>, and wrote <a href="http://www.zachleat.com/web/2007/07/22/what-sound-does-a-cow-make-mootools/">a little review</a> on my experience, coming from a YUI and jQuery background.</p>
<h2>How does it work?</h2>
<p>Every 5 scrolls (I reserve the right to change this number at any time I so wish to conserve bandwidth), the page makes an XmlHttpRequest to the server, gets the server time, and adjusts the delay of the next scroll event to synchronize scrolling between multiple browsers.  Ideally, if every computer were the same, we could just do a single XmlHttpRequest at page load and do a standard interval for scrolling.  But we all know that every web browser is different, and just because you do a setInterval(yourFunction,1000) doesn't mean it's actually going to run yourFunction every second.  It might run in 1010 ms or 990 ms.  Thus, the XmlHttpRequest is needed to resynchronize all of the clients to a standard clock.</p>
<p>If there is any interest, I'll post the code to the time.php script that returns the JSON containing the server time.</p>
<h2>What would you do different next time?</h2>
<p>I told my gracious web host about this project after I was approximately 90% complete with it, and his response was: "Did you use NTP?", with which I replied: "What is NTP?"  Ugh.  There is even a <a href="http://jehiah.cz/archive/ntp-for-javascript">JavaScript implementation</a>.</p>
<p>In order to provide balance and order to the universe, please read <a href="http://www.mcli.dist.maricopa.edu/tut/tut17.html">the following link</a>.</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/JavaScript" rel="tag">JavaScript</a>, <a href="http://technorati.com/tag/Mootools" rel="tag"> Mootools</a>, <a href="http://technorati.com/tag/marquee" rel="tag"> marquee</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/08/20/malarquee-bringing-back-the-marquee/feed/</wfw:commentRss>
		</item>
		<item>
		<title>20/20 Hindsight, a Look Back at ALARMd</title>
		<link>http://www.zachleat.com/web/2007/07/22/2020-hindsight-a-look-back-at-alarmd/</link>
		<comments>http://www.zachleat.com/web/2007/07/22/2020-hindsight-a-look-back-at-alarmd/#comments</comments>
		<pubDate>Sun, 22 Jul 2007 07:29:27 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Alarmd]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/22/2020-hindsight-a-look-back-at-alarmd/</guid>
		<description><![CDATA[Now that the traffic has died down a little bit on ALARMd, I'd like to write a little bit about my experiences with something I don't think anyone predicted would garner so much interest.
The day I sent the link to the LifeHacker editor, I purchased the alarmd.com domain.  My thoughts on the domain were [...]]]></description>
			<content:encoded><![CDATA[<p>Now that the traffic has died down a little bit on ALARMd, I'd like to write a little bit about my experiences with something I don't think anyone predicted would garner so much interest.</p>
<p>The day I sent the link to the LifeHacker editor, I purchased the alarmd.com domain.  My thoughts on the domain were that I should have it just in case I decided to host the clock on the domain for easy access, and I certainly didn't want anyone else to have it.  That turned out to be a good idea since an unnamed internet charlatan purchased a similar domain mere hours after I had purchased mine and pointed it to his website.  This same person was going onto various blogs and websites where ALARMd had been posted saying that it was a ripoff of his site, which of course was not true.  I'm sure he got some traffic from it, and certainly am curious about the liberties he takes with the truth just to make a buck.  Obviously I am not going to post a link to his website, since I do not want him to receive any traffic to his Google Ads machine.  I hope that you, as a reader of my website, will trust that anything linked to this guy's name is not worth any of your time.</p>
<p>The link was posted to LifeHacker, and my meager website went from an average of 50 hits a day to receiving 87000 hits in two weeks.  In the end, I got more visitors from stumbleupon than LifeHacker, which is really a testament to that website's popularity.</p>
<p>It was on delicious popular bookmarks for a while.  It actually also ended up being on television.  I know, I know, it seems ridiculous to even put websites on television, but it was.  A lady named Erin O'Hearn does a segment called "Right Now on the Net" for Channel 6 Action News in Philadelphia.  She had a blurb about it and you can <a href="http://rightnow.6abc.com/2007/06/great-discoveri.html">even watch it here</a> [Skip to 1:07].  I guess it was also on an internet radio show called "Techtalk Radio" and was featured as their site of the week.  You can <a href="http://www.techtalkradio.com/podcast/07152007.mp3">listen to that podcast here</a> [Skip to 47:09], even though they pronounce my name "Zach-A-Lot" and are obsessed with the "Naked" checkbox.  But to be fair, who isn't obsessed with Naked checkboxes?</p>
<p>And just recently, I put up the alarmd.com domain as a redirect to the site for all the hard-core users still going to it and using it.  It's still getting a couple of hundred hits a day.  </p>
<p>So, hindsight.  The alarm clock is a device that everyone uses and easily relates to, but also a device that people have low expectations for.  Most alarms only have one or two times they go off for, and with only a few options for alerting: buzzer or radio.  Most go off every day, even on the weekends when you want to sleep in.  But people put up with their crappy alarm clocks because there is literally no good alarm clock hardware out there.  And some of the features I've put into ALARMd can also be seen in alarm clocks that cost over $100 USD.  Ridiculous.  I would bet that there is a huge market for someone to come out with an alarm clock that does suck and costs $40, or maybe people just want to use their cell phones all the time.  I wonder if the iPhone alarm is any good.  Look for my next project, which will be just as, if not more, retarded as the Internet Alarm Clock.</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/alarmd" rel="tag">alarmd</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/07/22/2020-hindsight-a-look-back-at-alarmd/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DOMDom, easy DOM Element Creation</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/</link>
		<comments>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comments</comments>
		<pubDate>Sun, 08 Jul 2007 04:59:31 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[CSS Selectors]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[ExtJS]]></category>

		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/</guid>
		<description><![CDATA[Generally when approaching a complex problem involving web programming in JavaScript, the first question I ask myself is 'What would Jesus do?'  As much as I am entertained by a mental picture of Mr. Jesus himself sitting on his Jesux Distro appending children (and parents) into his DOM, I am instead distracted by an [...]]]></description>
			<content:encoded><![CDATA[<p>Generally when approaching a complex problem involving web programming in JavaScript, the first question I ask myself is 'What would Jesus do?'  As much as I am entertained by a mental picture of Mr. Jesus himself sitting on his <a href="http://www.geocities.com/ResearchTriangle/Node/4081/">Jesux Distro</a> appending children (and parents) into his DOM, I am instead distracted by an intense "passionate" hatred for Mel Gibson swelling in my chest.  It's actually quite distracting to the problem I am having, but I calm myself by punching my 4 foot tall inflatable Mad Max and wonder how much time I waste doing this.  I figure it happens about twice an hour.  (Digression)</p>
<p>The DOM.  Arch-nemesis of web developers attempting to support the ultimately tiny (I think it's down to about 5 or 8% now?) sliver of browser market share that Internet Explorer currently entails.  Let's make it easier on ourselves and make a little package to do it for us.  Run a function, pass in an argument with a description of the DOM node(s) we wish to create, and have the package auto-correct any bugs we would have encountered during manual creation, and maybe even have it inserted or appended for us.</p>
<p>But wait, why are we doing this when there are literally 80 billion other DOM element creation classes already out there?  It's all about syntax.  The existing packages are incredibly verbose, focusing too much on a complex object structure to describe the nodes, in some cases even having separate objects for attributes inside a single node.  Why not use the syntax we've already come to love in the various DOM query libraries that are available?  Why not use DOMDom? Let's see a few examples:</p>
<p>Single Node String</p>
<div class="syntax_hilite">
<div id="javascript-28">
<div class="javascript"><span style="color: #3366CC;">'div'</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-29">
<div class="code">&lt;div&gt;&lt;/div&gt;</div>
</div>
</div>
<p></p>
<p>Single Node String with ID and Classes</p>
<div class="syntax_hilite">
<div id="javascript-30">
<div class="javascript"><span style="color: #3366CC;">'div#id1.class1.class2'</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-31">
<div class="code">&lt;div id=<span style="color:#CC0000;">"id1"</span> class=<span style="color:#CC0000;">"class1 class2"</span>&gt;&lt;/div&gt;</div>
</div>
</div>
<p></p>
<p>Single Node String for a Form Element</p>
<div class="syntax_hilite">
<div id="javascript-32">
<div class="javascript"><span style="color: #3366CC;">'input[name=&quot;myTextBox&quot;,type=&quot;text&quot;,maxlength=&quot;5&quot;]'</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-33">
<div class="code">&lt;input name=<span style="color:#CC0000;">"myTextBox"</span> maxlength=<span style="color:#CC0000;">"5"</span> type=<span style="color:#CC0000;">"text"</span>/&gt;</div>
</div>
</div>
<p></p>
<p>Single Node String with Style Syntax</p>
<div class="syntax_hilite">
<div id="javascript-34">
<div class="javascript"><span style="color: #3366CC;">'div{height=80px,color=#f90,border=1px solid #000}'</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-35">
<div class="code">&lt;div style=<span style="color:#CC0000;">"border: 1px solid #000; height: 80px; color: #f90"</span>&gt;&lt;/div&gt;</div>
</div>
</div>
<p></p>
<p>Complex Single Node String with ID, multiple classes, Style, and Namespaced Attribute) </p>
<div class="syntax_hilite">
<div id="javascript-36">
<div class="javascript"><span style="color: #3366CC;">'div#id1.class1.class2[style=&quot;width:60px;color:#f90&quot;,@class=&quot;class4&quot;,@att=&quot;true&quot;,@namespace:att=&quot;false&quot;]'</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-37">
<div class="code">&lt;div id=<span style="color:#CC0000;">"id1"</span> att=<span style="color:#CC0000;">"true"</span> namespace:att=<span style="color:#CC0000;">"false"</span> class=<span style="color:#CC0000;">"class1 class2 class4"</span> style=<span style="color:#CC0000;">"width: 60px; color: #f90;"</span>&gt;&lt;/div&gt;</div>
</div>
</div>
<p></p>
<p>Multiple Node String: Linear (Parents with one Child)</p>
<div class="syntax_hilite">
<div id="javascript-38">
<div class="javascript"><span style="color: #3366CC;">'div span div'</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-39">
<div class="code">&lt;div&gt;<br />
&nbsp; &nbsp; &nbsp;&lt;span&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div&gt;&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp;&lt;/span&gt;<br />
&lt;/div&gt;</div>
</div>
</div>
<p></p>
<p>Multiple Node String: Non-Linear (Parent with more than one Child)</p>
<div class="syntax_hilite">
<div id="javascript-40">
<div class="javascript"><span style="color: #66cc66;">&#123;</span> <span style="color: #3366CC;">'div'</span>: <span style="color: #66cc66;">&#91;</span> <span style="color: #3366CC;">'span'</span>, <span style="color: #3366CC;">'span'</span> <span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-41">
<div class="code">&lt;div&gt;<br />
&nbsp; &nbsp; &nbsp;&lt;span&gt;&lt;/span&gt;<br />
&nbsp; &nbsp; &nbsp;&lt;span&gt;&lt;/span&gt;<br />
&lt;/div&gt;</div>
</div>
</div>
<p></p>
<h1>How Does It Work?</h1>
<p>By default, it's set up to do HTML Fragments (innerHTML) because they are much speedier than the manual DOM element creation (createElement).  But if you desire, you can toggle a boolean in the code and it will switch back to DOM element creation.  When in DOM element creation mode, it will account for the following browser bugs:</p>
<ul>
<li>(IE6) Standardized for attribute representation (pointer to htmlFor)</li>
<li>(IE6) Standardized case for accesskey, usemap, maxlength, and frameborder attributes.</li>
<li>(IE6) Standardized checked attribute for radio and checkboxes.</li>
<li>(IE6) Special consideration for dynamic handling of name and type attributes (on form elements).</li>
<li>(Firefox) <a href="http://developer.mozilla.org/en/docs/Whitespace_in_the_DOM">Works with whitespace that is treated as a node.</a></li>
</ul>
<h1>Syntax</h1>
<p>You should already be able to tell how to create a node from the examples above.  Here are some more things you might not have guessed:</p>
<p>Creating a node with an id</p>
<div class="syntax_hilite">
<div id="javascript-42">
<div class="javascript"><span style="color: #3366CC;">'div#myId'</span></div>
</div>
</div>
<p></p>
<p>Creating a node with CSS classes</p>
<div class="syntax_hilite">
<div id="javascript-43">
<div class="javascript"><span style="color: #3366CC;">'div.class1.class2'</span></div>
</div>
</div>
<p></p>
<p>Creating two nodes at the same level</p>
<div class="syntax_hilite">
<div id="javascript-44">
<div class="javascript"><span style="color: #66cc66;">&#91;</span> <span style="color: #3366CC;">'div'</span>, <span style="color: #3366CC;">'div'</span> <span style="color: #66cc66;">&#93;</span></div>
</div>
</div>
<p></p>
<p>Creating a node with two children</p>
<div class="syntax_hilite">
<div id="javascript-45">
<div class="javascript"><span style="color: #66cc66;">&#123;</span> <span style="color: #3366CC;">'div'</span>: <span style="color: #66cc66;">&#91;</span> <span style="color: #3366CC;">'div'</span>, <span style="color: #3366CC;">'div'</span> <span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>You can mix the {} and [] syntax wherever you like, but if you want a node to have non-linear children, you have to use the {} object notation.</p>
<p>Creating a text node (start the node declaration with a #, you can change this to another non-conflicting character in the code if you like)</p>
<div class="syntax_hilite">
<div id="javascript-46">
<div class="javascript"><span style="color: #3366CC;">'#Any Text Here'</span></div>
</div>
</div>
<p></p>
<p>Creating a node with attributes (the @ is optional)</p>
<div class="syntax_hilite">
<div id="javascript-47">
<div class="javascript"><span style="color: #3366CC;">'div[class=&quot;class3&quot;,style=&quot;width:60px;color:#f90&quot;,@att=&quot;true&quot;,@namespace:att=&quot;false&quot;]'</span></div>
</div>
</div>
<p></p>
<p>Creating a node with a Style Shortcut (mixing with a style attribute is handled properly)</p>
<div class="syntax_hilite">
<div id="javascript-48">
<div class="javascript"><span style="color: #3366CC;">'div{color=#f90,border=1px solid #000}[style=&quot;height:80px;background:#fff&quot;]'</span></div>
</div>
</div>
<p></p>
<p>A few notes on attributes.  Quotes are required on attributes (single or double but be consistent), but are not required in the style shortcut declaration.  Quotes are not allowed to be nested inside of attributes (a single quote cannot be inside of a double quote and vice versa).</p>
<p>And of course, all of the above can be mixed together</p>
<div class="syntax_hilite">
<div id="javascript-49">
<div class="javascript"><span style="color: #3366CC;">'div#myId.class1.class2{color=#f90}[customAttr=&quot;true&quot;,@customAttr2=&quot;false&quot;] div#child1 div#child2'</span></div>
</div>
</div>
<p></p>
<h1>Usage</h1>
<p><strong>Appending</strong> at the end of a parent's children:</p>
<div class="syntax_hilite">
<div id="javascript-50">
<div class="javascript">DOMDom.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'div'</span>, yourParentNode <span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><strong>Replacing</strong> the children of a parent:</p>
<div class="syntax_hilite">
<div id="javascript-51">
<div class="javascript">DOMDom.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'div'</span>, yourParentNode <span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><strong>Unshifting </strong>(inserting at the beginning of a parent's children):</p>
<div class="syntax_hilite">
<div id="javascript-52">
<div class="javascript">DOMDom.<span style="color: #006600;">unshift</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'div'</span>, yourParentNode <span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><strong>Inserting</strong> before a certain integer index of a parent's children:</p>
<div class="syntax_hilite">
<div id="javascript-53">
<div class="javascript">DOMDom.<span style="color: #006600;">insert</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'div'</span>, yourParentNode, <span style="color: #CC0000;">2</span> <span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// must have at least 3 children, the index is 0 based, if index is null with unshift by default </span></div>
</div>
</div>
<p></p>
<h1>Templates</h1>
<p>Use &lt;$var&gt; to indicate a variable, in this example &lt;$test&gt;</p>
<p><code><br />
// "Compile" the template<br />
var str = DOMDom.compile( { 'div.test span': '#Test &lt;$test&gt;' } );</p>
<p>// Use your template in some context, notice the test variable being set.<br />
for( var j = 0; j < 1000; j++ )<br />
{<br />
	// knows we're using a compiled template since we're passing in variables as a third argument.<br />
	DOMDom.append( str, d, { test: j } );<br />
}<br />
</code></p>
<h3>Benchmarks</p>
<h4>
(If you have Firebug open, make sure it's not on the HTML tab, this will slow down the benchmark significantly)</p>
<p>Most of my work here has been inspired by the DomQuery and DomHelper classes written by JavaScript rock star Jack Slocum (the guy's initials are J.S. for God's sake), so I modeled my benchmark after <a href="http://www.jackslocum.com/blog/examples/domhelper.php">his benchmark hosted on his website to test the DomHelper class</a>.  I'm running the same nodes he's testing on his website, so the results should be comparable.  You can <a href="http://www.zachleat.com/Projects/DOMDom/benchmark.html">test my benchmark for DOMDom here</a>.  Here are some results, reporting the average of 3 results with the format of an uncompiled element first and the compiled template in square brackets.<br />
</h4>
<h2>DOMDom Results</h2>
<p>Internet Explorer 6: 666 ms [328 ms]<br />
Firefox 2.0.0.4: 1880 ms [666 ms]<br />
Safari 3.0.2 [Windows]: 546 ms [151 ms]<br />
Opera 9.21: 343 ms [140 ms]</p>
<h2>Comparative numbers from Jack Slocum's DomHelper</h2>
<p>Internet Explorer 6: 2458 ms [677 ms]<br />
Firefox 2.0.0.4: 672 ms [458 ms]<br />
Safari 3.0.2 [Windows]: 291 ms [119 ms]<br />
Opera 9.21: 370 ms [166 ms]</p>
<p>The thing to take away from this is the question of why Satan is haunting my benchmarks?  Two 666 averages?  Anyway, DOMDom is quite a bit faster in the most popular browser, Internet Explorer, although I haven't tested it on IE7 yet.  In Firefox, the opposite is true, with DomHelper taking the lead.  Opera is comparable and Safari is faster in DomHelper as well.  You can run your own tests using the links above.</p>
<h1>Dependencies</h1>
<p>This library was built to work with Yahoo User Interface (YUI), but could be trivially ported to another library by changing the function dependencies listed in the ADAPTER variable in the code.</p>
<div class="syntax_hilite">
<div id="javascript-54">
<div class="javascript"><span style="color: #003366; font-weight: bold;">var</span> ADAPTER = <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; setStyle: YAHOO.<span style="color: #006600;">util</span>.<span style="color: #006600;">Dom</span>.<span style="color: #006600;">setStyle</span>,<br />
&nbsp; &nbsp; addClass: YAHOO.<span style="color: #006600;">util</span>.<span style="color: #006600;">Dom</span>.<span style="color: #006600;">addClass</span>,<br />
&nbsp; &nbsp; isString: YAHOO.<span style="color: #006600;">lang</span>.<span style="color: #006600;">isString</span>,<br />
&nbsp; &nbsp; isArray: YAHOO.<span style="color: #006600;">lang</span>.<span style="color: #006600;">isArray</span>,<br />
&nbsp; &nbsp; isNumber: YAHOO.<span style="color: #006600;">lang</span>.<span style="color: #006600;">isNumber</span>,<br />
&nbsp; &nbsp; isObject: YAHOO.<span style="color: #006600;">lang</span>.<span style="color: #006600;">isObject</span>,<br />
&nbsp; &nbsp; get: YAHOO.<span style="color: #006600;">util</span>.<span style="color: #006600;">Dom</span>.<span style="color: #006600;">get</span><br />
<span style="color: #66cc66;">&#125;</span>; <span style="color: #009900; font-style: italic;">// to port, change these references </span></div>
</div>
</div>
<p></p>
<p>If you're still reading this encyclopedia, here are some links:</p>
<ul>
<li><span style="font-size: 200%"><a href="http://www.zachleat.com/Projects/DOMDom/DOMDom.js">DOWNLOAD DOMDom</a></span></li>
<li><a href="http://www.zachleat.com/Projects/DOMDom/DOMDom-min-jsmin.js">DOWNLOAD DOMDom Minimized with JSMIN (10KB)</a></li>
<li><a href="http://www.zachleat.com/Projects/DOMDom/DOMDom-min-packer.js">DOWNLOAD DOMDom Minimized with Packer (6KB)</a></li>
<li><a href="http://www.zachleat.com/Projects/DOMDom/benchmark.html">See the benchmark</a></li>
<li><a href="http://www.zachleat.com/Projects/DOMDom/tests.html">See the test file with a bunch of examples of syntax</a></li>
</ul>
<p><a href="http://www.encyclopedia.com/doc/1O27-dom1.html"><em>-dom suffix denoting condition or state, as in freedom, wisdom, or DOMDom</em></a></p>
<p>Technorati Tags: <a href="http://technorati.com/tag/JavaScript" rel="tag">JavaScript</a>, <a href="http://technorati.com/tag/Yahoo" rel="tag"> Yahoo</a>, <a href="http://technorati.com/tag/YUI" rel="tag"> YUI</a>, <a href="http://technorati.com/tag/DOM" rel="tag"> DOM</a>, <a href="http://technorati.com/tag/HTML+Fragments" rel="tag"> HTML Fragments</a>, <a href="http://technorati.com/tag/Jack+Slocum" rel="tag"> Jack Slocum</a>, <a href="http://technorati.com/tag/DomHelper" rel="tag"> DomHelper</a></p>
<p><strong>Update</strong>: changed the variable syntax to allow variables inside of nodes (not just text).</h3>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wake up to YouTube on my Internet Alarm Clock</title>
		<link>http://www.zachleat.com/web/2007/06/18/wake-up-to-youtube-on-my-internet-alarm-clock/</link>
		<comments>http://www.zachleat.com/web/2007/06/18/wake-up-to-youtube-on-my-internet-alarm-clock/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 01:40:07 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[Interface Design]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Alarmd]]></category>

		<category><![CDATA[ExtJS]]></category>

		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/06/18/wake-up-to-youtube-on-my-internet-alarm-clock/</guid>
		<description><![CDATA[Update: Try the new ALARMd 2 Beta, with Google Calendar integration and offline Youtube caching.
Did you take your contacts out last night and you can't see the time on your alarm clock from all the way across the room?  
I'm here to calm your fears.  Enter ALARMD, the Internet Alarm Clock.  Wake [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Update</strong>: Try the new <a href="http://www.zachleat.com/web/2008/04/06/alarmd-2-beta-with-google-calendar-integration/">ALARMd 2 Beta</a>, with Google Calendar integration and offline Youtube caching.</em></p>
<p>Did you take your contacts out last night and you can't see the time on your alarm clock from all the way across the room?  </p>
<p>I'm here to calm your fears.  Enter <a href="http://www.zachleat.com/Projects/alarmd/">ALARMD, the Internet Alarm Clock</a>.  Wake up to any Youtube video (that allows embedding), a last.fm user stream or tag, or any mp3 hosted online.  There are a few defaults in there, but you can add and modify your own.</p>
<p><a href="http://www.flickr.com/photos/zachleat/531165035/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1067/531165035_d2ba407333.jpg" width="500" height="375" alt="Now that's an alarm clock" /></a></p>
<p>Features:</p>
<ul>
<li>Supports multiple alarms (ALT+R to add an alarm or use the Add Alarm button).</li>
<li>Options for 24 Hour (Military) time and Seconds display</li>
<li>Supports MP3 (hosted online), YouTube videos (that allow embedding), and last.fm user or tag streams.</li>
<li>Key Mash Mode to kill the alarm (hit five random keys in one second)</li>
<li>Time Font Size customization (automatically size to the width of the window using the Max option)</li>
<li>Typical alarm clock colors: Red, Green, or Blue</li>
<li>Alarm Toggle based on the Day of the Week</li>
<li>Test button to make sure your speaker volume is set correctly.</li>
<li>Sleep Mode button to get rid of the extra GUI while you don't need it.</li>
<li>Save all of your settings, URL's, and alarms locally in a cookie (you <strong>don't</strong> need yet another account to use this)</li>
</ul>
<p>Things to think about:</p>
<ul>
<li>Power Settings - disable your screen saver, or any sort of automatic suspend or sleep setting.  In my testing, having your monitor go into power save mode is acceptable, and the alarms will still sound (but you might want to test this yourself and leave a comment with your result).</li>
<li>You might not want to use with a CRT, for fear of burn in.</li>
<li>Personally, I like to use this in Opera, just because their default full screen mode (F11) doesn't have toolbars or a status bar.  But you can use the <a href="https://addons.mozilla.org/en-US/firefox/addon/4650">Fuller Screen Firefox plug-in</a> to soup up your Firefox for similar functionality.</li>
<li>Word of warning, the window <strong>must</strong> have focus to autoplay YouTube videos.</li>
<li>Make sure your local time on your computer is correct, especially if you are traveling between time zones.  It doesn't do any server side validation on the time (yet?).</li>
</ul>
<p>Possible Future Improvements:</p>
<ul>
<li>Countdown mode, displays amount of time until next alarm in place of the clock (good for timed presentations, where you want to see how much time is left before you have to quit).</li>
<li>Google Gears integration for offline mode (if your internet goes out during the night)</li>
<li>Support customizing source URL's on a per alarm basis.</li>
<li>Support days of the week toggle on a per alarm basis.</li>
<li>Support user specified color customization.</li>
<li>A crescendo alarm MP3 that increases in volume for a more peaceful wake up experience.</li>
<li>An alarm MP3 with especially violent noises for heavy sleepers.</li>
<li>An alarm MP3 of my mom's voice to get that nice feeling of childhood back.</li>
</ul>
<p>This internet application was built using the Yahoo UI Libraries (YUI) and Jack Slocum's Ext DomQuery class.  It is written entirely without using any server side programming languages, and therefore can be saved to your local machine.  Not that anyone might want to use the Internet Alarm Clock, but if you do, I declare it officially released under the BSD license.  Just don't forget to cite the source when you redistribute.</p>
<p><strong>Update</strong>: added a couple more things to think about.</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/YUI" rel="tag">YUI</a>, <a href="http://technorati.com/tag/DomQuery" rel="tag"> DomQuery</a>, <a href="http://technorati.com/tag/alarm-clock" rel="tag"> alarm-clock</a>, <a href="http://technorati.com/tag/javascript" rel="tag"> javascript</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/06/18/wake-up-to-youtube-on-my-internet-alarm-clock/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaScript Code Coverage Tool for Firebug</title>
		<link>http://www.zachleat.com/web/2007/04/18/javascript-code-coverage-tool-for-firebug/</link>
		<comments>http://www.zachleat.com/web/2007/04/18/javascript-code-coverage-tool-for-firebug/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 20:08:06 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Web Browsers]]></category>

		<category><![CDATA[Code Coverage]]></category>

		<category><![CDATA[Firebug]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[Selenium]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/04/18/javascript-code-coverage-tool-for-firebug/</guid>
		<description><![CDATA[Download FirebugCodeCoverage-0.1.xpi
Recently, I've become interested in client side automated testing tools.  When I found the Selenium plug-in for Firefox, I was blown away.  I can record actions in my browser and play them back!  No more manual testing of JavaScript code!
Researching a little bit more about automated testing tools led to the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zachleat.com/Projects/firebugCodeCoverage/FirebugCodeCoverage-0.1.xpi"><strong>Download FirebugCodeCoverage-0.1.xpi</strong></a></p>
<p>Recently, I've become interested in client side automated testing tools.  When I found the <a href="http://www.openqa.org/selenium-ide/">Selenium</a> plug-in for Firefox, I was blown away.  I can record actions in my browser and play them back!  No more manual testing of JavaScript code!</p>
<p>Researching a little bit more about automated testing tools led to the discovery of a metric called 'Code Coverage', a statistic that gives you a percentage of how much of your code executed during a certain period of time (usually while your automated test was executing).</p>
<p>Of course, I immediately thought of <a href="http://www.getfirebug.com/">Joe Hewitt's Firebug</a> extension for Firefox, which includes a feature for JavaScript Profiling.  The Profile feature of Firebug was similar to a Function Entry Code Coverage report, so I decided to modify the feature and release an add-on for Firefox that showed (at a file level) a list of which functions executed and which functions did not.</p>
<p><img src='http://www.zachleat.com/web/wp-content/uploads/2007/04/coverage.gif' alt='coverage.gif' /></p>
<p>So, now, to test my JavaScript code coverage, I will write automated tests using the Selenium IDE plug-in for Firefox, hit the Code Coverage button in Firebug, and try to get my Code Coverage statistics in the upper 90%'s.</p>
<p>Screenshot Example of running the tool at yahoo.com<br />
<img src='http://www.zachleat.com/web/wp-content/uploads/2007/04/coverage2.gif' alt='Code Coverage' /></p>
<p><a href="http://www.zachleat.com/Projects/firebugCodeCoverage/FirebugCodeCoverage-0.1.xpi"><strong>Download FirebugCodeCoverage-0.1.xpi</strong></a>.</p>
<p><strong>Requirements (obviously)</strong></p>
<ul>
<li>Mozilla Firefox</li>
<li>Firebug Extension for Mozilla Firefox</li>
</ul>
<p><strong>Limitations</strong>:</p>
<ul>
<li>Does not include statistics on anonymous functions.</li>
<li>Is limited to function (entry) code coverage, does not include other forms such as exit, statement, condition, or path code coverage. (Description: <a href="http://en.wikipedia.org/wiki/Code_coverage">Wikipedia</a>)</li>
<li>Is my first Firefox add-on, so there was a learning curve involved.</li>
</ul>
<p><strong>Future Improvements</strong>:</p>
<ul>
<li>Automated integration with Selenium IDE (one button to run tests and do code coverage)</li>
<li>Better display of results, instead of a big kludge of function names</li>
<li>Additional types of coverage, depending on what options are available from <a href="http://www.xulplanet.com/references/xpcomref/ifaces/jsdIDebuggerService.html">jsdIDebuggerService</a></li>
</ul>
<p>Technorati Tags: <a href="http://technorati.com/tag/Firebug" rel="tag">Firebug</a>, <a href="http://technorati.com/tag/Code+Coverage" rel="tag"> Code Coverage</a>, <a href="http://technorati.com/tag/JavaScript" rel="tag"> JavaScript</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/04/18/javascript-code-coverage-tool-for-firebug/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Conservative Design Example: Hierarchical Options</title>
		<link>http://www.zachleat.com/web/2007/03/23/conservative-design-example-hierarchical-options/</link>
		<comments>http://www.zachleat.com/web/2007/03/23/conservative-design-example-hierarchical-options/#comments</comments>
		<pubDate>Fri, 23 Mar 2007 06:52:12 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[Interface Design]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Conservative Design]]></category>

		<category><![CDATA[Hierarchical Select]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/03/23/conservative-design-example-hierarchical-options/</guid>
		<description><![CDATA[Welcome, one and all, to the second installment of actual code examples for the Conservative Design series.  The decision was made (by me) to rename the component in question from the original Hierarchical Select to Hierarchical Options, due to the fact that the hierarchy can consist of any multiple option component, and is not [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome, one and all, to the second installment of actual code examples for the Conservative Design series.  The decision was made (by me) to rename the component in question from the original Hierarchical Select to Hierarchical Options, due to the fact that the hierarchy can consist of any multiple option component, and is not limited to just a select.  And to this face, this particular component was documented in the original post entitled <a href="http://www.zachleat.com/web/2007/02/22/conservative-design-hierarchical-select-boxes/">Conservative Design: Hierarchical Select Boxes</a>.</p>
<p><a href='http://www.zachleat.com/Projects/valdi/hierarchicalOptions.html' title='Hierarchical Options'><img src='http://www.zachleat.com/web/wp-content/uploads/2007/03/hierarchical.gif' alt='Hierarchical Options' /></a><br />
Click the image above to go to the example.</p>
<p>Notes on the example: The Tree structure is as follows:</p>
<ul>
<li>Primary
<ul>
<li>Secondary</p>
<ul>
<li>Tertiary</p>
<ul>
<li>Quaternary</p>
<ul>
<li>Quinary</li>
</ul>
</li>
</ul>
</li>
<li>2nd Tertiary (is a static element that doesn't hide)</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>So without further adieu or out of place french, what do we have?  3 out of 4 requirements and 1 of 2 luxury items.</p>
<ul>
<li>Handles any number of select elements in a linear or tree (luxury item) like structure.</li>
<li>Child select elements are optional based on parent selection.  Can hide entire div element or display a message stating no options are available.</li>
<li>Compliant with the Reset button.</li>
<li>Right now only loads from standard HTML markup (not yet from JavaScript or JSON or an XMLHTTPRequest)</li>
<li>Only supports Select elements for now, in the future should be abstracted to support Checkbox Lists or any multiple option component.</li>
</ul>
<p><strong>Outstanding Bugs</strong>:</p>
<ul>
<li>Opera button doesn't reset properly with Reset Button</li>
<li>Clicking off of the default and then back onto the default has the original selections downstream (but doesn't propagate more than one level)</li>
</ul>
<p>Technorati Tags: <a href="http://technorati.com/tag/JavaScript" rel="tag">JavaScript</a>, <a href="http://technorati.com/tag/Hierarchical+Select" rel="tag"> Hierarchical Select</a>, <a href="http://technorati.com/tag/YUI" rel="tag"> YUI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/03/23/conservative-design-example-hierarchical-options/feed/</wfw:commentRss>
		</item>
		<item>
		<title>OMG SOA</title>
		<link>http://www.zachleat.com/web/2007/03/12/omg-soa/</link>
		<comments>http://www.zachleat.com/web/2007/03/12/omg-soa/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 02:20:43 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
		
		<category><![CDATA[Humor]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[SOA]]></category>

		<category><![CDATA[SOAP]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/03/12/omg-soa/</guid>
		<description><![CDATA[In today's Web 2.0 world of ultimate abstraction, you don't need to be bothered with the rudimentary low level programming functions of everyday languages.  Client Side implementation of JavaScript functions across the browser landscape is unreliable at best, so why should you trust it for anything?  So using forward thinking and futureproof compatibility [...]]]></description>
			<content:encoded><![CDATA[<p>In today's Web 2.0 world of <strong>ultimate abstraction</strong>, you don't need to be bothered with the rudimentary low level programming functions of everyday languages.  Client Side implementation of JavaScript functions across the browser landscape is unreliable at best, so why should you trust it for anything?  So using forward thinking and futureproof compatibility design, naturally we will turn to the next great phase of web's evolutionary growth, the Service Oriented Architecture (SOA).  Using SOAP envelopes to package our function calls, I will now demo what is certainly to be the future of web development, and maybe, all programming endeavors.  I call it: <strong>OMG SOA</strong>.</p>
<div style="text-align: center; background: #fff"><a href='http://h-master.net/web2.0/index.php' title='OMG SOA'><img src='http://www.zachleat.com/web/wp-content/uploads/2007/03/reflectomg-soabeta.png' alt='OMG SOA' /></a></div>
<p>Are you programming a for loop?  How do you know that the client will increment your integers through the loop correctly?  That's why you need to call our <strong>Incrementer Web Service</strong> to increment your loop counter.</p>
<p><em>Sample Service Calls</em>:<br />
Increment 0: <a href="http://www.zachleat.com/Projects/SOA/index.php/incrementer/0">http://www.zachleat.com/Projects/SOA/index.php/incrementer/0</a><br />
Increment 3920: <a href="http://www.zachleat.com/Projects/SOA/index.php/incrementer/3920">http://www.zachleat.com/Projects/SOA/index.php/incrementer/3920</a><br />
Increment 98: <a href="http://www.zachleat.com/Projects/SOA/index.php/incrementer/98">http://www.zachleat.com/Projects/SOA/index.php/incrementer/98</a></p>
<p>Are you programming an array that needs to be magically combined into a string?  Do you think you can reliably count on Internet Explorer to perform the function in the same way as your Firefox's, or your Opera's, or even your (God Forbid) Safari's???  No, dare I say it, no.</p>
<p>But don't fear.  We are here to comfort your pain, with a shot in the arm of standarditity.  Welcome the <strong>String Concatenation Web Service</strong>.</p>
<p><em>Sample Service Call</em>:<br />
Concatenate string1 with string2 with string3: <a href="http://www.zachleat.com/Projects/SOA/index.php/concat/string1/string2/string3/">http://www.zachleat.com/Projects/SOA/index.php/concat/string1/string2/string3/</a></p>
<p>And finally, are you feeling lost in this sea of amorphous web technologies mixing and mashing together to form the gelatinous blob of money and media whores we know as Web 2.0?  Don't worry, OMG SOA is here for you again to solve all of your identity crisis problems.  Ask our <strong>Are you Web 2.0 Web Service</strong> with your URL and the magic 8 ball service will answer your question.</p>
<p><em>Sample Service Call</em>:<br />
Is www.zachleat.com Web 2.0? <a href="http://www.zachleat.com/Projects/SOA/index.php/am-i-web-2.0/www.zachleat.com/">http://www.zachleat.com/Projects/SOA/index.php/am-i-web-2.0/www.zachleat.com/</a></p>
<p>Technorati Tags: <a href="http://technorati.com/tag/soa" rel="tag">soa</a>, <a href="http://technorati.com/tag/soap" rel="tag"> soap</a>, <a href="http://technorati.com/tag/web+2.0" rel="tag"> web 2.0</a></p>
<p><strong>Update</strong>: apparently there is already a company called the Object Management Group with a <a href="http://soa.omg.org/">website about SOA</a>.  Whoops?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/03/12/omg-soa/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
