<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>visophyte: data made shiny</title>
	<atom:link href="http://www.visophyte.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.visophyte.org/blog</link>
	<description>tool-building and visualization run amok</description>
	<lastBuildDate>Sun, 20 Dec 2009 10:57:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Thunderbird Jetpack Teasers: Custom tab with wmsy contents</title>
		<link>http://www.visophyte.org/blog/2009/12/05/thunderbird-jetpack-teasers-custom-tab-with-wmsy-contents/</link>
		<comments>http://www.visophyte.org/blog/2009/12/05/thunderbird-jetpack-teasers-custom-tab-with-wmsy-contents/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 04:05:22 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[jetpack]]></category>
		<category><![CDATA[wmsy]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=411</guid>
		<description><![CDATA[
Example jetpack source here because it&#8217;s too much to inline.
]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-412" title="wmsy-complex-contents-tab-contents" src="http://www.visophyte.org/blog/wp-content/uploads/2009/12/wmsy-complex-contents-tab-contents.png" alt="wmsy-complex-contents-tab-contents" width="350" height="169" /></p>
<p><a href="http://hg.mozilla.org/users/bugmail_asutherland.org/jetpack-tb-examples/file/ac71049eb97b/wmsy/synthetic/wmsy-complex-contents.js">Example jetpack source here</a> because it&#8217;s too much to inline.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/12/05/thunderbird-jetpack-teasers-custom-tab-with-wmsy-contents/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Thunderbird Jetpack Teasers: Words per Minute in Compose</title>
		<link>http://www.visophyte.org/blog/2009/11/22/thunderbird-jetpack-teasers-words-per-minute-in-compose/</link>
		<comments>http://www.visophyte.org/blog/2009/11/22/thunderbird-jetpack-teasers-words-per-minute-in-compose/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 15:50:51 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[jetpack]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=399</guid>
		<description><![CDATA[
jetpack.future.import&#40;&#34;thunderbird.compose&#34;&#41;;
jetpack.thunderbird.compose.appendComposePanel&#40;&#123;
  onReady: function &#40;panel, composeContext&#41; &#123;
    let doc = panel.contentDocument;
    let msgNode = $&#40;&#34;&#60;span /&#62;&#34;, doc.body&#41;.appendTo&#40;doc.body&#41;;
&#160;
    let started = Date.now&#40;&#41;;
    setInterval&#40;function&#40;&#41; &#123;
      let words = composeContext.getPlaintextContents&#40;&#41;.split&#40;/\s+/&#41;;
      let secs = Math.ceil&#40;&#40;Date.now&#40;&#41; - started&#41; [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jetpack.<span style="color: #660066;">future</span>.<span style="color: #003366; font-weight: bold;">import</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;thunderbird.compose&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
jetpack.<span style="color: #660066;">thunderbird</span>.<span style="color: #660066;">compose</span>.<span style="color: #660066;">appendComposePanel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  onReady<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>panel<span style="color: #339933;">,</span> composeContext<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    let doc <span style="color: #339933;">=</span> panel.<span style="color: #660066;">contentDocument</span><span style="color: #339933;">;</span>
    let msgNode <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;span /&gt;&quot;</span><span style="color: #339933;">,</span> doc.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>doc.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    let started <span style="color: #339933;">=</span> Date.<span style="color: #660066;">now</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    setInterval<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      let words <span style="color: #339933;">=</span> composeContext.<span style="color: #660066;">getPlaintextContents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s+/</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      let secs <span style="color: #339933;">=</span> Math.<span style="color: #660066;">ceil</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>Date.<span style="color: #660066;">now</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> started<span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      let wordsPerMinute <span style="color: #339933;">=</span> Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>words.<span style="color: #660066;">length</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">60</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> secs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      msgNode.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>wordsPerMinute <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; words per minute.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    panel.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  html<span style="color: #339933;">:</span> <span style="color: #339933;">&lt;&gt;&lt;</span>body style<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;overflow: hidden&quot;</span><span style="color: #339933;">&gt;&lt;/</span>body<span style="color: #339933;">&gt;&lt;/&gt;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><img class="alignnone size-full wp-image-400" title="thunderbird-jetpack-words-per-minute-example" src="http://www.visophyte.org/blog/wp-content/uploads/2009/11/thunderbird-jetpack-words-per-minute-example.png" alt="thunderbird-jetpack-words-per-minute-example" width="585" height="409" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/11/22/thunderbird-jetpack-teasers-words-per-minute-in-compose/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>prototype unified JavaScript/C++ back-traces for Mozilla in (archer) gdb</title>
		<link>http://www.visophyte.org/blog/2009/09/12/prototype-unified-javascriptc-back-traces-for-mozilla-in-archer-gdb/</link>
		<comments>http://www.visophyte.org/blog/2009/09/12/prototype-unified-javascriptc-back-traces-for-mozilla-in-archer-gdb/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 13:36:52 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[gaudy]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[pyflam]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=392</guid>
		<description><![CDATA[
As far as I know (and ignoring my previous efforts on chroniquery along these lines), up until now you had your C/C++ Mozilla backtraces via gdb (chocolate) and your JS backtraces via &#8220;call DumpJSStack()&#8221; or the debugger keyword from within JS (peanut butter), but these two great flavors had never come together to make a [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-393" title="fused-js-cpp-backtrace-2-upper-half" src="http://www.visophyte.org/blog/wp-content/uploads/2009/09/fused-js-cpp-backtrace-2-upper-half.png" alt="fused-js-cpp-backtrace-2-upper-half" width="704" height="360" /></p>
<p>As far as I know (and ignoring my previous efforts on <a href="http://www.visophyte.org/blog/2008/09/17/chroniquery-does-useful-things/">chroniquery</a> along these lines), up until now you had your C/C++ Mozilla backtraces via gdb (chocolate) and your JS backtraces via &#8220;call DumpJSStack()&#8221; or the debugger keyword from within JS (peanut butter), but these two great flavors had never come together to make a lot of money for dentists.</p>
<p>The screenshots (which is actually just one screenshot split in two) show invocation of a custom python gdb command building on my <a href="http://www.visophyte.org/blog/2008/09/17/chroniquery-does-useful-things/">previous exciting pretty gdb commands</a>.  The command has filtered out boring JS interpreter / XPConnect code and interleaved exciting interesting JS stack frames.</p>
<p>The implementation is reasonably simple and intended to be able to be implemented using VProbes to support my<a href="http://www.visophyte.org/blog/2009/08/03/using-vmware-recordreplay-and-vprobes-for-low-time-distortion-performance-profiling/"> recent performance work along those lines</a>.  We walk stack frames the usual way.  Ahead of time, we have marked out the PC ranges of interesting JS interpreter functions (js_Interpret and js_Execute).  If the stack frame&#8217;s instruction pointer is in one of those functions we grab the JSContext argument.  We pop frames until we reach the native frame those functions allocate from their own stack space (whose boundaries we know from the stack walking).</p>
<p>There is one trick we have to do involving dormantFrameChain.  While js_Execute has a consistent and straightforward usage of JS_SaveFrameChain, XPConnect and its quickstub friends are more complex.  Right now we use a dumb heuristic that just looks if our frame pointer is 0 and there is a dormantFrameChain, and in that case we restore it.  (Thankfully the garbage collector needs to know about the shelved frames, otherwise we might have to chase frames down.)  I haven&#8217;t put much effort into thinking about it, but the heurstic seems a bit reckless.  We could likely just concurrently walk the XPConnect context stack to figure out when to restore dormant frame chains.  The existing VProbe JS stack (only) code already goes to the horrible effort to get at the thread-local stack, so it wouldn&#8217;t be too much more work.  Things probably also fall down during garbage collection right now.</p>
<p>Hg repository is <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/pythongdb-gaudy/">here</a>.  Under no circumstances try to use this with jblandy&#8217;s excellent archer-mozilla JS magic right now.  The current code is very distrustful of gdb.Value in a dumb way and does exceedingly dangerous things wherein pointers are bounced to strings and back to integers because direct integer coercion is forbidden.  With pretty printers installed this is likely to break.  Also, this is all only tested on 1.9.1.</p>
<p><img class="alignnone size-full wp-image-394" title="fused-js-cpp-backtrace-2-lower-half" src="http://www.visophyte.org/blog/wp-content/uploads/2009/09/fused-js-cpp-backtrace-2-lower-half.png" alt="fused-js-cpp-backtrace-2-lower-half" width="705" height="325" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/09/12/prototype-unified-javascriptc-back-traces-for-mozilla-in-archer-gdb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>So&#8217;s your facet: Faceted global search for Mozilla Thunderbird</title>
		<link>http://www.visophyte.org/blog/2009/09/03/sos-your-facet-faceted-global-search-for-mozilla-thunderbird/</link>
		<comments>http://www.visophyte.org/blog/2009/09/03/sos-your-facet-faceted-global-search-for-mozilla-thunderbird/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 06:08:50 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[facets]]></category>
		<category><![CDATA[gloda]]></category>
		<category><![CDATA[simile]]></category>
		<category><![CDATA[timeline]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=374</guid>
		<description><![CDATA[
Following in the footsteps of the MIT SIMILE project&#8217;s Exhibit tool (originally authored by David Huynh) and Thunderbird Seek extension (again by David Huynh), we are hoping to land faceted global search for Thunderbird 3.0 (a la gloda) in beta 4.
I think it&#8217;s important to point out how ridiculously awesome the Seek extension is.  It [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/09/faceting-gloda-hover-davida-1.png"><img class="alignnone size-thumbnail wp-image-376" title="faceting-gloda-hover-davida-1" src="http://www.visophyte.org/blog/wp-content/uploads/2009/09/faceting-gloda-hover-davida-1-600x551.png" alt="faceting-gloda-hover-davida-1" width="600" height="551" /></a></p>
<p>Following in the footsteps of the <a href="http://web.mit.edu/">MIT</a> <a href="http://simile.mit.edu/">SIMILE</a> project&#8217;s <a href="http://www.simile-widgets.org/exhibit/">Exhibit</a> tool (originally authored by <a href="http://davidhuynh.net/">David Huynh</a>) and <a href="http://code.google.com/p/simile-seek/">Thunderbird Seek extension</a> (again by <a href="http://davidhuynh.net/">David Huynh</a>), we are hoping to land faceted global search for Thunderbird 3.0 (a la gloda) in beta 4.</p>
<p>I think it&#8217;s important to point out how ridiculously awesome the Seek extension is.  It is the only example of faceted browsing or search in an e-mail client that I am aware of.  (Note: I have to assume there are some research e-mail clients out there with faceting, but I haven&#8217;t seen them.)  Given the data model available to extensions in Thunderbird 2.0 and the idiosyncratic architecture of the UI code in 2.0, it&#8217;s not only a feature marvel but also a technical marvel.</p>
<p>Unfortunately, there was only so much Seek could do before it hit a wall given the limitations it had to work with.  Thunderbird 2.0&#8217;s per-folder indices are just that, per-folder.  They also require (fast) O(n) search on any attribute other than their unique key.  Although Seek populated an in-memory index for each folder, it was faced with having to implement its own global indexer and persistent database.</p>
<p>Gloda is now at a point where a global database should no longer be the limiting factor for extensions, or the core Thunderbird experience&#8230;</p>
<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/09/faceting-gloda-action-tag-hover-bienvenu-1.png"><img class="alignnone size-thumbnail wp-image-377" title="faceting-gloda-action-tag-hover-bienvenu-1" src="http://www.visophyte.org/blog/wp-content/uploads/2009/09/faceting-gloda-action-tag-hover-bienvenu-1-600x551.png" alt="faceting-gloda-action-tag-hover-bienvenu-1" width="600" height="551" /></a></p>
<p>The screenshots are of a fulltext search for &#8220;gloda&#8221; in my message store.  The first screenshot is without any facets applied and me hovering over one of David Ascher&#8217;s e-mail address.  The second is after having selected the &#8220;!action&#8221; tag and hovering over one of David Bienvenu&#8217;s e-mail address.  Gloda has a concept of contact aggregation of identities but owing to a want of UI for this in the address-book right now, it doesn&#8217;t happen.  We do not yet coalesce (approximately) duplicate messages, which explains any apparent duplicates you see.</p>
<p>The current state of things is a result of development effort by myself and <a href="http://ascher.ca/blog/">David Ascher</a> with design input from <a href="http://clarkbw.net/blog/">Bryan Clark</a> and <a href="http://www.andreasn.se/blog/">Andreas Nilsson</a> (with hopefully much more to come soon <img src='http://www.visophyte.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .  Although we aren&#8217;t using much code from our previous <a href="http://www.visophyte.org/blog/tag/exptoolbar/">exptoolbar</a> efforts, a lot of the thinking is based on the work David, Bryan, and myself did on that.  Much thanks to <a href="http://mesquilla.com/">Kent James</a>, <a href="http://sid0.blogspot.com/">Siddharth Agarwal</a>, and <a href="http://blog.davidbienvenu.org/">David Bienvenu</a> for their recent and ongoing improvements to the gloda (and mailnews) back-end which help make this hopefully compelling UI feature actually usable through efficient and comprehensive indexing that does not make you want to throw your computer through a window.</p>
<p>If you use <a href="http://s3.mozillamessaging.com/build/try-server/2009-09-03_16:12-asutherland@asutherland.org-facet-v5/asutherland@asutherland.org-facet-v5-mail-try-linux.tar.bz2">linux</a> or <a href="http://s3.mozillamessaging.com/build/try-server/2009-09-03_16:12-asutherland@asutherland.org-facet-v5/asutherland@asutherland.org-facet-v5-mail-try-mac.dmg">OS X</a>, I just linked you to try server builds.  The windows try server was sadly on fire and so couldn&#8217;t attend the build party.  The bug tracking the enhancement is bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=474711">474711</a> and has repository info if you want to spin your own build.  New try server builds will also be noted there.  Please keep in mind that this is an in-progress development effort; it is not finished, there are bugs.  Accordingly, please direct any feedback/discussion to the dev-apps-thunderbird <a href="https://lists.mozilla.org/listinfo/dev-apps-thunderbird">list</a> / <a href="news://news.mozilla.org/mozilla.dev.apps.thunderbird">newsgroup</a> rather than the bug.  Please beware that increases in awesomeness require that your gloda database be automatically blown away if you try the new version.  And first you have to <a href="https://wiki.mozilla.org/Thunderbird:Using_Gloda">turn gloda on</a> if you have not already.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/09/03/sos-your-facet-faceted-global-search-for-mozilla-thunderbird/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Using VMWare Record/Replay and VProbes for low time-distortion performance profiling</title>
		<link>http://www.visophyte.org/blog/2009/08/03/using-vmware-recordreplay-and-vprobes-for-low-time-distortion-performance-profiling/</link>
		<comments>http://www.visophyte.org/blog/2009/08/03/using-vmware-recordreplay-and-vprobes-for-low-time-distortion-performance-profiling/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 04:54:59 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Program Execution]]></category>
		<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[Visualizing]]></category>
		<category><![CDATA[chronicle]]></category>
		<category><![CDATA[doccelerator]]></category>
		<category><![CDATA[dtrace]]></category>
		<category><![CDATA[JSViz]]></category>
		<category><![CDATA[pecobro]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[vprobes]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=363</guid>
		<description><![CDATA[
The greatest problem with performance profiling is getting as much information as possible while affecting the results as little as possible.   For my work on pecobro I used mozilla&#8217;s JavaScript DTrace probes.  Because the probes are limited to notifications of all function invocations/returns with no discretion and there is no support for JS backtraces, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/08/profile-performance-graph-enumerateProps.png"><img class="alignnone size-thumbnail wp-image-365" title="profile-performance-graph-enumerateProps" src="http://www.visophyte.org/blog/wp-content/uploads/2009/08/profile-performance-graph-enumerateProps-600x302.png" alt="profile-performance-graph-enumerateProps" width="600" height="302" /></a></p>
<p>The greatest problem with performance profiling is getting as much information as possible while affecting the results as little as possible.   For my work on <a href="http://www.visophyte.org/blog/tag/pecobro/">pecobro</a> I used mozilla&#8217;s JavaScript DTrace probes.  Because the probes are limited to notifications of all function invocations/returns with no discretion and there is no support for JS backtraces, the impact on performance was heavy.  Although I have never seriously entertained using <a href="http://code.google.com/p/chronicle-recorder/">chronicle-recorder</a> (via <a href="http://www.visophyte.org/blog/tag/chroniquery/">chroniquery</a>) for performance investigations, it is a phenomenal tool and it would be fantastic if it were usable for this purpose.</p>
<p>VMware introduced with Workstation <a href="http://blogs.vmware.com/sherrod/2007/04/the_amazing_vm_.html">6</a>/<a href="http://blogs.vmware.com/vmtn/2008/08/introducing-rep.html">6.5</a> the ability to efficiently record VM execution by recording the non-deterministic parts of VM execution.  When you hit the record button it takes a snapshot and then does its thing.  For a 2 minute execution trace where Thunderbird is started up and gloda starts indexing and adaptively targets for 80% cpu usage, I have a 1G memory snapshot (the amount of memory allocated to the VM), a 57M vmlog file, and a 28M vmsn file.  There is also and a 40M disk delta file (against the disk snapshot), but I presume that&#8217;s a side effect of the execution rather than a component of it.</p>
<p>The record/replay functionality is the key to being able to analyze performance while minimizing the distortion of the data-gathering mechanisms.  There are apparently a lot of other solutions in the pipeline, many of them open source.  VMware peeps <a href="http://sourceforge.net/mailarchive/forum.php?thread_name=BAY103-W4642373BA0DDCC8326A9A0AA420%40phx.gbl&amp;forum_name=valgrind-developers">apparently also created a record/replay-ish mechanism</a> for <a href="http://valgrind.org/">valgrind</a>, valgrind-rr, which <a href="http://weblogs.mozillazine.org/roc/">roc</a> has thought about <a href="http://weblogs.mozillazine.org/roc/archives/2008/10/interesting_dev.html">leveraging for chronicle-recorder</a>.  I have also heard of Xen solutions to the problem, but am not currently aware of any usable solutions today.  And of course, there are many precursors to VMware&#8217;s work, but this blog post is not a literature survey.</p>
<p>There are 3 ways to get data out of a VM under replay, only 2 of which are usable for my purposes.</p>
<ol>
<li>Use gdb/the gdb remote target protocol.  The VMware server opens up a port that you can attach to.  The server has some built-in support to understand linux processes if you spoon feed it some critical offsets.  Once you do that, &#8220;info threads&#8221; lists every process in the image as a thread which you can attach to.  If you do the dance right, gdb provides perfect back-traces and you can set breakpoints and generally do your thing.  You can even rewind execution if you want, but since that means restoring state at the last checkpoint and running execution forward until it reaches the right spot, it&#8217;s not cheap.  In contrast, chronicle-recorder can run (process) time backwards, albeit at a steep initial cost.</li>
<li>Use <a href="http://x86vmm.blogspot.com/2007/09/presenting-vprobes.html">VProbes</a>.  Using a common analogy, dtrace is like a domesticated assassin black bear that comes from the factory understanding English and knowing how to get you a beer from the fridge as well as off your enemies.  VProbes, in contrast, is a grizzly bear that speaks no English.  Assuming you can convince it to go after your enemies, it will completely demolish them.  And you can probably teach it to get you a beer too, it just takes a lot more effort.</li>
<li>Use <a href="http://blogs.vmware.com/vmtn/2008/06/introducing-vas.html">VAssert</a>.  Just like asserts only happen in debug builds, VAsserts only happen during replay (but not during recording).  Except for the requirement that you think ahead to VAssert-enable your code, it&#8217;s awesome because, like static dtrace probes, you can use your code that already understands your code rather than trying to wail on things from outside using gdb or the like.  This one was not an option because it is Windows only as of WS 6.5.  (And Windows was not an option because building mozilla in a VM is ever so slow, and, let&#8217;s face it, I&#8217;m a linux kind of guy.  At least until someone buys me a solid gold house and a rocket car.)</li>
</ol>
<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/08/profile-performance-graph-callbackDriver-doubleClicked.png"><img class="alignnone size-thumbnail wp-image-367" title="profile-performance-graph-callbackDriver-doubleClicked" src="http://www.visophyte.org/blog/wp-content/uploads/2009/08/profile-performance-graph-callbackDriver-doubleClicked-600x414.png" alt="profile-performance-graph-callbackDriver-doubleClicked" width="600" height="414" /></a></p>
<p>My first step in this direction has been using a combination of #1 and #2 to get javascript backtraces using a timer-interval probe.  The probe roughly does the following:</p>
<ul>
<li>Get a pointer to the current linux kernel task_struct:
<ul>
<li>Assume we are uniprocessor and retrieve the value of x86_hw_tss.sp0 from the TSS struct for the first processor.</li>
<li>Now that we know the per-task kernel stack pointer, we can find a pointer to the task_struct at the base of the page.</li>
</ul>
</li>
<li>Check if the name of our task is &#8220;thunderbird-bin&#8221; and bail if it is not.</li>
<li>Pull the current timestamp from the linux kernel maintained <em>xtime</em>.  Ideally we could use VProbe&#8217;s <em>getsystemtime</em> function, but it doesn&#8217;t seem to work and/or is not well defined.  Our goal is to have a reliable indicator of what the real time is at this stage in the execution, because with a rapidly polling probe our execution will obviously be slower than realtime.  <em>xtime</em> is pretty good for this, but ticks at 10ms out of box (Ubuntu 9.04 i386 VM-targeted build), which is a rather limited granularity.  Presumably we can increase its tick rate, but not without some additional (though probably acceptable) time distortion.</li>
<li>Perform a JS stack dump:
<ul>
<li>Get XPConnect&#8217;s context for the thread.
<ul>
<li>Using information from gdb on where XPCPerThreadData::gTLSIndex is, load the tls slot.  (We could also just directly retrieve the tls slot from gdb.)</li>
<li>Get the NSPR thread private data for that TLS slot.
<ul>
<li>Using information from gdb on where pt_book is located, get the pthread_key for NSPR&#8217;s per-thread data.</li>
<li>Using the current task_struct from earlier, get the value of the GS segment register by looking into tls0_base and un-scrambling it from its hardware-specific configuration.</li>
<li>Use the pthread_key and GS to traverse the pthread structure and then the NSPR structure&#8230;</li>
</ul>
</li>
<li>Find the last XPCJSContextInfo in the nsTArray in the XPCJSContextStack.</li>
</ul>
</li>
<li>Pull the JSContext out, then get its JSStackFrame.</li>
<li>Recursively walk the frames (no iteration), manually/recursively (ugh) &#8220;converting&#8221; the 16-bit characters into 8-bit strings through violent truncation and dubious use of sprintf.</li>
</ul>
</li>
</ul>
<p>The obvious-ish limitation is that by relying on XPConnect&#8217;s understanding of the JS stack, we miss out on the most specific pure interpreter stack frames at any given time.  This is mitigated by the fact that XPConnect is like air to the Thunderbird code-base and that we still have the functions higher up the call stack.  This can also presumably be addressed by detecting when we are in the interpreter code and poking around.  It&#8217;s been a while since I&#8217;ve been in that part of SpiderMonkey&#8217;s guts&#8230; there may be complications with fast natives that could require clever stack work.</p>
<p>This blog post is getting rather long, so let&#8217;s just tie this off and say that I have extended <a href="http://www.visophyte.org/blog/tag/doccelerator/">doccelerator</a> to be able to parse the trace files, spitting the output into its own CouchDB database.  Then doccelerator is able to expose that data via <a href="http://www.kylescholz.com/blog/">Kyle Scholz</a>&#8217;s <a href="http://code.google.com/p/jsviz/">JSViz</a> in an interactive force-directed graph that is related back to the documentation data.  The second screenshot demonstrates that double-clicking on the (blue) node that is the source of the tooltip brings up our documentation on GlodaIndexer.callbackDriver.  <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/doccelerator/">doccelerator hg repo</a>.  <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/tb-test-help/file/edd5e8a44ad3/jsstack.emt">vprobe emmett script</a> in <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/tb-test-help/">hg repo</a>.</p>
<p><a href="http://clicky.visophyte.org/examples/live/doccelerator/_design/doccelerator/index.html#perfTop=perfish">See a live demo here</a>.  It will eat your cpu although it will eventually back off once it feels that layout has converged.  You should be able to drag nodes around.  You should also be able to double-click on nodes and have the documentation for that function be shown *if it is available*.  We have no mapping for native frames or XBL stuff at this time.  Depending on what other browsers do when they see JS 1.8 code, it may not work in non-Firefox browsers.  (If they ignore the 1.8 file, all should be well.)  I will ideally fix that soon by adding an explicit extension mechanism.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/08/03/using-vmware-recordreplay-and-vprobes-for-low-time-distortion-performance-profiling/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thunderbird Jetpack messageDisplay.overrideMessageDisplay fun.</title>
		<link>http://www.visophyte.org/blog/2009/07/23/thunderbird-jetpack-messagedisplay-overridemessagedisplay-fun/</link>
		<comments>http://www.visophyte.org/blog/2009/07/23/thunderbird-jetpack-messagedisplay-overridemessagedisplay-fun/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 13:34:12 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[jetpack]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=351</guid>
		<description><![CDATA[
As part of our goal to make it easy to write extensions for Thunderbird 3, we&#8217;ve been working on getting Jetpack running under Thunderbird and exposing Thunderbird-specific points.  This is all experimental, but it&#8217;s having good results.
The first example replaces the message you get from twitter when someone follows you and instead shows you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/07/jetpack-twitter-follow-notification.png"><img class="alignnone size-thumbnail wp-image-352" title="jetpack-twitter-follow-notification" src="http://www.visophyte.org/blog/wp-content/uploads/2009/07/jetpack-twitter-follow-notification-600x584.png" alt="jetpack-twitter-follow-notification" width="600" height="584" /></a></p>
<p>As part of our goal to make it easy to write extensions for Thunderbird 3, we&#8217;ve been working on getting Jetpack running under Thunderbird and exposing Thunderbird-specific points.  This is all experimental, but it&#8217;s having good results.</p>
<p>The <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/jetpack-tb-examples/file/a117452f167b/message-display/sender-specific/twitter-followed.js">first example</a> replaces the message you get from twitter when someone follows you and instead shows you that person&#8217;s twitter page so you can see what they&#8217;ve written.  Unfortunately, if you try and click on links on the page you will become sad because they all try and trigger your web browser.  But <a href="http://ccgi.standard8.plus.com/blog">Standard8</a> is hard at work resolving the content display issues.  Besides demonstrating registration via a regex over the sender&#8217;s e-mail address, it also shows us extracting message headers from the message.  Also, we introduce a small HTML snippet that precedes the nested web browser so it&#8217;s not just an embedded web browser.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jetpack.<span style="color: #660066;">future</span>.<span style="color: #003366; font-weight: bold;">import</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;thunderbird.messageDisplay&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
jetpack.<span style="color: #660066;">thunderbird</span>.<span style="color: #660066;">messageDisplay</span>.<span style="color: #660066;">overrideMessageDisplay</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  match<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    fromAddress<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/twitter-follow-[^@]+@postmaster.twitter.com/</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  onDisplay<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>aGlodaMsg<span style="color: #339933;">,</span> aMimeMsg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    let desc <span style="color: #339933;">=</span> aMimeMsg.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;X-Twittersendername&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;some anonymous jerk&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
      <span style="color: #3366CC;">&quot; has followed you on Twitter.  Check out their twitter page below.&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
      beforeHtml<span style="color: #339933;">:</span>
        <span style="color: #339933;">&lt;&gt;</span>
          <span style="color: #339933;">&lt;</span>div style<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;background-color: black; color: white; padding: 3px; margin: 3px; -moz-border-radius: 3px;&quot;</span><span style="color: #339933;">&gt;</span>
            <span style="color: #009900;">&#123;</span>desc<span style="color: #009900;">&#125;</span>
          <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;/&gt;</span>
      url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;http://twitter.com/&quot;</span> <span style="color: #339933;">+</span> aMimeMsg.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;X-Twittersenderscreenname&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/07/jetpack-amazon-big-total.png"><img class="alignnone size-thumbnail wp-image-356" title="jetpack-amazon-big-total" src="http://www.visophyte.org/blog/wp-content/uploads/2009/07/jetpack-amazon-big-total-600x404.png" alt="jetpack-amazon-big-total" width="600" height="404" /></a></p>
<p>Our <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/jetpack-tb-examples/file/a117452f167b/message-display/sender-specific/amazon-big-total.js">second example</a> of the extension point replaces e-mails from Amazon about an order (order confirmation and shipment confirmation) with the amount of money you spent on the order in BIG LETTERS (or rather BIG NUMBERS).  It uses a regular expression run against the message body to find the total order cost.  Then it generates a simple web page to present the information to you.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jetpack.<span style="color: #660066;">future</span>.<span style="color: #003366; font-weight: bold;">import</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;thunderbird.messageDisplay&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
jetpack.<span style="color: #660066;">thunderbird</span>.<span style="color: #660066;">messageDisplay</span>.<span style="color: #660066;">overrideMessageDisplay</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  match<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    fromAddress<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/(?:auto-confirm|ship-confirm)@amazon.(?:com|ca)/</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  _totalRe<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/Total(?: for this Order)?:[^$]+\$\s*(\d+\.\d{2})/</span><span style="color: #339933;">,</span>
  onDisplay<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>aGlodaMsg<span style="color: #339933;">,</span> aMimeMsg<span style="color: #339933;">,</span> aMsgHdr<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    let bodyText <span style="color: #339933;">=</span> aMimeMsg.<span style="color: #660066;">coerceBodyToPlaintext</span><span style="color: #009900;">&#40;</span>aMsgHdr.<span style="color: #660066;">folder</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    let match <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._totalRe.<span style="color: #660066;">exec</span><span style="color: #009900;">&#40;</span>bodyText<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    let total <span style="color: #339933;">=</span> match <span style="color: #339933;">?</span> match<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;hard to say&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
      html<span style="color: #339933;">:</span>
      <span style="color: #339933;">&lt;&gt;</span>
        <span style="color: #339933;">&lt;</span>style<span style="color: #339933;">&gt;&lt;!</span><span style="color: #009900;">&#91;</span>CDATA<span style="color: #009900;">&#91;</span>
          body <span style="color: #009900;">&#123;</span> background<span style="color: #339933;">-</span>color<span style="color: #339933;">:</span> #ffffff<span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
          .<span style="color: #660066;">amount</span> <span style="color: #009900;">&#123;</span> font<span style="color: #339933;">-</span>size<span style="color: #339933;">:</span> <span style="color: #CC0000;">800</span><span style="color: #339933;">%;</span> <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;&lt;/</span>style<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
          you spent... <span style="color: #339933;">&lt;</span>span <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;amount&quot;</span><span style="color: #339933;">&gt;</span>$<span style="color: #009900;">&#123;</span>total<span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
      <span style="color: #339933;">&lt;/&gt;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The modified version of Jetpack can be found <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/opc-jetpack/">here</a> on the &#8220;thunderbird&#8221; branch.  &#8220;about:jetpack&#8221; can be triggered from the &#8220;Tools&#8221; menu.  Besides the development jetpack, you can also add jetpacks from the about:jetpack &#8220;Installed Features&#8221; tab by providing a URL directly to the javascript file.  Unfortunately, I just tried installed more than one Feature at the same time and that fell down.  I&#8217;m unclear if that&#8217;s a Thunderbird content issue, a problem with my changes, or a problem in Jetpack/Ubiquity that may go away when I update the branch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/07/23/thunderbird-jetpack-messagedisplay-overridemessagedisplay-fun/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Doccelerator: JavaScript documentation via JSHydra into CouchDB with an AJAX UI</title>
		<link>http://www.visophyte.org/blog/2009/07/20/doccelerator-javascript-documentation-via-jshydra-into-couchdb-with-an-ajax-ui/</link>
		<comments>http://www.visophyte.org/blog/2009/07/20/doccelerator-javascript-documentation-via-jshydra-into-couchdb-with-an-ajax-ui/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 05:09:04 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[doccelerator]]></category>
		<category><![CDATA[docs]]></category>
		<category><![CDATA[jshydra]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=343</guid>
		<description><![CDATA[
About the name.  David Ascher picked it.  My choice was flamboydoc in recognition of my love of angry fruit salad color themes and because every remotely sane name has already been used by the 10 million other documentation tools out there.  Regrettably not only have we lost the excellent name, but the color scheme is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/07/doccelerator-1.png"><img class="alignnone size-thumbnail wp-image-346" title="doccelerator-1" src="http://www.visophyte.org/blog/wp-content/uploads/2009/07/doccelerator-1-600x371.png" alt="doccelerator-1" width="600" height="371" /></a></p>
<p>About the name.  <a href="http://ascher.ca/blog/">David Ascher</a> picked it.  My choice was flamboydoc in recognition of my love of <a href="http://www.emacswiki.org/emacs/AngryFruitSalad">angry fruit salad</a> color themes and because every remotely sane name has already been used by the 10 million other documentation tools out there.  Regrettably not only have we lost the excellent name, but the color scheme is at best mildly irritated at this point.</p>
<p>So why yet another JavaScript documentation tool:</p>
<ul>
<li>JavaScript 1.8 support.  <a href="http://quetzalcoatal.blogspot.com/2009/01/jshydra.html">JSHydra</a> (thanks <a href="http://quetzalcoatal.blogspot.com/">jcranmer</a>!) is built on spidermonkey.  In terms of existing JS documentation tools out there, they can be briefly lumped into &#8220;doesn&#8217;t even both attempting to parse JavaScript&#8221; and &#8220;parses it to some degree, but gets really confused by JavaScript 1.8 syntax&#8221;.  By having the parser be the parser of our  JS engine, parsing success is guaranteed.  And non-parsing tools tend to require too much hand labeling to be practical.</li>
<li>Docceleterator is not intended to be <em>just</em> a documentation tool.  While JSHydra is still in its infancy, it promises the ability to extract information from function bodies.  Its namesake, <a href="https://developer.mozilla.org/en/Dehydra">Dehydra</a>, is a static analysis tool for C++ and has already given us <a href="http://vocamus.net/dave/?p=557">great things</a> (dxr, also in its infancy).</li>
</ul>
<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/07/doccelerator-comment.png"><img class="alignnone size-thumbnail wp-image-347" title="doccelerator-comment" src="http://www.visophyte.org/blog/wp-content/uploads/2009/07/doccelerator-comment-600x202.png" alt="doccelerator-comment" width="600" height="202" /></a></p>
<ul>
<li>Support community API docs contributions without forking the API docs or requiring source patches.  <a href="https://developer.mozilla.org/">DevMo</a> is a great place for documentation, but it is an iffy place for doxygen-style API docs.  Short of an exceedingly elaborate tool that round-trips doxygen/JSDoc comments to the wiki and user modifications back again, the documentation is bound to diverge.  By supporting comments directly on the semantic objects themselves[1], we eliminate having to try and determine what a given wiki change corresponds to.  (This would be annoying even if you could force the wiki users to obey a strict formatting pattern.)  This enables automatic patch generation, etc.</li>
<li>Mashable.  You post the JavaScript source file to a server running the doccelerator parser.  You get back a JSON set of documents.  You post those into a <a href="http://couchdb.org/">CouchDB</a> couch.  The UI is a <a href="http://github.com/jchris/couchapp/tree/master">CouchApp</a>; you can modify it.  Don&#8217;t like the UI, just want a service?  You can query the couch for things and get back JSON documents.  Want custom (CouchDB) views but are not in control of a documentation couch?  Replicate the couch to your own local couch and add some views.</li>
<li>Able to leverage data from dehydra/dxr.  Mozilla JS code lives in a world of XPCOM objects and their XPIDL-defined interfaces.  We want the JS documentation to be able to interact with that world.  Obviously, this raises some issues of where the boundary lies between dxr and Doccelerator.  I don&#8217;t think it matters at this point; we just need internal and API documentation for Thunderbird 3 now-ish.</li>
<li>A more &#8216;dynamic&#8217; UI.  The UI is inspired by <a href="http://www.tiddlywiki.com/">TiddlyWiki</a>&#8217;s interface where all wiki &#8220;pages&#8221; open in the same document.  I often find myself only caring about a few methods of a class at any given time.  Documentation is generally either organized in monolithic pages or single pages per function.  Either way, I tend to end up with a separate tab for each thing of interest.  This usually ends in both confusion and way too many tabs.</li>
</ul>
<p>1: Right now I only support commenting at the documentation display granularity which means you cannot comment on arguments individually, just the function/method/class/etc.</p>
<p>Example links which will eventually die because I&#8217;m not guaranteeing this couch instance will stay up forever:</p>
<ul>
<li><a href="http://clicky.visophyte.org/examples/live/doccelerator/_design/doccelerator/index.html#f=comm-central/mail/base/content/folderDisplay.js&amp;t=FolderDisplayWidget">Live version of the first screen shot of folderDisplay.js and FolderDisplayWidget</a></li>
<li><a href="http://clicky.visophyte.org/examples/live/doccelerator/_design/doccelerator/index.html#n=FTBO_stubOutAttributes">Live version of the second screen shot of comments on FTBO_stubOutAttributes.  Feel free to add your own.</a></li>
<li><a href="http://clicky.visophyte.org/examples/live/doccelerator/_design/doccelerator/index.html">Live version with nothing up.  Click on some files, explore!</a></li>
</ul>
<p>The hg repo is <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/doccelerator/">here</a>.  I tried to code the JS against the 1.5 standard and generally be cross-browser compatible, but I know at least Konqueror seems to get upset when it comes time to post (modified) comments.  I&#8217;m not sure what&#8217;s up with that.</p>
<p>Exciting potential taglines:</p>
<ul>
<li>Doccelerator: Documentation from the future, because the documentation was doccelerated past the speed of light, and we all know how that turns out.</li>
<li>Doccelerator: It sounds like an extra pedal for your car and it&#8217;s just as easy to use&#8230; unless we&#8217;re talking about the clutch.</li>
<li>Doccelerator: Thankfully the name doesn&#8217;t demand confusingly named classes in the service of a stretched metaphor.  That&#8217;s good, right?</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/07/20/doccelerator-javascript-documentation-via-jshydra-into-couchdb-with-an-ajax-ui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Review Board and Bugzilla reviews, take 2.</title>
		<link>http://www.visophyte.org/blog/2009/06/20/review-board-and-bugzilla-reviews-take-2/</link>
		<comments>http://www.visophyte.org/blog/2009/06/20/review-board-and-bugzilla-reviews-take-2/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 09:05:52 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[bugzilla]]></category>
		<category><![CDATA[review board]]></category>
		<category><![CDATA[reviews]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=335</guid>
		<description><![CDATA[
Last time I played with Review Board and bugzilla request queues things were great for me, but no one else.  I had to create an account for you on the instance, add you to my script that synchronizes request queues, run the script, and then keep running the script periodically.  Not to mention there wasn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/06/review-board-diff.png"><img class="alignnone size-thumbnail wp-image-336" title="review-board-diff" src="http://www.visophyte.org/blog/wp-content/uploads/2009/06/review-board-diff-600x405.png" alt="review-board-diff" width="600" height="405" /></a></p>
<p><a href="http://www.visophyte.org/blog/2009/03/20/using-review-board-for-bugzilla-request-queues-reviews/">Last time I played with Review Board and bugzilla request queues</a> things were great for me, but no one else.  I had to create an account for you on the instance, add you to my script that synchronizes request queues, run the script, and then keep running the script periodically.  Not to mention there wasn&#8217;t really a way to get your review out and into bugzilla.  No one actually tried to use it, so they probably also didn&#8217;t notice there were caching issues related to the ever-changing definition of &#8220;HEAD&#8221; (&#8220;tip&#8221;).  It sucked, and when I upgraded and everything broke, no one cared, not even me.</p>
<p>But now it&#8217;s back and better than ever:</p>
<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/06/review-board-bugzilla-queue-sync.png"><img class="alignnone size-thumbnail wp-image-337" title="review-board-bugzilla-queue-sync" src="http://www.visophyte.org/blog/wp-content/uploads/2009/06/review-board-bugzilla-queue-sync-600x323.png" alt="review-board-bugzilla-queue-sync" width="600" height="323" /></a></p>
<ul>
<li>People don&#8217;t need to login at all to see review requests and reviews!  Just point them at the URL and away they go.  (Actually, this was the case before, but it was not obvious.)</li>
<li>You can/must sign in with Open ID!  If you have Weave and are reading this in the future, Weave can be your Open ID friend!  If you are like me and live in the present (Weave 0.3.2), something is wrong and it doesn&#8217;t work, not to mention that Weave takes over the Open ID box so you can&#8217;t use credentials that work.</li>
<li>There&#8217;s a button that updates your request queue for the 16 most recent requests made of you.  Just make sure that you have entered your bugzilla e-mail address on the &#8220;my account&#8221; page.  This may have happened automatically depending on what your Open ID provider provided/you told them to provide.</li>
<li>There&#8217;s export functionality so you can take your review and cram it in bugzilla.</li>
<li>The definition of &#8220;tip&#8221; gets nailed down when the review request gets created, so no more ugly caching issues.  Patches can still fail to apply, though, if &#8220;tip&#8221; has drifted from when the patch was first created.</li>
<li>It has friendlier assumptions about what repo you are dealing with.  Thunderbird/MailNews Core/Calendar/SeaMonkey are all assumed to be in comm-central, everyone else is assumed to be in mozilla-central.  Patches against other repos (including mozilla 1.9.1) clearly will not work without additional logic (and some kind of extra info, like people putting &#8220;1.9.1&#8243; in their attachment descriptions.)</li>
</ul>
<p>Here is a (fake) example of the &#8220;pretty&#8221; review output that is possible if you tell people about your reviewboard review (see it live <a href="http://reviews.visophyte.org/r/381294/">here</a>).  Although it says <a href="http://blog.davidbienvenu.org/">Bienvenu</a>, it&#8217;s just me pretending to be him because his review queue is more interesting than mine.  The comments are accordingly mine.</p>
<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/06/review-board-review-pretty.png"><img class="alignnone size-thumbnail wp-image-338" title="review-board-review-pretty" src="http://www.visophyte.org/blog/wp-content/uploads/2009/06/review-board-review-pretty-600x405.png" alt="review-board-review-pretty" width="600" height="405" /></a></p>
<p>Now, what does the export look like (see it live <a href="http://reviews.visophyte.org/r/bzexport/2/">here</a>)?</p>
<pre>on file: mailnews/base/src/nsMessenger.cpp line 635
&gt;     // if we have a mailbox:// url that points to an .eml file, we have to read
&gt;     // the file size as well

what a pretty comment

on file: mailnews/base/src/nsMessenger.cpp line 642
&gt;     NS_ENSURE_SUCCESS(rv, rv);

please rename rv ARRRRRR-VEEEEEE</pre>
<p>Yeah, it looks like that.</p>
<p>A quick feature summary that explains why this is better than just looking at diffs in bugzilla:</p>
<ul>
<li>Syntax highlighting!</li>
<li>It actually has the full-context of the rest of the file!  No more being limited to the 3 or 8 lines of context in the diff you are provided.  I know I have done a lazy review and let a bug through that would not have happened if I had more context at my fingertips (or was not sometimes lazy).</li>
<li>People just trimming down your patch to what they are commenting on leaves you with no context of what changed at all!</li>
</ul>
<p>Useful links:</p>
<ul>
<li>A <a href="http://reviews.visophyte.org/r/384008/diff/">more interesting live diff</a> to check out.</li>
<li>The <a href="http://reviews.visophyte.org/">root of the review board</a> that will prompt you to login via an Open ID account.  When syncing your review queue, please keep in mind that it can take a bit to do all the legwork and you won&#8217;t see any feedback until it is actually done doing everything else.  You should get some form of feedback no matter what happens, so don&#8217;t keep hitting refresh.</li>
<li>The <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/opc-reviewboard/">hg repo for my modified version of review-board</a>.  It&#8217;s based on an extremely shallow hgsvn checkout.  My questionable development strategy was to make changes with emacs locally, commit, then push to my VM, so the changesets are sometimes a bit excessive.</li>
</ul>
<p>Caveat usor:</p>
<ul>
<li>This is running on a linode VM right now.  This is better than my local box or what not, but it&#8217;s not Mo[MC]o IT or anything.</li>
<li>My changes, at least the export functionality, may be buggy.  You may need to rely on me to fix the export functionality to get your stuff out that way.  (If the hg diff doesn&#8217;t apply cleanly, you can&#8217;t enter data to lose it, so I&#8217;m less concerned about that.)</li>
<li>I have no plans to blow away the database, but at the same time, please be prepared for the possibility that space ninjas destroy your data.  Use the export functionality and save it to a text file or something periodically if you&#8217;re doing a major review.  (In case it&#8217;s not obvious, the export functionality is the text labeled &#8220;bugzilla-style export&#8221; to the right of the reviewer&#8217;s name at the top-left of each review.)  You can do your review in multiple passes, exporting each review pass individually.</li>
<li>I am confident something will go wrong.  Feel free to post comments here or ping me on IRC (:asuth).</li>
<li>If people actually try using this, I&#8217;ll stop developing on the live server, but do be aware that apache restarts (lasting a few seconds) may periodically happen, but this should not really impact anything.</li>
</ul>
<p>Props:</p>
<ul>
<li><a href="http://www.review-board.org/">Review Board</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/06/20/review-board-and-bugzilla-reviews-take-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using BugXhibit to find that bug you know you saw recently but can&#8217;t find</title>
		<link>http://www.visophyte.org/blog/2009/06/06/using-bugxhibit-to-find-that-bug-you-know-you-saw-recently-but-cant-find/</link>
		<comments>http://www.visophyte.org/blog/2009/06/06/using-bugxhibit-to-find-that-bug-you-know-you-saw-recently-but-cant-find/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 06:45:39 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[bugxhibit]]></category>
		<category><![CDATA[bugzilla]]></category>
		<category><![CDATA[exhibit]]></category>
		<category><![CDATA[simile]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=325</guid>
		<description><![CDATA[
BugXhibit, the Bugzilla search results viewer made with the SIMILE Exhibit widget, is now more fancy, and now addresses another one of my use cases.  I frequently find myself wanting to point someone at a bug, or go back to a bug that I know passed through my bugmail recently, and have trouble finding it.  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/06/bugxhibit-cc-search.png"><img class="alignnone size-thumbnail wp-image-326" title="bugxhibit-cc-search" src="http://www.visophyte.org/blog/wp-content/uploads/2009/06/bugxhibit-cc-search-600x423.png" alt="bugxhibit-cc-search" width="600" height="423" /></a></p>
<p><a href="http://www.visophyte.org/blog/2009/05/28/bugxhibit-exhibit-on-bugzilla-results/">BugXhibit</a>, the <a href="http://www.bugzilla.org/">Bugzilla</a> search results viewer made with the <a href="http://simile.mit.edu/">SIMILE</a> <a href="http://www.simile-widgets.org/exhibit/">Exhibit</a> widget, is now more fancy, and now addresses another one of my use cases.  I frequently find myself wanting to point someone at a bug, or go back to a bug that I know passed through my bugmail recently, and have trouble finding it.  So now BugXhibit can do easy searches based on reporter/assignee/cc/commenter with time ranges.</p>
<p>Examples by way of live links this time (noting that the default time interval is 7 days).  Uh, and if it gives you an error for reasons I don&#8217;t fully understand if you open it in a new tab (in the background) from here, just hitting enter in the address bar should fix it.  I&#8217;m going to lazyweb that problem for now.</p>
<ul>
<li><a href="http://clicky.visophyte.org/tools/bugxhibit/bugxhibit.html?cc=bugmail@asutherland.org">cc=bugmail@asutherland.org</a>: Bugs modified in the last week that I am cc&#8217;d on.</li>
<li><a href="http://clicky.visophyte.org/tools/bugxhibit/bugxhibit.html?cc=bugmail@asutherland.org&amp;howrecent=1m">cc=bugmail@asutherland.org&amp;howrecent=1m</a>: Bugs modified in the last month (and generous change) that I am cc&#8217;d on.</li>
<li><a href="http://clicky.visophyte.org/tools/bugxhibit/bugxhibit.html?reporter=bugmail@asutherland.org">reporter=bugmail@asutherland.org</a>: Bugs modified in the last week that I reported.</li>
<li><a href="http://clicky.visophyte.org/tools/bugxhibit/bugxhibit.html?assignee=bugmail@asutherland.org">assignee=bugmail@asutherland.org</a>: Bugs modified in the last week that I am the assignee on.</li>
<li><a href="http://clicky.visophyte.org/tools/bugxhibit/bugxhibit.html?commenter=bugmail@asutherland.org">commenter=bugmail@asutherland.org</a>: Bugs modified in the last week that I have ever commented on.</li>
<li><a href="http://clicky.visophyte.org/tools/bugxhibit/bugxhibit.html?who=bugmail@asutherland.org&amp;why=reporter&amp;why=assignee">who=bugmail@asutherland.org&amp;why=reporter&amp;why=assignee</a>: Bugs modified in the last week that I am either the reporter of or that I am the assignee of.</li>
</ul>
<p>Other changes:</p>
<ul>
<li>It now is also self documenting, just click on &#8220;Show Docs&#8221; on the page.</li>
<li>You can now use arguments to specify the sort and whether grouping is active on the page.</li>
<li>The date parsing is better.  Bugzilla doesn&#8217;t provide the raw dates but attempts to change things based on how recent the date is.  BugXhibit does a good job of fixing up the date if you are in the same timezone as the bugzilla server, and a less good but acceptable job if you aren&#8217;t.</li>
<li>Upgraded to exhibit 2.1.0 and now the numeric sliders with histograms work for me.  Woo!</li>
</ul>
<p>Other notes:</p>
<ul>
<li> <a href="http://informationisart.com/stas/">Staś Małolepszy</a> made <a href="http://informationisart.com/stas/bugxhibit-an-interface-to-bugzillas-search-results">a post about BugXhibit</a>, wherein you can find a ubiquity command that is ever so useful.</li>
<li>A shout out to <a href="http://davidhuynh.net/index.php">David Huynh</a> to thank him for Exhibit in the first place.</li>
</ul>
<p>The <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/bugxhibit/">hg repo is here</a>, as always.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/06/06/using-bugxhibit-to-find-that-bug-you-know-you-saw-recently-but-cant-find/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>DevMoXhibit: Exhibit on DevMo (Deki Wiki) results</title>
		<link>http://www.visophyte.org/blog/2009/06/05/devmoxhibit-exhibit-on-devmo-deki-wiki-results/</link>
		<comments>http://www.visophyte.org/blog/2009/06/05/devmoxhibit-exhibit-on-devmo-deki-wiki-results/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 13:34:31 +0000</pubDate>
		<dc:creator>Andrew Sutherland</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[devmo]]></category>
		<category><![CDATA[exhibit]]></category>
		<category><![CDATA[simile]]></category>

		<guid isPermaLink="false">http://www.visophyte.org/blog/?p=318</guid>
		<description><![CDATA[
The above screenshot is of a normal search query on DevMo for &#8220;customize toolbar&#8221;.  I see 2.5 results, and I honestly have no interest in the first item at all.  (It&#8217;s a page that only advanced DevMo authors would care about, for those who refuse to squint or click on images to see bigger versions [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/06/devmo-search-customize-toolbar.png"><img class="alignnone size-thumbnail wp-image-319" title="devmo-search-customize-toolbar" src="http://www.visophyte.org/blog/wp-content/uploads/2009/06/devmo-search-customize-toolbar-600x397.png" alt="devmo-search-customize-toolbar" width="600" height="397" /></a></p>
<p>The above screenshot is of a normal search query on <a href="https://developer.mozilla.org/">DevMo</a> for &#8220;customize toolbar&#8221;.  I see 2.5 results, and I honestly have no interest in the first item at all.  (It&#8217;s a page that only advanced DevMo authors would care about, for those who refuse to squint or click on images to see bigger versions of images.)</p>
<p><a href="http://www.visophyte.org/blog/wp-content/uploads/2009/06/devmoxhibit-search-customize-toolbar-corrected.png"><img class="alignnone size-thumbnail wp-image-321" title="devmoxhibit-search-customize-toolbar-corrected" src="http://www.visophyte.org/blog/wp-content/uploads/2009/06/devmoxhibit-search-customize-toolbar-corrected-600x384.png" alt="devmoxhibit-search-customize-toolbar-corrected" width="600" height="384" /></a></p>
<p>The above screenshot is of the same query using DevMoXhibit.  You will note you can see more things, and the first result from the other page is completely elided because we filter by default so that only &#8220;Real&#8221; result pages are shown.  (In general, I am not looking for talk pages or user pages or meta-pages.)</p>
<p>But enough about my interpretations of pictures, why don&#8217;t you:</p>
<ul>
<li><a href="http://clicky.visophyte.org/tools/devmoxhibit/devmoxhibit.html?qs=customize+toolbar">Try looking at the above results yourself.</a></li>
<li><a href="http://clicky.visophyte.org/tools/devmoxhibit/devmoxhibit.html">Go formulate your own query and examine the results.</a></li>
</ul>
<p>Neat things we do that may not be immediately obvious:</p>
<ul>
<li>We flatten the score into deciles, and then within each decile range we sort based on the view count for the page.  The theory is that, given equally likely results, the one that more people have looked at is probably more interesting to you, roughly speaking.</li>
<li>We use a simple heuristic to figure out the page type, as mentioned above (&#8220;Real&#8221;, &#8220;Talk&#8221;, &#8220;User&#8221;, etc.)</li>
<li>We try and hide all things related to the language, as we explicitly query on a language which means it&#8217;s just noise.  Right now, that language is always english, but the code uses a variable if you want to write the code to hook that up and expose it in the UI.</li>
<li>We produce a &#8220;smart&#8221; snippet.  The snippets provided by the search results naively will include &#8220;chrome&#8221; that is part of the document, which makes for a nearly useless snippet.  For example, take a gander at XUL/toolbar:
<ul>
<li>Plain old snippet:
<ul>
<li>« XUL Reference home    [ Examples | Attributes | Properties | Methods | Related ]      A container which typically contains a row of buttons. It is a type of box that defaults to horizontal orientation. &#8230;</li>
</ul>
</li>
<li>Smart snippet:
<ul>
<li><span class="snippet"><span>A container which typically contains a row of buttons. It is a type of box that defaults to horizontal orientation. &#8230;</span></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="snippet"><span>We produce a sometimes over-zealous smart snippet.  If you were to keep reading both of those snippets, you would notice that the smart snippet eats a bit that the non-smart-snippet does not.  That is because the smart snippet is based on looking at a version of the snippet which has HTML tags in it, and then it tries to nuke those HTML tags out of existence using simple regexps.<br />
</span></span></li>
</ul>
<p>Implementation notes:</p>
<ul>
<li>This probably should work on other deki wikis if so adapted, but I don&#8217;t use any others, so YMMV.</li>
<li>We actually issue two search queries because there are two result formats that can be produced.  &#8220;xml&#8221; is an inexplicable mixture of too much data and too little data.  Namely, it does not tell you the tags on a document, which is basically the most useful piece of info, but it does tell you every link to and from that page (which we expose, although I doubt it will be useful enough to justify it).  It does give you a link to be able to get the tags, but that&#8217;s a costly operation when you have to perform it for each search result.  In contrast, &#8220;search&#8221; gives you the tags; they are only space-delimited, but that&#8217;s fine.  (&#8220;Inexplicable&#8221; may be a bit harsh; looking at the source, it&#8217;s just dumping the page info without further processing/lookups, but arguably it would be very useful if they made the effort to fetch that data.)</li>
<li>Because of cross-site XHR issues, this is not quite as hackable as I would like.  My demo server above is using mod_proxy (with a very specific constraint) to proxy the search to DevMo.  When I develop locally, I have to do the same thing.  Presumably if you are using Firefox 3.5 and devmo is set up correctly, then this would not be a problem.  But, 1) for no good reason, I only use Firefox 3.0 and 2) have no clue whether devmo is emitting the headers that would enable that to work.  I strongly encourage someone to look into #2 and fix it if not.</li>
<li>As with BugXhibit, the sliders are totally broken for me and it&#8217;s sad, but I left them in there in the hopes that they work for someone, somewhere.  Alternately, I would not complain if someone, somewhere, fixed them.</li>
</ul>
<p>The hg repo is <a href="http://hg.mozilla.org/users/bugmail_asutherland.org/devmoxhibit/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visophyte.org/blog/2009/06/05/devmoxhibit-exhibit-on-devmo-deki-wiki-results/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
