<br />
<b>Deprecated</b>:  Assigning the return value of new by reference is deprecated in <b>/home/edelabar/ericdelabar.com/wp-settings.php</b> on line <b>472</b><br />
<br />
<b>Deprecated</b>:  Assigning the return value of new by reference is deprecated in <b>/home/edelabar/ericdelabar.com/wp-settings.php</b> on line <b>487</b><br />
<br />
<b>Deprecated</b>:  Assigning the return value of new by reference is deprecated in <b>/home/edelabar/ericdelabar.com/wp-settings.php</b> on line <b>494</b><br />
<br />
<b>Deprecated</b>:  Assigning the return value of new by reference is deprecated in <b>/home/edelabar/ericdelabar.com/wp-settings.php</b> on line <b>530</b><br />
<br />
<b>Strict Standards</b>:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::Enable() should not be called statically in <b>/home/edelabar/ericdelabar.com/wp-includes/plugin.php</b> on line <b>311</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /home/edelabar/ericdelabar.com/wp-settings.php:472) in <b>/home/edelabar/ericdelabar.com/wp-includes/feed-rss2.php</b> on line <b>8</b><br />
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Eric DeLabar</title>
	<atom:link href="http://www.ericdelabar.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ericdelabar.com</link>
	<description>Web 2.0 from a Web Purist and J2EE Developer</description>
	<pubDate>Tue, 10 Mar 2009 11:59:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Hammering Screws: Programmers and Tool Blindness</title>
		<link>http://www.ericdelabar.com/2008/06/hammering-screws.html</link>
		<comments>http://www.ericdelabar.com/2008/06/hammering-screws.html#comments</comments>
		<pubDate>Thu, 19 Jun 2008 18:16:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[code]]></category>

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

		<category><![CDATA[soap box]]></category>

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

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

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=71</guid>
		<description><![CDATA[I seem to have hit a nerve by saying that I was going to uninstall Eclipse.  I'm guessing people just don't like the idea that they might be using the wrong tool for the job.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/didmyself/2368738599/"><img src="http://www.ericdelabar.com/wp-content/uploads/2008/06/screws.jpg" alt="screws.jpg" border="0" width="200" height="150" style="margin-top: 0;"/></a><a href="http://www.ericdelabar.com/2008/06/coding-your-fingers-off.html">In my last post</a> I told a half-truth by ending with <q>&#8220;If you need me I’ll be uninstalling Eclipse.&#8221;</q>  Honestly, I only removed it from my laptop because I rarely do any real Java development directly on my laptop, and should I need a quick code editor I have <a href="http://macromates.com/">TextMate</a> which handles most of my coding needs pretty simply.   However, the commotion that the statement caused is what I&#8217;m going to address in this&nbsp;post. </p>
<blockquote><p>If all you have is a hammer, everything looks like a nail.<br/>-<cite><a href="http://en.wikipedia.org/wiki/Bernard_Baruch">Bernard&nbsp;Baruch</a></cite></p>
</blockquote>
<p>To continue with my tools theme I&#8217;m going to address what I&#8217;ll call &#8220;tool-blindness,&#8221; the mentality that the tools you have and know how to use are perfect for every situation.  In other words, if the tools you have require you to hammer screws then by-god you&#8217;re going to hammer&nbsp;screws.</p>
<p>Recently there has been a grass-roots, developer movement at my employer to switch from <a href="http://ant.apache.org/">Ant</a> to <a href="http://maven.apache.org/">Maven</a>.  I love Maven, it&#8217;s leaps and bounds better than the <em>way we were using</em> Ant.  (Notice I didn&#8217;t say Ant in general, I&#8217;m only planning on starting one holy-war with this post!)  My last four projects have used Maven, and it makes the build and deploy process significantly easier, especially when it comes to dependancy management.  However, <a href="http://www.eclipse.org/">everyone&#8217;s favorite Java <span class="caps">IDE</span></a> does not play well with Maven because Maven&#8217;s standard directory layout is significantly different from Eclipse&#8217;s convention.  People have attempted to alleviate this problem by using the <a href="http://m2eclipse.codehaus.org/">M2 plug-in</a> and <a href="http://www.devx.com/Java/Article/36785">following the instructions here</a>, but the result still feels like you&#8217;re forcing Eclipse to do something it doesn&#8217;t want to.  Add that to the fact that the version of Eclipse we&#8217;re using crashes at least once a day, and you should be able to see why I&#8217;m looking for&nbsp;alternatives.</p>
<p>In short, our metaphorical hardware (the build process) has changed from nails to screws and our hammer (Eclipse) is no longer the best tool for the job.  However, we&#8217;re still using the hammer because it&#8217;s what everyone knows how to use and only a few of us are not tool-blind enough to look for something else.  It also doesn&#8217;t help that the alternatives that play nicely with Maven, namely <a href="http://www.jetbrains.com/idea/">IntelliJ <span class="caps">IDEA</span></a> and Textmate-and-a-shell are not &#8220;<a href="http://c2.com/cgi/wiki?FreeAsInBeer">free as in&nbsp;beer</a>.&#8221;</p>
<p>As I mentioned in the comments of my <a href="http://www.ericdelabar.com/2008/06/coding-your-fingers-off.html">last post</a>, Eclipse has been feeling a little more like <a href="http://forums.mtbr.com/showthread.php?t=338564">this tool</a> than <a href="http://www.wengerna.com/browse/product.jsp?prod_id=20&#038;cat_id=1&#038;cat_name=Knives&#038;sub_cat_id=18">this one</a>.  So maybe it&#8217;s time to ask which tool you really want on your tool&nbsp;belt.</p>
<p>In an interesting turn of events, Alex Vazquez over at <a href="http://wufoo.com/">Wufoo</a>/<a href="http://particletree.com/">Particletree</a> is going through the same process with a different perspective.  Alex is moving, based in part by recommendation and in part by language choice, from Java on Eclipse to <span class="caps">PHP</span> on Textmate, and he seems to be liking it so far.  Alex does, however, sum up Eclipse rather nicely, and coincidentally within my&nbsp;theme:</p>
<blockquote><p>The right development environment can save a programmer countless hours and is like a hammer in the carpenter’s tool belt. Since my background was in Java, my preference was for large sledge hammers and my development environment of choice was the de facto Java <span class="caps">IDE</span> Eclipse. It has a number of amazing features like autocomplete, refactoring and hundreds of plugins for every task imaginable. It’s no secret Java requires mountains of code, but Eclipse was made to move mountains.<br/>-<cite><a href="http://particletree.com/features/eclipse-to-textmate-an-ideological-change/">Alex&nbsp;Vazquez</a></cite></p>
</blockquote>
<p>I think Alex really nails (pardon the pun) the fact that if you&#8217;re going to be doing Java <em>Enterprise</em> development you <strong>need</strong> an <span class="caps">IDE</span> that can handle it.  You need something that generates the code and provides the re-factoring tools and autocompletion to make it possible to <q>&#8220;move mountains.&#8221;</q>  However I&#8217;d like to pose a question to all Java developers who use Eclipse; how much of Eclipse do you <strong>really</strong> use?  Besides re-factoring, code completion/generation, and cvs/svn/scm integration, is there anything else you couldn&#8217;t live without?  Anything else that Textmate doesn&#8217;t do?  (Besides run on Windows, we&#8217;ll save that tool for a different day.)  Look at all of the stuff Eclipse does that you don&#8217;t use, is the added bulk really worth it?  How much memory is your Eclipse process using right now?  (Mine&#8217;s got ~<span class="caps">254MB</span>, 5x more than the next largest memory footprint, and my Eclipse process is basically idle.)  Just my two cents, please form your own opinions, after all <a href="http://www.ericdelabar.com/2008/06/coding-your-fingers-off.html#comment-1280">I&#8217;m just a kid who couldn&#8217;t possibly have any&nbsp;experience</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/06/hammering-screws.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Maintenance</title>
		<link>http://www.ericdelabar.com/2008/06/maintenance.html</link>
		<comments>http://www.ericdelabar.com/2008/06/maintenance.html#comments</comments>
		<pubDate>Wed, 18 Jun 2008 18:40:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[site news]]></category>

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=70</guid>
		<description><![CDATA[Some quick tidying up for all of the DZone readers.]]></description>
			<content:encoded><![CDATA[<p>A quick welcome to everyone passing through via DZone!  Please subscribe, I&#8217;d love to have you&nbsp;back!</p>
<p>If you&#8217;re new here, please excuse the mess, it&#8217;s still a work in progress since the content has been my number one priority.  Speaking of content, I finally replaced the default Wordpress about page, so go <a href="http://www.ericdelabar.com/about">check mine out</a> if you&#8217;re&nbsp;interested!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/06/maintenance.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Coding Your Fingers Off - Hand Tools, Power Tools, and Programmers</title>
		<link>http://www.ericdelabar.com/2008/06/coding-your-fingers-off.html</link>
		<comments>http://www.ericdelabar.com/2008/06/coding-your-fingers-off.html#comments</comments>
		<pubDate>Tue, 17 Jun 2008 15:53:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[code]]></category>

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

		<category><![CDATA[soap box]]></category>

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

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=68</guid>
		<description><![CDATA[Recently there's been a buzz in the blogosphere about the lack of quality coding talent currently available in the market.  A lot of people are asking why.  I'm proposing an answer.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.ericdelabar.com/wp-content/uploads/2008/06/saw.gif" alt="saw.gif" border="0" width="200" height="177" style="margin-top: 0;"/>I have read quite a few posts recently on the <a href="http://mamchenkov.net/wordpress/2008/06/04/where-did-all-the-php-programmers-go/">lack of quality programmers</a>, web or otherwise, available in the current market.  I&#8217;ve even written a post myself on some of the <a href="http://www.ericdelabar.com/2008/05/jack-of-more-master-of-less.html">&#8220;differences&#8221; in the technology stack</a> between now and when I started programming professionally just four years ago.  Some people are saying we need to <a href="http://news.bbc.co.uk/2/hi/technology/7324556.stm">encourage children to become programmers</a>, others are <a href="http://www.doolwind.com/blog/?p=94">questioning the languages that are taught in schools</a>, still others are <a href="http://eriwen.com/opinion/what-i-wanted-to-know/">criticizing the things that are not taught (or encouraged)</a> during secondary education.  I&#8217;m going to question <strong>how</strong> things are&nbsp;taught.</p>
<p>I spent my first year of college at <a href="http://www.rit.edu/kgcoe/undergrad/software.htm"><span class="caps">RIT</span></a>, not to downplay my last three years at <a href="http://mathcs.muhlenberg.edu/">Muhlenberg</a>, but everything I really <strong>needed</strong> to learn I learned in three quarters at <span class="caps">RIT</span>.  Computer Science 101-103 had labs in a <a href="http://www.sun.com/">Sun</a> <a href="http://en.wikipedia.org/wiki/Unix">Unix</a> lab.  We wrote <a href="http://java.sun.com/">Java</a> code using <a href="http://www.gnu.org/software/emacs/">Emacs</a> from a <a href="http://www.gnu.org/software/bash/">shell</a>.  We compiled it from that shell.  We checked it into <a href="http://www.gnu.org/software/rcs/"><span class="caps">RCS</span></a> from that shell.  We ran <a href="http://www.gnu.org/software/diffutils/diffutils.html">diffs</a> from that shell.  We submitted our completed assignments from that shell.  We loved that shell, whether we wanted to or&nbsp;not.</p>
<p>We did not have an <abbr title="integrated development environment"><span class="caps">IDE</span></abbr>, not in today&#8217;s sense anyway; there was no code complete, re-factoring tools, or visual <abbr title="software configuration management"><span class="caps">SCM</span></abbr> merging tools.  In the process we learned Unix, we learned how to <a href="http://www.gnu.org/software/grep/">grep</a>, how to use <a href="http://www.gnu.org/software/sed/">sed</a> and <a href="http://www.gnu.org/software/gawk/">awk</a>, <a href="http://en.wikipedia.org/wiki/TELNET">telnet</a>, <a href="http://www.openssh.org/">ssh</a>, and command line <a href="http://en.wikipedia.org/wiki/File_Transfer_Protocol">ftp</a>.  We learned how the internet worked by first learning how a network worked.  We learned to write code, use a computer, and use the internet with the functional equivalent of hand tools.  In the process we learned and understood how and why it all fit&nbsp;together.</p>
<p>As a matter of illustration, I&#8217;m reminded of the <a href="http://en.wikipedia.org/wiki/Home_Improvement">Home Improvement</a> television show that was on when I was a kid.  In it, <a href="http://en.wikipedia.org/wiki/Tim_Allen">Tim Allen</a> plays <a href="http://en.wikipedia.org/wiki/Tim_Taylor_%28character%29">Tim Taylor</a>, the host of a cable <span class="caps">TV</span> tool show called <a href="http://en.wikipedia.org/wiki/Tool_Time">Tool Time</a>.  He has an assistant, <a href="http://en.wikipedia.org/wiki/Al_Borland">Al Borland</a>, played by <a href="http://en.wikipedia.org/wiki/Richard_Karn">Richard Karn</a>.  On the show, Tim&#8217;s motto is &#8220;more power,&#8221; which usually leads him to the biggest <a href="http://en.wikipedia.org/wiki/Binford_Tools">Binford Tools</a> power tools, disastrous projects, and eventually the emergency room.  Al, on the other hand, is more of a renaissance man, appreciating the beauty, elegance, and simplicity of hand tools and the wood they&#8217;re used on.  Although I don&#8217;t think it was ever stated, Al never ended up in the emergency room.  Which character would you hire to work on your&nbsp;house?</p>
<p>But I digress, we&#8217;re seeing more and more computer science grads who have worked only on Windows.  They&#8217;ve used <a href="http://www.eclipse.org/">Eclipse</a> and <a href="http://msdn.microsoft.com/en-us/vstudio/products/default.aspx" rel="nofollow">Visual Studio</a>.  They know how to use the very basic <span class="caps">IDE</span> functionality with the mouse and they live and die by <kbd>ctrl+c</kbd> and <kbd>ctrl+v</kbd>.  They were given power tools in the very beginning of their careers and now quite a few of them have figuratively managed to cut their fingers off.  They&#8217;re crippled programmers because the &#8220;more power,&#8221; here&#8217;s-a-monsterous-power-tool-that-does-everything-you&#8217;ll-ever-need-really-fast attitude has physically removed their ability to operate the simple tools that solve their problems in an elegant manner.  They&#8217;re afraid of the shell because they don&#8217;t know how to use it, but they&#8217;re not afraid of the IDE because it has a big, shiny button that promises to make their life easier if they press it.  Power tools in the real world have warnings about loss of life and limb if operated incorrectly.  Sadly, power tools in the digital world do&nbsp;not.</p>
<p>So, I propose my solution.  Bring the hand tools back into the classroom.  Eliminate <span class="caps">IDE</span>&#8217;s from the educational system.  Teach students to use the shell, and with it the tools of our <a href="http://en.wikipedia.org/wiki/Hacker_%28hobbyist%29">hacker</a> forefathers.  Let them nick their fingers with a hand saw instead of cutting them off with a circular saw.  Encourage them to <strong>use</strong> open source.  Encourage them to <strong>contribute to</strong> open source.  The web in general runs on it, they should know how it gets made, and know how to </strong>give back to the community</strong> that has made a large part of their future pay possible.  Teach them Emacs or <a href="http://eriwen.com/opinion/what-i-wanted-to-know">Vi</a>.  Give them <a href="http://www.nongnu.org/cvs/">cvs</a>, <a href="http://subversion.tigris.org/">svn</a>, or <a href="http://git.or.cz/">git</a>, and teach them to read a diff.  Make them create a website and <strong>share</strong> what they&#8217;re learning, or at least <strong>participate</strong> in the forums of some pet open source project.  Do them a favor and <strong>scare the ones who aren&#8217;t meant to be doing this</strong> out of the profession.  If they don&#8217;t have the <strong>passion</strong> to persevere they need to find something else to do.  Ladies and gentlemen of academia, I ask you for one thing.  Stop manufacturing cookie-cutter, power-tool graduates and start nurturing artesian, master&nbsp;programmers.</p>
<p>Thank you.  If you need me I&#8217;ll be uninstalling&nbsp;Eclipse.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/06/coding-your-fingers-off.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Border Weirdness in Internet Explorer</title>
		<link>http://www.ericdelabar.com/2008/06/weird-borders-ie.html</link>
		<comments>http://www.ericdelabar.com/2008/06/weird-borders-ie.html#comments</comments>
		<pubDate>Thu, 12 Jun 2008 14:03:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[bugs]]></category>

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

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

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=67</guid>
		<description><![CDATA[Found this interesting bug while helping a friend with a site redesign.  Basically, IE's background placement renders relative to the outside of the border instead of the inside, here's the cause, and two possible solutions.]]></description>
			<content:encoded><![CDATA[<p>While helping a friend rework his <a href="http://www.vintageboardgames.net/">Vintage Board Games</a> site (rework not live yet), we came across an interesting <span class="caps">IE</span> bug.  In a nutshell, in some cases, <span class="caps">IE</span> was placing a <span class="caps">CSS</span> background image relative to the outside of an element&#8217;s border instead of the&nbsp;inside.</p>
<p>The <a href="http://www.ericdelabar.com/examples/weird-borders-ie7/" rel="nofollow">simplified markup of the bug and <span class="caps">CSS</span> are as&nbsp;follows:</a></p>
<p><code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xhtml" style="font-family:monospace;">&lt;div class=&quot;content&quot;&gt;
	&lt;div class=&quot;left&quot;&gt;&lt;/div&gt;
	&lt;div class=&quot;right&quot;&gt;&lt;/div&gt;
	&lt;div style=&quot;clear: both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;</pre></td></tr></table></div>

<p></code><br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="css css" style="font-family:monospace;"><span style="color: #6666ff;">.container</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">420px</span>;
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.content</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">10px</span> <span style="color: #cc00cc;">#3570d6</span>;
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;"> background_invert.gif </span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #993333;">center</span> <span style="color: #993333;">no-repeat</span>;
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.left</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span>;
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span>;
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">300px</span>;
	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span>;
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">green</span>;
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.right</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span>;
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span>;
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span>;
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span>;
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> cyan;
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p></code></p>
<p>Basically, it&#8217;s a two column layout with the columns wrapped in a <code>div</code> that has a large border.  (That <code>div</code> also has a background image set on it.  The <code>.container</code> <code>div</code> seems extraneous in this example but was a requirement for the layout.)  The desired rendering of this markup should look something like the following: (Note: the black/brown box is the background&nbsp;image.)</p>
<p><img src="http://www.ericdelabar.com/wp-content/uploads/2008/06/ie-correct.gif" alt="ie_correct.gif" border="0" width="427" height="327"  style="float: none;"/></p>
<p>But in <span class="caps">IE</span>, we get&nbsp;this:</p>
<p><img src="http://www.ericdelabar.com/wp-content/uploads/2008/06/ie-bug.gif" alt="ie_bug.gif" border="0" width="427" height="327"  style="float: none;"/></p>
<p>If you don&#8217;t trust my images, please <a href="http://www.ericdelabar.com/examples/weird-borders-ie7/index.php" rel="nofollow">try for&nbsp;yourself</a>.</p>
<p>We quickly found two solutions to this problem, <a href="http://www.ericdelabar.com/examples/weird-borders-ie7/index.php?solution=1" rel="nofollow">the first</a> involved altering the alignment of the background image to be <code>center</code> instead of&nbsp;<code>left</code>:</p>
<p><code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>3
4
5
6
7
8
</pre></td><td class="code"><pre class="css css" style="font-family:monospace;">...
<span style="color: #6666ff;">.content</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">10px</span> <span style="color: #cc00cc;">#3570d6</span>;
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;"> background_invert.gif </span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">center</span> <span style="color: #993333;">center</span> <span style="color: #993333;">no-repeat</span>;
<span style="color: #00AA00;">&#125;</span>
...</pre></td></tr></table></div>

<p></code></p>
<p>This is how we actually solved the problem on the site.  <a href="http://www.ericdelabar.com/examples/weird-borders-ie7/index.php?solution=2" rel="nofollow">The second solution</a> I found while attempting to narrow down the cause of this problem.  For this solution we simply set a <code>min-height</code> on the <code>.content</code>&nbsp;<code>div</code>:</p>
<p><code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="css css" style="font-family:monospace;">...
<span style="color: #6666ff;">.content</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">min-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span>;
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">10px</span> <span style="color: #cc00cc;">#3570d6</span>;
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;"> background_invert.gif </span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #993333;">center</span> <span style="color: #993333;">no-repeat</span>;
<span style="color: #00AA00;">&#125;</span>
...</pre></td></tr></table></div>

<p></code></p>
<p>I&#8217;m assuming this is some sort of <a href="http://www.satzansatz.de/cssd/onhavinglayout.html">hasLayout</a> issue and giving the <code>div</code> a <code>min-height</code> (<code>height</code> in IE6, accomplished with <a href="http://www.quirksmode.org/css/condcom.html">conditional comments</a> in <a href="http://www.ericdelabar.com/examples/weird-borders-ie7/index.php?solution=2" rel="nofollow">my example</a>) also gives it layout, but I honestly have no idea what causes this.  Anybody have any&nbsp;thoughts?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/06/weird-borders-ie.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>The Parable of the Plumber and the Programmer</title>
		<link>http://www.ericdelabar.com/2008/06/parable-of-plumber-and-programmer.html</link>
		<comments>http://www.ericdelabar.com/2008/06/parable-of-plumber-and-programmer.html#comments</comments>
		<pubDate>Wed, 11 Jun 2008 15:33:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[soap box]]></category>

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

		<category><![CDATA[view from the trenches]]></category>

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=64</guid>
		<description><![CDATA[I'm not sure if it's a question of attitude, experience, or the fact that there are parts of the plumbing profession that literally stink, but people rarely tell a plumber how to do their job, and I doubt many plumbers would even let someone if they tried.]]></description>
			<content:encoded><![CDATA[<p>One day a small business owner, known to dabble in the do-it-yourself arts, was reading the visitor statistics from the website that his nephew had made him. Disappointed by the long page loads, low traffic, and cross-browser inconsistencies, the small business owner went to his kitchen for a glass of water. He turned on the faucet and nothing happened. A minute later, water started pouring out from under the sink. Quickly, he turned off the water and rushed back to his computer and looked up the name of a local plumber, he called, and had a plumber dispatched immediately. By chance, he also saw an advertisement for a local “low-cost, satisfaction guaranteed, web developer” and called him as&nbsp;well.</p>
<p>Twenty minutes later, they both arrived. Apologizing for the timing and offering a cup of coffee, the small business owner asked if the web developer wouldn&#8217;t mind waiting while he got the plumber started. The web developer, figuring he&#8217;d only had six cups of coffee today, decided a little waiting was not a&nbsp;problem.</p>
<p>The small business owner took the plumber to the water shut-off valve, and the plumber quickly shut it off. While discussing the solution, the small business owner told the plumber that he would like all of the pipes from the valve to the sink to be replaced with <span class="caps">PEX</span> pipes instead of the existing copper. Concerned, the plumber warned that there was nothing wrong with the existing copper pipes and that he was unsure if <span class="caps">PEX</span> was even allowed by local commercial building codes. The plumber even offered to first double-check the codes, but in a hurry to get back to the web developer before he drank all of the coffee, the small business owner told the plumber to just do it. He blindly signed the contract, completely ignoring the written warning about violating building codes, and left the plumber to do the&nbsp;job.</p>
<p>Relieved to have one problem scratched from his list, the small business owner left the plumber and returned to the web developer, who had already drank all of the coffee. Annoyed, the small business owner began making a new pot of coffee while explaining the problem with his website. Hearing the same thing a thousand times before, the web developer began his speech about web standards, usability, accessibility, and information architecture. Within seconds, the small business owner&#8217;s eyes had glazed over, and he began ignoring everything the web developer&nbsp;said.</p>
<p>A few hours passed. The plumber finished the job, the small business owner signed the web developer&#8217;s boiler-plate contract with 100% satisfaction guarantee, and both the plumber and the web developer left the small business owner to finish his list of&nbsp;things-to-do.</p>
<p>About a month later, the web developer returned to the small business owner&#8217;s office to show him the finished product. Coincidentally, the city building inspector arrived at the same time. Learning his lesson about web developers and coffee from the last visit, the small business owner told the building inspector that the work was done down the hall in the first room on the right, and left him to his&nbsp;job.</p>
<p>The small business owner and the web developer went to a computer and the web developer showed the small business owner the finished product. Unimpressed by the lack of motion, flashing, and changing colors the small business owner said that the new site was “nice, but needs something.” The web developer, who truthfully knew this was coming, began regretting his 100% satisfaction guarantee. By the time the small business owner was done stating his &#8220;satisfaction requirements,&#8221; the site had lost its information architecture, the typography was small and low-contrast, the flash-intro was back, and bigger than ever, and the back end programming was changed from a lightweight <span class="caps">CMS</span> to a large enterprise framework that the small business owner&#8217;s friend had heard about at a trade show. Concerned for his portfolio, but tired of this particular client, the web developer left the small business owner&#8217;s office; defeated and hoping to just get the job done as soon as&nbsp;possible.</p>
<p>Glowing from his victory against the tasteless web developer, the small business owner went down the hall to find the building inspector. The building inspector was sitting in the corner of the room finishing up his report on the plumbing changes. He looked up from the paper and told the small business owner that all of the <span class="caps">PEX</span> pipes had to be removed because it was against code in a commercial building. Aghast, the small business owner quickly called the plumber to chastise him for performing such a blatant building code violation. Unimpressed, the plumber simply referred the small business owner to section 4c of their signed contract where it stated that the small business owner had been informed of all building codes to the best of the plumber&#8217;s knowledge and that any specific requirements performed by the plumber per the customer were the responsibility of the customer. The plumber also stated that he would be glad to come out and replace all of the <span class="caps">PEX</span> with brand-new copper, under a brand-new&nbsp;contract.</p>
<p>About a month later the &#8220;improved&#8221; website was live and still suffering from the same long page loads, low traffic, and cross-browser inconsistencies. The web designer however, had already folded his company and taken up a new career as an apprentice to the local&nbsp;plumber.</p>
<h3>The&nbsp;Morals</h3>
<p>Mostly everything we do as web developers is according to some specification or recommendation, but it&#8217;s still very easy to ignore them all and still produce a “functioning” website. We compete in an amazing marketplace against everyone from the boss&#8217; nephew to Fortune 500 companies. Because of this, highly skilled web developers working at small companies or even as freelancers often make stupid promises, including 100% satisfaction guarantees. These guarantees do not help anyone because the client is rarely satisfied, the end result isn&#8217;t worthy of the web developer&#8217;s portfolio, and none of the original problems have been&nbsp;solved.</p>
<p>Plumber&#8217;s have the law, the union, air-tight contracts, years of collective experience, and the fact that there&#8217;s no such thing as <span class="caps">WYSIWYG</span> plumbing software to keep the average Joe from calling themselves master&nbsp;plumbers.</p>
<h3>The&nbsp;Soapbox</h3>
<p>I&#8217;m not sure if it&#8217;s a question of attitude, experience, or the fact that there are parts of the plumbing profession that literally stink, but people rarely tell a plumber how to do their job, and I doubt many plumbers would even let someone if they tried. To the same extent, a plumber&#8217;s work is usually not up for scrutiny in the public eye, in fact other than in basements and under sinks, it&#8217;s rarely even visible to the proerty-owner&#8217;s&nbsp;eye.</p>
<p>So what&#8217;s my point? With the amount of very talented web developers and designers available world wide, the web has the potential to be a very beautiful, very usable, and very accessible place. However, the web wasn&#8217;t build by graphic artists, typographers, interactive designers and information architects, it was built by tinkerers, inventors, and do-it-yourselfers, kind of like the first indoor plumbing. We have a long way to go before there are laws requiring best practices, and professional reputations that allow us to say “this is the way I&#8217;m going to do it, and it&#8217;s non-negotiable.” But that doesn&#8217;t mean we should stop educating our customers and return to table based layouts and excessive use of the blink and marquee tags. It means there&#8217;s a light at the end of the tunnel. Until until we reach that time, sell the fact that you&#8217;re an expert and not the fact that you&#8217;re guaranteeing satisfaction. Let your work speak for itself, a well-designed and well-implemented site will just work and will lead to a satisfied customer, whether or not it&#8217;s been guaranteed in&nbsp;writing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/06/parable-of-plumber-and-programmer.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Found Code: Optimizing Large Form Performance in JavaScript</title>
		<link>http://www.ericdelabar.com/2008/06/large-forms-performance.html</link>
		<comments>http://www.ericdelabar.com/2008/06/large-forms-performance.html#comments</comments>
		<pubDate>Tue, 10 Jun 2008 18:25:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[found code]]></category>

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

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

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

		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=63</guid>
		<description><![CDATA[A analysis of some poorly performing JavaScript and a better, faster solution that accomplishes the same functionality.]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;ve covered before, <a href="http://www.ericdelabar.com/2008/04/javascript-getelementbyid-performance.html">ill-used JavaScript can lead to some serious performance problems</a>, most of which are caused by simply not thinking about what the code is really doing.  Recently I came across a site that provided digital photo printing,  This site had a nice interface that allowed my to upload close to three hundred photos.  On the resulting page, each photo was displayed with all of the available sizes as input boxes, which <a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=300" rel="nofollow">looked something like this</a>.  I liked the interface, but came across a very serious problem.  The event handlers that updated the totals box ran on the keyup event and recalculated the total of the entire form!  This worked fine with ten or twenty photos, but the 300 that I provided brought my browser to a screeching&nbsp;halt.</p>
<p>I&#8217;ve taken the liberty of creating a very simplistic mock-up of the form and a simplified version of the JavaScript, <a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=300">which is available in my examples section</a>.  The demo uses <a href="http://www.getfirebug.com/">Firebug</a> and <a href="http://www.getfirebug.com/lite.html">Firebug Lite</a> for logging just like I did in my <a href="http://www.ericdelabar.com/2008/04/javascript-getelementbyid-performance.html">dollar function article</a>, and the <a href="http://www.ericdelabar.com/examples/lib/benchmark.js">benchmark class</a> from that article as well.  The site&#8217;s JavaScript was a bit more complex and actually did an <span class="caps">AJAX</span> lookup of the price on each keyup, but I&#8217;m more concerned with the JavaScript performance here, so I simplified the code to something like&nbsp;this:</p>
<p><code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> PhotoSelector <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">Class</span>.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
PhotoSelector.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	initialize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> <span style="color: #000066;">name</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> init <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Benchmark<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		init.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Beginning Initialization!&quot;</span> <span style="color: #009900;">&#41;</span>;
&nbsp;
		$A<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span> 
			<span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> inp <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				inp.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> Element.<span style="color: #660066;">hasClassName</span><span style="color: #009900;">&#40;</span>inp<span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;qtyInput&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					inp.<span style="color: #660066;">onkeyup</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">recalculate</span>.<span style="color: #660066;">bindAsEventListener</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span>;
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>
		<span style="color: #009900;">&#41;</span>;
&nbsp;
		init.<span style="color: #660066;">end</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Initialization Complete in &quot;</span> <span style="color: #339933;">+</span> init.<span style="color: #660066;">inMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; milli(s).&quot;</span> <span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	recalculate<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> calc <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Benchmark<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		calc.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fourby&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fiveby&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;eightby&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;wallet&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> inputs <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;pictures&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> 0; i <span style="color: #339933;">&lt;</span> inputs.<span style="color: #660066;">length</span>; i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> totalId <span style="color: #339933;">=</span> inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">id</span>.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/([a-z]+)[0-9]+/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>;
			<span style="color: #003366; font-weight: bold;">var</span> total <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>totalId<span style="color: #009900;">&#41;</span>;
			total.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>total.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> parseInt<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		calc.<span style="color: #660066;">end</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Recalculation Complete in &quot;</span> <span style="color: #339933;">+</span> calc.<span style="color: #660066;">inMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; milli(s).&quot;</span> <span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> ps;
Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>window<span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;load&quot;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>ps <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> PhotoSelector<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p></code></p>
<p>Basically, on window load, this code grabs every input element, sets its value to zero, and binds an event handler to it.  The event handler runs on key up and loops through every input box in the &#8220;pictures&#8221; list, and updates the totals inputs at the top of the page.  As I said above, this code works fine with <a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=20">20 pictures</a>, but it starts getting slow <a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=300">around 300</a>, and becomes almost <a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=1000">unusable at 1000</a>.  Care to <a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=10000">try 10,000</a>?  (Be careful, it crashes my browser!)  To test it, simply enter values in the photo inputs and watch the totals boxes&nbsp;increment.</p>
<p>The main problem with this code comes from the <code>recalculate</code> function.  Problem number one is my personal pet peeve, the dollar sign function is called at least six times!  Well, I guess six times wouldn&#8217;t be terrible for the entire page, but it&#8217;s called at least six times on every key up event!  Problem number two, the biggest problem, is the fact that this code re-crawls what amounts to the entire DOM every time the event fires.  Obviously the larger the DOM, the more time this is going to&nbsp;take.</p>
<p>So, how do we fix it?  Well, here&#8217;s how I fixed it, I&#8217;ll explain the details&nbsp;below:</p>
<p><code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> PhotoSelector <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">Class</span>.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
PhotoSelector.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	initialize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> <span style="color: #000066;">name</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> init <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Benchmark<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		init.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Beginning Initialization!&quot;</span> <span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">old</span> <span style="color: #339933;">=</span> 0;
		<span style="color: #003366; font-weight: bold;">var</span> totals <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
			fourby<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fourby&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			fiveby<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fiveby&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			eightby<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;eightby&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			wallet<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;wallet&quot;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#125;</span>;
		totals.<span style="color: #660066;">fourby</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
		totals.<span style="color: #660066;">fiveby</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
		totals.<span style="color: #660066;">eightby</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
		totals.<span style="color: #660066;">wallet</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
&nbsp;
		$$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.qtyInput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span> 
			<span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> inp<span style="color: #339933;">,</span> index <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				inp.<span style="color: #000066;">onfocus</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">enter</span><span style="color: #009900;">&#40;</span> inp<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bindAsEventListener</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span>;
				inp.<span style="color: #000066;">onblur</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">recalculate</span><span style="color: #009900;">&#40;</span> inp<span style="color: #339933;">,</span> totals<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bindAsEventListener</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>
		<span style="color: #009900;">&#41;</span>;
&nbsp;
		init.<span style="color: #660066;">end</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Initialization Complete in &quot;</span> <span style="color: #339933;">+</span> init.<span style="color: #660066;">inMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; milli(s).&quot;</span> <span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	enter<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> inp<span style="color: #339933;">,</span> me <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			me.<span style="color: #660066;">old</span> <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>inp.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	recalculate<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> inp<span style="color: #339933;">,</span> totals<span style="color: #339933;">,</span> me <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> type <span style="color: #339933;">=</span> inp.<span style="color: #660066;">id</span>.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/([a-z]+)[0-9]+/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>;
		<span style="color: #003366; font-weight: bold;">var</span> total <span style="color: #339933;">=</span> totals<span style="color: #009900;">&#91;</span>type<span style="color: #009900;">&#93;</span>;
		inp.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> 0;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> calc <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Benchmark<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			calc.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
			<span style="color: #003366; font-weight: bold;">var</span> newVal <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>inp.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> me.<span style="color: #660066;">old</span> <span style="color: #339933;">&gt;</span> newVal <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				newVal <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> me.<span style="color: #660066;">old</span> <span style="color: #339933;">-</span> newVal <span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span>;
			<span style="color: #009900;">&#125;</span>
			total.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>total.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> newVal;
&nbsp;
			calc.<span style="color: #660066;">end</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Recalculation Complete in &quot;</span> <span style="color: #339933;">+</span> calc.<span style="color: #660066;">inMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; milli(s).&quot;</span> <span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> ps;
Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>window<span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;load&quot;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>ps <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> PhotoSelector<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p></code></p>
<p>To solve problem number one from above I created a simple object for storing references to all of the total input boxes (lines 9-14), now we have a simple associative array lookup whenever we need to update a total.  Problem number two is mainly solved by recording the original value of the input on focus (line 22, 31-35), and then comparing them on blur (line 23, 37-54).  Because we&#8217;re doing this on blur, we can update only the necessary total input (lines 45-49) instead of recalculating the entire form.  I made one final tweak, mainly to make solving problem number one easier, and that is the <code>recalculate</code> function now returns a specific event handler for the given input so that the event handler itself does not need to call the dollar&nbsp;function.</p>
<p>So, comparing these in my regular, not-very-scientific fashion, I came up with the following results.  I chose to measure the startup time, which will increase with the size of the page, as well as the event handler time.  I also measured these times across a pretty decent amount of pictures, and across a few&nbsp;browsers.</p>
<h4>Safari (<span class="caps">OS</span>&nbsp;X)</h4>
<table>
<thead>
<tr>
<th></th>
<th colspan="2">Optimized Time</th>
<th colspan="2">Unoptimized Time</th>
</tr>
<tr>
<th>Pictures</th>
<th>Load</th>
<th>Handler</th>
<th>Load</th>
<th>Handler</th>
</tr>
</thead>
<tbody>
<tr>
<td>10</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=10">4 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=10">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=10">6 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=10">3 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>50</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=50">17 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=50">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=50">14 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=50">13 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>100</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=100">33 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=100">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=100">24 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=100">26 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>1000</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=1000">365 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=1000">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=1000">452 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=1000">178 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
</tbody>
</table>
<h4>Internet Explorer 7 (Windows&nbsp;Vista)</h4>
<table>
<thead>
<tr>
<th></th>
<th colspan="2">Optimized Time</th>
<th colspan="2">Unoptimized Time</th>
</tr>
<tr>
<th>Pictures</th>
<th>Load</th>
<th>Handler</th>
<th>Load</th>
<th>Handler</th>
</tr>
</thead>
<tbody>
<tr>
<td>10</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=10">56 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=10">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=10">48 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=10">9 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>50</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=50">238 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=50">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=50">213 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=50">76 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>100</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=100">457 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=100">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=100">424 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=100">235 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>1000</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=1000">4642 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=1000">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=1000">4584 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=1000">28110 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
</tbody>
</table>
<p><strong>28 seconds!?&nbsp;Why!?</strong></p>
<h4>Firefox 2 (Windows&nbsp;Vista)</h4>
<table>
<thead>
<tr>
<th></th>
<th colspan="2">Optimized Time</th>
<th colspan="2">Unoptimized Time</th>
</tr>
<tr>
<th>Pictures</th>
<th>Load</th>
<th>Handler</th>
<th>Load</th>
<th>Handler</th>
</tr>
</thead>
<tbody>
<tr>
<td>10</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=10">12 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=10">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=10">8 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=10">7 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>50</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=50">45 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=50">0 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=50">31 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=50">30 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>100</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=100">87 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=100">1 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=100">60 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=100">59 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
<tr>
<td>1000</td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=1000">985 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/optimized.php?qty=1000">3 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=1000">584 <abbr title="milliseconds">ms</abbr></a></td>
<td><a href="http://www.ericdelabar.com/examples/large-forms-performance/unoptimized.php?qty=1000">581 <abbr title="milliseconds">ms</abbr></a></td>
</tr>
</tbody>
</table>
<p>The results pretty obviously speak for themselves, but there is one caveat, be sure to notice the initial load time.  Since the event handlers still need to be assigned to each input on the page the more inputs there are the longer the page load takes, and the load time is even slightly slower on the optimized page.  Be sure to consider this time, possibly by capping the number of inputs displayed, since the code itself is very processor intensive and appears to actually hang the entire computer while processing.  Obviously, these fixes become more important as the number of inputs grows, but any speed increase when the user is directly interacting with the page is a good&nbsp;one!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/06/large-forms-performance.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Psychology, Avatars, and My High School Yearbook</title>
		<link>http://www.ericdelabar.com/2008/06/avatars-and-psychology.html</link>
		<comments>http://www.ericdelabar.com/2008/06/avatars-and-psychology.html#comments</comments>
		<pubDate>Mon, 09 Jun 2008 15:22:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[blogging]]></category>

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

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

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=62</guid>
		<description><![CDATA[Unfounded, unscientific thoughts on what your avatar says to me about you roughly based on something I vaguely remember from working on my yearbook in high school.]]></description>
			<content:encoded><![CDATA[<p>At one point in high school I went to a workshop on making a great yearbook.  It was interesting, got me out of a day of school, and really helped with the two pages of the book I actually got to work on.  Besides that, I took out of it a few facts about portrait composition, mainly that looking right is generally associated with looking into the future and looking left into the past.  Recently there&#8217;s even been some talk about <a href="http://www.theonion.com/content/news/obama_practices_looking_off_into">Obama and his &#8220;looking into the future&#8221; pose</a>, which definitely follows these&nbsp;guidelines.</p>
<p>But seriously, The Onion aside, every self-respection &#8220;Web 2.0&#8221; site out there has some sort of avatar available to its users.  What does your avatar say about you?  Well, I&#8217;m no psychologist, in fact I didn&#8217;t even take the course on it in college, but here&#8217;s what I think&nbsp;anyway.</p>
<ul>
<li>Facing Right - Already covered, looking into the future.  Possibly optimistic, probably at least positive in&nbsp;nature.</li>
<li>Facing Left - Again, already covered, looking into the past, possibly back through history.  Nostalgic.  May or may not be negative, sometimes may seem a little&nbsp;jaded.</li>
<li>Looking Straight Ahead - Sometimes dominant, sometimes playful, sometimes creepy.  As with the next two seems to have more to do with the rest of the facial&nbsp;expression.</li>
<li>Looking Up - If straight ahead, can be submissive or unconfident, if facing right, increases positive feel, if left, seems&nbsp;narcissistic.</li>
<li>Looking Down - If straight head, definite dominance, if left or right, shows increasing negativity on past or future&nbsp;view.</li>
<li>Serious - Boring, possibly pompous; only has an avatar to get 100% on LinkedIn profile or because boss or some self-help personal-branding article said&nbsp;so.</li>
<li>Goofy - Fun, party-animal, not ready to settle down now, or potentially ever.  Probably not the best worker-drone code-monkey but could make a great rock&nbsp;star.</li>
<li>Picture of Somebody Else - Personally, I find this quite creepy.   Usually very hard to actually identify these, in my experience when meeting somebody in the real world and finding their avatar doesn&#8217;t match I get a little turned off.  This can be pulled off ironically by using an obvious-not-you type of photo as more of a caricature, but I have only seen this pulled off well a few&nbsp;times.</li>
<li>Picture of Somebody Famous - The more famous the better, if the picture is not recognized by he majority of your audience it simply becomes &#8220;Picture of Somebody Else&#8221; and therefore loses its power.  May also appear very stalker-like or just plain juvenile if done in a fan-boy&nbsp;manner.</li>
<li>Professional Portrait - See &#8220;serious&#8221; above, screams real estate agent, lawyer, sales person, or scammy-internet&nbsp;marketer.</li>
<li>Candid - Probably my favorite type.  Seems sincere and&nbsp;real.</li>
<li>Group Photo - Lack of self-confidence or own identity, possibly critical of own&nbsp;appearance.</li>
<li>Caricature - Makes me wonder about self-confidence, but could be done in irony.  Potential for inside jokes here.  A good caricature plays on flaws, so this may say positive things about self&nbsp;confidence.</li>
<li>Animal(s) - Awe!!!1  <span class="caps">OMG</span> look at the cute kittens and ponies! I can haz cheesburger?  Seriously.  Unless you&#8217;re twelve or doing it for purely and obviously ironic reasons I usually look down on this as somebody I&#8217;m not even interested in listening&nbsp;to.</li>
<li>Logo or Mascot - Definitely used for self-branding or maybe just branding in general, if done well can be a great asset, but may also appear very spammy if done poorly.  May say things about self-image or confidence, especially if hiding behind&nbsp;anonymity.</li>
<li>Object - Like an animal, logo, or picture of somebody else, this gives the user complete anonymity and can become very hard to read-into.  Lots of room for irony or playfulness can allow personality to shine through, but if not done well it may just turn into a poor inside&nbsp;joke.</li>
</ul>
<p>Now, please understand, I&#8217;m not necessarily criticizing <strong><span class="caps">ANY</span></strong> use of an avatar in one of these manners; in fact there is probably somebody out there that has a very good reason for using a pony for their avatar, and I&#8217;m sure they do it well.  I&#8217;m just saying this is what my first impression of you is based on the two seconds I&#8217;ve had to see your&nbsp;avatar.</p>
<p>Well, what do you think?  Am I right?  Am I completely wrong?  Did I just insult you <strong>and</strong> your mother with my analysis of your avatar?  Just to remind you, I have no scientific backing for doing this, which I&#8217;m guessing makes it a better analysis, but if you disagree, tell me why I&#8217;m&nbsp;wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/06/avatars-and-psychology.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Google Giveth and Google Taketh Away</title>
		<link>http://www.ericdelabar.com/2008/06/google-givith-google-taketh.html</link>
		<comments>http://www.ericdelabar.com/2008/06/google-givith-google-taketh.html#comments</comments>
		<pubDate>Mon, 02 Jun 2008 15:41:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[seo]]></category>

		<category><![CDATA[soap box]]></category>

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

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=61</guid>
		<description><![CDATA[Getting listed in a Google SERP is not your god-given right.  Just because you've found a way to make money with Google doesn't mean Google has to allow you to do it forever.]]></description>
			<content:encoded><![CDATA[<p><a href="http://seo-theory.com/wordpress/">Michael Martinez over at <span class="caps">SEO</span> Theory</a> recently posted an interesting article on <a href="http://seo-theory.com/wordpress/2008/06/01/contract-law-and-the-web-how-enforceable-are-webmaster-guidelines/">contract law, terms of service, and how they apply to the web</a>.  It&#8217;s worth a read and raises some interesting points, but my main beef is the loosely stated complaint about <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&#038;answer=35769">Webmaster Guidelines</a>, specifically those of <a href="http://www.google.com/">everyone&#8217;s favorite search engine</a>.  This complaint, and variations on it, have been bouncing around the <span class="caps">SEO</span>/M and Affiliate communities for a while now and I&#8217;ve heard more than enough whining on the subject.  Frankly stated, it seems they don&#8217;t like the fact that they actually need to work in order to keep their <a href="http://en.wikipedia.org/wiki/Spam_(electronic)">spam</a> profitable on the search engine result&nbsp;pages.</p>
<p>Google, as with most other search engines, is a business.  In order to actually remain in business, contrary to popular belief on the web, they need to make a profit.  In most web business models profit is proportional to the number of users.  So far, at least in my opinion, all of this is web business 101.  Google has its number of users for one reason, as of now it&#8217;s arguably the easiest and most accurate search engine available.  Google will retain its users as long as it remains the easiest and most accurate search engine&nbsp;available.</p>
<p>Easy is something that Google has down pat, you can&#8217;t get much easier than a single input and a button, accurate is where it gets interesting.  In order to remain accurate Google needs to be unmanipulatable.  Their algorithm needs to return the most relevant and authoritative content possible, and that means excluding spam.  If you&#8217;re not publishing the most relevant and useful content out there you don&#8217;t deserve to be listed, let alone rank on the first&nbsp;page.</p>
<p>For better or for worse, the bulk of <span class="caps">SEO</span> exists to manipulate the search engines, and if you think otherwise you&#8217;re seriously deluding yourself.  Don&#8217;t get me wrong, I believe <span class="caps">SEO</span> is absolutely necessary, if you don&#8217;t at least try to be listed in the search engines there&#8217;s a pretty good chance your site will never be found.  However, <span class="caps">SEO</span> is only the start, it&#8217;s the framework to build your content upon.  Good <span class="caps">SEO</span> establishes a solid base for accessibility, findability, and information architecture, which is a good thing.  Good <span class="caps">SEO</span>, however, is not magic.  If you do it the Google-approved &#8220;right&#8221; way it will probably take a decently long time to get a specific ranking, but once you have it, it should be pretty difficult to lose.  Taking a shortcut and ignoring the webmaster guidelines may prove useful and in some cases successful, but comes with the underlying risk of being delisted&nbsp;altogether.</p>
<p>Basically, what I&#8217;m saying is that <span class="caps">SEO</span>, be it black hat or white hat is a gamble.  It&#8217;s a simple question of risk versus reward, and relies very heavily on your business model.  If your business model is to make a quick buck over a short-term, by all means, go black hat, but don&#8217;t complain when you&#8217;re discovered and your profit dries up.  However, if your business model is to make a long-term name for yourself or your business, go white hat, take your time producing quality, relevant content, and rely on Google to keep the spam from appearing ahead of you in the&nbsp;SERPs.</p>
<p>Either way, Google will continue doing what they do, producing to the best of their ability the most relevant SERPs for a given query, and they&#8217;ll change their algorithm whenever necessary to make it happen.  Instead of complaining about the Webmaster Guidelines, thank Google for them, without them you&#8217;d be shooting in the dark.  Instead of complaining about quality guidelines, thank Google for them, the higher the consistent quality of the ads and results Google displays the greater the chance they&#8217;ll be clicked&nbsp;on.</p>
<p>Complaining about and attempting to change Google&#8217;s practices on these points will not help you in the long run.  Take a second and think about this.  If Google lowers its quality control standards to appease the <span class="caps">SEO</span>&#8217;s and affiliate marketers, Google becomes less useful to the end user.  If Google becomes less useful, less end users will actually use it.  If less end users actually use Google, you have less potential customers, and like it or not your profits are going to be less as&nbsp;well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/06/google-givith-google-taketh.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Programming In Pants</title>
		<link>http://www.ericdelabar.com/2008/05/programming-in-pants.html</link>
		<comments>http://www.ericdelabar.com/2008/05/programming-in-pants.html#comments</comments>
		<pubDate>Fri, 30 May 2008 15:58:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<category><![CDATA[soap box]]></category>

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

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=60</guid>
		<description><![CDATA[Programmers are a rare breed, equal parts scientist and artist, they don't fit well into the bureaucracy and bullshit of a traditional company.   It's got a lot to do with atmosphere and even more to do with attitude, they don't call it herding cats for nothing.]]></description>
			<content:encoded><![CDATA[<p>This topic has been bouncing around my head for a while, but <a href="http://itmanagement.earthweb.com/career/article.php/3749841">an article I stumbled across on Digg</a> brought it to the front.  In this article the author&nbsp;states:</p>
<blockquote><p>My favorite variation of this is the concept that your pants make you a better programmer. If I wear khaki pants to work it makes me a better worker then if I wear denim pants. Though I don’t have a client-facing position, it still makes me more effective if my pants come from Banana&nbsp;Republic.</p>
<p><cite>-Sara&nbsp;Chipps</cite></p></blockquote>
<p>I work for an east coast, software services company that has yet to realize that breaking the spirits, creativity and individuality of their programmers is not a good thing.  Conceptually, I love my job, or at least what I do, however it has nothing to do with where I work.  I have no problem with rules, in fact I realize in most cases they are a necessity.  However when the rules exist because it&#8217;s how it&#8217;s always been done, I start to get a little&nbsp;annoyed.</p>
<p>We have a dress code, it&#8217;s business casual.  On Monday we can wear jeans, as long as they fit properly and are not torn or frayed.  Casual day is on Monday because that&#8217;s the day the country club is closed, so the bosses can wear jeans and not have to change before they go to lunch.  In the &#8220;summer&#8221; (a vague term not actually defined anywhere) we can wear khaki shorts.  Until this year, shorts were only allowed on Tuesdays and Thursdays, had to be crisply ironed, and cargo pants were unacceptable (good luck finding those any place your grandparents don&#8217;t shop).  During the &#8220;summer,&#8221; casual Mondays no longer apply, you&#8217;re allowed to wear khaki shorts so why would you want to wear jeans in an office that averages a temperature of about 64 degrees fahrenheit?  Although, I guess it is nice that I will be comfortable walking twenty feet from the door to my car after work.  On occasion a big new customer will be brought into the office and we&#8217;ll be asked to dress extra-nice for the resulting dog-and-pony show, further proving that the standard day-to-day business casual serves no&nbsp;purpose.</p>
<p>So, an entire whiney paragraph about our dress code, boo-hoo, poor programmer how will you ever&nbsp;survive?</p>
<p>This is not a question about surviving, it&#8217;s a matter of thriving.  I&#8217;m as much an artist as I am a scientist or a mathematician, and scientifically speaking I&#8217;m a better, more creative artist when I&#8217;m comfortable than I am when I&#8217;m not.  A collar does not make my code faster.  Brown shoes do not make me a better designer.  Khaki pants certainly don&#8217;t make me a better programmer.  I&#8217;m not going to say that my code will be directly improved by wearing a t-shirt, sneakers, and jeans, but wearing them will improve my morale and enhance my creativity, and that has a chance of improving my code, or at least my desire to be&nbsp;here.</p>
<p>But I digress.  This is not about a dress code, it&#8217;s about a mentality, both management&#8217;s and employee&#8217;s.  They call it <a href="http://www.amazon.com/Herding-Cats-Primer-Programmers-Lead/dp/1590590171/ref=pd_bbs_sr_2?ie=UTF8&#038;s=books&#038;qid=1212162879&#038;sr=8-2">herding cats</a> for a reason.  Programmers are a different breed, and if you think you can prove otherwise you&#8217;re not dealing with the right kind of programmers.  Look at the companies out there making a fortune in this sector.  The ones that attract the best and the brightest developers.  Is there a dress code at <a href="http://www.google.com/support/jobs/bin/static.py?page=about.html">Google</a>?  <a href="http://www.facebook.com/jobs/quotes.php">Facebook</a>?  <a href="http://www.apple.com/jobs/us/pro/inside/benefits.html">Apple</a>?  I don&#8217;t think so.  These companies provide <a href="http://www.google.com/support/jobs/bin/static.py?page=benefits.html">creative benefits like free lunch, dinner, snacks and sodas, interesting and non-conformist workspaces and places, car washes, dry cleaning, and bike repair</a> to name a few.  They think outside the cube. If you keep your talent happy there is a higher chance of keeping your talent, unless of course you enjoy nurturing rock stars until they&#8217;re good enough to leave you in the dust for a greener&nbsp;pasture.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/05/programming-in-pants.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Letting Google Help With Your Site Performance</title>
		<link>http://www.ericdelabar.com/2008/05/letting-google-help-with-your-site-performance.html</link>
		<comments>http://www.ericdelabar.com/2008/05/letting-google-help-with-your-site-performance.html#comments</comments>
		<pubDate>Wed, 28 May 2008 14:56:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[javascript]]></category>

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

		<category><![CDATA[progressive enhancement]]></category>

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

		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.ericdelabar.com/?p=59</guid>
		<description><![CDATA[With JavaScript libraries and frameworks being all the rage in Web 2.0 development, Google is now offering a helping hand in improving you site's performance.]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s face it, cross-browser JavaScript and <span class="caps">AJAX</span> without a helper library or framework is pretty difficult.  However, these libraries can be pretty hefty when it comes to page download size, especially if sent uncompressed and un-optimized.  Most of the libraries have a statement in their docs that says something along the lines of &#8220;grow up and compress your JavaScript&#8221; but not all of us have sufficient access to their web host to actually be able to do that.  Enter Google.  Google&#8217;s <a href="http://code.google.com/apis/ajaxlibs/"><span class="caps">AJAX</span> Libraries <span class="caps">API</span></a> serves as a <a href="http://en.wikipedia.org/wiki/Content_distribution_network">content distribution network</a> for providing pre-compressed versions of the web&#8217;s favorite Web 2.0 JavaScript&nbsp;libraries:</p>
<ul>
<li><a href="http://jquery.com/">jQuery</a></li>
<li><a href="http://www.prototypejs.org/">prototype</a></li>
<li><a href="http://script.aculo.us/">script.aculo.us</a></li>
<li><a href="http://mootools.net/">MooTools</a></li>
<li><a href="http://dojotoolkit.org/">dojo</a></li>
</ul>
<p>Access to these libraries is quite simple, in fact loading prototype can be accomplished with the following four lines of&nbsp;code:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://www.google.com/jsapi&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
	google.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;prototype&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;1.6.0.2&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p></code></p>
<p>Pretty simple, but let&#8217;s look at some&nbsp;metrics.</p>
<table>
<thead>
<tr>
<th colspan="4">With Google</th>
<th colspan="4">Without Google</th>
</tr>
<tr>
<th colspan="2">(no cache)</th>
<th colspan="2">(local cache)</th>
<th colspan="2">(no cache)</th>
<th colspan="2">(local cache)</th>
</tr>
<tr>
<th><span class="caps">KB</span></th>
<th>Time</th>
<th><span class="caps">KB</span></th>
<th>Time</th>
<th><span class="caps">KB</span></th>
<th>Time</th>
<th><span class="caps">KB</span></th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr>
<td>66</td>
<td>982ms</td>
<td>4</td>
<td>980ms</td>
<td>252</td>
<td>2.14s</td>
<td>0</td>
<td>1.19s</td>
</tr>
</tbody>
</table>
<p>As you can see, the Google version is significantly faster and smaller on the initial load, subsequent loads a little less obvious, but still slightly faster.  However, this test was not all that scientific, since I really only have the ability to do this with Firefox and Firebug, I only did it once, and my network speed can vary significantly from request to request.  Despite all of that, testing this across a few other browser/<span class="caps">OS</span> combinations does reveal a pattern where the Google <span class="caps">AJAX</span> Library <span class="caps">API</span> pages do feel faster, even if only by a fraction of a second.  I&#8217;ve provided my test pages, <a href="http://www.ericdelabar.com/examples/letting-google-help-with-your-site-performance/google.html" rel="nofollow">with Google</a> and <a href="http://www.ericdelabar.com/examples/letting-google-help-with-your-site-performance/no-google.html" rel="nofollow">without-Google</a>, for you to perform your own tests, and I&#8217;d love to hear what other people think and see their&nbsp;results.</p>
<p>The verdict, I like it, but I have a few caveats.  First, as pointed out to me by <a href="http://inscrutabledesign.com/" title="Chris" rel="met friend co-worker">the Unscrutable Designer</a>, you&#8217;re relying on a third party site to host your scripts, in this case it means you need to trust Google to <a href="http://en.wikipedia.org/wiki/Don't_be_evil">not be evil</a>.  Personally, I do, but that is a decision to be made on a case-by-case basis.  Secondly, you have to trust the reliability of your content distribution network, can you risk your JavaScript functionality if Google&#8217;s server goes down?  Thanks to progressive enhancement, having no library should be basically the same as no JavaScript, so my properly implemented site should still function, so this is personally not a show-stopper for&nbsp;me.</p>
<p>Now, one last thought.  Keep in mind that this is not the <strong>most</strong> optimal solution since it still makes a request for each library you load and the libraries themselves are not optimized, but it does bring along with it an interesting benefit.  The more sites that use this service the higher the chance of getting a local cache hit on one of these files, which of course means one less&nbsp;download.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericdelabar.com/2008/05/letting-google-help-with-your-site-performance.html/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.310 seconds -->
<!-- Cached page served by WP-Cache -->
