<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/atom10full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
  <title>2 tablespoons</title>
  <subtitle>provider of web, print, and written communication services</subtitle>
  <link rel="alternate" type="text/html" href="http://2tbsp.com" />
  
  <id>http://2tbsp.com/atom/feed</id>
  <updated>2008-01-23T22:14:18-08:00</updated>
  <logo>http://2tbsp.com/sites/2tbsp.com/themes/tbsp/images/logo.png</logo><link rel="self" href="http://feeds.feedburner.com/2tbsp" type="application/atom+xml" /><entry>
    <title>Speed up PHP development in Eclipse PDT with Templates and Snippets </title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/375679008/104" />
    <id>http://2tbsp.com/node/104</id>
    <published>2008-08-26T16:23:56-07:00</published>
    <updated>2008-08-27T14:58:08-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="Eclipse" />
    <category term="How to" />
    <summary type="html"><![CDATA[<p>Busy schedules, long to do lists, and deadlines make it tough for developers to get familiar with some of the advanced features their tools provide. This is a shame, because some features, like Eclipse Templates, can really reduce coding time and errors.<br />
You already know that Eclipse PDT provides autocompletion and hints for PHP&#39;s built in functions. In addition, commenting your code with PHPDoc adds autocompletion and hinting for your application&#39;s classes, methods, and variables. If you haven&#39;t already discovered, Eclipse PDT also provides autocompletion of PHP&#39;s control structures, class definitions, and methods through code templates.</p>
    ]]></summary>
    <content type="html">&lt;p&gt;Busy schedules, long to do lists, and deadlines make it tough for developers to get familiar with some of the advanced features their tools provide. This is a shame, because some features, like Eclipse Templates, can really reduce coding time and errors.&lt;/p&gt;
&lt;p&gt;You already know that Eclipse PDT provides autocompletion and hints for PHP&amp;#39;s built in functions. In addition, commenting your code with PHPDoc adds autocompletion and hinting for your application&amp;#39;s classes, methods, and variables. If you haven&amp;#39;t already discovered, Eclipse PDT also provides autocompletion of PHP&amp;#39;s control structures, class definitions, and methods through code templates.&lt;/p&gt;
&lt;h2&gt;Eclipse PDT Templates&lt;/h2&gt;
&lt;p&gt;The PHP Developer Tools plug in provides several templates for all of PHP&amp;#39;s control structures (if/else, for, foreach, while, switch, etc.) and more. Fire up Eclipse and take a look at Preferences &amp;gt; PHP &amp;gt; Templates. Here are all of the predefined templates available.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://2tbsp.com/system/files/pdt-templates-list.png" /&gt;&lt;/p&gt;
&lt;p&gt;The name column indicates what you need to type to insert a template. Context, description, and the template code are all visible here. Some of the names are straightforward but others may take time to memorize. &lt;a href="http://2tbsp.com/system/files/pdt-template-list.txt" target="_blank"&gt;Printing the template list&lt;/a&gt; and keeping it nearby might be helpful.&lt;/p&gt;
&lt;p&gt;To insert a template, type the name followed by Control + Space bar, select the template, and hit enter/return. Below, I typed &amp;#39;swi&amp;#39; and then Control + Space bar to add a switch statement.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;You must be working in a file that&amp;#39;s part of a PHP Project to be able to use these PDT templates!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://2tbsp.com/system/files/pdt-templates-hint.png" /&gt;&lt;/p&gt;
&lt;p&gt;Once inserted, templates may contain variable fields. The switch template contains two variables (shown with box outlines below), one for the switch statement&amp;#39;s variable/expression and the second for the case comparison. Just tab between the fields.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://2tbsp.com/system/files/pdt-templates-variables.png" /&gt;&lt;/p&gt;
&lt;p&gt;Think of all of the time you&amp;#39;ll save and the typos you&amp;#39;ll avoid with these templates. If the value or format of any of the templates don&amp;#39;t fit with you or your team&amp;#39;s coding standards, add new or edit existing templates, and share them with the team by exporting and importing them. Just to be safe, be sure to keep a copy of your exported template XML file as future PDT upgrades may overwrite customizations.&lt;/p&gt;
&lt;h2&gt;Eclipse Snippets&lt;/h2&gt;
&lt;p&gt;Most IDE&amp;#39;s include a feature to save blocks of code for re-use and Eclipse is no exception. Snippets are suited for code that is not part of an existing template.&lt;/p&gt;
&lt;p&gt;Add the snippet to your workspace by selecting Window &amp;gt; Show View &amp;gt; Other... and then select General &amp;gt; Snippets. You can add categories to group snippets however you&amp;#39;d like (ex. PHP, CakePHP, Zend Framework, CSS, Bash, Smarty, etc.). Once you have your categories, add snippets to them.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open a file and enter a new block or select an existing block of code.&lt;/li&gt;
&lt;li&gt;Copy the code block.&lt;/li&gt;
&lt;li&gt;Click in the Snippets view, under a specific target category, if you&amp;#39;ve created categories.&lt;/li&gt;
&lt;li&gt;Select &amp;quot;Paste as Snippet...&amp;quot; in the Snippets view menu.&lt;/li&gt;
&lt;li&gt;In the &amp;quot;Customize Palette&amp;quot; dialog, enter a name and description.&lt;/li&gt;
&lt;li&gt;Use the &amp;quot;Move Up&amp;quot; and &amp;quot;Move Down&amp;quot; buttons to order the snippet in lists as desired.&lt;/li&gt;
&lt;li&gt;Click OK&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can also right-click anywhere in the Snippets view and select &amp;quot;Customize&amp;quot; to add a snippet. I haven&amp;#39;t worked with variables yet, I assume they work like Template variables do. You can set when snippet categories are displayed so that, for example, PHP-related snippets are displayed only when you&amp;#39;re editing PHP files.&lt;/p&gt;
&lt;p&gt;Snippets can be exported and imported just like templates. Once I&amp;#39;ve created and used them for a while, I may share a few snippet categories. Let me know if you&amp;#39;ve seen any good collections.&lt;/p&gt;
&lt;p&gt;Happy coding!&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=Q7vkpk"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=Q7vkpk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=9AtMAK"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=9AtMAK" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/104</feedburner:origLink></entry>
  <entry>
    <title>Evernote: Save notes, picts, clippings, and scribbles in one place</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/337758699/103" />
    <id>http://2tbsp.com/node/103</id>
    <published>2008-07-16T22:28:42-07:00</published>
    <updated>2008-07-17T16:29:07-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="Review" />
    <summary type="html"><![CDATA[<p><img src="http://www.evernote.com/about/img/logo.gif" alt="Evernote" width="228" height="60" align="right" />When inspiration or a sense of responsibility hits me I&#39;ll jot down a note or sketch something out with whatever means are available. If I&#39;m at work I&#39;ll send myself a to do list or a link to check out later in an email message. When out of reach of digitial devices, post it notes, scraps of paper, and the highly-versatile cocktail napkin receive the rest of my scribbles and scratches. Now if I could just remember where I&#39;ve squirreled away these bits of brilliance.<br />
Enter <a href="http://www.evernote.com">Evernote</a> , a new service to help you collect and manage your mental notes in each of their forms. Evernote allows you to send and store notes in text, image, and audio format through a variety of methods. I had signed up for a free account last month but hadn&#39;t had a chance to take Evernote for a spin until tonight.</p>
    ]]></summary>
    <content type="html">&lt;p&gt;&lt;img src="http://www.evernote.com/about/img/logo.gif" alt="Evernote" width="228" height="60" align="right" /&gt;When inspiration or a sense of responsibility hits me I&amp;#39;ll jot down a note or sketch something out with whatever means are available. If I&amp;#39;m at work I&amp;#39;ll send myself a to do list or a link to check out later in an email message. When out of reach of digitial devices, post it notes, scraps of paper, and the highly-versatile cocktail napkin receive the rest of my scribbles and scratches. Now if I could just remember where I&amp;#39;ve squirreled away these bits of brilliance. &lt;/p&gt;
