<?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>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>
	<lastBuildDate>Fri, 30 Jul 2010 01:59:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>ALARMd is now on Github</title>
		<link>http://www.zachleat.com/web/2010/07/21/alarmd-is-now-on-github/</link>
		<comments>http://www.zachleat.com/web/2010/07/21/alarmd-is-now-on-github/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 01:47:40 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Alarmd]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Github]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=726</guid>
		<description><![CDATA[In an effort to mindlessly copy what everyone else on the internet is doing keep current on the latest and greatest Source Code Management tools, I decided that it would be good practice to move my open source project ALARMd (as seen on Lifehacker) from Google Code to Github. Feel free to fork/contribute at your [...]]]></description>
			<content:encoded><![CDATA[<p>In an effort to <del datetime="2010-07-22T00:54:05+00:00">mindlessly copy what everyone else on the internet is doing</del> keep current on the latest and greatest Source Code Management tools, I decided that it would be good practice to move my open source project ALARMd (as seen on <a href="http://lifehacker.com/271043/wake-up-to-a-youtube-video-with-alarmd">Lifehacker</a>) from <a href="/web/2008/10/08/alarmd-is-a-google-code-project/">Google Code</a> to Github.</p>
<p>Feel free to fork/contribute at your leisure.<br />
<a href="http://github.com/zachleat/ALARMd">http://github.com/zachleat/ALARMd</a></p>
<p>If you&#8217;re new, you can check out <a href="http://www.alarmd.com/">ALARMd.com</a> to see what I&#8217;m talking about.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2010/07/21/alarmd-is-now-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maiden Voyage of the DOM Sailbloat</title>
		<link>http://www.zachleat.com/web/2010/07/19/dom-sailbloat/</link>
		<comments>http://www.zachleat.com/web/2010/07/19/dom-sailbloat/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 04:09:28 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[DOM]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[Firebug Lite]]></category>
		<category><![CDATA[log4javascript]]></category>
		<category><![CDATA[YUI Logger]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=698</guid>
		<description><![CDATA[As many of you may already know, my day job includes managing a large and complex enterprise jQuery-based user interface component library. It&#8217;s used by all new web applications at the company, which boasts over an IT department of approximately 1500 people and hundreds of web applications. Needless to say, I get a fair volume [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.zachleat.com/web/wp-content/uploads/2010/07/typhoon-in-macao.jpg" alt="" title="typhoon-in-macao" width="680" height="503" class="aligncenter size-full wp-image-710" /></p>
<p>As many of you may already know, my day job includes managing a large and complex enterprise jQuery-based user interface component library. It&#8217;s used by all new web applications at the company, which boasts over an IT department of approximately 1500 people and hundreds of web applications.  Needless to say, I get a fair volume of interesting support tickets that come my way.  A few weeks ago, I had the pleasure of receiving one such ticket.</p>
<p>The support ticket&#8217;s symptoms included a oft-heard complaint: poor performance.  On the web, poor performance can be attributed to a great many things, but most often can be boiled down to a bottleneck in JavaScript code using the DOM API.  This time, strangely enough, the culprit was something else entirely.</p>
<p>One of the first things I check when an application complains of poor performance is the total size of the document, or how many nodes it has.  One of the best ways to ensure good performance is to keep your document small, especially on projects using heavy dynamic element selection and filtering (think jQuery, Mootools, Prototype, Dojo, or any code using a selector engine like Sizzle).  Any JavaScript library emulating CSS selectors executing over a very large document is going to take quite a bit longer than querying a small document, especially when the user&#8217;s browser doesn&#8217;t support native <code>querySelector</code> or <code>getElementsByClassName</code>.</p>
<p>To get an idea of what the size of a large document is, I usually go to a site with some fairly advanced JavaScript and query their size.</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">// Returns the total number of nodes in the document
document.getElementsByTagName('*').length;
// note: this number will not include any child nodes inside of iframes.</pre></div></div>

<table>
<thead>
<tr>
<th>URL</th>
<th>Total Element Count</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>maps.google.com</code></td>
<td><code>731</code></td>
</tr>
<tr>
<td><code>my.yahoo.com</code></td>
<td><code>1508</code></td>
</tr>
<tr>
<td><code>calendar.google.com (Authenticated)</code></td>
<td><code>681</code></td>
</tr>
<tr>
<td><code>reader.google.com (Authenticated)</code></td>
<td><code>4866</code></td>
</tr>
</tbody>
</table>
<p>Getting back to the support ticket in question.  After querying the document, I quickly found that the page contained over <strong>50000 nodes</strong>.  Wow.  So, we&#8217;ve caught a big one.  You&#8217;re going to be telling your grandkids about this some day.  But, now what?</p>
<p>I decided it would be beneficial to find out where and what all of those nodes were.  After clicking around the live document in the Firebug&#8217;s HTML tab for awhile, looking at View Source, and Ajax requests in the Console, I successfully determined the culprit.  This particular application was using <a href="http://wicket.apache.org/">Wicket</a>, a popular Java library for web applications, which includes its own <em>Ajax Logger</em> component (similar to my favorite <a href="http://log4javascript.org/">log4javascript</a>; or something like the <a href="http://developer.yahoo.com/yui/logger/">YUI Logger</a>), used to keep track of an application&#8217;s Ajax calls and JavaScript page manipulations with an inline GUI embedded in the parent document.  On one page load, this application&#8217;s Ajax logger component had <strong>created 40000 nodes of log content</strong>.</p>
<p>It&#8217;s important to realize that embedding unnecessary content of that magnitude on the page can be very detrimental to performance. <strong>JavaScript loggers should log to a new child window, rather than be embedded in the parent document.</strong>  This way they won&#8217;t bloat the document, but still provide you with much needed logging information.</p>
<p>But, in the future, how might this type of problem be more easily diagnosed and prevented?  Ideally, when confronted with large documents, we want to see where in the document the majority of those nodes are located.  But there isn&#8217;t an easy way to see which portion of the document is using the largest number of nodes, especially if the culprit is deep into the document tree.  We can go through the source code manually, but that isn&#8217;t  very efficient.</p>
<p>So in the spirit of exploratory development to help troubleshoot real-world problems, I decided to make a Firebug Lite plugin.  This would give me an easy cross-browser tool to diagnose my problem in a familiar interface.  Load up Firebug Lite, load the <em>DOM Sailbloat</em> JavaScript file, and easily spot the HTML love handles.</p>
<p>Here&#8217;s what it looks like in action:<br />
<img src="http://www.zachleat.com/web/wp-content/uploads/2010/07/Screen-shot-2010-07-19-at-9.59.49-PM.png" alt="" title="Screen shot of the DOM Sailbloat Firebug Lite plugin" class="aligncenter size-full wp-image-714" /></p>
<h2>Go Forth</h2>
<ol>
<li><a href="http://www.zachleat.com/domsailbloat/">See the demo</a></li>
<li><a href="http://www.zachleat.com/domsailbloat/domsailbloat.js">Download the source</a></li>
<li><a href="http://github.com/zachleat/DOM-Sailbloat">Fork the Sailbloat on GitHub</a></li>
</ol>
<p><em>Note: there is currently an undiagnosed issue with the Sailbloat and it fails to load intermittently.  If you know why, I&#8217;d be happy to put your name in the source code credits.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2010/07/19/dom-sailbloat/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The &#8220;24&#8243; Clock on ALARMd</title>
		<link>http://www.zachleat.com/web/2010/01/24/the-24-clock-on-alarmd/</link>
		<comments>http://www.zachleat.com/web/2010/01/24/the-24-clock-on-alarmd/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 07:37:52 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Alarmd]]></category>
		<category><![CDATA[font-face]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=465</guid>
		<description><![CDATA[If you&#8217;re only using @font-face for titles and text, you&#8217;re missing out on a whole wealth of use cases that have yet to be explored. For instance, I created a very simple 7 Segment Display Numeric font to be used for a skin on alarmd.com and changed the color using nothing but CSS to create [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re only using @font-face for titles and text, you&#8217;re missing out on a whole <a href="http://www.zachleat.com/web/2010/01/03/css-sprites-using-font-face/">wealth of use cases</a> that have yet to be explored.  For instance, I created a very simple <a href="http://fontstruct.fontshop.com/fontstructions/show/282059">7 Segment Display Numeric font</a> to be used for a skin on <a href="http://www.alarmd.com/">alarmd.com</a> and changed the color using nothing but CSS to create the &#8220;24&#8243; Clock (true fans will note that the actual font is italic and <a href="http://www.panopticist.com/2006/05/there_is_something_weird_going_on_with_the_clock_on_24.php">has a serif on the 1</a>).  Nonetheless, this is just another useful application of @font-face.</p>
<p>Take a look at the <a href="http://www.fontsquirrel.com/fonts/list/style/Dingbat">Dingbats section on fontsquirrel</a> to get your brain going in the same direction.</p>
<p><img src="http://www.zachleat.com/web/wp-content/uploads/2010/01/Screen-shot-2010-01-24-at-1.22.39-AM.png" alt="" title="Screenshot of the 24 Clock on alarmd.com"/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2010/01/24/the-24-clock-on-alarmd/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ALARMd Unix Time Format for 1234567890 Day</title>
		<link>http://www.zachleat.com/web/2009/02/13/alarmd-unix-time-format-for-1234567890-day/</link>
		<comments>http://www.zachleat.com/web/2009/02/13/alarmd-unix-time-format-for-1234567890-day/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 19:11:18 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=196</guid>
		<description><![CDATA[In honor of 1234567890 day, I&#8217;ve added the Unix time format to ALARMd. Hit Options, then the Clock Format tab to change to Unix Time. Enjoy!]]></description>
			<content:encoded><![CDATA[<p>In honor of <a href="http://www.1234567890day.com/">1234567890 day</a>, I&#8217;ve added the Unix time format to <a href="http://www.alarmd.com/">ALARMd</a>.</p>
<p>Hit <strong>Options</strong>, then the <strong>Clock Format tab</strong> to change to Unix Time.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2009/02/13/alarmd-unix-time-format-for-1234567890-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scare Your Visitors with this JavaScript Gravatar Plugin</title>
		<link>http://www.zachleat.com/web/2009/01/08/scare-your-visitors-with-this-javascript-gravatar-plugin/</link>
		<comments>http://www.zachleat.com/web/2009/01/08/scare-your-visitors-with-this-javascript-gravatar-plugin/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 03:47:43 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Gravatar]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=157</guid>
		<description><![CDATA[Here's a use case.  An unregistered visitor visits your blog, and decides that your <strong>content is so good that it merits a comment</strong>!  Congratulations, you've fooled them!  But since they're leaving a comment, why not show them a preview of their gravatar?]]></description>
			<content:encoded><![CDATA[<h2><a href="/javascript/gravatar/index.html">See the Demo</a></h2>
<h2><a href="/javascript/gravatar/jquery.gravatar.js">Download the Source Code</a></h2>
<p><br/><br />
<br/></p>
<p><img src="http://www.zachleat.com/web/wp-content/uploads/2009/01/blog-comment.png" alt="Tournology Blog Comment Form" title="blog-comment" width="484" height="266" class="size-full wp-image-158" /></p>
<p>Here&#8217;s a use case.  An unregistered visitor visits your blog, and decides that your <strong>content is so good that it merits a comment</strong>!  Congratulations, you&#8217;ve fooled them!  Now you can <a href="http://www.centernetworks.com/twply-twitter-replies-auction">twply their account details for $1200 on Sitepoint</a>!  Just kidding.  But generally, when you visit a blog&#8217;s commenting section (such as the <a href="http://www.tournology.com/blog/">Tournology Blog</a> shown above), you&#8217;ll see a simple form to authenticate you&#8217;re not a spammer, generally including (among other things) an e-mail address field.</p>
<p><br/><br />
<br/></p>
<p><img src="http://www.zachleat.com/web/wp-content/uploads/2009/01/blog-comment-after.png" alt="Tournology Blog Comment Form With Gravatar" title="blog-comment-after" width="484" height="266" class="size-full wp-image-160" /></p>
<p>Well, since they&#8217;re typing their e-mail address, wouldn&#8217;t it be cool if we could <strong>show them their gravatar</strong> right there, inline with the blog comment form?  Well, that&#8217;s now possible with my new <strong><a href="http://www.zachleat.com/javascript/gravatar/jquery.gravatar.js">JavaScript Gravatar Plugin</a></strong>!  It doesn&#8217;t have any server side language dependencies.</p>
<p><br/><br />
<br/></p>
<p><img src="http://www.zachleat.com/web/wp-content/uploads/2009/01/gravatar-signup.png" alt="Gravatar Signup Page" title="gravatar-signup" width="483" height="265" class="size-full wp-image-162" /></p>
<p>Hell, <a href="http://en.gravatar.com/">gravatar.com</a> could even use this to <strong>improve the user experience of registering your e-mail account</strong>.  Right now it does a full page refresh and doesn&#8217;t even show you a preview!</p>
<p><br/></p>
<h2><a href="/javascript/gravatar/index.html">See the Demo</a></h2>
<h2><a href="/javascript/gravatar/jquery.gravatar.js">Download the Source Code</a></h2>
<p><br/></p>
<h2>Licensing</h2>
<p>
Licensed under the <a href="http://sam.zoy.org/wtfpl/">WTFPL</a>, as highly recommended by <a href="http://foohack.com/">Isaac Schleuter</a> (<a href="/web/2007/04/05/google-using-yui-grids-css/">see discussion</a>).
</p>
<p><br/></p>
<h2>JavaScript Dependencies:</h2>
<ul>
<li>Requires <a href="http://jquery.com">jQuery</a> (Feel free to port and post a link!)</li>
<li>Requires <a href="http://pajhome.org.uk/crypt/md5/md5.js">md5.js</a></li>
</ul>
<p><br/></p>
<h2>Example Usage:</h2>
<p>Easiest form, onblur of email text input field:</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;">'#emailTextField'</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>event<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">after</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">gravatar</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><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: #009900;">&#41;</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></pre></div></div>

<p>Showing all options, again onblur of email text input field.</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;">'#email'</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>event<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">gravatar</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><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: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// integer size: between 1 and 512, default 80 (in pixels)</span>
        size<span style="color: #339933;">:</span> <span style="color: #CC0000;">200</span><span style="color: #339933;">,</span>
        <span style="color: #006600; font-style: italic;">// maximum rating (in order of raunchiness, least to most): g (default), pg, r, x</span>
        rating<span style="color: #339933;">:</span> <span style="color: #3366CC;">'pg'</span><span style="color: #339933;">,</span>
        <span style="color: #006600; font-style: italic;">// url to define a default image (can also be one of: identicon, monsterid, wavatar)</span>
        image<span style="color: #339933;">:</span> <span style="color: #3366CC;">'identicon'</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</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></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2009/01/08/scare-your-visitors-with-this-javascript-gravatar-plugin/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ALARMd is a Google Code Project</title>
		<link>http://www.zachleat.com/web/2008/10/08/alarmd-is-a-google-code-project/</link>
		<comments>http://www.zachleat.com/web/2008/10/08/alarmd-is-a-google-code-project/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 01:29:24 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Alarmd]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=147</guid>
		<description><![CDATA[I received a request this week to participate in development of the internet alarm clock I developed awhile back called ALARMd. It has gone through two major revisions, and my interest in contributing additional source code to the project is waning. I&#8217;ve got other projects. So, I&#8217;ve decided to publish it to Google Code. I [...]]]></description>
			<content:encoded><![CDATA[<p>I received a request this week to participate in development of the internet alarm clock I developed awhile back called <a href="http://www.alarmd.com/">ALARMd</a>.  It has gone through two major revisions, and my interest in contributing additional source code to the project is waning.  I&#8217;ve got <a href="http://www.tournology.com/">other projects</a>.  So, I&#8217;ve decided to publish it to Google Code.  I won&#8217;t be doing new development on the project, but will accept patches and commits to the repository.  Feel free to ask me for project member status.</p>
<p>See <a href="http://code.google.com/p/alarmd/">ALARMd on Google Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2008/10/08/alarmd-is-a-google-code-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fight Registrastination. Register to vote!</title>
		<link>http://www.zachleat.com/web/2008/09/07/fight-registrastination-register-to-vote/</link>
		<comments>http://www.zachleat.com/web/2008/09/07/fight-registrastination-register-to-vote/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 08:14:23 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[geocode]]></category>
		<category><![CDATA[location]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=145</guid>
		<description><![CDATA[Apologies to international readers, this spam message is intended for citizens of the USA only. Thanks for understanding. Have a friend that hasn&#8217;t registered to vote yet? Do your civic duty by guilting them into action. Help them fight registrastination by sharing a link to a big bold deadline. Fight Registrastination. Register to vote NOW! [...]]]></description>
			<content:encoded><![CDATA[<p><em>Apologies to international readers, this spam message is intended for citizens of the USA only.  Thanks for understanding.</em></p>
<p>Have a friend that hasn&#8217;t registered to vote yet?  Do your civic duty by guilting them into action.  Help them fight registrastination by sharing a link to a big bold deadline.</p>
<p><a href="http://www.zachleat.com/registrastination/">Fight Registrastination.  Register to vote NOW!</a></p>
<p>For those demanding technical content from each blog post, the page does use a nice <a href="http://www.maxmind.com/app/javascript_city">JavaScript IP Address Geocoder hosted by MaxMind</a> that&#8217;s worth a look.  It also uses a previously mentioned <a href="http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/">JavaScript Pretty Date Difference</a> script.</p>
<p>Here&#8217;s a few other things that one might also look at if they were making a location aware application:</p>
<ul>
<li><a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding">Google Maps API: Geocoding</a></li>
<li><a href="http://code.google.com/p/gears/wiki/GeolocationAPI">Gears GeoLocation API</a></li>
<li><a href="http://wiki.developers.facebook.com/index.php/Users.getInfo">Parse a Facebook user&#8217;s location.</a></li>
<li><a href="http://apiwiki.twitter.com/REST+API+Documentation#updatelocationnbsp">Twitter&#8217;s API only provides update_location</a>, not a way to get the current location.</li>
<li>As mentioned above, <a href="http://www.maxmind.com/app/ip-location">MaxMind&#8217;s IP Address Geocoding Service</a></li>
<li><a href="http://fireeagle.yahoo.net/">Yahoo&#8217;s FireEagle</a>, <a href="http://brightkite.com/">BrightKite</a>, <a href="http://plazes.com/">Plazes</a>, and <a href="http://www.dopplr.com/">Dopplr</a></li>
</ul>
<p>MaxMind&#8217;s seemed the best fit for my use case: guessing the State of an anonymous user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2008/09/07/fight-registrastination-register-to-vote/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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 [...]]]></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&#8242;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>
		<slash:comments>10</slash:comments>
		</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&#8217;t let this Pretty Date thing go. I decided to use a modification of John Resig&#8217;s Pretty Date JavaScript implementation written by Dean Landolt and shared in the comments on John&#8217;s page. The script was an obvious choice for the next iteration of Alarmd, which is nearing completion as I type. The more I [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;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&#8217;s Pretty Date JavaScript implementation</a> written by Dean Landolt and shared in the comments on John&#8217;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&#8217;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 &#8220;Tomorrow&#8221;), 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 &#8212; 47 hours from now would be labeled &#8220;1 Day&#8221;).  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&#8217;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&#8217;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><strong>Update</strong>: Dates for this script must have a specific <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO8601 format</a>: <em>YYYY-MM-DDTHH:MM:SSZ</em> (in UTC) where T and Z are literals.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>PHP Pretty Date</title>
		<link>http://www.zachleat.com/web/2008/02/10/php-pretty-date/</link>
		<comments>http://www.zachleat.com/web/2008/02/10/php-pretty-date/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 21:13:21 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Dates]]></category>
		<category><![CDATA[Propel]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2008/02/10/php-pretty-date/</guid>
		<description><![CDATA[This class is pretty much a direct port of John Resig&#8217;s JavaScript Pretty Date to PHP 5. A few notes: Requires PHP >= 5.10, due to the usage of PHP&#8217;s new DateTimeclass. The new DateTime object parses strings using PHP&#8217;s strtotime, so you don&#8217;t need to pass in an ISO8601 formatted date, as in JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p>This class is pretty much a direct port of <a href="http://ejohn.org/blog/javascript-pretty-date/">John Resig&#8217;s JavaScript Pretty Date</a> to PHP 5.  A few notes:</p>
<ul>
<li>Requires PHP >= 5.10, due to the usage of PHP&#8217;s new <a href="http://us3.php.net/manual/en/function.date-create.php">DateTime</a>class.</li>
<li>The new DateTime object parses strings using PHP&#8217;s <a href="http://us3.php.net/manual/en/function.strtotime.php">strtotime</a>, so you don&#8217;t need to pass in an ISO8601 formatted date, as in JavaScript Pretty Date. Try &#8220;now&#8221;, or &#8220;next Wednesday&#8221;, or &#8220;+2 weeks 4 days 23 hours 9 seconds&#8221;.</li>
<li>Extended to handle Months and Years in the past (JavaScript version only goes to weeks)</li>
</ul>
<p>Usage:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// pass in a String DateTime, compared to another String DateTime (defaults to now)</span>
<span style="color: #000088;">$myString</span> <span style="color: #339933;">=</span> Date_Difference<span style="color: #339933;">::</span><span style="color: #004000;">getStringResolved</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-7 weeks'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$myString</span> <span style="color: #339933;">=</span> Date_Difference<span style="color: #339933;">::</span><span style="color: #004000;">getStringResolved</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-7 weeks'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'+1 week'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// pass in a DateTime object, compared to another DateTime object (defaults to now)</span>
<span style="color: #666666; font-style: italic;">// useful with the Propel ORM, which uses DateTime objects internally.</span>
<span style="color: #000088;">$myString</span> <span style="color: #339933;">=</span> Date_Difference<span style="color: #339933;">::</span><span style="color: #004000;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> DateTime<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-7 weeks'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$myString</span> <span style="color: #339933;">=</span> Date_Difference<span style="color: #339933;">::</span><span style="color: #004000;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> DateTime<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-7 weeks'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">new</span> DateTime<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'+1 week'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><a href="http://www.zachleat.com/Projects/phpPrettyDate/Date_Difference.phps">Download PHP Pretty Date</a> (PHP 5.10+, 1.86KB)<br />
<a href="http://www.zachleat.com/Projects/phpPrettyDate/Date_Difference.phps">http://www.zachleat.com/Projects/phpPrettyDate/Date_Difference.phps</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2008/02/10/php-pretty-date/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</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&#8217;s computer and get it to open a competitor&#8217;s website during a big presentation to the company president.</p>
<p>Fun to be had by all, I&#8217;m sure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/08/21/alarmd-now-supports-urls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</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&#8217;d have so much in common? Since you&#8217;re obviously like me, you&#8217;ve probably wondered to [...]]]></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&#8217;d have so much in common?  Since you&#8217;re obviously like me, you&#8217;ve probably wondered to yourself: where did the marquee tag go?  Why isn&#8217;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&#8217;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&#8217;t part of the spec either!  I&#8217;m just offended as you, let me reassure you.  </p>
<p>Well today, we&#8217;re going to solve all of that.  Today, I&#8217;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&#8217;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&#8217;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&#8217;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&#8217;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&#8217;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&#8217;s fun to try new things on the web, experiment a bit.  That&#8217;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&#8217;t mean it&#8217;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&#8217;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: &#8220;Did you use NTP?&#8221;, with which I replied: &#8220;What is NTP?&#8221;  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>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/08/20/malarquee-bringing-back-the-marquee/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</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&#8217;d like to write a little bit about my experiences with something I don&#8217;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&#8217;d like to write a little bit about my experiences with something I don&#8217;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&#8217;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&#8217;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&#8217;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&#8217;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&#8217;Hearn does a segment called &#8220;Right Now on the Net&#8221; 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 &#8220;Techtalk Radio&#8221; 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 &#8220;Zach-A-Lot&#8221; and are obsessed with the &#8220;Naked&#8221; checkbox.  But to be fair, who isn&#8217;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&#8217;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&#8217;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>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/07/22/2020-hindsight-a-look-back-at-alarmd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</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 &#8216;What would Jesus do?&#8217; 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 intense [...]]]></description>
			<content:encoded><![CDATA[<p>Generally when approaching a complex problem involving web programming in JavaScript, the first question I ask myself is &#8216;What would Jesus do?&#8217;  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 &#8220;passionate&#8221; hatred for Mel Gibson swelling in my chest.  It&#8217;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&#8217;s down to about 5 or 8% now?) sliver of browser market share that Internet Explorer currently entails.  Let&#8217;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&#8217;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&#8217;ve already come to love in the various DOM query libraries that are available?  Why not use DOMDom? Let&#8217;s see a few examples:</p>
<p>Single Node String</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'div'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div&gt;&lt;/div&gt;</pre></div></div>

<p>Single Node String with ID and Classes</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'div#id1.class1.class2'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;id1&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;class1 class2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Single Node String for a Form Element</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'input[name=&quot;myTextBox&quot;,type=&quot;text&quot;,maxlength=&quot;5&quot;]'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;myTextBox&quot;</span> <span style="color: #000066;">maxlength</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Single Node String with Style Syntax</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'div{height=80px,color=#f90,border=1px solid #000}'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;border: 1px solid #000; height: 80px; color: #f90&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Complex Single Node String with ID, multiple classes, Style, and Namespaced Attribute)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><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></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;id1&quot;</span> <span style="color: #000066;">att</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">namespace:att</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;class1 class2 class4&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;width: 60px; color: #f90;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Multiple Node String: Linear (Parents with one Child)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'div span div'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Multiple Node String: Non-Linear (Parent with more than one Child)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">'div'</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span> <span style="color: #3366CC;">'span'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'span'</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h1>How Does It Work?</h1>
<p>By default, it&#8217;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="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'div#myId'</span></pre></div></div>

<p>Creating a node with CSS classes</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'div.class1.class2'</span></pre></div></div>

<p>Creating two nodes at the same level</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #3366CC;">'div'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'div'</span> <span style="color: #009900;">&#93;</span></pre></div></div>

<p>Creating a node with two children</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">'div'</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span> <span style="color: #3366CC;">'div'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'div'</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<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="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'#Any Text Here'</span></pre></div></div>

<p>Creating a node with attributes (the @ is optional)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><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></pre></div></div>

<p>Creating a node with a Style Shortcut (mixing with a style attribute is handled properly)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'div{color=#f90,border=1px solid #000}[style=&quot;height:80px;background:#fff&quot;]'</span></pre></div></div>

<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="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #3366CC;">'div#myId.class1.class2{color=#f90}[customAttr=&quot;true&quot;,@customAttr2=&quot;false&quot;] div#child1 div#child2'</span></pre></div></div>

<h1>Usage</h1>
<p><strong>Appending</strong> at the end of a parent&#8217;s children:</p>

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

<p><strong>Replacing</strong> the children of a parent:</p>

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

<p><strong>Unshifting </strong>(inserting at the beginning of a parent&#8217;s children):</p>

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

<p><strong>Inserting</strong> before a certain integer index of a parent&#8217;s children:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">DOMDom.<span style="color: #660066;">insert</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'div'</span><span style="color: #339933;">,</span> yourParentNode<span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// must have at least 3 children, the index is 0 based, if index is null with unshift by default</span></pre></div></div>

<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="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> ADAPTER <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	setStyle<span style="color: #339933;">:</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">setStyle</span><span style="color: #339933;">,</span>
	addClass<span style="color: #339933;">:</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">addClass</span><span style="color: #339933;">,</span>
	isString<span style="color: #339933;">:</span> YAHOO.<span style="color: #660066;">lang</span>.<span style="color: #660066;">isString</span><span style="color: #339933;">,</span>
	isArray<span style="color: #339933;">:</span> YAHOO.<span style="color: #660066;">lang</span>.<span style="color: #660066;">isArray</span><span style="color: #339933;">,</span>
	isNumber<span style="color: #339933;">:</span> YAHOO.<span style="color: #660066;">lang</span>.<span style="color: #660066;">isNumber</span><span style="color: #339933;">,</span>
	isObject<span style="color: #339933;">:</span> YAHOO.<span style="color: #660066;">lang</span>.<span style="color: #660066;">isObject</span><span style="color: #339933;">,</span>
	get<span style="color: #339933;">:</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">get</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// to port, change these references</span></pre></div></div>

<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><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>
		<slash:comments>12</slash:comments>
		</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&#8217;t see the time on your alarm clock from all the way across the room? I&#8217;m here to calm your fears. Enter ALARMD, the Internet Alarm Clock. Wake up to [...]]]></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&#8217;t see the time on your alarm clock from all the way across the room?  </p>
<p>I&#8217;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&#8217;t need it.</li>
<li>Save all of your settings, URL&#8217;s, and alarms locally in a cookie (you <strong>don&#8217;t</strong> need yet another account to use this)</li>
</ul>
<p>Things to think about:</p>
<ul>
<li>Power Settings &#8211; 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&#8217;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&#8217;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&#8217;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&#8217;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&#8217;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&#8217;t forget to cite the source when you redistribute.</p>
<p><strong>Update</strong>: added a couple more things to think about.</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>
		<slash:comments>24</slash:comments>
		</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&#8217;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 discovery [...]]]></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&#8217;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 &#8216;Code Coverage&#8217;, 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&#8217;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%&#8217;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><strong>Update:</strong> After many requests and much self deliberation, I have decided not to update the plugin to work with newer versions of Firefox.  Code Coverage doesn&#8217;t belong in the browser, it&#8217;s just the wrong place in the tool chain to have something like this.  Code Coverage results need to be exportable, and the utility must be executable from the command line to use with unit tests and continuous integration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/04/18/javascript-code-coverage-tool-for-firebug/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>
