<?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>Echographia</title>
	<atom:link href="http://www.echographia.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.echographia.com/blog</link>
	<description>making things better, making better things</description>
	<pubDate>Wed, 07 Sep 2011 02:32:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>awake! from nib!</title>
		<link>http://www.echographia.com/blog/2011/09/06/awake-from-nib/</link>
		<comments>http://www.echographia.com/blog/2011/09/06/awake-from-nib/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 02:32:50 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[macruby]]></category>

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

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=130</guid>
		<description><![CDATA[Tonight&#8217;s MacRuby/Xcode lesson: An object (say, an instance of a subclass of NSArrayController) created in Interface Builder won&#8217;t necessarily have its initialize method called when the program runs. This, I guess, is because the object was instantiated when you created it in Interface Builder, and cryogenically frozen, and when your program runs, it doesn&#8217;t instantiate [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight&#8217;s MacRuby/Xcode lesson: An object (say, an instance of a subclass of <code>NSArrayController</code>) created in Interface Builder won&#8217;t necessarily have its <code>initialize</code> method called when the program runs. This, I guess, is because the object was instantiated when you created it in Interface Builder, and cryogenically frozen, and when <em>your</em> program runs, it doesn&#8217;t <em>instantiate</em> the object, it merely <em>wakes it up</em>. So you should put the initialization code in <code>awakeFromNib</code>. I think.</p>
<p>(The <code>init</code> method on an instance of a subclass of <code>NSObject</code> was called. I don&#8217;t know why <code>init</code> and not <code>initialize</code>. I&#8217;ve got a lot to learn.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2011/09/06/awake-from-nib/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tumblr Tags</title>
		<link>http://www.echographia.com/blog/2011/06/29/tumblr-tags/</link>
		<comments>http://www.echographia.com/blog/2011/06/29/tumblr-tags/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 19:26:42 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[mongodb]]></category>

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

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

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=128</guid>
		<description><![CDATA[I just put another hobby project on GitHub. It&#8217;s a web service that&#8217;s meant to help me (or, in theory, someone else) insert a dynamic list of most-used tags on my Tumblr blog. It doesn&#8217;t really help with the inserting, yet, but it will get me the list. And it gave me some experience with [...]]]></description>
			<content:encoded><![CDATA[<p>I just put another <a href="https://github.com/eostrom/tumblr_tags">hobby project on GitHub</a>. It&#8217;s a web service that&#8217;s meant to help me (or, in theory, someone else) insert a dynamic list of most-used tags on my <a href="http://slapdash.erikostrom.com/">Tumblr blog</a>. It doesn&#8217;t really help with the inserting, yet, but it will get me the list. And it gave me some experience with <a href="http://www.sinatrarb.com/">Sinatra</a> and <a href="http://www.mongodb.org/">MongoDB</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2011/06/29/tumblr-tags/feed/</wfw:commentRss>
		</item>
		<item>
		<title></title>
		<link>http://www.echographia.com/blog/2011/06/10/126/</link>
		<comments>http://www.echographia.com/blog/2011/06/10/126/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 18:51:26 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[macruby]]></category>

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

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

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=126</guid>
		<description><![CDATA[I wrote something with MacRuby, finally. It's a tool to help me post music every day over on my non-technical blog. The MacRuby part is that it uses iTunes to convert uncompressed audio to MP3, add metadata, and post it to my web site. And add it to my library along the way. That's pretty cool. But in retrospect I think iTunes is not the right tool for this job.]]></description>
			<content:encoded><![CDATA[<p>I wrote something with <a href="http://macruby.org/">MacRuby</a>, finally. It&#8217;s a <a href="https://github.com/eostrom/med">tool</a> to help me post <a href="http://slapdash.erikostrom.com/tagged/music%20every%20day">music every day</a> over on my non-technical blog. The MacRuby part is that it uses iTunes to convert uncompressed audio to MP3, add metadata, and post it to my web site. And add it to my library along the way. That&#8217;s pretty cool. The script also uploads the track to my web site, but that&#8217;s straight Ruby.</p>
<p>In retrospect I think iTunes is not the right tool for this job. It&#8217;s a hammer, not a scalpel. It doesn&#8217;t give you a lot of fine control, and it takes more energy than the task really warrants. For example, sometimes I need to find a specific track in the library. The API iTunes offers through <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/Introduction/Introduction.html">Scripting Bridge</a> doesn&#8217;t let me look up a track by multiple criteria (track 28 from the album &#8220;Music Every Day&#8221; in MP3 format) - it just gives me the same keyword search you find in the UI. So I can search for the album &#8220;Music Every Day&#8221; and then loop through the returned tracks looking for the one I need. It gets the job done, but it&#8217;s not ideal.</p>
<p>So if I were starting over I might use <a href="http://lame-encoder.rubyforge.org/">LAME</a> and <a href="http://ruby-mp3info.rubyforge.org/">RubyMp3info</a>, or something. But it was interesting to get some practice with MacRuby, and if I ever decided to put a GUI on this it&#8217;ll be good to have had the experience. <a href="https://github.com/eostrom/med">The code is on GitHub</a>, if you&#8217;re curious.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2011/06/10/126/feed/</wfw:commentRss>
		</item>
		<item>
		<title>my plans for Minnebar</title>
		<link>http://www.echographia.com/blog/2011/05/06/my-plans-for-minnebar/</link>
		<comments>http://www.echographia.com/blog/2011/05/06/my-plans-for-minnebar/#comments</comments>
		<pubDate>Fri, 06 May 2011 22:08:40 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=123</guid>
		<description><![CDATA[Posted here, because why write something down if you&#8217;re not going to put it on the web somewhere?
9:40: Geeks Connecting Neighbors. Because talking with a bunch of fellow geeks about how to use technology to help people connect with their neighbors seems easier than actually talking to my neighbors. Backup: Mirah.
10:40: Making Music Like a [...]]]></description>
			<content:encoded><![CDATA[<p>Posted here, because why write something down if you&#8217;re not going to put it on the web somewhere?</p>
<p><strong>9:40:</strong> Geeks Connecting Neighbors. Because talking with a bunch of fellow geeks about how to use technology to help people connect with their neighbors seems easier than actually talking to my neighbors. Backup: Mirah.</p>
<p><strong>10:40:</strong> Making Music Like a Nerd II. I make software and I make music, but not at the same time, and for decades now I&#8217;ve been alternately intrigued and irritated by the tools to do it. Time to look again. Backup: Maps? Fonts? Android?</p>
<p><strong>11:40:</strong> Building the Tech Community You Want to See. Because I like diversity. Backup: ?</p>
<p><strong>1:40:</strong> I don&#8217;t know, maybe social networks.</p>
<p><strong>2:40:</strong> OpenStreetMap 101. I like maps! And openness! I used OSM on <a href="http://touringmachine.org/">Touring Machine</a> and was impressed. Backup I should be going to instead: Negotiating Consulting Contracts That Work.</p>
<p><strong>3:40:</strong> Color Theory &amp; Consumption. Not sure why. Backup: Get More From Your Data, or Why Don&#8217;t You Blog More?</p>
<p><strong>4:40:</strong> Personal Rapid Transit. I&#8217;ve been skeptical about this concept since I read Bruno Latour&#8217;s <cite>Aramis</cite> back in the &#8217;90s, but I don&#8217;t really remember why. Time for a refresher course!</p>
<p>Minnebar is &#8220;an (un)conference aimed at getting those in Minnesota’s tech and design communities together to discuss topics that interest them.&#8221; It happens tomorrow, and it&#8217;s sold out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2011/05/06/my-plans-for-minnebar/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Back to Java</title>
		<link>http://www.echographia.com/blog/2011/03/14/back-to-java/</link>
		<comments>http://www.echographia.com/blog/2011/03/14/back-to-java/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 16:52:42 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[eclipse]]></category>

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

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=121</guid>
		<description><![CDATA[When I picked up Ruby on Rails in 2006, it was a great relief after several years in Java and C to be using a language that let me express things concisely, without a lot of boilerplate, and without fighting the type system all the time. But this week I was contacted by an old [...]]]></description>
			<content:encoded><![CDATA[<p>When I picked up Ruby on Rails in 2006, it was a great relief after several years in Java and C to be using a language that let me express things concisely, without a lot of boilerplate, and without fighting the type system all the time. But this week I was contacted by an old client to do a little touch-up on a Java program, and you know what? Java is kind of fun again!</p>
<p>And it turns out I&#8217;ve missed some things about Eclipse - specifically, the way Java and Eclipse, working together, can let you know you&#8217;ve made a dumb mistake long before your tests or your web browser do. And although I&#8217;m comfortable using ruby-debug at the command line, I&#8217;ve missed having a GUI around my debugger. Maybe I&#8217;ll give RadRails or NetBeans or RubyMine another shot.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2011/03/14/back-to-java/feed/</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;Element not found in the cache&#8221;</title>
		<link>http://www.echographia.com/blog/2011/01/13/element-not-found-in-the-cache/</link>
		<comments>http://www.echographia.com/blog/2011/01/13/element-not-found-in-the-cache/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 18:25:06 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[capybara]]></category>

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

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

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

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

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=116</guid>
		<description><![CDATA[I was getting the above error, intermittently, from Selenium/WebDriver via Cucumber/Capybara. My code looked something like this:

When /^I wait for the popup to close$/ do
  wait_until &#123; !page.find&#40;'#nyroModalContent'&#41;.try&#40;:visible?&#41; &#125;
end

What&#8217;s happening, I think, is this:

Capybara asks Selenium for a handle to the #nyroModalContent element.
Selenium, after returning it, gets the response from my server that tells [...]]]></description>
			<content:encoded><![CDATA[<p>I was getting the above error, intermittently, from Selenium/WebDriver via Cucumber/Capybara. My code looked something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">When</span> <span style="color:#006600; font-weight:bold;">/</span>^I wait <span style="color:#9966CC; font-weight:bold;">for</span> the popup to close$<span style="color:#006600; font-weight:bold;">/</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  wait_until <span style="color:#006600; font-weight:bold;">&#123;</span> !page.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'#nyroModalContent'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">try</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:visible</span>?<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>What&#8217;s happening, I think, is this:</p>
<ol>
<li>Capybara asks Selenium for a handle to the #nyroModalContent element.</li>
<li>Selenium, after returning it, gets the response from my server that tells it to close the popup.</li>
<li>Capybara asks Selenium, hey, that element you just gave me a handle to? Is it still visible?</li>
<li>Selenium is all, &#8220;What element?&#8221;</li>
</ol>
<p>For my present purposes, it turns out I don&#8217;t need the &#8220;visible&#8221; check, so I could just do this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">  wait_until <span style="color:#006600; font-weight:bold;">&#123;</span> page.<span style="color:#9900CC;">has_no_css</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'#nyroModalContent'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>If I had needed to get the element and then act on it, though, I think the way to do it would be to write JavaScript that performs both actions, and call it with <code>page.evaluate_script</code>.</p>
<p>[Ran across John Nunemaker's exhortation to <a href="http://railstips.org/blog/archives/2007/07/11/clogging-code-blogging/">"clog it before you forget it."</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2011/01/13/element-not-found-in-the-cache/feed/</wfw:commentRss>
		</item>
		<item>
		<title>sane Sinatra stack traces in Cucumber</title>
		<link>http://www.echographia.com/blog/2010/04/19/sane-sinatra-stack-traces-in-cucumber/</link>
		<comments>http://www.echographia.com/blog/2010/04/19/sane-sinatra-stack-traces-in-cucumber/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 15:52:28 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=114</guid>
		<description><![CDATA[I&#8217;m building an app in Sinatra and testing it (in part) with Cucumber. When exceptions were raised in my application, I&#8217;d get a stack trace wrapped in pages and pages of HTML - very nice when you&#8217;re testing in a browser, but almost impossible to work with in a command-line test. After a surprisingly long [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m building an app in <a href="http://www.sinatrarb.com/">Sinatra</a> and testing it (in part) with <a href="http://cukes.info/">Cucumber</a>. When exceptions were raised in my application, I&#8217;d get a stack trace wrapped in pages and pages of HTML - very nice when you&#8217;re testing in a browser, but almost impossible to work with in a command-line test. After a surprisingly long investigation, I added these lines to <code>env.rb</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#008000; font-style:italic;"># Don't generate fancy HTML for stack traces.</span>
disable <span style="color:#ff3333; font-weight:bold;">:show_exceptions</span>
<span style="color:#008000; font-style:italic;"># Allow errors to get out of the app so Cucumber can display them.</span>
enable <span style="color:#ff3333; font-weight:bold;">:raise_errors</span></pre></div></div>

<p>Both are required. If you just <code>disable :show_exceptions</code>, you&#8217;re spared the fancy HTML, but you&#8217;re also spared any useful information about what&#8217;s going wrong. (You just get &#8220;Internal Server Error&#8221;.) But if you just enable <code>:raise_errors</code>, well, the errors don&#8217;t get raised - they&#8217;re trapped by the exception-showing code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2010/04/19/sane-sinatra-stack-traces-in-cucumber/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Release announcement: Flickr Watchr</title>
		<link>http://www.echographia.com/blog/2010/03/08/release-announcement-flickr-watchr/</link>
		<comments>http://www.echographia.com/blog/2010/03/08/release-announcement-flickr-watchr/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 03:42:36 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=111</guid>
		<description><![CDATA[Just kidding, mostly. I got email today informing me that Watchr &#8220;has been released successfully in Brothersoft&#8221;. Congratulations!
Watchr is a tiny program I wrote five years ago. Ken and I were talking about how we&#8217;d like something that pops up images when they&#8217;re posted to Flickr. For reasons I don&#8217;t now recall, we then wrote [...]]]></description>
			<content:encoded><![CDATA[<p>Just kidding, mostly. I got email today informing me that Watchr &#8220;has been released successfully in Brothersoft&#8221;. Congratulations!</p>
<p>Watchr is a tiny program I wrote five years ago. <a href="http://www.notes.xythian.net/">Ken</a> and I were talking about how we&#8217;d like something that pops up images when they&#8217;re posted to Flickr. For reasons I don&#8217;t now recall, we then wrote two separate applications, <a href="http://www.notes.xythian.net/2005/01/10/watcher/">his in Python</a> and <a href="http://www.erikostrom.com/watchr/watchr.html">mine in Java</a>. (By the way, that page is the only use so far of erikostrom.com, except as a mirror of <a href="http://drowning.org/">drowning.org</a>, the equally dated site about my singer-songwriter career.)</p>
<p>I&#8217;m a little surprised to find that it still basically works. Write once, run everywhere, I guess! Although it still has the same Mac bug noted in 2005, which bothers me more now that I&#8217;m a Mac user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2010/03/08/release-announcement-flickr-watchr/feed/</wfw:commentRss>
		</item>
		<item>
		<title>setting up browser automation with FireWatir</title>
		<link>http://www.echographia.com/blog/2009/12/23/setting-up-browser-automation-with-firewatir/</link>
		<comments>http://www.echographia.com/blog/2009/12/23/setting-up-browser-automation-with-firewatir/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 19:14:30 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=109</guid>
		<description><![CDATA[Ruby-based testing will only get you so far in the web development world - sooner or later you need to make sure your code works in a real browser. So for the last few years I&#8217;ve been occasionally trying to get a browser-based test automation tool running - often something in the Selenium family. It [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby-based testing will only get you so far in the web development world - sooner or later you need to make sure your code works in a real browser. So for the last few years I&#8217;ve been occasionally trying to get a browser-based test automation tool running - often something in the <a href="http://seleniumhq.org/">Selenium</a> family. It usually takes a full day for me to give up, usually because I just can&#8217;t get the tool to actually drive the browser.</p>
<p>Today I got <a href="http://wiki.openqa.org/display/WTR/FireWatir">FireWatir</a> working! It wasn&#8217;t that hard, but I had to consult a few different web pages, so here it is all in one place.</p>
<ol>
<li>Via <a href="http://wiki.openqa.org/display/WTR/FireWatir+Installation">FireWatir Installation</a>, install the gem:

<div class="wp_syntax"><div class="code"><pre>sudo gem install firewatir</pre></div></div>

<p>and the <code>JSSh</code> Firefox extension (<a href="http://wiki.openqa.org/download/attachments/13893658/jssh-3.5.x-Darwin-param.xpi?version=1">Mac FF 3.5 version</a>) to make Firefox steerable.</p>
<li><a href="http://support.mozilla.com/en-US/kb/Managing+profiles">Set up a Firefox profile</a>, so you can run tests without all your weird extensions in play, and without messing with your personal browser session and history. Mine is called &#8220;tester&#8221;.
<li><a href="http://alephzarro.com/blog/2007/03/12/jssh-for-firefox-on-linux-because-firewatir-loves-it/">Start up Firefox with JSSh</a> and your new profile (you can do this while Firefox is running):

<div class="wp_syntax"><div class="code"><pre>/Applications/Firefox.app/Contents/MacOS/firefox -jssh -P &quot;tester&quot;</pre></div></div>

<li>In an <code>irb</code> session, <a href="http://wiki.openqa.org/display/WTR/FireWatir+Example+Script">try some stuff</a> - for example, on a new <a href="http://spreecommerce.com/">Spree</a> instance:

<div class="wp_syntax"><div class="code"><pre class="ruby">ff = <span style="color:#6666ff; font-weight:bold;">FireWatir::Firefox</span>.<span style="color:#9900CC;">new</span>
ff.<span style="color:#9900CC;">goto</span> <span style="color:#996600;">'http://localhost:3000/'</span>
ff.<span style="color:#9900CC;">link</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:text</span>, <span style="color:#996600;">'Clothing'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">click</span></pre></div></div>

</ol>
<p>Voila! Now I want to try <a href="http://code.google.com/p/cucumber-and-watir/">Cucumber and Watir</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2009/12/23/setting-up-browser-automation-with-firewatir/feed/</wfw:commentRss>
		</item>
		<item>
		<title>John Resig on JavaScript testing, performance analysis, and jQuery 1.4</title>
		<link>http://www.echographia.com/blog/2009/12/11/john-resig-on-javascript-testing-performance-analysis-and-jquery-14/</link>
		<comments>http://www.echographia.com/blog/2009/12/11/john-resig-on-javascript-testing-performance-analysis-and-jquery-14/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 06:39:52 +0000</pubDate>
		<dc:creator>erik</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.echographia.com/blog/?p=104</guid>
		<description><![CDATA[John Resig, of jQuery and other fame, spoke tonight at the BayJax meetup in the Yahoo! cafeteria. His slides are probably online somewhere, but they are lucid, informative, illustrated with pictures and code samples, and written by someone who knows what he&#8217;s talking about, not to mention who was paying attention while writing them. (Update: [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ejohn.org/">John Resig</a>, of jQuery and other fame, spoke tonight at the <a href="http://www.meetup.com/BayJax/">BayJax meetup</a> in the Yahoo! cafeteria. His slides are probably online somewhere, but they are lucid, informative, illustrated with pictures and code samples, and written by someone who knows what he&#8217;s talking about, not to mention who was paying attention while writing them. (<strong>Update:</strong> Video <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=263846173">on iTunes</a> and <a href="http://yuiblog.com/yuitheater/resig-testing.m4v">not on iTunes</a>.) If that&#8217;s not your bag, you&#8217;ll want to read my notes instead:<br />
<span id="more-104"></span><br />
PART I: Testing JavaScript</p>
<p>javascript testing is different from desktop/server testing<br />
- cross-browser issues</p>
<p>there are a lot of javascript testing frameworks!<br />
- long tail<br />
- it&#8217;s easy to write one</p>
<p>basic components for a testing framework<br />
- the usual, plus async tests<br />
- minimum: assertions<br />
(&#8217;glorified assertion-and-logging framework&#8217;)<br />
- async tests<br />
- pause (stop executing other tests) and resume</p>
<p>why write your own?<br />
- a good way to understand what testing is for<br />
- not too many cross-browser issues</p>
<p>popular frameworks:<br />
- (none)<br />
- JSUnit<br />
- 2001, and looks it<br />
- YUITest<br />
- good code, supports async tests and event simulation<br />
- (looks like nested contexts?)<br />
- QUnit<br />
- async testing, test timeouts<br />
- no dependencies<br />
- easy to use<br />
- FireUnit<br />
- firebug extension</p>
<p>standardization<br />
- CommonJS: standard API across client and server environments<br />
- including testing API, now adopted by QUnit (I think)</p>
<p>server-side testing of client-side code<br />
- usually Java + Rhino<br />
- Crosscheck (Java)<br />
- Env.js (pure JS)<br />
- BlueRidge (Env.js + Screw.unit + Rhino)</p>
<p>browser launching<br />
- WebDriver (Java)<br />
- Watir (Ruby)<br />
- JsTestDriver (Java)<br />
- Selenium RC (Java)</p>
<p>distributed (for scale)<br />
- Selenium Grid - on Amazon servers<br />
- TestSwarm - crowd-sourced</p>
<p>PART II: Accurately Measuring JavaScript</p>
<p>major use cases:<br />
- same code, different platforms<br />
- which browser is fastest?<br />
- different code, same platform<br />
- which framework is fastest?<br />
- how should we implement this?</p>
<p>same code, different platform<br />
- SunSpider (WebKit), V8 (Chrome), Dromaeo (Mozilla)</p>
<p>&#8230; statistics&#8230;</p>
<p>error rate<br />
- faster tests =&gt; less accuracy<br />
- faster *browsers* =&gt; less accuracy<br />
- dromaeo/v8 test runs/sec instead of msec/run<br />
- use harmonic mean to average</p>
<p>different code, same platform<br />
- most solutions are bad<br />
- few runs, inaccurate<br />
- garbage collection<br />
- use mode instead of mean<br />
- less accurate than mean, but more consistent<br />
- don&#8217;t discard &#8220;bad&#8221; results - GC is significant<br />
- may reflect memory issues<br />
- getTime() &#8220;very very imprecise&#8221;<br />
- 15ms intervals on XP (except FF/Chrome)<br />
- IE in Wine gives you precision, but it&#8217;s not IE on Windows</p>
<p>- browser tools<br />
- Safari, Firebug, IE 8 profilers<br />
- DynaTrace Ajax for IE 6-8<br />
- Shark - watches internal function calls</p>
<p>PART III: jQuery 1.4<br />
- complexity reduction<br />
- bubbling change, submit, focus, blur<br />
- required script loading</p>
<p>analyzing performance<br />
- stop measuring absolute execution time<br />
- improve code quality and flow</p>
<p>complexity analysis<br />
- count function calls instead of seconds<br />
- may indicate not slowness, but poorly written code<br />
- remove() did a lot more work than it needed to<br />
- and so did everything that used remove()</p>
<p>event bubbling in IE<br />
- focus, blur, change, and submit don&#8217;t bubble<br />
- alternative solutions: piggyback on events that DO bubble<br />
- focus/blur: use focusin/focusout<br />
- submit: watch for click&#8230; or &#8216;enter&#8217; keypress&#8230;<br />
- change: basically reimplement the whole event<br />
- track previous value<br />
- watch for keyup navigation, checkbox clicks<br />
- beforeactive on radio buttons</p>
<p>jQuery.require()<br />
- don&#8217;t try to load a script multiple times<br />
- load synchronously if needed for dependent code<br />
- load asynchronously if you can get away with it!</p>
<p>URL mapping<br />
- require(&#8217;ajax&#8217;) =&gt; ajax.js<br />
- namespaces expand to URLs</p>
<p>PART IV: HTML 5 Elements in IE</p>
<p>problem #1<br />
- unknown elements are unstyled, and &#8220;inner contents escape&#8221;<br />
- fix: document.createElement(&#8217;section&#8217;) makes section work<br />
- html5shiv does that for all HTML5</p>
<p>problem #2<br />
- unknown elements can&#8217;t hold other unknown elements<br />
- even with html5shiv<br />
- no fix</p>
<p>problem #3<br />
- nodeName of unknown elements is treated as XML<br />
- fix: don&#8217;t assume nodeName is uppercase</p>
<p>problem #4<br />
- injecting unknown elements via innerHTML fails<br />
- &#8220;fix&#8221;: parse HTML and build DOM in JS</p>
<p>Q&amp;A:</p>
<p>&#8230; i zoned out&#8230;</p>
<p>Q: clojure?<br />
A: framework&#8230; okay. compiler&#8230; pretty slick!<br />
- but designed to compile your whole application<br />
- can&#8217;t compile the framework separately</p>
]]></content:encoded>
			<wfw:commentRss>http://www.echographia.com/blog/2009/12/11/john-resig-on-javascript-testing-performance-analysis-and-jquery-14/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