&lt;p&gt;Enter &lt;a href="http://www.evernote.com"&gt;Evernote&lt;/a&gt; , a new service to help you collect and manage your mental notes in each of their forms. Evernote allows you to send and store notes in text, image, and audio format through a variety of methods. I had signed up for a free account last month but hadn&amp;#39;t had a chance to take Evernote for a spin until tonight. &lt;/p&gt;
&lt;h2&gt;The Basics&lt;/h2&gt;
&lt;p&gt;It&amp;#39;s easy to to get up and running. Submit notes through a web interface, your very own Evernote email address, desktop clients for Windows and Mac, or through mobile clients, including one for the iPhone. Create Notebooks to group your notes, add tags, and browse notes in either thumbnail or list views. &lt;/p&gt;
&lt;p&gt;&lt;img src="/system/files/evernote-view.png" alt="Evernote notebooks" /&gt; &lt;/p&gt;
&lt;h2&gt;Email Notes and Attachments&lt;/h2&gt;
&lt;p&gt;Each Evernote account comes with a custom email address. Save this address to your desktop and mobile device to send text notes with photo or scanned attachments. Subject titles are used as note titles and Evernote seems to do a good job retaining message format. No worries about spam here since Evernote account addresses are sufficiently randomized. &lt;/p&gt;
&lt;p&gt;I was hoping that I&amp;#39;d be able to rotate the image attachment shown below, but alas image rotation doesn&amp;#39;t appear to be a feature yet. This was the only shortcoming I found with the service. &lt;/p&gt;
&lt;p&gt;&lt;img src="/system/files/evernote-email.png" alt="Evernote Email" /&gt;&lt;/p&gt;
&lt;h2&gt;
Send &amp;#39;em from the Desktop&lt;br /&gt;
&lt;/h2&gt;
&lt;p&gt;Evernote  provides Mac and Windows users with handy desktop clients. Unfortunately Mac users with less than Leopard are left out. &lt;/p&gt;
&lt;p&gt;&lt;img src="/system/files/evernote-mac.png" alt="Evernote for the Mac" /&gt; &lt;/p&gt;
&lt;p&gt;The client allows you to easily create and format new text notes, screenshots, clipboard contents, and iSight pictures. You can also keep notes in sync locally for offline viewing and search. &lt;/p&gt;
&lt;p&gt;&lt;img src="/system/files/evernote-desktop.png" alt="Evernote desktop for the Mac" /&gt;&lt;/p&gt;
&lt;h2&gt;
Speaking of search&lt;br /&gt;
&lt;/h2&gt;
&lt;p&gt;I was a bit skeptical of how well Evernote&amp;#39;s OCR capabilities would work, especially with handwriting as poor as mine. I am blown away at how well Evernote&amp;#39;s hand writing recognition worked. Keywords found in images are highlighted nicely as shown with the following &amp;#39;FTP&amp;#39; search result. &lt;/p&gt;
&lt;p&gt;&lt;img src="/system/files/evernote-search.png" width="303" height="53" /&gt;&lt;/p&gt;
&lt;h2&gt;
Impressive&lt;/h2&gt;
&lt;p&gt;Overall I&amp;#39;m really impressed with Evernote. I plan on piling my notes near my Brother multipage scanner for periodic capture and posting. No more rifling through piles of paper for me. Give it a try and see what you think. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=aGUEgj"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=aGUEgj" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=KoCK5J"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=KoCK5J" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/103</feedburner:origLink></entry>
  <entry>
    <title>Notes on Popular JavaScript Frameworks, Libraries, and Toolkits, Part 1</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/325493803/100" />
    <id>http://2tbsp.com/node/100</id>
    <published>2008-07-02T22:15:18-07:00</published>
    <updated>2008-07-03T11:16:35-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="JavaScript" />
    <category term="Review" />
    <category term="YUI" />
    <summary type="html"><![CDATA[<p>
Although my JavaScript development focus is currently on the <a href="http://developer.yahoo.com/yui/">Yahoo! User Interface Library (YUI)</a> I do try to keep up with some of the other libraries. Here I&#39;ll begin to offer up my recent notes and observations on five popular projects, Dojo, Ext JS, jQuery, Moo Tools, Prototype/Scriptaculous, and YUI.</p>
    ]]></summary>
    <content type="html">&lt;p&gt;
Although my JavaScript development focus is currently on the &lt;a href="http://developer.yahoo.com/yui/"&gt;Yahoo! User Interface Library (YUI)&lt;/a&gt; I do try to keep up with some of the other libraries. Here I&amp;#39;ll begin to offer up my recent notes and observations on five popular projects, Dojo, Ext JS, jQuery, Moo Tools, Prototype/Scriptaculous, and YUI.&lt;br /&gt;
&lt;!--break--&gt;
&lt;/p&gt;
&lt;p&gt;&lt;img src="http://2tbsp.com/system/files/js-lib-logos.png" style="float:right" /&gt;&lt;/p&gt;
&lt;h2&gt;What about &amp;lt;insert JavaScript library here&amp;gt;?&lt;/h2&gt;
&lt;p&gt;
This is a fair question often asked while reading &amp;quot;comparative literature.&amp;quot; According to other blog posts on the subject, Google, benchmark test results, and web development job ads, the projects covered here have garnered more attention from the web development community than others.
&lt;/p&gt;
&lt;h2&gt;JavaScript Projects According to Google&lt;/h2&gt;
&lt;p&gt;
Last month Google gave an endorsement of sorts to jQuery, prototype/script.aculo.us, MooTools, and dojo by offering hosting of each through their &lt;a href="http://code.google.com/apis/ajaxlibs/"&gt;AJAX Libraries API&lt;/a&gt;. Any web developer in the world can now easily include the latest stable version of these libraries in their projects. I can&amp;#39;t think of much higher praise for a project than a nod from Google. These projects can tout their selection and, more importantly, the  benefits of Google serving as their &lt;a href="http://en.wikipedia.org/wiki/Content_Delivery_Network"&gt;CDN hosting service&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Google probably isn&amp;#39;t going to host a competitor&amp;#39;s library, even if Yahoo! didn&amp;#39;t provide &lt;a href="http://developer.yahoo.com/yui/articles/hosting/"&gt;hosted versions of the YUI&lt;/a&gt;. I&amp;#39;m also guessing that the commercial component of Ext JS&amp;#39;s dual licence ruled them out from the AJAX Library API.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://trends.google.com"&gt;Google Trends&lt;/a&gt; has become the latest judge in web popularity contests. Here&amp;#39;s a Google Trend comparison of each project&amp;#39;s web site: &lt;a href="http://trends.google.com/websites?q=dojotoolkit.org%2C+extjs.com%2C+jquery.com%2C+prototypejs.org%2C+mootools.net&amp;amp;geo=all&amp;amp;date=all&amp;amp;sort=0"&gt;dojotoolkit.org, extjs.com, jquery.com, prototypejs.org, mootools.net&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.scrnshots.com/users/ckieffer/screenshots/20330"&gt;&lt;img src="http://s3.amazonaws.com/scrnshots.com/screenshots/20330/ScrnShotsDesktop-1214630240_large.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
I initially included &lt;a href="http://mochikit.com/"&gt;MochiKit&lt;/a&gt; with the others but &lt;a href="http://trends.google.com/websites?q=mochikit.com%2C+extjs.com%2C+jquery.com%2C+prototypejs.org%2C+mootools.net&amp;amp;geo=all&amp;amp;date=all&amp;amp;sort=0"&gt;it did not fair well&lt;/a&gt;. MochiKit is a well-established project with many merits and deserves an honorable mention here. Some will also note that the YUI isn&amp;#39;t included. Yahoo! uses &lt;em&gt;http://developer.yahoo.com/yui/&lt;/em&gt; instead of a dedicated subdomain for the YUI. The Google Trends report only showed data for &lt;em&gt;developer.yahoo.com&lt;/em&gt;.
&lt;/p&gt;
&lt;h2&gt;JavaScript Library Usage on Popular Sites&lt;/h2&gt;
&lt;p&gt;
Pingdom, a server monitoring service, recently posted the results of a simple study of &lt;a href="http://royal.pingdom.com/?p=305"&gt;JavaScript framework usage among top websites&lt;/a&gt;. They chose to scan the HTML source of site home pages listed on the &lt;a href="http://www.alexa.com/site/ds/top_sites?cc=US&amp;amp;ts_mode=country&amp;amp;lang=none"&gt;Alexa US Top 100&lt;/a&gt; and the &lt;a href="http://www.webware.com/html/ww/100/2008/winners.html"&gt;Webware Top 100 Web Apps&lt;/a&gt;. They searched for specific keywords and file names associated with the use of Prototype, JQuery, MooTools, YUI, Dojo, ExtJS and MochiKit. The study includes a list of sites they found using each and basic summaries of the libraries (Note: My next post will expand on these summaries).
&lt;/p&gt;
&lt;p&gt;
The study didn&amp;#39;t find evidence of Dojo, Ext JS, or MochiKit in use on the site&amp;#39;s home pages but the results should not be considered conclusive. I suspect that Ext JS usage would score quite high in a survey of corporate intranet sites. Ext JS provides formal training and support services which are typically valued in corporate IT environments. In regards to Dojo, I suspect that the recent &lt;a href="http://devzone.zend.com/article/3545-Dojo-and-Zend-Framework-Partnership-Announcement"&gt;announcement of their partnership with the Zend Framework&lt;/a&gt; will produce a spike in its usage after the 1.6 release of the Zend Framework later this summer.
&lt;/p&gt;
&lt;h2&gt;JavaScript Size and Performance Benchmark Tests&lt;/h2&gt;
&lt;p&gt;
Performance benchmark tests based on general and randomized cases may seem to provide a smoking gun when choosing one framework over another, but be careful. Regardless of the tester&amp;#39;s reputation or methods, these tests weren&amp;#39;t run against your application in your environment. Ahh, those darn variables always get in the way of simple calculations ;) Tests may reveal advantages in one framework but ultimately performance is determined by a framework coupled with your design ingenuity, coding skill, and infrastructure.
&lt;/p&gt;
&lt;p&gt;
PBwiki recently conducted a &lt;a href="http://jst.pbwiki.com/"&gt;JavaScript library performance benchmark test&lt;/a&gt; that caught the interest of jQuery&amp;#39;s creator, John Resig (for reasons that&amp;#39;ll become more obvious in the next sentence). Of the libraries tested, jQuery did very well. Dojo and YUI were neck and neck in the middle of the pack. Prototype by itself was comparable to YUI and dojo but as soon as Scriptaculous was added to the mix, Prototype&amp;#39;s performance seems to have suffered greatly. On his blog John provides &lt;a href="http://ejohn.org/blog/library-loading-speed/"&gt;a summary of the test results&lt;/a&gt; and emphasizes  why you &lt;a href="http://ejohn.org/blog/the-performance-paradox/"&gt;shouldn&amp;#39;t trust random-user-generated performance tests&lt;/a&gt;. I wouldn&amp;#39;t choose a library for a project solely on the numbers but I would likely cite poor results to discount one.
&lt;/p&gt;
&lt;h2&gt;JavaScript Libraries in the Eyes of Employers&lt;/h2&gt;
&lt;p&gt;
This aspect is of particular interest to those of you in the job market. If you&amp;#39;re looking to expand your skill set, here are &lt;a href="http://www.indeed.com/jobtrends?q=dojo%2C+extjs%2C+jquery%2C+mootools%2C+scriptaculous%2C+yui"&gt;the JavaScript libraries&lt;/a&gt;  that &lt;a href="http://www.indeed.com/"&gt;Indeed.com&lt;/a&gt; says employers are looking for in their job ads.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.scrnshots.com/users/ckieffer/screenshots/20458"&gt;&lt;img src="http://s3.amazonaws.com/scrnshots.com/screenshots/20458/ScrnShotsDesktop-1214676849_large.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Prototype&lt;/em&gt; produced skewed results for obvious reasons and &lt;em&gt;Prototype js&lt;/em&gt; didn&amp;#39;t produce any results.
&lt;/p&gt;
&lt;p&gt;
Obviously this is just a cursory comparison. I&amp;#39;m currently spending some time with each project to provide a more thoughtful description of each. In the meantime, what were the deciding factors when you chose a specific library?
&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=ByGMGj"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=ByGMGj" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=v82TuJ"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=v82TuJ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/100</feedburner:origLink></entry>
  <entry>
    <title>A Few Diversions</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/323000082/102" />
    <id>http://2tbsp.com/node/102</id>
    <published>2008-06-29T22:30:21-07:00</published>
    <updated>2008-06-29T22:36:53-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="Community/Social Networks" />
    <category term="Fun" />
    <category term="Sites" />
    <summary type="html"><![CDATA[<p><a href="http://scrnshots.com">ScrnShots.com</a> is yet another social networking site for the InterWeb. This one targets a small niche market, sharing screen shots. It may seem a bit too narrow of a focus, but I&#39;m going to give it a try for a bit. Specifically, I&#39;m going to start posting new screenshots used in tutorials and posts on this site. I&#39;ll also add it to my my list of design inspiration sites to review when I begin a new project.</p>
    ]]></summary>
    <content type="html">&lt;p&gt;&lt;a href="http://scrnshots.com"&gt;ScrnShots.com&lt;/a&gt; is yet another social networking site for the InterWeb. This one targets a small niche market, sharing screen shots. It may seem a bit too narrow of a focus, but I&amp;#39;m going to give it a try for a bit. Specifically, I&amp;#39;m going to start posting new screenshots used in tutorials and posts on this site. I&amp;#39;ll also add it to my my list of design inspiration sites to review when I begin a new project.&lt;/p&gt;
&lt;p&gt;ScrnShots includes all of the standard features, including tagging, favorites, feeds, and widgets. It also provides handy upload tools for both Mac and Windows. The Mac desktop uploader is available through a menu bar item and provides full screen, window, and area options. After capture you can easily caption and tag the screen shot then upload. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://wordle.net"&gt;Wordle.net&lt;/a&gt;  is simple diversion for any typography or tag cloud fanatic. Enter a list of words and phrases or use a set of del.icio.us tags or the contents of an RSS feed to generate a stylized word cloud. Change the structure, colors, and font face to make the cloud your own.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s my del.icou.us tag cloud. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://scrnshots.com/users/ckieffer/screenshots/21038"&gt;&lt;img src="http://s3.amazonaws.com/scrnshots.com/screenshots/21038/wordle-ckieffer_large.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And here&amp;#39;s one that brought a laugh followed by my own sad self realization :/
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://scrnshots.com/users/ckieffer/screenshots/21042"&gt;&lt;img src="http://s3.amazonaws.com/scrnshots.com/screenshots/21042/wordle-funny_large.png" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Finally, if you like to doodle, &lt;a href="http://www.scribbls.com/"&gt;Scribbls.com&lt;/a&gt;  is for you. The idea is draw two things that create something totally different when they&amp;#39;re combined. Words can&amp;#39;t explain, so give it a try. Be sure to check the most hearted scribbls. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://scrnshots.com/users/ckieffer/screenshots/21050"&gt;&lt;img src="http://s3.amazonaws.com/scrnshots.com/screenshots/21050/scribbls_bacon_large.png" /&gt;&lt;/a&gt;&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=GlsIMi"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=GlsIMi" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=vhVs9I"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=vhVs9I" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/102</feedburner:origLink></entry>
  <entry>
    <title>JavaScript Libraries Playing Nice with Others?</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/321685647/99" />
    <id>http://2tbsp.com/node/99</id>
    <published>2008-06-27T16:48:26-07:00</published>
    <updated>2008-06-27T16:51:41-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="JavaScript" />
    <category term="YUI" />
    <summary type="html"><![CDATA[<p>A common occurrence in Web 2.0 sites, and one that a recent <a href="http://royal.pingdom.com/?p=305">Pingdom study</a> notes, is the concurrent use of multiple JavaScript libraries. One explanation for this is that a required (more often desired) feature or widget may appear to only be available within one specific library.</p>
    ]]></summary>
    <content type="html">&lt;p&gt;A common occurrence in Web 2.0 sites, and one that a recent &lt;a href="http://royal.pingdom.com/?p=305"&gt;Pingdom study&lt;/a&gt; notes, is the concurrent use of multiple JavaScript libraries. One explanation for this is that a required (more often desired) feature or widget may appear to only be available within one specific library.&lt;/p&gt;
&lt;p&gt;This perception may have been true a few years ago but is certainly less likely today. What&amp;#39;s more likely is that a developer sees a real or perceived obstacle in implementing or developing a widget with one library over another. &amp;quot;Either the widget exists but I can&amp;#39;t seem to install it or it&amp;#39;s missing and I&amp;#39;m having trouble building it.&amp;quot;&lt;/p&gt;
&lt;p&gt;Either way, I&amp;#39;m beginning to develop more of a purist&amp;#39;s view -- choose one framework for a project or environment and stick with it.&lt;/p&gt;
&lt;p&gt;If a widget doesn&amp;#39;t exist in a framework, I won&amp;#39;t simply use another framework just to add it. Why you ask? Simplicity and performance. It&amp;#39;s great that all of these JavaScript libraries reside in their own name space so as not to interfere with the others, but this makes it too easy to add unnecessary complexity and overhead to a site. &lt;/p&gt;
&lt;p&gt;I&amp;#39;ve developed a few sites that embed the &lt;a href="http://gallery.menalto.com"&gt;Gallery Photo Manager&lt;/a&gt; in &lt;a href="http://drupal.org"&gt;Drupal&lt;/a&gt;. At its core Gallery uses YUI while Drupal uses jQuery. To complicate matters I implemented a Script.aculo.us-based Lightbox effect. The use of Script.aculo.us introduced repetition in basic DOM handling functions that are already provided in YUI and jQuery. Although the repetition only adds up to a few extra kilobytes, these kilobytes add up.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve decided to replace the effect with a &lt;a href="http://test.thecodecentral.com/demos/lightboxrev/lightbox.html"&gt;YUI equivalent&lt;/a&gt;. One less library to complicate things and fewer file transfers to slow things down. What do you think? Are you using multiple JS libraries? Are you contemplating a JavaScript consolidation effort?&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=OWBwai"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=OWBwai" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=YGVJ1I"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=YGVJ1I" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/99</feedburner:origLink></entry>
  <entry>
    <title>How to Remove a Workspace in Eclipse under OS X</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/282355043/93" />
    <id>http://2tbsp.com/node/93</id>
    <published>2008-05-02T13:50:33-07:00</published>
    <updated>2008-05-03T10:28:03-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="Eclipse" />
    <category term="OS X" />
    <summary type="html"><![CDATA[<p>The other morning, before I had my morning coffee, I fired up Eclipse and when prompted to select my Workspace, I entered my password and hit return. Still in a haze, I wondered why I was looking at the default Workspace. After restarting and seeing my password in the selected Workspace I finally woke up. D'oh!</p>
    ]]></summary>
    <content type="html">&lt;p&gt;The other morning, before I had my morning coffee, I fired up Eclipse and when prompted to select my Workspace, I entered my password and hit return. Still in a haze, I wondered why I was looking at the default Workspace. After restarting and seeing my password in the selected Workspace I finally woke up. D'oh!&lt;/p&gt;
&lt;p&gt;So where the heck is this Workspace list stored? I couldn't find the list under preferences. There wasn't a hidden settings file in my home directory. I then started poking around in /Applications/eclipse. Ah ha! Here's the setting file that contains recent workspaces.&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-html4strict"&gt;/Applications/eclipse/configuration/.settings/org.eclipse.ui.ide.prefs&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Opened this file up and deleted the workspace from the RECENT_WORKSPACES. I had to make sure that I didn't remove to many line feeds (\n) which separate each workspace. I'm not sure why eclipse stores these preferences in the Applications folder. Why isn't this information stored in my home directory? &lt;/p&gt;
&lt;p&gt;Oh well. I may never make this mistake again, but you never know. Hope this helps someone else out there.&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=tGqPbh"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=tGqPbh" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=Apv9IH"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=Apv9IH" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/93</feedburner:origLink></entry>
  <entry>
    <title>YUI Rollover Part 2: Improving JavaScript Performance and Scalability</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/281740211/92" />
    <id>http://2tbsp.com/node/92</id>
    <published>2008-05-01T16:14:33-07:00</published>
    <updated>2008-05-01T16:27:40-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="JavaScript" />
    <category term="YUI" />
    <summary type="html"><![CDATA[<p>In my <a href="/node/91">previous article</a> we traded in old school JavaScript habits for unobtrusive methods and the Yahoo! User Interface Library (YUI). The YUI's Event and DOM extensions greatly simplify basic DOM scripting tasks. Let's build on this foundation and improve the rollover script's performance and scalability.</p>
    ]]></summary>
    <content type="html">&lt;p&gt;In my &lt;a href="/node/91"&gt;previous article&lt;/a&gt; we traded in old school JavaScript habits for unobtrusive methods and the Yahoo! User Interface Library (YUI). The YUI's Event and DOM extensions greatly simplify basic DOM scripting tasks. Let's build on this foundation and improve the rollover script's performance and scalability.&lt;!--break--&gt;&lt;/p&gt;
&lt;p&gt;Thanks to &lt;a href="/node/91#comment-2553"&gt;Nick&lt;/a&gt; and &lt;a href="/node/91#comment-2558"&gt;Dirk&lt;/a&gt; for their comments on event listeners impact on script performance. Nick points out the fact that JavaScript performance will degrade as more buttons are added to the &lt;a href="http://2tbsp.com/system/files/yui-rollover.html"&gt;example rollover menu&lt;/a&gt;. The use of a DOM scripting technique called event delegation can greatly reduce performance hits sustained through the assignment of event listeners. &lt;/p&gt;
&lt;h2&gt;Improve Performance through Event Delegation and Bubbling&lt;/h2&gt;
&lt;p&gt;The current version of the rollover script loops through the menu container and assigns event listeners to each button. Assigning listeners to child elements this way can, and will, have a negative impact on performance. &lt;/p&gt;
&lt;div style="float:right; width:223px; text-align:right;"&gt;
&lt;img src="http://2tbsp.com/system/files/fig-bubble.png" alt="Illustration of the DOM bubbling effect" /&gt;&lt;/p&gt;
&lt;div class="caption"&gt;credit: &lt;a href="http://www.senocular.com/flash/tutorials/buttoncapturing/"&gt;Senocular.com&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Let's use event delegation to simplify things. Event delegation leverages an inherit  browser behavior called "event bubbling". By default, when an event happens to an element's descendents, the event "bubbles up" through the DOM to the parent. &lt;/p&gt;
&lt;p&gt;This means that we can assign event listeners to the menu rather than every button it contains. In our rollover example we can reduce the number of event listeners from 3 to just 1. Wow! We've just cut the work required to assign listeners by 66%. You can see that the performance savings of event delegation add up quickly.&lt;/p&gt;
&lt;p&gt;We'll use the same HTML markup and CSS from the previous example. &lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-html4strict"&gt;&lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;id&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;menu&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 1&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 1&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 2&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 2&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Here's the updated script using the YUI's Event and DOM extensions. The script now uses Event's handy getTarget() method which captures the target of the current event.  &lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-javascript"&gt;&amp;lt;script type=&lt;span style="color: #3366CC;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;
&lt;span style="color: #009900; font-style: italic;"&gt;// Create the menu object&lt;/span&gt;
&lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; roll = &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #009900; font-style: italic;"&gt;// The rollover function&lt;/span&gt;
  over : &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;e&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    &lt;span style="color: #009900; font-style: italic;"&gt;// Capture the current target element&lt;/span&gt;
    &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; elTarget = YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;getTarget&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;e&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
    &lt;span style="color: #009900; font-style: italic;"&gt;// Step through this section of the DOM looking for a btn &lt;/span&gt;
    &lt;span style="color: #009900; font-style: italic;"&gt;// in the target's ancestory, stop at the menu container&lt;/span&gt;
    &lt;span style="color: #000066; font-weight: bold;"&gt;while&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;elTarget.&lt;span style="color: #006600;"&gt;id&lt;/span&gt; != &lt;span style="color: #3366CC;"&gt;'menu'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
      &lt;span style="color: #009900; font-style: italic;"&gt;// If we're over a btn, turn it on and stop&lt;/span&gt;
      &lt;span style="color: #000066; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;hasClass&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;elTarget, &lt;span style="color: #3366CC;"&gt;'btn'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
        YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;addClass&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;elTarget, &lt;span style="color: #3366CC;"&gt;'btn-over'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
        &lt;span style="color: #000066; font-weight: bold;"&gt;break&lt;/span&gt;;
      &lt;span style="color: #009900; font-style: italic;"&gt;// Keep looking one level up&lt;/span&gt;
      &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt; &lt;span style="color: #000066; font-weight: bold;"&gt;else&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
        elTarget = elTarget.&lt;span style="color: #006600;"&gt;parentNode&lt;/span&gt;;
      &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
    &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;,
  &lt;span style="color: #009900; font-style: italic;"&gt;// Reset menu styles&lt;/span&gt;
  out : &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;e&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; btns = YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;getElementsByClassName&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'btn'&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'div'&lt;/span&gt;, &lt;span style="color: #000066; font-weight: bold;"&gt;this&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
    YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;removeClass&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;btns, &lt;span style="color: #3366CC;"&gt;'btn-over'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;;
&lt;span style="color: #009900; font-style: italic;"&gt;// Assign event listeners to just the menu&lt;/span&gt;
YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;on&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'menu'&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'mouseover'&lt;/span&gt;, roll.&lt;span style="color: #006600;"&gt;over&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;on&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'menu'&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'mouseout'&lt;/span&gt;, roll.&lt;span style="color: #006600;"&gt;out&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Take a look at the &lt;a href="http://2tbsp.com/system/files/yui-rollover2.html"&gt;functioning example&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Allow for Growth&lt;/h2&gt;
&lt;p&gt;The updated rollover script gives us a big improvement in performance, but it doesn't scale at all. The script includes hardcoded references to a single menu. What if we want to add additional menus?&lt;/p&gt;
&lt;p&gt;First, let's update the stylesheet to use classes, instead of an ID, to target and style rollover menus.&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-css"&gt;&lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
  &lt;span style="color: #000000; font-weight: bold;"&gt;font&lt;/span&gt;: &lt;span style="color: #933;"&gt;&lt;span style="color: #933;"&gt;85&lt;/span&gt;%&lt;/span&gt; Arial, Helvetica, san-&lt;span style="color: #993333;"&gt;serif&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt;, &lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn-over&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;background-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#e7e7e7&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-width&lt;/span&gt;: &lt;span style="color: #933;"&gt;2px&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-style&lt;/span&gt;: &lt;span style="color: #993333;"&gt;solid&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;666&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;float&lt;/span&gt;: &lt;span style="color: #000000; font-weight: bold;"&gt;left&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;margin&lt;/span&gt;: &lt;span style="color: #933;"&gt;0&lt;/span&gt; &lt;span style="color: #933;"&gt;5px&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;width&lt;/span&gt;: &lt;span style="color: #933;"&gt;150px&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;999&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt; a, &lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn-over&lt;/span&gt; a &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
  &lt;span style="color: #000000; font-weight: bold;"&gt;color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#fff&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;background-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;999&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;display&lt;/span&gt;: &lt;span style="color: #993333;"&gt;block&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;padding&lt;/span&gt;: &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.3em&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.5em&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;text-decoration&lt;/span&gt;: &lt;span style="color: #993333;"&gt;none&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; p &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
  &lt;span style="color: #000000; font-weight: bold;"&gt;clear&lt;/span&gt;: &lt;span style="color: #993333;"&gt;both&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;padding-top&lt;/span&gt;: &lt;span style="color: #933;"&gt;1em&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt; p &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;padding&lt;/span&gt;: &lt;span style="color: #933;"&gt;0&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.5em&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #808080; font-style: italic;"&gt;/* Rollover styles */&lt;/span&gt;
&lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn-over&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;666&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;000&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #6666ff;"&gt;.rollover&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn-over&lt;/span&gt; a &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;background-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;666&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Next, apply the rollover class to a menu, or two.&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-html4strict"&gt;&lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;id&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;menu1&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;rollover&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 1&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 1&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 2&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 2&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Here's a menu.&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;id&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;menu2&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;rollover&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 4&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 4&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 5&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 5&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Here's another menu.&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;The script now needs to include a method for adding event listeners to each of the rollover menus. This task is handled by menu.init() which is run once the page is loaded. The only other change is the use of the rollover class to stop our walk of the DOM.  &lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-javascript"&gt;&amp;lt;script type=&lt;span style="color: #3366CC;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;
&lt;span style="color: #009900; font-style: italic;"&gt;// Create the menu object&lt;/span&gt;
&lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; roll = &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Assign event listeners to all rollover menus, &lt;/span&gt;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Isn't getElementsByClassName wonderful?!&lt;/span&gt;
  init : &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; menus = YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;getElementsByClassName&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'rollover'&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'div'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
    YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;on&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;menus, &lt;span style="color: #3366CC;"&gt;'mouseover'&lt;/span&gt;, roll.&lt;span style="color: #006600;"&gt;over&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;    
    YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;on&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;menus, &lt;span style="color: #3366CC;"&gt;'mouseout'&lt;/span&gt;, roll.&lt;span style="color: #006600;"&gt;out&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;,
  &lt;span style="color: #009900; font-style: italic;"&gt;// The rollover function, only change is using className instead of ID&lt;/span&gt;
  over : &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;e&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    &lt;span style="color: #009900; font-style: italic;"&gt;// Capture the current target element&lt;/span&gt;
    &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; elTarget = YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;getTarget&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;e&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
    &lt;span style="color: #009900; font-style: italic;"&gt;// Step through this section of the DOM looking for a btn &lt;/span&gt;
    &lt;span style="color: #009900; font-style: italic;"&gt;// in the target's ancestory, stop at the menu container&lt;/span&gt;
    &lt;span style="color: #000066; font-weight: bold;"&gt;while&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;elTarget.&lt;span style="color: #006600;"&gt;className&lt;/span&gt; != &lt;span style="color: #3366CC;"&gt;'rollover'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
      &lt;span style="color: #009900; font-style: italic;"&gt;// If we're over a btn, turn it on and stop&lt;/span&gt;
      &lt;span style="color: #000066; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;hasClass&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;elTarget, &lt;span style="color: #3366CC;"&gt;'btn'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
        YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;addClass&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;elTarget, &lt;span style="color: #3366CC;"&gt;'btn-over'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
        &lt;span style="color: #000066; font-weight: bold;"&gt;break&lt;/span&gt;;
      &lt;span style="color: #009900; font-style: italic;"&gt;// Keep looking one level up&lt;/span&gt;
      &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt; &lt;span style="color: #000066; font-weight: bold;"&gt;else&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
        elTarget = elTarget.&lt;span style="color: #006600;"&gt;parentNode&lt;/span&gt;;
      &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
    &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;,
  &lt;span style="color: #009900; font-style: italic;"&gt;// Reset menu styles&lt;/span&gt;
  out : &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;e&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; btns = YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;getElementsByClassName&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'btn'&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'div'&lt;/span&gt;, &lt;span style="color: #000066; font-weight: bold;"&gt;this&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
    YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;removeClass&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;btns, &lt;span style="color: #3366CC;"&gt;'btn-over'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;;
&amp;nbsp;
&lt;span style="color: #009900; font-style: italic;"&gt;// Initialize all rollover menus when the page loads&lt;/span&gt;
YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;on&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;window, &lt;span style="color: #3366CC;"&gt;'load'&lt;/span&gt;, roll.&lt;span style="color: #006600;"&gt;init&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;And here's the working example of the &lt;a href="http://2tbsp.com/system/files/yui-rollover-multi.html"&gt;rollover script that scales&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;So there you have it. A few simple examples illustrating how to improve performance and scalability in JavaScript. These are basic examples and hopefully they'll help you refactor your scripts to meet your site's needs. I highly recommend reading Peter-Paul Koch's explanation of mouse events and event order in the DOM and how each browser handles them. They helped me tremendously.&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=gypJGh"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=gypJGh" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=PNjrvH"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=PNjrvH" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/92</feedburner:origLink></entry>
  <entry>
    <title>Introduction to Unobtrusive JavaScript, DOM Scripting, and the Yahoo! User Interface (YUI) Library</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/277402594/91" />
    <id>http://2tbsp.com/node/91</id>
    <published>2008-04-24T22:07:15-07:00</published>
    <updated>2008-05-06T16:01:18-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="HTML/CSS" />
    <category term="JavaScript" />
    <summary type="html"><![CDATA[<p>If you know JavaScript but have yet to make the leap to unobtrusive JavaScript, read on. I'll demonstrate how to upgrade a traditional DHTML rollover to an unobtrusive script and then to a script that leverages the Yahoo! User Interface Library's (YUI).</p>
    ]]></summary>
    <content type="html">&lt;p&gt;If you know JavaScript but have yet to make the leap to unobtrusive JavaScript, read on. I'll demonstrate how to upgrade a traditional DHTML rollover to an unobtrusive script and then to a script that leverages the Yahoo! User Interface Library's (YUI).&lt;!--break--&gt;&lt;/p&gt;
&lt;h2&gt;What is Unobtrusive JavaScript and DOM Scripting?&lt;/h2&gt;
&lt;p&gt;Rather than hardcoding event handlers as HTML attributes, unobtrusive JavaScript assigns them using the DOM. Well-structured, valid HTML is a prerequisite to DOM scripting. Documents should declare a DOCTYPE, they should validate against the DOCTYPE, and presentational styles should be applied with CSS (read "should" as "life will be easier for everyone if you do"). Use a few targeted CSS ID and class selectors to define page layout. Don't go overboard on defining selectors, remember, &lt;a href="/content/taking_your_css_skills_next_level"&gt;descendent selectors are your friend&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I'll use a simple text-based rollover for demonstration purposes. In a perfect world, with perfect browsers, this effect would be created using the CSS pseudo hover class but, as you've probably guessed, it doesn't work in Internet Explorer 6. Here's a screenshot of what we're building.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://2tbsp.com/system/files/rollover.png" /&gt;&lt;/p&gt;
&lt;h2&gt;The Rollover, Obtrusively Old School Style&lt;/h2&gt;
&lt;p&gt;First, the style sheet. Nothing wrong here as long as these are stored in an external CSS file.&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-css"&gt;&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
  &lt;span style="color: #000000; font-weight: bold;"&gt;font&lt;/span&gt;: &lt;span style="color: #933;"&gt;&lt;span style="color: #933;"&gt;85&lt;/span&gt;%&lt;/span&gt; Arial, Helvetica, san-&lt;span style="color: #993333;"&gt;serif&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;background-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#e7e7e7&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;999&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-style&lt;/span&gt;: &lt;span style="color: #993333;"&gt;solid&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-width&lt;/span&gt;: &lt;span style="color: #933;"&gt;2px&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;666&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;float&lt;/span&gt;: &lt;span style="color: #000000; font-weight: bold;"&gt;left&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;margin&lt;/span&gt;: &lt;span style="color: #933;"&gt;0&lt;/span&gt; &lt;span style="color: #933;"&gt;5px&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;width&lt;/span&gt;: &lt;span style="color: #933;"&gt;150px&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt; a &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
  &lt;span style="color: #000000; font-weight: bold;"&gt;color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#fff&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;background-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;999&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;display&lt;/span&gt;: &lt;span style="color: #993333;"&gt;block&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;padding&lt;/span&gt;: &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.3em&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.5em&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;text-decoration&lt;/span&gt;: &lt;span style="color: #993333;"&gt;none&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; p &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;padding&lt;/span&gt;: &lt;span style="color: #933;"&gt;0&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.5em&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Next the markup. The old school technique involves writing the rollover script functions and triggering them from event attributes. More complex actions required more and more stuff muddying up what was a perfectly readable HTML document. &lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-html4strict"&gt;&lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;id&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;menu&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;id&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn1&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;onmouseover&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;rollOver('btn1')&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;onmouseout&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;rollOut('btn1')&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 1&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 1&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;id&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn2&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;onmouseover&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;rollOver('btn2')&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;onmouseout&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;rollOut('btn2')&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 2&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 2&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;id&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn3&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;onmouseover&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;rollOver('btn3')&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;onmouseout&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;rollOut('btn3')&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Finally, the JavaScript. A function to set styles on mouseover and another to restore the original styles on mouseout. If you change a color in the stylesheet, you'll have to change it here too.&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-javascript"&gt;&amp;lt;script type=&lt;span style="color: #3366CC;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;
&lt;span style="color: #009900; font-style: italic;"&gt;// Apply rollover styles&lt;/span&gt;
&lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt; rollOver&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;el&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Get the elements&lt;/span&gt;
  &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; thisBtn = document.&lt;span style="color: #006600;"&gt;getElementById&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;el&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; thisLink = thisBtn.&lt;span style="color: #006600;"&gt;getElementsByTagName&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'a'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Change their styles&lt;/span&gt;
  thisLink&lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #CC0000;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;.&lt;span style="color: #006600;"&gt;style&lt;/span&gt;.&lt;span style="color: #006600;"&gt;backgroundColor&lt;/span&gt; = &lt;span style="color: #3366CC;"&gt;'#666'&lt;/span&gt;;
  thisBtn.&lt;span style="color: #006600;"&gt;style&lt;/span&gt;.&lt;span style="color: #006600;"&gt;borderColor&lt;/span&gt; = &lt;span style="color: #3366CC;"&gt;'#666'&lt;/span&gt;;
  thisBtn.&lt;span style="color: #006600;"&gt;style&lt;/span&gt;.&lt;span style="color: #006600;"&gt;color&lt;/span&gt; = &lt;span style="color: #3366CC;"&gt;'#000'&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #009900; font-style: italic;"&gt;// Reset styles&lt;/span&gt;
&lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt; rollOut&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;el&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Get the elements&lt;/span&gt;
  &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; thisBtn = document.&lt;span style="color: #006600;"&gt;getElementById&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;el&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; thisLink = thisBtn.&lt;span style="color: #006600;"&gt;getElementsByTagName&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'a'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Change their styles back again&lt;/span&gt;
  thisLink&lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #CC0000;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;.&lt;span style="color: #006600;"&gt;style&lt;/span&gt;.&lt;span style="color: #006600;"&gt;backgroundColor&lt;/span&gt; = &lt;span style="color: #3366CC;"&gt;'#999'&lt;/span&gt;;
  thisBtn.&lt;span style="color: #006600;"&gt;style&lt;/span&gt;.&lt;span style="color: #006600;"&gt;borderColor&lt;/span&gt; = &lt;span style="color: #3366CC;"&gt;'#999'&lt;/span&gt;;
  thisBtn.&lt;span style="color: #006600;"&gt;style&lt;/span&gt;.&lt;span style="color: #006600;"&gt;color&lt;/span&gt; = &lt;span style="color: #3366CC;"&gt;'#666'&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&amp;lt;script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;h2&gt;Make the Script Less Obtrusive&lt;/h2&gt;
&lt;p&gt;Let's clean things up a bit. Strip those event handlers from the button containers. &lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-html4strict"&gt;&lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;id&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;menu&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 1&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 1&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 2&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 2&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/div.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;div&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;class&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;btn&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/a.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #000066;"&gt;href&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="color: #009900;"&gt;&lt;a href="http://december.com/html/4/element/p.html"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Description for link 3&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Now, make a few CSS adjustments and additions to define the hover styles where they belong, in the style sheet.&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-css"&gt;&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
  &lt;span style="color: #000000; font-weight: bold;"&gt;font&lt;/span&gt;: &lt;span style="color: #933;"&gt;&lt;span style="color: #933;"&gt;85&lt;/span&gt;%&lt;/span&gt; Arial, Helvetica, san-&lt;span style="color: #993333;"&gt;serif&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt;, &lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn-over&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;background-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#e7e7e7&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-width&lt;/span&gt;: &lt;span style="color: #933;"&gt;2px&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-style&lt;/span&gt;: &lt;span style="color: #993333;"&gt;solid&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;666&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;float&lt;/span&gt;: &lt;span style="color: #000000; font-weight: bold;"&gt;left&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;margin&lt;/span&gt;: &lt;span style="color: #933;"&gt;0&lt;/span&gt; &lt;span style="color: #933;"&gt;5px&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;width&lt;/span&gt;: &lt;span style="color: #933;"&gt;150px&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;999&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn&lt;/span&gt; a, &lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn-over&lt;/span&gt; a &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
  &lt;span style="color: #000000; font-weight: bold;"&gt;color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#fff&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;background-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;999&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;display&lt;/span&gt;: &lt;span style="color: #993333;"&gt;block&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;padding&lt;/span&gt;: &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.3em&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.5em&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;text-decoration&lt;/span&gt;: &lt;span style="color: #993333;"&gt;none&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; p &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;padding&lt;/span&gt;: &lt;span style="color: #933;"&gt;0&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;&lt;span style="color: #933;"&gt;.5em&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #808080; font-style: italic;"&gt;/* Rollover styles */&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn-over&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;border-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;666&lt;/span&gt;&lt;/span&gt;;
  &lt;span style="color: #000000; font-weight: bold;"&gt;color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;000&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #cc00cc;"&gt;#menu&lt;/span&gt; &lt;span style="color: #6666ff;"&gt;.btn-over&lt;/span&gt; a &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #000000; font-weight: bold;"&gt;background-color&lt;/span&gt;: &lt;span style="color: #cc00cc;"&gt;#&lt;span style="color: #933;"&gt;666&lt;/span&gt;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;With that done, hook it all up with the script.&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-javascript"&gt;&amp;lt;script type=&lt;span style="color: #3366CC;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;
&lt;span style="color: #009900; font-style: italic;"&gt;// Attach event listeners to the buttons&lt;/span&gt;
&lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt; findButtons&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; menu, btns, i;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Get the menu element to access the btn divs&lt;/span&gt;
  menu = document.&lt;span style="color: #006600;"&gt;getElementById&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'menu'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  btns = menu.&lt;span style="color: #006600;"&gt;getElementsByTagName&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'div'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #000066; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;i=&lt;span style="color: #CC0000;"&gt;0&lt;/span&gt;; i&amp;lt;btns.&lt;span style="color: #006600;"&gt;length&lt;/span&gt;; i++&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    &lt;span style="color: #009900; font-style: italic;"&gt;// Attach event listeners for rollovers to the btns&lt;/span&gt;
    &lt;span style="color: #000066; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0066FF;"&gt;/btn/&lt;/span&gt;.&lt;span style="color: #006600;"&gt;test&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;btns&lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;i&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;.&lt;span style="color: #006600;"&gt;className&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt; 
      btns&lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;i&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;.&lt;span style="color: #006600;"&gt;onmouseover&lt;/span&gt; = &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;roll&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000066; font-weight: bold;"&gt;this&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;;
      btns&lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;i&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;.&lt;span style="color: #006600;"&gt;onmouseout&lt;/span&gt; = &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;roll&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000066; font-weight: bold;"&gt;this&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;;
    &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #009900; font-style: italic;"&gt;// Attached to the buttons and ready to roll&lt;/span&gt;
&lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt; roll&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;o&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #009900; font-style: italic;"&gt;// btn is our off state, so turn it on&lt;/span&gt;
  &lt;span style="color: #000066; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;o.&lt;span style="color: #006600;"&gt;className&lt;/span&gt; == &lt;span style="color: #3366CC;"&gt;'btn'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    o.&lt;span style="color: #006600;"&gt;className&lt;/span&gt; = &lt;span style="color: #3366CC;"&gt;'btn-over'&lt;/span&gt;;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Otherwise, turn it off&lt;/span&gt;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt; &lt;span style="color: #000066; font-weight: bold;"&gt;else&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    o.&lt;span style="color: #006600;"&gt;className&lt;/span&gt; = &lt;span style="color: #3366CC;"&gt;'btn'&lt;/span&gt;;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #009900; font-style: italic;"&gt;// Initialize the rollover&lt;/span&gt;
window.&lt;span style="color: #000066;"&gt;onload&lt;/span&gt; = &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  findButtons&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Everything is now in its proper place. No more JavaScript in the HTML and styles aren't defined in the JavaScript. This will be much easier to maintain.&lt;/p&gt;
&lt;h2&gt;Unobtrusive, the YUI Style&lt;/h2&gt;
&lt;p&gt;YUI is one of the many JavaScript libraries that have gained attention in recent years. Some say it's too big and bulky and that may be true in certain cases, like creating a simple rollover. But it's rare in our Web 2.0 world that a site's only JavaScript-powered feature is a rollover. YUI is my current JavaScript framework of choice because along with being feature-rich, it's well documented, tested, and supported.&lt;/p&gt;
&lt;p&gt;So here's the rollover script powered by the YUI's Yahoo! Global Object, and DOM and Event extensions. &lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-javascript"&gt;&amp;lt;script type=&lt;span style="color: #3366CC;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt; src=&lt;span style="color: #3366CC;"&gt;&amp;quot;http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&lt;span style="color: #3366CC;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;
&lt;span style="color: #009900; font-style: italic;"&gt;// Create a menu object, put everything we need into it&lt;/span&gt;
&lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; menu = &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
  &lt;span style="color: #009900; font-style: italic;"&gt;// Initialize the menu rollover&lt;/span&gt;
  init : &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    &lt;span style="color: #009900; font-style: italic;"&gt;// Get the btn elements&lt;/span&gt;
    btns = YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;getElementsByClassName&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #3366CC;"&gt;'btn'&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'div'&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'menu'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
    &lt;span style="color: #009900; font-style: italic;"&gt;// Assign event listeners to the btns&lt;/span&gt;
    &lt;span style="color: #000066; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; i=&lt;span style="color: #CC0000;"&gt;0&lt;/span&gt;; i&amp;lt;btns.&lt;span style="color: #006600;"&gt;length&lt;/span&gt;; i++&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
      YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;addListener&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;btns&lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;i&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'mouseover'&lt;/span&gt;, menu.&lt;span style="color: #006600;"&gt;roll&lt;/span&gt;, i&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
      YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;addListener&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;btns&lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;i&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'mouseout'&lt;/span&gt;, menu.&lt;span style="color: #006600;"&gt;roll&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
    &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;,
  &lt;span style="color: #009900; font-style: italic;"&gt;// First, turn 'em all off, then turn one on&lt;/span&gt;
  roll : &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;e, i&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;
    YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;removeClass&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;btns, &lt;span style="color: #3366CC;"&gt;'btn-over'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
    YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Dom&lt;/span&gt;.&lt;span style="color: #006600;"&gt;addClass&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;btns&lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;i&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;, &lt;span style="color: #3366CC;"&gt;'btn-over'&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
  &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;
&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;;
&lt;span style="color: #009900; font-style: italic;"&gt;// Initialize the menu&lt;/span&gt;
YAHOO.&lt;span style="color: #006600;"&gt;util&lt;/span&gt;.&lt;span style="color: #006600;"&gt;Event&lt;/span&gt;.&lt;span style="color: #006600;"&gt;on&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;window, &lt;span style="color: #3366CC;"&gt;'load'&lt;/span&gt;, menu.&lt;span style="color: #006600;"&gt;init&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;
&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;The YUI version basically works just like the unobtrusive version. Yahoo! provides hosted versions of all the YUI extensions, just add a link to yahoo-dom-event.js. With the help of the Yahoo! Global Object and DOM and Event extensions, it's easy to grab  button elements and assign event handlers that trigger the roll function. The main difference here is that everything is neatly encapsulated into the menu object. The YUI's &lt;a href="http://developer.yahoo.com/yui/dom/#class"&gt;getElementsByClassName and remove/addClass&lt;/a&gt; methods make DOM scripting a breeze. &lt;/p&gt;
&lt;p&gt;Take a look at the &lt;a href="http://2tbsp.com/system/files/yui-rollover.html"&gt;final product&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Hopefully these basic examples serve as a kick in the rear for those clinging to those old school ways. Now that you have the basics of event handling down, &lt;a href="/node/92"&gt;I'll show you how to improve the scripts performance through event delegation and how to make it scalable to power multiple rollover menus&lt;/a&gt;.&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=kg9rl"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=kg9rl" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=wMcnL"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=wMcnL" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/91</feedburner:origLink></entry>
  <entry>
    <title>Subversion Administration: Separate an SVN Repository into Individual Projects</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/255315882/88" />
    <id>http://2tbsp.com/node/88</id>
    <published>2008-03-20T21:02:15-07:00</published>
    <updated>2008-03-22T08:50:26-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="How to" />
    <category term="Subversion" />
    <summary type="html"><![CDATA[<p>
I&#39;ve been using Subversion since the <a href="http://gallery.menalto.com/" title="The Gallery Project">Gallery Project</a>  switched to it from CVS a few years back. I decided to install Subversion to manage my freelance projects last year and am getting up to speed on repository administration. I flip-flopped for a while on whether to keep projects in a single or separate repositories. I initially decided to keep everything in one repository, but later decided to separate them out. Fortunately, the svnadmin and svndumpfilter utilities make it relatively simple to separate repositories into individual projects.
</p>
    ]]></summary>
    <content type="html">&lt;p&gt;
I&amp;#39;ve been using Subversion since the &lt;a href="http://gallery.menalto.com/" title="The Gallery Project"&gt;Gallery Project&lt;/a&gt;  switched to it from CVS a few years back. I decided to install Subversion to manage my freelance projects last year and am getting up to speed on repository administration. I flip-flopped for a while on whether to keep projects in a single or separate repositories. I initially decided to keep everything in one repository, but later decided to separate them out. Fortunately, the svnadmin and svndumpfilter utilities make it relatively simple to separate repositories into individual projects.
&lt;/p&gt;
&lt;p&gt;&lt;!--break--&gt;&lt;/p&gt;
&lt;p&gt;
My goal is to create two new projects from folders stored in the trunk of a single repository. My repository&amp;#39;s history isn&amp;#39;t complex—it doesn&amp;#39;t contain tags or branches yet. You&amp;#39;ll need to put a bit more thought into how to deal with existing tags and branches.
&lt;/p&gt;
&lt;p&gt;
My current svn root layout is:
&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;/svnroot
    /branches
    /tags
    /trunk
        /project1
        /project2&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;
The desired layout is:
&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;/svnroot
    /project1
        /branches
        /tags
        /trunk
    /project2
        /branches
        /tags
        /trunk&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;
The basic steps to separate these repositories are:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Dump the current repository&lt;/li&gt;
&lt;li&gt;Separate folders in the dump to separate files with svndumpfilter&lt;/li&gt;
&lt;li&gt;Create new repositories&lt;/li&gt;
&lt;li&gt;Load the filtered dump files into the new repositories&lt;/li&gt;
&lt;li&gt;Cleanup the new repository layout, move files from trunk/projectN to trunk/&lt;/li&gt;
&lt;li&gt;Delete the original branches, tags, and trunk repositories from svnroot&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
I&amp;#39;ll use tmp as working directory to dump and filter files.
&lt;/p&gt;
&lt;h2&gt;Dump the current repository&lt;/h2&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;svnadmin dump /svnroot/originalproject &amp;amp;gt; /tmp/original.dump&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;h2&gt;Separate folders to separate files with svndumpfilter&lt;/h2&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;&lt;span style="color: #c20cb9; font-weight: bold;"&gt;cat&lt;/span&gt; /tmp/original.dump | svndumpfilter --drop-empty-revs --renumber-revs include trunk/project1 &amp;amp;gt; /tmp/project1.dump
&lt;span style="color: #c20cb9; font-weight: bold;"&gt;cat&lt;/span&gt; /tmp/original.dump | svndumpfilter --drop-empty-revs --renumber-revs include trunk/project2 &amp;amp;gt; /tmp/project2.dump&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;
The key here is the include option which targets the project folder(s). There&amp;#39;s also an exclude option that might come in handy if you&amp;#39;re trying to remove one folder from a group of many. The --drop-empty-revs and --renumber-revs options remove commit log messages for other folders and renumber the remaining revision numbers.
&lt;/p&gt;
&lt;h2&gt;Create new repositories&lt;/h2&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;svnadmin create /svnroot/project1
svnadmin create /svnroot/project2&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;h2&gt;Load the filtered dump files into the new repositories&lt;/h2&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;svnadmin load /svnroot/project1 &amp;amp;lt; /tmp/project1.dump 
svnadmin load /svnroot/project2 &amp;amp;lt; /tmp/project2.dump&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;h2&gt;Cleanup new repository layout, move files from trunk/projectN to trunk/&lt;/h2&gt;
&lt;p&gt;
Each repository layout now looks something like:
&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;/svnroot
    /project1
        /branches
        /tags
        /trunk
            /project1
                file1
                ...
                fileX&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;
But they should look like:
&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;/svnroot
    /project1
        /branches
        /tags
        /trunk
            file1
            ...
            fileX&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;
Subversion doesn&amp;#39;t allow wildcard gobling, so it&amp;#39;s impossible to do something like:
&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;svn move trunk/project1/* trunk/&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;
It was possible to edit path information in the project dump files before loading them, but it seemed easier to check out a working copy of each, move things around, and then commit the changes.
&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;svn checkout &lt;span style="color: #c20cb9; font-weight: bold;"&gt;file&lt;/span&gt; :///svnroot/project1 /tmp/project1
&lt;span style="color: #7a0874; font-weight: bold;"&gt;cd&lt;/span&gt; /tmp/project1/trunk&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;
Now, a little shell work to move things around. &lt;a href="http://subversion.tigris.org/faq.html#sorry-no-globbing"&gt;Thanks Tigris!&lt;/a&gt; PLEASE NOTE: Use this at your own risk. Back up your repository before trying the following or be ready to use svn revert.
&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="geshifilter-bash"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;for&lt;/span&gt; i &lt;span style="color: #000000; font-weight: bold;"&gt;in&lt;/span&gt; /tmp/project1/trunk/project1/*; &lt;span style="color: #000000; font-weight: bold;"&gt;do&lt;/span&gt; svn &lt;span style="color: #c20cb9; font-weight: bold;"&gt;mv&lt;/span&gt; &lt;span style="color: #007800;"&gt;$i&lt;/span&gt; /tmp/project1/trunk; &lt;span style="color: #000000; font-weight: bold;"&gt;done&lt;/span&gt;
svn commit -m &lt;span style="color: #ff0000;"&gt;&amp;quot;Moved all project files to trunk&amp;quot;&lt;/span&gt;
svn remove /tmp/project1/trunk/project1
svn commit -m &lt;span style="color: #ff0000;"&gt;&amp;quot;Removed obsolete project1 folder after moving its contents to trunk&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;
Lather, rinse, repeat.
&lt;/p&gt;
&lt;p&gt;
At some point I&amp;#39;ll probably back track and write a post on installing and configuring Subversion with MacPorts but that&amp;#39;s it, at least for now.
&lt;/p&gt;
    &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=7tSwl"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=7tSwl" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/2tbsp?a=Rde0L"&gt;&lt;img src="http://feeds.feedburner.com/~f/2tbsp?i=Rde0L" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
  <feedburner:origLink>http://2tbsp.com/node/88</feedburner:origLink></entry>
  <entry>
    <title>Notes on Choosing a PHP Framework: A Comparison of CakePHP and the Zend Framework</title>
    <link rel="alternate" type="text/html" href="http://feeds.feedburner.com/~r/2tbsp/~3/235814456/87" />
    <id>http://2tbsp.com/node/87</id>
    <published>2008-02-15T15:05:17-08:00</published>
    <updated>2008-05-21T13:52:14-07:00</updated>
    <author>
      <name>chad</name>
    </author>
    <category term="Frameworks" />
    <category term="PHP" />
    <category term="Review" />
    <summary type="html"><![CDATA[<p>
UPDATE:Parlez vous Français? Guillaume Rossolini has created a <a href="http://g-rossolini.developpez.com/comparatifs/php/cake-zf/">French translation of this article</a>.
</p>
<p>
Are you considering using a PHP framework for your next project? If so, this article&#39;s for you. I&#39;ve narrowed down my choices to CakePHP and the Zend Framework and have documented my findings  here.
</p>
    ]]></summary>
    <content type="html">&lt;p&gt;
UPDATE:Parlez vous Français? Guillaume Rossolini has created a &lt;a href="http://g-rossolini.developpez.com/comparatifs/php/cake-zf/"&gt;French translation of this article&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Are you considering using a PHP framework for your next project? If so, this article&amp;#39;s for you. I&amp;#39;ve narrowed down my choices to CakePHP and the Zend Framework and have documented my findings  here.
&lt;/p&gt;
&lt;p&gt;
Four or five years ago I began researching PHP application frameworks. At the time, the pickings were very slim, especially when compared to those available to Java developers. On the advice of an ex-Coldfusion developer, I settled on the PHP port of Fusebox, the de facto Coldfusion framework. Fusebox 3 provided a convenient set of loose conventions for structuring applications, organizing code, naming files, and controlling flow. It served my development team well and &lt;a href="http://www.lanl.gov/news/index.php/fuseaction/nr.subject"&gt;applications we built with it&lt;/a&gt; are still up and running.
&lt;/p&gt;
&lt;p&gt;
I took a two-year &amp;quot;break&amp;quot; from development and upon my return I found more PHP frameworks than you can shake a stick at. Now I need to find a solid MVC-based framework and after reading dozens of articles and completing a few tutorials, I&amp;#39;ve narrowed my focus to CakePHP and the Zend Framework.
&lt;/p&gt;
&lt;p&gt;
Before going further, let it be known that my point of view is that of someone with plenty of application development experience but without a formal IT or CS degree. I can&amp;#39;t go on  about the merits of one design pattern vs. another. I do, however, understand the need for convention, the advantages of modularity, and the efficiency of easily repeatable processes.
&lt;/p&gt;
&lt;p&gt;
Please note that symfony, Prado, Code Ignitor, and many of the other PHP frameworks all look quite capable of meeting most project needs. If you&amp;#39;re a fanboy of another framework, please don&amp;#39;t espouse it&amp;#39;s merits here. I am, however, interested in hearing about your general experience in learning a framework, particularly  in the context of your professional background.
&lt;/p&gt;
&lt;p&gt;
Here&amp;#39;s a comparison and a few conclusions after spending a bit of time with both CakePHP and the Zend Framework. Please note that my quality scale range is: poor, fair, good, excellent.
&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="5"&gt;
&lt;caption&gt;
	Feature Comparison of CakePHP and the Zend Framework&lt;br /&gt;
	&lt;/caption&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th scope="col"&gt;
&lt;div align="left"&gt;
			Feature
			&lt;/div&gt;
&lt;/th&gt;
&lt;th scope="col"&gt;CakePHP&lt;/th&gt;
&lt;th scope="col"&gt;Zend Framework&lt;/th&gt;
&lt;th scope="col"&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;
&lt;div align="left"&gt;
			License
			&lt;/div&gt;
&lt;/th&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			&lt;a href="http://en.wikipedia.org/wiki/MIT_License"&gt;MIT&lt;/a&gt;
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			&lt;a href="http://en.wikipedia.org/wiki/New_BSD_License"&gt;BSD&lt;/a&gt;
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;Each of these licenses is fairly flexible. Carefully consider how your application will be used and distributed. It&amp;#39;s also important to consider compatability with 3rd-party extensions included in your application.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;
&lt;div align="left"&gt;
			Compatability
			&lt;/div&gt;
&lt;/th&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			4 and 5
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			5.1.4 or later
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;I&amp;#39;m curious to know what CakePHP&amp;#39;s PHP 4 support plans are. I would wager that Zend&amp;#39;s focus on PHP 5 provides it with performance advantages.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;
&lt;div align="left"&gt;
			Documentation
			&lt;/div&gt;
&lt;/th&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			&lt;a href="http://book.cakephp.org/"&gt;good&lt;/a&gt;
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			&lt;a href="http://framework.zend.com/manual/"&gt;excellent&lt;/a&gt;
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;CakePHP&amp;#39;s documentation is good but Zend&amp;#39;s API documentation is more thorough.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;
&lt;div align="left"&gt;
			Community
			&lt;/div&gt;
&lt;/th&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			&lt;a href="http://groups.google.com/group/cake-php"&gt;Google group&lt;/a&gt;,  &lt;br /&gt;
			&lt;a href="irc://irc.freenode.net/cakephp"&gt;IRC&lt;/a&gt;, &lt;a href="http://bakery.cakephp.org/"&gt;Articles&lt;/a&gt;
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			&lt;a href="http://framework.zend.com/wiki/display/ZFDEV/Home"&gt;Wiki&lt;/a&gt;, &lt;br /&gt;
			&lt;a href="http://framework.zend.com/wiki/display/ZFDEV/Contributing+to+Zend+Framework#ContributingtoZendFramework-Subscribetotheappropriatemailinglists"&gt;Lists&lt;/a&gt;, &lt;a href="http://framework.zend.com/support/communitybased/"&gt;Chat&lt;/a&gt;
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;Both frameworks have active user communities. In addition to official channels, there are also several 3rd-party community sites easily found through Google. CakePHP has done an excellent job of marketing their framework considering that they don&amp;#39;t have the corporate backing that ZF has. &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;
&lt;div align="left"&gt;
			Tutorial/Sample Availability
			&lt;/div&gt;
&lt;/th&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			excellent
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			fair
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;&lt;a href="http://bakery.cakephp.org/"&gt;CakePHP&amp;#39;s Bakery&lt;/a&gt;  provides an extensive collection of user-submitted applications and code samples. The &lt;a href="http://www.ibm.com/developerworks/edu/os-dw-os-php-cake1.html"&gt;IBM developerWorks CakePHP tutorials and aritcles&lt;/a&gt; are excellent. The Zend tutorials I&amp;#39;ve reviewed are good but require a siginifcant amount of MVC design experience. The &lt;a href="http://framework.zend.com/manual/videos"&gt;ZF beginner&amp;#39;s videos&lt;/a&gt;, however, are very helpful. &lt;a href="http://cakephp.org/screencasts"&gt;CakePHP provides screencasts&lt;/a&gt; too.
			&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;
&lt;div align="left"&gt;
			MVC
			&lt;/div&gt;
&lt;/th&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			strict
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			optional
			&lt;/div&gt;
&lt;/td&gt;
&lt;td rowspan="2"&gt;These points are the biggest distinctions between these frameworks and probably the most important factors when choosing one over the other. CakePHP has very strict naming and code organization conventions while Zend only enforces conventions when employing its MVC capabilities.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;
&lt;div align="left"&gt;
			Conventions
			&lt;/div&gt;
&lt;/th&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			strict
			&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;div align="center"&gt;
			flexible
			&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;
