<?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>The Nuclear Bunny Blog &#187; Jobs</title>
	<atom:link href="http://blog.nuclearbunny.org/category/jobs/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nuclearbunny.org</link>
	<description>Blah, blah, blah...</description>
	<lastBuildDate>Thu, 15 Jul 2010 04:45:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>You Don&#8217;t Need Flash for Rich Graphs on a Web Page</title>
		<link>http://blog.nuclearbunny.org/2010/04/11/you-dont-need-flash-for-rich-graphs-on-a-web-page/</link>
		<comments>http://blog.nuclearbunny.org/2010/04/11/you-dont-need-flash-for-rich-graphs-on-a-web-page/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 21:35:33 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[graphs]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ria]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=593</guid>
		<description><![CDATA[Adobe&#8217;s Flash has a lot of uses, but one of the most impressive to me has been the the creation of interactive graphs on a web page. One just has to visit Google Finance to see a great example of this in action; it&#8217;s fast, effective and fits seemlessly within the rest of the page. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.adobe.com/flashplatform/">Adobe&#8217;s Flash</a> has a lot of uses, but one of the most impressive to me has been the the creation of interactive graphs  on a web page. One just has to visit <a href="http://www.google.com/finance?q=NASDAQ:GOOG" target="_blank">Google Finance</a> to see a great example of this in action; it&#8217;s fast, effective and fits seemlessly within the rest of the page.</p>
<p>Many times, however, Flash isn&#8217;t an appropriate technology to use. If you&#8217;re an open-source product like Zenoss, Flash presents a licensing issue. If you&#8217;re targeting mobile platforms like the <a href="http://www.apple.com/iphone/">iPhone</a>, Flash isn&#8217;t available. And, sometimes, you may just not like Flash; it does have it&#8217;s own security problems and overhead, for example. What&#8217;s a web developer to do? Enter HTML5 to the rescue&#8230;</p>
<p><a href="http://en.wikipedia.org/wiki/Html5" target="_blank">HTML5</a> is not yet an approved standard, but it&#8217;s well on its way and surprisingly well-supported by the browser community already. One of the nice new features provided in HTML5 is the <a href="http://en.wikipedia.org/wiki/Canvas_element" target="_blank">canvas element</a> which allows for two-dimensional drawing functionality. Between this new feature and JavaScript, we should be able to create a rich graph display.</p>
<p>To get started, we&#8217;ll first need to create an HTML document that has the structure we&#8217;re after and a place for our drawing canvas to reside.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
    &lt;title&gt;Rich Graph Example using HTML5's Canvas Element&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;Rich Graph Example using HTML5's Canvas Element&lt;/h1&gt;
    &lt;canvas id=&quot;graph1&quot; width=&quot;500&quot; height=&quot;200&quot;&gt;
      This text is displayed if your browser sucks.
    &lt;/canvas&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>Next, we&#8217;ll need some JavaScript to do the work of creating the actual graph display. First, we&#8217;ll need to get a reference to the canvas DOM element and then ask it for it&#8217;s 2D drawing context:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #003366; font-weight: bold;">var</span> graph1 <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'graph1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> context <span style="color: #339933;">=</span> graph1.<span style="color: #660066;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'2d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Next, we&#8217;ll need to define the raw data used to display the graph. We&#8217;re going to assume a set of CPU processor time measurements with 5-minute measurement intervals, much like you would see in <a href="http://www.zenoss.com/">Zenoss</a> or other systems management application.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #006600; font-style: italic;">// Raw data, such as what might come back from a server query.</span>
    data <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">9.9430</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">7</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">50</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">0.0000</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">7</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">55</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">0.0000</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> 00<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">0.0000</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> 05<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">5.5828</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">1.0000</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">15</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">25.3120</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">45.8210</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">25</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">98.3211</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">30</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">96.1290</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">35</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">94.9128</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">40</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">98.3219</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">45</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #009900;">&#123;</span> value<span style="color: #339933;">:</span> <span style="color: #CC0000;">32.4912</span><span style="color: #339933;">,</span> time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2010</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">50</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Calculate the maximums in the provided data.</span>
    <span style="color: #003366; font-weight: bold;">var</span> maxY <span style="color: #339933;">=</span> <span style="color: #CC0000;">0.0</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> data.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      maxY <span style="color: #339933;">=</span> Math.<span style="color: #660066;">max</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span><span style="color: #339933;">,</span> maxY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #003366; font-weight: bold;">var</span> dataMaxY <span style="color: #339933;">=</span> Math.<span style="color: #660066;">ceil</span><span style="color: #009900;">&#40;</span>maxY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> dataMaxX <span style="color: #339933;">=</span> data.<span style="color: #660066;">length</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now, we have to calculate where we can start drawing on the canvas and how many pixels equal one coordinate in our user space data. The more elaborate legends we&#8217;ll want to use on the graph, the more these calculations will matter as we leave space for drawing text around the actual graph.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #006600; font-style: italic;">// define a font to use for legends</span>
    <span style="color: #003366; font-weight: bold;">var</span> fontHeight <span style="color: #339933;">=</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> font <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;12px/20px arial, sans-serif&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> xStart <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> yStart <span style="color: #339933;">=</span> fontHeight <span style="color: #339933;">*</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// leave room for 2 lines of text at the bottom</span>
    <span style="color: #003366; font-weight: bold;">var</span> xEnd <span style="color: #339933;">=</span> graph1.<span style="color: #660066;">width</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> yEnd <span style="color: #339933;">=</span> graph1.<span style="color: #660066;">height</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Determine how many pixel units equal one user space coordinate.</span>
    <span style="color: #003366; font-weight: bold;">var</span> xStep <span style="color: #339933;">=</span> dataMaxX <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span>xEnd <span style="color: #339933;">-</span> xStart<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> yStep <span style="color: #339933;">=</span> dataMaxY <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span>yEnd <span style="color: #339933;">-</span> yStart<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Create an array of 2D points to represent the user space</span>
    <span style="color: #006600; font-style: italic;">// coordinates of each data item.</span>
    points <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span>data.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> data.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> i <span style="color: #339933;">/</span> xStep <span style="color: #339933;">+</span> xStart<span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> y <span style="color: #339933;">=</span> data<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">/</span> yStep <span style="color: #339933;">+</span> yStart<span style="color: #339933;">;</span>
      points<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span> x<span style="color: #339933;">,</span> y<span style="color: #339933;">:</span> y <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now we get to the actual drawing of the graph. This is straight-forward 2D drawing that should be familiar to anyone who has done it with other technology.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #006600; font-style: italic;">// Save the graphics context before we begin mucking with it.</span>
    context.<span style="color: #660066;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Create a transform so that the graph portion of the chart can be</span>
    <span style="color: #006600; font-style: italic;">// drawn using a bottom-left origin instead of the default upper-left.</span>
    context.<span style="color: #660066;">translate</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> yEnd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #660066;">scale</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1.0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Draw our path using the appropriate color.</span>
    context.<span style="color: #660066;">beginPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #660066;">strokeStyle</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'black'</span><span style="color: #339933;">;</span>
    context.<span style="color: #660066;">lineWidth</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">;</span>
    context.<span style="color: #660066;">moveTo</span><span style="color: #009900;">&#40;</span>points<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> points<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> points.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      context.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>points<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> points<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    context.<span style="color: #660066;">stroke</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #660066;">restore</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>At this stage, we can render a simple line-graph using JavaScript and an HTML5 canvas element. Now about making it rich and interactive? We&#8217;ll need to add some mouse event handling. We&#8217;ll do something simple here: as the mouse moves along the x-axis of the graph we&#8217;ll find the current data point based solely on its x-position. This technique is more useful to an end-user and saves the calculation of finding how close a point is to a line segment.</p>
<p>Mouse events are still rather browser specific, so the calculations presented here to determine the offset of the mouse inside of the canvas are simplified and will not work in all scenarios.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    graph1.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mousemove'</span><span style="color: #339933;">,</span> mouseWatcher<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> mouseWatcher<span style="color: #009900;">&#40;</span>evt<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// Get the mouse position relative to the canvas element. This stuff</span>
      <span style="color: #006600; font-style: italic;">// is still gnarly across browsers. Here we're assuming we need to</span>
      <span style="color: #006600; font-style: italic;">// figure out the offset the canvas has in the client area, so our</span>
      <span style="color: #006600; font-style: italic;">// mouse position is really relative to the canvas, not the client area.</span>
      <span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> graph1.<span style="color: #660066;">offsetLeft</span> <span style="color: #339933;">+</span> evt.<span style="color: #660066;">clientX</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> y <span style="color: #339933;">=</span> graph1.<span style="color: #660066;">height</span> <span style="color: #339933;">+</span> graph1.<span style="color: #660066;">offsetTop</span> <span style="color: #339933;">-</span> evt.<span style="color: #660066;">clientY</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// Get the data point at this X position</span>
      <span style="color: #003366; font-weight: bold;">var</span> foundPoint <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> x1 <span style="color: #339933;">=</span> points<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> points.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> x2 <span style="color: #339933;">=</span> points<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;=</span> x1 <span style="color: #339933;">&amp;&amp;</span> x <span style="color: #339933;">&lt;=</span> x2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          foundPoint <span style="color: #339933;">=</span> i<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>foundPoint <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        txt <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span> <span style="color: #339933;">+</span> data<span style="color: #009900;">&#91;</span>foundPoint<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span>.<span style="color: #660066;">toFixed</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; @ &quot;</span> <span style="color: #339933;">+</span> data<span style="color: #009900;">&#91;</span>foundPoint<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">time</span>.<span style="color: #660066;">toDateString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// draw a new information line in the legend</span>
        context.<span style="color: #660066;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        context.<span style="color: #660066;">font</span> <span style="color: #339933;">=</span> font<span style="color: #339933;">;</span>
        context.<span style="color: #660066;">clearRect</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> yEnd <span style="color: #339933;">-</span> fontHeight<span style="color: #339933;">,</span> xEnd<span style="color: #339933;">,</span> fontHeight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        context.<span style="color: #660066;">fillText</span><span style="color: #009900;">&#40;</span>txt<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> yEnd<span style="color: #339933;">,</span> xEnd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        context.<span style="color: #660066;">restore</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: #009900;">&#125;</span></pre></div></div>

<p>And that&#8217;s it. Over your Sunday morning coffee you can write a simple, yet effective, interactive graph display using HTML and JavaScript alone. Clearly, a tremendous amount of work remains to make the graphs beautiful and robust, but luckily a large number of people are already working on libraries to do this work for us.</p>
<p>Internet Explorer will not yet display canvas elements natively, but luckily this problem is being <a href="http://blog.vlad1.com/2008/07/30/no-browser-left-behind/">solved</a> for us.</p>
<p>There are other problems, too. Today, for example, the font measurement abilities in the HTML5 specification are lacking.</p>
<p>If you want to see the example in action click <a href='http://blog.nuclearbunny.org/wp-content/uploads/2010/04/canvas-graphs.html'>here.</a> View the source in your browser to see the final source code to the example. A screenshot of the example is below.</p>
<p><a href="http://blog.nuclearbunny.org/wp-content/uploads/2010/04/Screen-shot-2010-04-11-at-16.44.55.png"><img src="http://blog.nuclearbunny.org/wp-content/uploads/2010/04/Screen-shot-2010-04-11-at-16.44.55.png" alt="" title="Screen shot of graph" width="666" height="277" class="aligncenter size-full wp-image-616" /></a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2010%2F04%2F11%2Fyou-dont-need-flash-for-rich-graphs-on-a-web-page%2F&amp;title=You%20Don%27t%20Need%20Flash%20for%20Rich%20Graphs%20on%20a%20Web%20Page&amp;bodytext=Adobe%27s%20Flash%20has%20a%20lot%20of%20uses%2C%20but%20one%20of%20the%20most%20impressive%20to%20me%20has%20been%20the%20the%20creation%20of%20interactive%20graphs%20%20on%20a%20web%20page.%20One%20just%20has%20to%20visit%20Google%20Finance%20to%20see%20a%20great%20example%20of%20this%20in%20action%3B%20it%27s%20fast%2C%20effective%20and%20fits%20seemles" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2010%2F04%2F11%2Fyou-dont-need-flash-for-rich-graphs-on-a-web-page%2F&amp;title=You%20Don%27t%20Need%20Flash%20for%20Rich%20Graphs%20on%20a%20Web%20Page" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2010%2F04%2F11%2Fyou-dont-need-flash-for-rich-graphs-on-a-web-page%2F&amp;title=You%20Don%27t%20Need%20Flash%20for%20Rich%20Graphs%20on%20a%20Web%20Page&amp;notes=Adobe%27s%20Flash%20has%20a%20lot%20of%20uses%2C%20but%20one%20of%20the%20most%20impressive%20to%20me%20has%20been%20the%20the%20creation%20of%20interactive%20graphs%20%20on%20a%20web%20page.%20One%20just%20has%20to%20visit%20Google%20Finance%20to%20see%20a%20great%20example%20of%20this%20in%20action%3B%20it%27s%20fast%2C%20effective%20and%20fits%20seemles" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2010%2F04%2F11%2Fyou-dont-need-flash-for-rich-graphs-on-a-web-page%2F&amp;title=You%20Don%27t%20Need%20Flash%20for%20Rich%20Graphs%20on%20a%20Web%20Page&amp;annotation=Adobe%27s%20Flash%20has%20a%20lot%20of%20uses%2C%20but%20one%20of%20the%20most%20impressive%20to%20me%20has%20been%20the%20the%20creation%20of%20interactive%20graphs%20%20on%20a%20web%20page.%20One%20just%20has%20to%20visit%20Google%20Finance%20to%20see%20a%20great%20example%20of%20this%20in%20action%3B%20it%27s%20fast%2C%20effective%20and%20fits%20seemles" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2010%2F04%2F11%2Fyou-dont-need-flash-for-rich-graphs-on-a-web-page%2F&amp;t=You%20Don%27t%20Need%20Flash%20for%20Rich%20Graphs%20on%20a%20Web%20Page" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2010/04/11/you-dont-need-flash-for-rich-graphs-on-a-web-page/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My Zenoss Development Environment &#8211; Part 3</title>
		<link>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-3/</link>
		<comments>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-3/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 22:01:01 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=545</guid>
		<description><![CDATA[In Part 1 of this series we discussed getting an initial Zenoss environment checked out and running on a Mac OS X or Ubuntu system. In Part 2 we discussed how to configure Eclipse to use the Zenoss source. In this part, we&#8217;ll discuss how to handle day-to-day operations such as branch management and working [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="../2009/10/22/my-zenoss-development-environment-part-1/" target="_blank">Part 1</a> of this series we discussed getting an initial <a href="http://www.zenoss.com/" target="_blank">Zenoss</a> environment checked out and running on a <a href="http://www.apple.com/macosx/" target="_blank">Mac OS X </a>or <a href="http://www.ubuntu.com/" target="_blank">Ubuntu</a> system. In <a href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/" target="_self">Part 2</a> we discussed how to configure <a href="http://www.eclipse.org/" target="_blank">Eclipse</a> to use the Zenoss source. In this part, we&#8217;ll discuss how to handle day-to-day operations such as branch management and working with multiple versions.</p>
<h2>Branch-Based Development</h2>
<p>At Zenoss we do all development, including bug fixes and small maintenance tasks, in a private development branch within the subversion repository. This allows us to independently work-on changes, check-them into the repository for safe-keeping, and then perform code reviews with team members without having to share files or using <a href="http://pastebin.com/" target="_blank">pastebin</a> style tools (even though we do both at times).</p>
<ol>
<li>Create a branch within your user&#8217;s sandbox. In this example, I&#8217;ve decided to name the sandbox <code>new-widget</code> to identify what I&#8217;m working on. If I were fixing a defect, I&#8217;d use the defect number from the defect tracking system. Create the branch by copying the trunk folder to the sandbox branch. In Subversion this is a low-overhead operation and doesn&#8217;t actually copy files.<code><br />
svn copy http://dev.zenoss.org/svn/trunk http://dev.zenoss.org/svn/sandboxen/cgibbons/new-widget -m " * Copying trunk to sandbox branch."<br />
</code></li>
<li>Switch your working directory to use the new sandbox branch. You can do this either from the command-line or using Eclipse. From the command line, you&#8217;d do the following:<code><br />
cd $HOME/zenoss/core<br />
svn switch http://dev.zenoss.org/svn/sandboxen/cgibbons/new-widget<br />
</code>From within Eclipse, secondary-click on the <code>core</code> project and choose <em>Switch to Another Branch/Tag/Revision&#8230;</em> option from the Team menu. On the dialog that appears, enter in the sandbox URL. After switching, your Eclipse will show the new location next to the core project item.<br />
<a rel="attachment wp-att-549" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-3/picture-8/"><img class="aligncenter size-full wp-image-549" title="svn switch" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-8.png" alt="svn switch" width="670" height="491" /></a></li>
</ol>
<p>Once your development environment has been switched, you can make changes and commit to the Subversion repository as desired. If you&#8217;re unsure if you are in the right branch, you can always use the <code>svn info</code> command to see which directory is being used.</p>
<h2>Merging Branches</h2>
<p>Once you have completed changes in a branch and have had them reviewed by a peer, it is time to merge them into trunk (or another branch, if using a maintenance release). Merging can be tricky, but a consistent process can make it much easier to handle.</p>
<ol>
<li>Change your working directory to a checked-out and clean version of the branch you want to merge into. For example, I keep a <code>$HOME/zenoss/clean-trunk</code> directory that I never make changes to, except for merging.</li>
<li>Determine the base working revision of your working branch. There are a variety of ways to do this, but one of the best is to view the revision log graph within the Trac system directly. For example, for the branch discussed above we can browse to <a href="http://dev.zenoss.org/trac/log/sandboxen/cgibbons/new-widget" target="_blank">http://dev.zenoss.org/trac/log/sandboxen/cgibbons/new-widget/</a> and see that revision <strong>15513</strong> is the base.</li>
<li>Perform a dry-run on the merge to get a general idea of what the changes into the branch will be. You should see your expected changes, plus any conflicts from changes to the other branch while you have been working in the sandbox branch.<code><br />
svn merge --dry-run --revision <strong>15513</strong>:HEAD <strong>http://dev.zenoss.org/svn/sandboxen/cgibbons/new-widget</strong> .<br />
</code></li>
<li>If the merge results look satisfactory, rerun the command without the dry-run argument.</li>
<li>Look at the final merge results using <code>svn status</code> and <code>svn diff</code>, and once you&#8217;re ready, issue an <code>svn commit</code>.</li>
</ol>
<h2>Multiple Branches and Zenoss Configuration</h2>
<p>As you switch between branches you will often render your Zenoss configuration useless.  Resetting your database after each branch switch is usually a good practice, and being able to quickly recreate any test data you may need makes this process less painful.</p>
<p>After switching a branch, my process is usually the following:</p>
<ol>
<li>Shutdown zenoss and restart only zeo.<code><br />
zenoss stop<br />
zeoctl start</code></li>
<li>Run the zenwipe script from the inst source directory.<code><br />
$HOME/zenoss/inst/zenwipe.sh --no-prompt</code></li>
<li>Run <code>zenmigrate</code> to install any database changes available within the current branch.</li>
</ol>
<p>Depending upon the task at hand, I may install additional ZenPacks and add new devices through the command-line if those are needed. Helper scripts, such as <code>install-windows.sh</code> to install of the Windows ZenPacks and create several local test devices in the instance, are useful tools to have for your typical configurations.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-3%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%203&amp;bodytext=In%20Part%201%20of%20this%20series%20we%20discussed%20getting%20an%20initial%20Zenoss%20environment%20checked%20out%20and%20running%20on%20a%20Mac%20OS%20X%20or%20Ubuntu%20system.%20In%20Part%202%20we%20discussed%20how%20to%20configure%20Eclipse%20to%20use%20the%20Zenoss%20source.%20In%20this%20part%2C%20we%27ll%20discuss%20how%20to%20handle%20da" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-3%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%203" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-3%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%203&amp;notes=In%20Part%201%20of%20this%20series%20we%20discussed%20getting%20an%20initial%20Zenoss%20environment%20checked%20out%20and%20running%20on%20a%20Mac%20OS%20X%20or%20Ubuntu%20system.%20In%20Part%202%20we%20discussed%20how%20to%20configure%20Eclipse%20to%20use%20the%20Zenoss%20source.%20In%20this%20part%2C%20we%27ll%20discuss%20how%20to%20handle%20da" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-3%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%203&amp;annotation=In%20Part%201%20of%20this%20series%20we%20discussed%20getting%20an%20initial%20Zenoss%20environment%20checked%20out%20and%20running%20on%20a%20Mac%20OS%20X%20or%20Ubuntu%20system.%20In%20Part%202%20we%20discussed%20how%20to%20configure%20Eclipse%20to%20use%20the%20Zenoss%20source.%20In%20this%20part%2C%20we%27ll%20discuss%20how%20to%20handle%20da" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-3%2F&amp;t=My%20Zenoss%20Development%20Environment%20-%20Part%203" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My Zenoss Development Environment &#8211; Part 2</title>
		<link>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/</link>
		<comments>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 19:26:36 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=511</guid>
		<description><![CDATA[In Part 1 of this series we discussed getting an initial Zenoss environment checked out and running on a Mac OS X or Ubuntu system. In this part, we&#8217;ll discuss configuring Eclipse to use this environment. Mac OS X Prerequisites Install Eclipse Classic 3.5.x Mac Cocoa 32-bit. Ubuntu Prerequisites Install the Sun Java JDK. Why? [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-1/" target="_blank">Part 1</a> of this series we discussed getting an initial <a href="http://www.zenoss.com/" target="_blank">Zenoss</a> environment checked out and running on a <a href="http://www.apple.com/macosx/" target="_blank">Mac OS X </a>or <a href="http://www.ubuntu.com/" target="_blank">Ubuntu</a> system. In this part, we&#8217;ll discuss configuring <a href="http://www.eclipse.org/" target="_blank">Eclipse</a> to use this environment.</p>
<h2>Mac OS X Prerequisites</h2>
<ol>
<li>Install <a href="http://www.eclipse.org/downloads/" target="_blank">Eclipse Classic</a> 3.5.x Mac <a href="http://blog.zvikico.com/2009/06/eclipse-galileo-for-mac-cocoa-or-carbon.html" target="_blank">Cocoa 32-bit</a>.</li>
</ol>
<h2>Ubuntu Prerequisites</h2>
<ol>
<li>Install the Sun Java JDK. <strong>Why?</strong> Eclipse is a Java application and requires a full-fledged Java environment to run properly.<code><br />
sudo apt-get -y install sun-java6-jdk<br />
</code></li>
<li>Install <a href="http://www.eclipse.org/downloads/" target="_blank">Eclipse Classic</a> 3.5.x Linux 32-bit.</li>
</ol>
<h2>Eclipse Configuration</h2>
<ol>
<li>In part one, we created a Zenoss root project directory of <code>$HOME/zenoss</code> &#8211; use that directory, or the one you created, for the rest of these steps.</li>
<li>Launch Eclipse and configure it to use the Zenoss root project directory. <strong>Why?</strong> Eclipse needs a workspace directory to keep track of configuration settings for a group of related projects. By placing the workspace directory inside of the Zenoss root workspace, we can separate the requirements for a Zenoss workspace from other projects you may be using.<a rel="attachment wp-att-484" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-1/eclipse-workspace-2/"><img title="eclipse-workspace" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/eclipse-workspace1.png" alt="eclipse-workspace" width="677" height="324" /></a></li>
<li>Install the <a href="http://pydev.org/" target="_blank">PyDev</a> plug-in for Eclipse. <strong>Why?</strong> PyDev provides Python language support to Eclipse.
<ol>
<li>Go to the Help Menu and choose<em> Install New Software</em>.</li>
<li>In the Available Software dialog, choose <em>Add</em> and enter in <code>http://pydev.org/updates/</code> as the Location and close the dialog. Eclipse will return to the Available Software dialog.<a rel="attachment wp-att-498" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-1/picture-5/"><img title="PyDev" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-5.png" alt="PyDev" width="555" height="260" /></a></li>
<li>Software matching PyDev will appear in the dialog; pick the <em>PyDev</em> option but do not pick <em>PyDev Mylyn Integration</em>. Click <em>Next</em> and install the plug-in.</li>
</ol>
<p><a rel="attachment wp-att-500" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-1/picture-6-2/"><img title="PyDev" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-61.png" alt="PyDev" width="725" height="643" /></a></li>
<li>Install the <a href="http://subclipse.tigris.org/" target="_blank">Subclipse</a> plug-in. <strong>Why?</strong> Subclipse allows you to work with the Subversion version control system directly from within Eclipse.
<ol>
<li>In the Available Software dialog add the Subclipse plug-in update site: <code>
<p>http://subclipse.tigris.org/update_1.6.x</p>
<p></code></li>
<li>In the Available Software dialog, choose the <em>Subclipse</em>, <em>Subversion Client Adapter</em>, <em>Subversion JavaHL Native Library Adapter</em> and the <em>Subversion Revision Graph </em>items.<a rel="attachment wp-att-553" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/picture-5-2/"><img class="aligncenter size-full wp-image-553" title="Subclipse" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-51.png" alt="Subclipse" width="798" height="742" /></a></li>
</ol>
</li>
<li>Go to the Window menu, choose Open Perspective and then SVN Repository Exploring (you may have to choose Other&#8230; to see this option).</li>
<li>Choose the New Repository Location button in the SVN Repositories panel. Add the Zenoss SVN site at <code>http://dev.zenoss.org/svn</code></li>
<li>Open the SVN repository and select the <code>trunk</code> folder. Secondary-click the folder and choose the <em>Checkout&#8230; </em>option. Be sure to change the Depth option to be <em>Only this item</em> so that we don&#8217;t check out any of the sub-folders of trunk just yet (many of the folders within trunk are not needed for development, but we want to keep the directory structure). In the next dialog you will be asked to choose a Project Wizard. Open the Pydev tree item and select the <em>Pydev Project</em> option.<a rel="attachment wp-att-554" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/picture-6-3/"><img class="aligncenter size-full wp-image-554" title="svn checkout" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-62.png" alt="svn checkout" width="605" height="556" /></a></li>
<li>Create the project in the Pydev Project dialog:
<ol>
<li>Use <code>core</code> as the project name and use the default location. This should create a core project at <code>$HOME/zenoss/core</code>.</li>
<li>Make sure the <em>Python</em> project type is selected.</li>
<li>Select<em> 2.4</em> as the Python Grammar version.</li>
<li>Uncheck the <em>Create default &#8216;src&#8217; folder..</em>. option.</li>
<li>Click the Click here to <em>configure an interpreter not listed&#8230;</em> option in order to add the python interpreter built by the Zenoss installation scripts.
<ol>
<li>In the Preferences Dialog, choose the Interpreter &#8211; Python item underneath Pydev and select the <em>New&#8230;</em> button to add a new Python interpreter.</li>
<li>Browse to the <code>$ZENHOME/bin</code> directory and choose the <code>python2.4</code> executable from that directory.</li>
<li>Name the interpreter <code>python-2.4</code>, <code>zenoss-python</code> or some other variant.</li>
<p><a rel="attachment wp-att-529" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/picture-13/"><img class="aligncenter size-full wp-image-529" title="Picture 13" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-13.png" alt="Picture 13" width="632" height="303" /></a>After the new Python interpreter has been added, return to the Pydev Project dialog and choose that interpreter from the list and then click <em>Finish</em> to create the project.</ol>
</li>
<li>Update the <code>core</code> folder from the command-line SVN client so you can selectively pull the sub-folders of the core project and not all of them:<code><br />
cd $HOME/zenoss/core<br />
svn update Products<br />
</code></li>
<li>Move the Products directory the installation checked out and create a symbolic link to the one updated above. <strong>Why?</strong> This allows the Products source tree to be worked on from Eclipse and then also used by the Zenoss run-time.<code><br />
cd $ZENHOME<br />
mv Products Products.old<br />
ln -s $HOME/zenoss/core/Products Products</code></li>
<li>Return to Eclipse and choose the <em>Refresh</em> option from the File menu so that Eclipse notices the updated directory and builds necessary dependencies.</li>
<li>Secondary-click on the core project folder in Eclipse and choose <em>Properties</em>. Choose the <em>PyDev &#8211; PYTHONPATH</em> item and add source folders so PyDev can reference the project from within itself.
<ol>
<li>In the Source Folders tab choose the <em>Add source folder</em> button and pick the root <code>core</code> folder from the provided list.<a rel="attachment wp-att-532" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/picture-2/"><img class="aligncenter size-full wp-image-532" title="Picture 2" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-2.png" alt="Picture 2" width="860" height="617" /></a></li>
<li>In the External Libraries tab choose the <em>Add source folder</em> button and choose the <code>$ZENHOME/lib/python</code> directory.<a rel="attachment wp-att-533" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/picture-3/"><img class="aligncenter size-full wp-image-533" title="Picture 3" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-3.png" alt="Picture 3" width="860" height="617" /></a></li>
</ol>
</li>
</ol>
<p>At this point, your Eclipse project should allow you to navigate between dependencies within the Zenoss project. You can also simultaneously switch between using the Team feature within Eclipse to update and manage Subversion or do so using the command-line svn client.</p>
<h2>Next&#8230;</h2>
<p>In <a href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-3/" target="_blank">Part 3</a> of this series, we&#8217;ll discuss how to manage day-to-day activities such as creating sandbox branches for changes and dealing with multiple versions are done from within the same environment.</li>
</ol>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-2%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%202&amp;bodytext=In%20Part%201%20of%20this%20series%20we%20discussed%20getting%20an%20initial%20Zenoss%20environment%20checked%20out%20and%20running%20on%20a%20Mac%20OS%20X%20or%20Ubuntu%20system.%20In%20this%20part%2C%20we%27ll%20discuss%20configuring%20Eclipse%20to%20use%20this%20environment.%0D%0AMac%20OS%20X%20Prerequisites%0D%0A%0D%0A%09Install%20Eclipse%20C" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-2%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%202" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-2%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%202&amp;notes=In%20Part%201%20of%20this%20series%20we%20discussed%20getting%20an%20initial%20Zenoss%20environment%20checked%20out%20and%20running%20on%20a%20Mac%20OS%20X%20or%20Ubuntu%20system.%20In%20this%20part%2C%20we%27ll%20discuss%20configuring%20Eclipse%20to%20use%20this%20environment.%0D%0AMac%20OS%20X%20Prerequisites%0D%0A%0D%0A%09Install%20Eclipse%20C" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-2%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%202&amp;annotation=In%20Part%201%20of%20this%20series%20we%20discussed%20getting%20an%20initial%20Zenoss%20environment%20checked%20out%20and%20running%20on%20a%20Mac%20OS%20X%20or%20Ubuntu%20system.%20In%20this%20part%2C%20we%27ll%20discuss%20configuring%20Eclipse%20to%20use%20this%20environment.%0D%0AMac%20OS%20X%20Prerequisites%0D%0A%0D%0A%09Install%20Eclipse%20C" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-2%2F&amp;t=My%20Zenoss%20Development%20Environment%20-%20Part%202" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My Zenoss Development Environment &#8211; Part 1</title>
		<link>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-1/</link>
		<comments>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-1/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 17:05:46 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=469</guid>
		<description><![CDATA[Over the past 18 months the developers at Zenoss have used a variety of development environments and methods to productively work with Zenoss, but there are a lot of best practices that have emerged out of this diversity. I develop Zenoss primarily on Mac OS X, with some work done on Ubuntu when necessary. I [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past 18 months the developers at <a href="http://www.zenoss.com/" target="_blank">Zenoss</a> have used a variety of development environments and methods to productively work with Zenoss, but there are a lot of best practices that have emerged out of this diversity.</p>
<p>I develop Zenoss primarily on <a href="http://www.apple.com/macosx/" target="_blank">Mac OS X</a>, with some work done on <a href="http://www.ubuntu.com/" target="_blank">Ubuntu</a> when necessary. I normally use <a href="http://www.eclipse.org/" target="_blank">Eclipse</a> as my development editor, although I&#8217;ll often just use <a href="http://www.vim.org/" target="_blank">vim</a> when doing quick changes or bug fixes. In either case, careful setup of the Zenoss environment is key to being able to productively work with both the new development version and with the shipping versions that require maintenance.</p>
<p>The environment you get by default when you check out the source version of Zenoss from the source repository, or from a source tarball, is not necessarily setup in the best way to develop productively using tools like Eclipse.</p>
<p>The rest of this post will document how both my Mac OS X and Ubuntu environments are initially configured so that a working source Zenoss installation is realized.</p>
<h2>Mac OS X Prerequisites</h2>
<p>These prerequisite instructions assume Mac OS X 10.5 Leopard; 10.6 Snow Leopard will not be able to compile Zenoss&#8217;s third-party dependencies, so an additional work-around is required for that platform until Zenoss moves to <a href="http://www.python.org/download/releases/2.6/" target="_blank">Python 2.6</a>.</p>
<ol>
<li>Install <a href="http://developer.apple.com/technology/xcode.html" target="_blank">Xcode</a>. <strong>Why?</strong> Installs the GNU C/C++ compiler and other command-line development tools needed to build dependencies used by Zenoss.</li>
<li>Install <a href="http://www.open.collab.net/downloads/community/" target="_blank">Universal Subversion 1.6.x from CollabNet Community</a>.<strong>Why?</strong> Leopard only comes with Subversion 1.4.x. This version is not compatible with the Subclipse plug-in for Eclipse that will be used later. In order to be able to use both the command-line and Eclipse Subversion versions simultaneously on the same checked our source, the release of subversion should match. This installation will place the Subversion binaries in <code>/opt/subversion</code> and should automatically add it to your <code>PATH</code>.</li>
<li> Install <a href="http://dev.mysql.com/downloads/" target="_blank">MySQL Community Edition 5.1 32-bit</a>. <strong>Why?</strong> Zenoss needs MySQL for storage of event data.</li>
</ol>
<h2>Ubuntu Prerequisites</h2>
<p>These prerequisite instructions assume Ubuntu 9.04 32-bit Desktop Edition. Installing the server edition or one with different options may require additional prerequisites to be installed.</p>
<ol>
<li>Install Subversion. <strong>Why?</strong> Working with the Zenoss product in source form requires Subversion to access the source repositories (it is also possible to build directly from a source tarball, but this is not discussed here).<br />
<code>sudo apt-get -y install subversion<br />
</code></li>
<li>Install MySQL. <strong>Why?</strong> Zenoss needs MySQL for storage of event data.<br />
<code>sudo apt-get -y install mysql-client mysql-server libmysqlclient15-dev<br />
</code></li>
<li>Install additional development environment tools. <strong>Why?</strong> Zenoss third-party dependencies require several binaries to be built from source.<br />
<code>sudo apt-get -y install patch make vim gcc g++ autoconf</code></li>
<li>Install SNMP support. <strong>Why</strong>? Zenoss requires SNMP libraries for monitoring, and having a local SNMP agent is useful for testing.<code><br />
sudo apt-get -y install libsnmp-base snmp snmpd</code></li>
<li>Install Liberation TrueType fonts. <strong>Why?</strong> Graphs generated by RRDtool will not contain the correct glyphs without this font package.<code><br />
sudo apt-get -y install ttf-liberation</code></li>
</ol>
<h2>Environment Configuration</h2>
<p>Configuring Eclipse will require determining where you want to work with your Zenoss installation, and installing Eclipse plug-ins to provide the features required for Python and Subversion support.</p>
<ol>
<li>Create your Zenoss root directory:<code><br />
mkdir $HOME/zenoss<br />
</code></li>
<li>Create and run a <code>setup.sh</code> script that will configure needed environment variables for zenoss. This script can be started from your log in profile if desired.<code><br />
cd $HOME/zenoss<br />
cat &gt; zenoss-config.sh &lt;&lt;EOF<br />
ZENHOME=$HOME/zenoss/zenhome<br />
PYTHONPATH=$ZENHOME/lib/python<br />
PATH=\$ZENHOME/bin:\$PATH<br />
export ZENHOME PYTHONPATH PATH<br />
EOF<br />
chmod +x zenoss-config.sh<br />
. zenoss-config.sh<br />
mkdir $ZENHOME<br />
</code></li>
<li>Checkout the Zenoss source installation tree. <strong>Why?</strong> This tree is used to bootstrap the installation from the source repository and create a running Zenoss installation. We&#8217;ll need this before we modify it to fit the needs of our development environment.<code><br />
svn co http://dev.zenoss.org/svn/trunk/inst inst<br />
</code></li>
<li>Run the installation script to checkout, compile, and configure a zenoss environment. If you need to customize your MySQL configuration at all do not use the <code>--no-prompt</code> argument.<code><br />
cd inst<br />
./install.sh --no-prompt<br />
</code></li>
<li>Modify the <code>zensocket</code> file to be setuid root. <strong>Why?</strong> Some of the Zenoss daemons use a privileged port and making the file owned by root and accessible by the Zenoss user allows the daemons to be run as a non-priviledged user but still use the privileged port.<code><br />
sudo chown root:`id -g` $ZENHOME/bin/zensocket<br />
sudo chmod 04750 $ZENHOME/bin/zensocket<br />
</code></li>
</ol>
<p>At this point, you should have running zeo and zope processes and be able to log on to the local Zenoss instance. Your Zenoss root directory should look similar to the following:<br />
<a rel="attachment wp-att-491" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-1/picture-4/"><img class="aligncenter size-full wp-image-491" title="zenoss workspace" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/10/Picture-4.png" alt="zenoss workspace" width="492" height="393" /></a></p>
<h2>Next&#8230;</h2>
<p>In <a title="Part 2" href="http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-2/" target="_self">Part 2</a> of this series, we&#8217;ll download and configure the Eclipse IDE.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-1%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%201&amp;bodytext=Over%20the%20past%2018%20months%20the%20developers%20at%20Zenoss%20have%20used%20a%20variety%20of%20development%20environments%20and%20methods%20to%20productively%20work%20with%20Zenoss%2C%20but%20there%20are%20a%20lot%20of%20best%20practices%20that%20have%20emerged%20out%20of%20this%20diversity.%0D%0A%0D%0AI%20develop%20Zenoss%20primaril" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-1%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%201" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-1%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%201&amp;notes=Over%20the%20past%2018%20months%20the%20developers%20at%20Zenoss%20have%20used%20a%20variety%20of%20development%20environments%20and%20methods%20to%20productively%20work%20with%20Zenoss%2C%20but%20there%20are%20a%20lot%20of%20best%20practices%20that%20have%20emerged%20out%20of%20this%20diversity.%0D%0A%0D%0AI%20develop%20Zenoss%20primaril" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-1%2F&amp;title=My%20Zenoss%20Development%20Environment%20-%20Part%201&amp;annotation=Over%20the%20past%2018%20months%20the%20developers%20at%20Zenoss%20have%20used%20a%20variety%20of%20development%20environments%20and%20methods%20to%20productively%20work%20with%20Zenoss%2C%20but%20there%20are%20a%20lot%20of%20best%20practices%20that%20have%20emerged%20out%20of%20this%20diversity.%0D%0A%0D%0AI%20develop%20Zenoss%20primaril" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F10%2F22%2Fmy-zenoss-development-environment-part-1%2F&amp;t=My%20Zenoss%20Development%20Environment%20-%20Part%201" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/10/22/my-zenoss-development-environment-part-1/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>One Year at Zenoss</title>
		<link>http://blog.nuclearbunny.org/2009/04/08/one-year-at-zenoss/</link>
		<comments>http://blog.nuclearbunny.org/2009/04/08/one-year-at-zenoss/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 02:13:31 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SCRUM]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=331</guid>
		<description><![CDATA[Yesterday marked my one-year anniversary at Zenoss. When I decided to take the job at Zenoss I knew it would be a challenging position, and time has proven this assumption correct. The new (to me, anyway) technology, the remote work environment and the realities of a startup company with limited resources have all added their [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday marked my one-year anniversary at <a title="Zenoss, Inc. corporate web site" href="http://www.zenoss.com/" target="_blank">Zenoss</a>. When I decided to take the job at Zenoss I knew it would be a challenging position, and time has proven this assumption correct. The new (to me, anyway) technology, the remote work environment and the realities of a startup company with limited resources have all added their own challenges to the job.</p>
<p>I found the Zenoss product itself to be more mature than I had expected. While it still has plenty of rough edges, especially in the user interface, it is a rather feature-rich application with a very large user base in both the free community and paid enterprise versions. There is a tremendous amount of work left to do on the application, but with each version we see a significant step forward and an expanded user interest because of the changes.</p>
<p>When I came to Zenoss, my new co-workers and I brought with us a culture of using agile development methodologies and processes to the company. We expected, and were asked by company management, to implement those processes at Zenoss. Over the past year, we have seen the right things happen from this shift in engineering culture:</p>
<ul>
<li>development time has become more predictable</li>
<li>planning and priority selection take a much more important role than ever before, and not just in engineering (in fact, most importantly not in engineering, but at the executive level)</li>
<li>quality assurance is now a fundamental part of the engineering process, not a luxury for later</li>
<li>code and design quality has improved dramatically as the engineering team begins to understand how much control they really do have over the process</li>
</ul>
<p>There still remain many challenges, but these are the same ones I have seen with all teams that struggle with the discipline needed for agile methodologies. Effectively breaking down large development tasks into two-week iterations remains a hurdle; I suspect at a fundamental level many of the developers do not fully believe this is possible, which is a long, long discussion. There was also a reluctance, until recently, to fully engage with teammates on performing effective code and design reviews. These will both improve over time as the team matures.</p>
<p>When I first started at Zenoss there were 5 developers in Annapolis, 2 developers in Austin and me , usually working remote in Houston. Since then, the team dynamics have changed so that I and one other developer are remote most of the time, 3 developers are full-time in Austin and 1 in Annapolis. This team dynamic change has made the infrastructure needed to support remote development much more important, but at the same time it has made the remote developers somewhat more isolated since a bit more now happens only in one location. Since I travel to Austin frequently I can avoid the worst of this unavoidable trend, but it will likely always remain a challenge as long as we have remote employees.</p>
<p>On a personal level, working remotely full-time for this long has been much more difficult than I expected. I last did this much remote work in the mid-90s, and it was difficult to do then, as well. On the surface, I spend all of my work hours focused on some problem on the computer, but in reality much of my job is very social and without face time it starts to wear on me very quickly. Frequent visits to Austin help tremendously, but in reality this will likely always be an issue until I relocate.</p>
<p>I&#8217;ve encountered almost all of the traditional problems people have while working at home, but especially keeping focus and balancing the time spent between work and home life. Focus is purely a self-discipline issue, but it is remarkable how much of this is provided by the routine of commuting to an office. Maintaining a good work-life balance is also tremendously hard when working at home, unless you dedicate a specific place in the house for work. It took a few months to really learn this lesson but eventually I bought a second desk and made myself an office separate from my normal home office. Before then, I found it way too easy to bring my laptop into the living room and I&#8217;d continue to check e-mail and work on problems throughout the evening. Sometimes, I still do, but not at least it is not a mindless occurrence.</p>
<p>Zenoss is a very small company, and naturally we have very limited resources. Of course, today&#8217;s economic environment makes this true for almost every single company. But more specifically, I find ourselves working around what effectively is a lack of resources in our IT department. I often have to build my own virtual machines at home, or buy little widgets to help productivity because I am remote. At some level, I don&#8217;t mind this, since it&#8217;s nice being able to actually work somewhere you <em>can</em> do this, rather than being told you can&#8217;t.</p>
<p>After a year, I&#8217;m still not a huge fan of the <a href="http://www.python.org/" target="_blank">Python</a> programming language, but I&#8217;ve come to accept it and I can be productive with it. Working with it feels a whole lot like I stepped back in time 15 years, and saying that is a great way to start an argument, so I&#8217;ll just leave it at that.</p>
<p>One great surprise from the past year is that I became the guru for Zenoss&#8217;s Windows monitoring technology. We have a custom implementation of <a href="http://en.wikipedia.org/wiki/MSRPC" target="_blank">MS-RPC</a> that is based upon the <a href="http://wiki.samba.org/index.php/Samba4" target="_blank">Samba 4</a> source tree. On top of this layer, we have provided our own implementations of the <a href="http://msdn.microsoft.com/en-us/library/ms809340.aspx" target="_blank">DCOM</a>, <a href="http://msdn.microsoft.com/en-us/library/ms809340.aspx" target="_blank">WMI</a>, and <a href="http://msdn.microsoft.com/en-us/library/ms809340.aspx" target="_blank">Windows registry</a> interfaces so we can call these services directly on any Windows device. This is a great feature, as it allows us to communicate directly to Windows devices from our Linux based product, without requiring a Windows device to be running our software just to provide Windows-based connectivity, unlike some other systems management products.</p>
<p>Over the next few months I will be taking on more and more of the implementation of the new Zenoss user interface, which is a great project that should dramatically improve the user acceptance of quality of the application. It also gives me more time to work on user interfaces, which is always an area of software development I enjoy but rarely get a chance to do.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F08%2Fone-year-at-zenoss%2F&amp;title=One%20Year%20at%20Zenoss&amp;bodytext=Yesterday%20marked%20my%20one-year%20anniversary%20at%20Zenoss.%20When%20I%20decided%20to%20take%20the%20job%20at%20Zenoss%20I%20knew%20it%20would%20be%20a%20challenging%20position%2C%20and%20time%20has%20proven%20this%20assumption%20correct.%20The%20new%20%28to%20me%2C%20anyway%29%20technology%2C%20the%20remote%20work%20environment%20and%20t" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F08%2Fone-year-at-zenoss%2F&amp;title=One%20Year%20at%20Zenoss" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F08%2Fone-year-at-zenoss%2F&amp;title=One%20Year%20at%20Zenoss&amp;notes=Yesterday%20marked%20my%20one-year%20anniversary%20at%20Zenoss.%20When%20I%20decided%20to%20take%20the%20job%20at%20Zenoss%20I%20knew%20it%20would%20be%20a%20challenging%20position%2C%20and%20time%20has%20proven%20this%20assumption%20correct.%20The%20new%20%28to%20me%2C%20anyway%29%20technology%2C%20the%20remote%20work%20environment%20and%20t" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F08%2Fone-year-at-zenoss%2F&amp;title=One%20Year%20at%20Zenoss&amp;annotation=Yesterday%20marked%20my%20one-year%20anniversary%20at%20Zenoss.%20When%20I%20decided%20to%20take%20the%20job%20at%20Zenoss%20I%20knew%20it%20would%20be%20a%20challenging%20position%2C%20and%20time%20has%20proven%20this%20assumption%20correct.%20The%20new%20%28to%20me%2C%20anyway%29%20technology%2C%20the%20remote%20work%20environment%20and%20t" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F08%2Fone-year-at-zenoss%2F&amp;t=One%20Year%20at%20Zenoss" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/04/08/one-year-at-zenoss/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Secure Windows Monitoring with Zenoss</title>
		<link>http://blog.nuclearbunny.org/2009/04/07/secure-windows-monitoring-with-zenoss/</link>
		<comments>http://blog.nuclearbunny.org/2009/04/07/secure-windows-monitoring-with-zenoss/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 23:50:06 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[DCOM]]></category>
		<category><![CDATA[msrpc]]></category>
		<category><![CDATA[RPC]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=334</guid>
		<description><![CDATA[Starting with version 2.3.x, Zenoss can monitor computers running Microsoft Windows with a variety of data collection protocols: SNMP, WMI over DCOM/MS-RPC and Perfmon over MS-RPC. In Zenoss Core, the status of Windows services and the Windows Event Log are monitored using Windows Management Instrumentation (WMI) queries over the DCOM/MS-RPC protocol. In the implementation of [...]]]></description>
			<content:encoded><![CDATA[<p>Starting with version 2.3.x, <a title="Zenoss, Inc. corporate web site" href="http://www.zenoss.com/" target="_blank">Zenoss</a> can monitor computers running Microsoft Windows with a variety of data collection protocols: SNMP, WMI over DCOM/MS-RPC and Perfmon over MS-RPC.</p>
<p>In Zenoss Core, the status of Windows services and the Windows Event Log are monitored using <a title="Windows Management Instrumentation" href="http://msdn.microsoft.com/en-us/library/aa394582.aspx">Windows Management Instrumentation (WMI)</a> queries over the DCOM/MS-RPC protocol. In the implementation of MS-RPC that Zenoss is based upon, authentication credentials are sent to the remote server using the <a title="Microsoft NTLM" href="http://msdn.microsoft.com/en-us/library/aa378749.aspx" target="_blank">Windows Challenge / Response (NTLM) mechanism</a>. Using this authentication mechanism, the actual password is never sent across the network, but rather the server produces a &#8220;challenge&#8221; value that the client must calculate using the password rather than sending it across the network.</p>
<p>NTLM authentication is the same mechanism that Windows devices themselves use for client/server communications, such as file sharing and remote administration.</p>
<p>Starting with version 2.3.x, Zenoss Enterprise gathers Perfmon data using the remote Windows registry API over the MS-RPC protocol. This technique is both more efficient and secure than the previous one. The same authentication mechanism used by Zenoss&#8217;s WMI library is used here, providing the same level of security.</p>
<p>Prior to version 2.3.x, Zenoss Enterprise used a different mechanism to collect Perfmon data from Windows devices. This mechanism used a utility known as <a title="winexe homepage :)" href="http://eol.ovh.org/winexe/" target="_blank">winexe</a> to remotely execute commands on the Windows device (in this case, the typeperf.exe Windows utility). Unfortunately, the winexe utility sends the username and password used for authentication across the network in clear text, providing a less than ideal configuration for security.</p>
<p>Zenoss users monitoring Windows devices should be running version 2.3.3 or newer for the best possible security when communicating with those devices.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F07%2Fsecure-windows-monitoring-with-zenoss%2F&amp;title=Secure%20Windows%20Monitoring%20with%20Zenoss&amp;bodytext=Starting%20with%20version%202.3.x%2C%20Zenoss%20can%20monitor%20computers%20running%20Microsoft%20Windows%20with%20a%20variety%20of%20data%20collection%20protocols%3A%20SNMP%2C%20WMI%20over%20DCOM%2FMS-RPC%20and%20Perfmon%20over%20MS-RPC.%0D%0A%0D%0AIn%20Zenoss%20Core%2C%20the%20status%20of%20Windows%20services%20and%20the%20Windows%20Eve" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F07%2Fsecure-windows-monitoring-with-zenoss%2F&amp;title=Secure%20Windows%20Monitoring%20with%20Zenoss" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F07%2Fsecure-windows-monitoring-with-zenoss%2F&amp;title=Secure%20Windows%20Monitoring%20with%20Zenoss&amp;notes=Starting%20with%20version%202.3.x%2C%20Zenoss%20can%20monitor%20computers%20running%20Microsoft%20Windows%20with%20a%20variety%20of%20data%20collection%20protocols%3A%20SNMP%2C%20WMI%20over%20DCOM%2FMS-RPC%20and%20Perfmon%20over%20MS-RPC.%0D%0A%0D%0AIn%20Zenoss%20Core%2C%20the%20status%20of%20Windows%20services%20and%20the%20Windows%20Eve" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F07%2Fsecure-windows-monitoring-with-zenoss%2F&amp;title=Secure%20Windows%20Monitoring%20with%20Zenoss&amp;annotation=Starting%20with%20version%202.3.x%2C%20Zenoss%20can%20monitor%20computers%20running%20Microsoft%20Windows%20with%20a%20variety%20of%20data%20collection%20protocols%3A%20SNMP%2C%20WMI%20over%20DCOM%2FMS-RPC%20and%20Perfmon%20over%20MS-RPC.%0D%0A%0D%0AIn%20Zenoss%20Core%2C%20the%20status%20of%20Windows%20services%20and%20the%20Windows%20Eve" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F04%2F07%2Fsecure-windows-monitoring-with-zenoss%2F&amp;t=Secure%20Windows%20Monitoring%20with%20Zenoss" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/04/07/secure-windows-monitoring-with-zenoss/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting a Native Code Stack Trace from a Zenoss Daemon</title>
		<link>http://blog.nuclearbunny.org/2009/03/19/getting-a-native-code-stack-trace-from-a-zenoss-daemon/</link>
		<comments>http://blog.nuclearbunny.org/2009/03/19/getting-a-native-code-stack-trace-from-a-zenoss-daemon/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 21:35:05 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=313</guid>
		<description><![CDATA[Zenoss uses the Python programming language for the vast majority of its code, and all of the daemons and commands that run are Python scripts. Several daemons also make use of native code (i.e. code written in languages like C or C++ that must be compiled into object files and organized into libraries) to perform [...]]]></description>
			<content:encoded><![CDATA[<p>Zenoss uses the Python programming language for the vast majority of its code, and all of the daemons and commands that run are Python scripts. Several daemons also make use of native code (i.e. code written in languages like C or C++ that must be compiled into object files and organized into libraries) to perform functions such as remote Windows and SNMP connectivity.</p>
<p>Occasionally, one of these daemons crash in these native libraries, and not in the actual Python code. When this happens, the Python interpreter is unable to produce a relatively friendly stack trace that it would for pure Python code. For example, a crash in a Python script would produce something that looks familiar to most programmers:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">Traceback <span style="color: black;">&#40;</span>most recent call last<span style="color: black;">&#41;</span>:
File <span style="color: #483d8b;">&quot;test.py&quot;</span>, line <span style="color: #ff4500;">5</span>, <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #66cc66;">?</span>
z = y / x
<span style="color: #008000;">ZeroDivisionError</span>: integer division <span style="color: #ff7700;font-weight:bold;">or</span> modulo by zero</pre></div></div>

<p>By contrast, if you have a crash inside of a native library you likely would not see anything more than <code>Bus Error</code> or a similar message, and often nothing at all &#8212; the daemon process will just exit. For example, here we have a dynamic library written in C with a single function: <code>doit</code>. This function will attempt to access a <code>NULL</code> pointer when called, which results in the following output:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">$ python -i
Python 2.4.4 <span style="color: black;">&#40;</span><span style="color: #808080; font-style: italic;">#1, Feb 23 2009, 09:17:03) </span>
<span style="color: black;">&#91;</span>GCC 4.0.1 <span style="color: black;">&#40;</span>Apple Inc. <span style="color: black;">build</span> <span style="color: #ff4500;">5490</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span> on darwin
Type <span style="color: #483d8b;">&quot;help&quot;</span>, <span style="color: #483d8b;">&quot;copyright&quot;</span>, <span style="color: #483d8b;">&quot;credits&quot;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #483d8b;">&quot;license&quot;</span> <span style="color: #ff7700;font-weight:bold;">for</span> more information.
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">from</span> ctypes <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">from</span> ctypes.<span style="color: black;">util</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> lib = CDLL<span style="color: black;">&#40;</span>find_library<span style="color: black;">&#40;</span><span style="color: #483d8b;">'test'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> lib.<span style="color: black;">doit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
Bus error</pre></div></div>

<p>To get a stack trace from the native code, the Python interpreter must be run from the GNU debugger, or gdb. All of the Zenoss daemons share a common architecture in how they are started, so the process for running the daemon from within gdb will be similar no matter which daemon you use.</p>
<ol>
<li>Determine your <code>ZENHOME</code> directory location by running <code>echo $ZENHOME</code> from the shell prompt. In the remainder of this example, we will assume it is set to <code>/Users/cgibbons/zenoss</code></li>
<li>Pick the daemon you want to run. In this example, we will use zenwin &#8212; the daemon responsible for monitoring the state of services on Windows devices.</li>
<li>Look at the actual daemon script:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$ZENHOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>zenwin
<span style="color: #666666; font-style: italic;">#! /usr/bin/env bash</span>
<span style="color: #666666; font-style: italic;">#############################################################################</span>
<span style="color: #666666; font-style: italic;"># This program is part of Zenoss Core, an open source monitoring platform.</span>
<span style="color: #666666; font-style: italic;"># Copyright (C) 2007, Zenoss Inc.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># This program is free software; you can redistribute it and/or modify it</span>
<span style="color: #666666; font-style: italic;"># under the terms of the GNU General Public License version 2 as published by</span>
<span style="color: #666666; font-style: italic;"># the Free Software Foundation.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># For complete information please visit: http://www.zenoss.com/oss/</span>
<span style="color: #666666; font-style: italic;">#############################################################################</span>
&nbsp;
. <span style="color: #007800;">$ZENHOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>zenfunctions
&nbsp;
<span style="color: #007800;">PRGHOME</span>=<span style="color: #007800;">$ZENHOME</span><span style="color: #000000; font-weight: bold;">/</span>Products<span style="color: #000000; font-weight: bold;">/</span>ZenWin
<span style="color: #007800;">PRGNAME</span>=zenwin.py
<span style="color: #007800;">CFGFILE</span>=<span style="color: #007800;">$CFGDIR</span><span style="color: #000000; font-weight: bold;">/</span>zenwin.conf
&nbsp;
generic <span style="color: #ff0000;">&quot;$@&quot;</span></pre></div></div>

</li>
<li>Run gdb in the python interpreter:

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">$ gdb python
GNU gdb 6.3.50<span style="color: #339933;">-</span><span style="color: #0000dd;">20050815</span> <span style="color: #009900;">&#40;</span>Apple version gdb<span style="color: #339933;">-</span><span style="color: #0000dd;">962</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>Sat Jul <span style="color: #0000dd;">26</span> <span style="color:#800080;">08</span><span style="color: #339933;">:</span><span style="color: #0000dd;">14</span><span style="color: #339933;">:</span><span style="color: #0000dd;">40</span> UTC <span style="color: #0000dd;">2008</span><span style="color: #009900;">&#41;</span>
Copyright <span style="color: #0000dd;">2004</span> Free Software Foundation<span style="color: #339933;">,</span> Inc.
<span style="color: #202020;">GDB</span> is free software<span style="color: #339933;">,</span> covered by the GNU General Public License<span style="color: #339933;">,</span> and you are
welcome to change it and<span style="color: #339933;">/</span>or distribute copies of it under certain conditions.
<span style="color: #202020;">Type</span> <span style="color: #ff0000;">&quot;show copying&quot;</span> to see the conditions.
<span style="color: #202020;">There</span> is absolutely no warranty <span style="color: #b1b100;">for</span> GDB.  <span style="color: #202020;">Type</span> <span style="color: #ff0000;">&quot;show warranty&quot;</span> <span style="color: #b1b100;">for</span> details.
<span style="color: #202020;">This</span> GDB was configured as <span style="color: #ff0000;">&quot;i386-apple-darwin&quot;</span>...<span style="color: #202020;">Reading</span> symbols <span style="color: #b1b100;">for</span> shared libraries .... <span style="color: #202020;">done</span>
&nbsp;
<span style="color: #009900;">&#40;</span>gdb<span style="color: #009900;">&#41;</span></pre></div></div>

</li>
<li>Set the program arguments. Note how the zenwin script above is used to build the actual argument string:

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#40;</span>gdb<span style="color: #009900;">&#41;</span> set args <span style="color: #339933;">/</span>Users<span style="color: #339933;">/</span>cgibbons<span style="color: #339933;">/</span>zenoss<span style="color: #339933;">/</span>Products<span style="color: #339933;">/</span>ZenWin<span style="color: #339933;">/</span>zenwin.<span style="color: #202020;">py</span> <span style="color: #339933;">--</span>configfile<span style="color: #339933;">=/</span>Users<span style="color: #339933;">/</span>cgibbons<span style="color: #339933;">/</span>zenoss<span style="color: #339933;">/</span>etc<span style="color: #339933;">/</span>zenwin.<span style="color: #202020;">conf</span> run <span style="color: #339933;">-</span>v10 <span style="color: #339933;">-</span>c</pre></div></div>

</li>
<li>Finally, run the daemon process within the debugger:

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#40;</span>gdb<span style="color: #009900;">&#41;</span> run
Starting program<span style="color: #339933;">:</span> <span style="color: #339933;">/</span>Users<span style="color: #339933;">/</span>cgibbons<span style="color: #339933;">/</span>zenoss<span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>python <span style="color: #339933;">/</span>Users<span style="color: #339933;">/</span>cgibbons<span style="color: #339933;">/</span>zenoss<span style="color: #339933;">/</span>Products<span style="color: #339933;">/</span>ZenWin<span style="color: #339933;">/</span>zenwin.<span style="color: #202020;">py</span> <span style="color: #339933;">--</span>configfile<span style="color: #339933;">=/</span>Users<span style="color: #339933;">/</span>cgibbons<span style="color: #339933;">/</span>zenoss<span style="color: #339933;">/</span>etc<span style="color: #339933;">/</span>zenwin.<span style="color: #202020;">conf</span> run <span style="color: #339933;">-</span>v10 <span style="color: #339933;">-</span>c</pre></div></div>

</li>
</ol>
<p>The daemon will then run as if it were started directly from the command-line. Any pdb trace statements will still be activated and you can use pdb commands as expected. But, once a native code crash is detected by the debugger, the gdb prompt will be provided and the gdb <code>where</code> command may be used to view the native code stack trace. For example, if we do this with our previous doit test, we&#8217;ll see this output:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">&gt;&gt;&gt;</span> lib.<span style="color: #202020;">doit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
&nbsp;
Program received signal EXC_BAD_ACCESS<span style="color: #339933;">,</span> Could not access memory.
<span style="color: #202020;">Reason</span><span style="color: #339933;">:</span> KERN_PROTECTION_FAILURE at address<span style="color: #339933;">:</span> <span style="color: #208080;">0x00000000</span>
<span style="color: #208080;">0x93ebe457</span> in __vfprintf <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#40;</span>gdb<span style="color: #009900;">&#41;</span> where
<span style="color: #339933;">#0  0x93ebe457 in __vfprintf ()</span>
<span style="color: #339933;">#1  0x93ef2da7 in vfprintf_l ()</span>
<span style="color: #339933;">#2  0x93f17fbb in printf ()</span>
<span style="color: #339933;">#3  0x003b9ffe in doit () at test.c:6</span>
<span style="color: #339933;">#4  0x0039476d in .LCFI1 () at /Users/cgibbons/src/zenoss/trunk/inst/build/ctypes-1.0.1/source/libffi/src/x86/darwin.S:81</span>
<span style="color: #339933;">#5  0x00394701 in ffi_call (cif=0xbffff1a8, fn=0x3b9fe6 &lt;doit&gt;, rvalue=0xa0414584, avalue=0xbffff120) at /Users/cgibbons/src/zenoss/trunk/inst/build/ctypes-1.0.1/source/libffi/src/x86/ffi_darwin.c:249</span>
<span style="color: #339933;">#6  0x0038f21e in _CallProc (pProc=0x3b9fe6 &lt;doit&gt;, argtuple=0x15a030, flags=4097, argtypes=0x0, restype=0x21b600, checker=0x0) at source/callproc.c:665</span>
<span style="color: #339933;">#7  0x00389f02 in CFuncPtr_call (self=0x174880, inargs=0x15a030, kwds=0x0) at source/_ctypes.c:3357</span>
<span style="color: #339933;">#8  0x00007e12 in PyObject_Call (func=0x174880, arg=0x15a030, kw=0x0) at Objects/abstract.c:1795</span>
<span style="color: #339933;">#9  0x00080dcb in do_call [inlined] () at Python/ceval.c:3776</span>
<span style="color: #339933;">#10 0x00080dcb in PyEval_EvalFrame (f=0x209960) at Python/ceval.c:3591</span>
<span style="color: #339933;">#11 0x0008327f in PyEval_EvalCodeEx (co=0x1ac5e0, globals=0x173a50, locals=0x173a50, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2741</span>
<span style="color: #339933;">#12 0x00083547 in PyEval_EvalCode (co=0xbffff064, globals=0xbffff064, locals=0xbffff064) at Python/ceval.c:484</span>
<span style="color: #339933;">#13 0x000aae36 in PyRun_InteractiveOneFlags (fp=0xbffff064, filename=0xdb4a6 &quot;&lt;stdin&gt;&quot;, flags=0xbffff818) at Python/pythonrun.c:1287</span>
<span style="color: #339933;">#14 0x000aaf73 in PyRun_InteractiveLoopFlags (fp=0xa04175e0, filename=0xdb4a6 &quot;&lt;stdin&gt;&quot;, flags=0xbffff818) at Python/pythonrun.c:706</span>
<span style="color: #339933;">#15 0x000abe29 in PyRun_AnyFileExFlags (fp=0xa04175e0, filename=0xdb4a6 &quot;&lt;stdin&gt;&quot;, closeit=0, flags=0xbffff818) at Python/pythonrun.c:669</span>
<span style="color: #339933;">#16 0x000b5f8a in Py_Main (argc=0, argv=0xbffff8a4) at Modules/main.c:493</span>
<span style="color: #339933;">#17 0x00001d0b in _start ()</span>
<span style="color: #339933;">#18 0x00001c39 in start ()</span>
<span style="color: #009900;">&#40;</span>gdb<span style="color: #009900;">&#41;</span></pre></div></div>

<p>If the native library was built with debugging symbols a nice programmer-friendly stack trace will be generated like in the above example. Here we can see exactly what line our <code>doit</code> function crashed at. Now the bug should be easy to find and fix, right?</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F19%2Fgetting-a-native-code-stack-trace-from-a-zenoss-daemon%2F&amp;title=Getting%20a%20Native%20Code%20Stack%20Trace%20from%20a%20Zenoss%20Daemon&amp;bodytext=Zenoss%20uses%20the%20Python%20programming%20language%20for%20the%20vast%20majority%20of%20its%20code%2C%20and%20all%20of%20the%20daemons%20and%20commands%20that%20run%20are%20Python%20scripts.%20Several%20daemons%20also%20make%20use%20of%20native%20code%20%28i.e.%20code%20written%20in%20languages%20like%20C%20or%20C%2B%2B%20that%20must%20be%20co" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F19%2Fgetting-a-native-code-stack-trace-from-a-zenoss-daemon%2F&amp;title=Getting%20a%20Native%20Code%20Stack%20Trace%20from%20a%20Zenoss%20Daemon" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F19%2Fgetting-a-native-code-stack-trace-from-a-zenoss-daemon%2F&amp;title=Getting%20a%20Native%20Code%20Stack%20Trace%20from%20a%20Zenoss%20Daemon&amp;notes=Zenoss%20uses%20the%20Python%20programming%20language%20for%20the%20vast%20majority%20of%20its%20code%2C%20and%20all%20of%20the%20daemons%20and%20commands%20that%20run%20are%20Python%20scripts.%20Several%20daemons%20also%20make%20use%20of%20native%20code%20%28i.e.%20code%20written%20in%20languages%20like%20C%20or%20C%2B%2B%20that%20must%20be%20co" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F19%2Fgetting-a-native-code-stack-trace-from-a-zenoss-daemon%2F&amp;title=Getting%20a%20Native%20Code%20Stack%20Trace%20from%20a%20Zenoss%20Daemon&amp;annotation=Zenoss%20uses%20the%20Python%20programming%20language%20for%20the%20vast%20majority%20of%20its%20code%2C%20and%20all%20of%20the%20daemons%20and%20commands%20that%20run%20are%20Python%20scripts.%20Several%20daemons%20also%20make%20use%20of%20native%20code%20%28i.e.%20code%20written%20in%20languages%20like%20C%20or%20C%2B%2B%20that%20must%20be%20co" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F19%2Fgetting-a-native-code-stack-trace-from-a-zenoss-daemon%2F&amp;t=Getting%20a%20Native%20Code%20Stack%20Trace%20from%20a%20Zenoss%20Daemon" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/03/19/getting-a-native-code-stack-trace-from-a-zenoss-daemon/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>new MacBook setup</title>
		<link>http://blog.nuclearbunny.org/2009/03/17/new-macbook-setup/</link>
		<comments>http://blog.nuclearbunny.org/2009/03/17/new-macbook-setup/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 03:07:37 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=284</guid>
		<description><![CDATA[I bought another Mac today, a nice 2.4 GHz 13-inch unibody MacBook. I had planned on buying a 17-inch unibody MacBook Pro, and very nearly did, but luckily sanity won out and I remembered how much of a hassle it was to carry around those giant things, even if they are only &#8220;only&#8221; 6.6 lbs. [...]]]></description>
			<content:encoded><![CDATA[<p>I bought another Mac today, a nice 2.4 GHz 13-inch unibody MacBook. I had planned on buying a 17-inch unibody MacBook Pro, and very nearly did, but luckily sanity won out and I remembered how much of a hassle it was to carry around those giant things, even if they are only &#8220;only&#8221; 6.6 lbs.</p>
<p>I had a 2.0 GHz 13-inch MacBook a couple of years ago when the first Intel-based models came out and I do remember the screen resolution, while not abundant, was more than adequate for browsing, e-mail and even development. And, the unibody model is only 4.5 lbs, so 2 lbs lighter will be a lot nicer to carry around. I also sprung for a spare battery to try and help get a little closer to the awesome battery life of the 17-inch model.</p>
<p>Of course, the obvious question is why buy another laptop when I&#8217;ve already got a nice 15-inch MacBook Pro that work provides? The answer there is easy: I don&#8217;t want to do anything personal, even development, on the work provided machine.</p>
<p>Now, on to the actual system setup, documented here for posterity.</p>
<ol>
<li>After account creation, run software update and get all the latest updates installed first.</li>
<li>Create an applecare account with an easy, but secure, password. This way the Apple store geeks can have that account should there need to be any repair work done.</li>
<li>Change the battery lifetime display with Show -&gt; <strong>Time</strong>.</li>
<li>Secure the screensaver by using System Preferences -&gt; Security -&gt; General and checking the <strong>Require password to wake this computer from sleep or screen saver</strong> option.</li>
<li>Disable the Front Row remote by using System Preferences -&gt; Security -&gt; General and checking the <strong>Disable remote control infrared receiver</strong> option.</li>
<li>Disable the Front Row keyboard shortcut by using System Preferences -&gt; Keyboard &amp; Mouse -&gt; Keyboard Shortcuts and disabling the <strong>Hide and show Front Row shortcut</strong>.</li>
<li>Enable full keyboard shortcuts by checking the <strong>All controls</strong> option in the bottom of the same Keyboard Shortcuts screen.</li>
<li>Enable the <strong>Use secure virtual memory</strong> option in System Preferences -&gt; Security -&gt; General.</li>
<li>Encrypt my home directory with System Preferences -&gt; Security -&gt; FileVault.</li>
<li>Install Growl 1.1.4 from <a title="Growl" href="http://growl.info/" target="_blank">http://growl.info/</a>
<ol>
<li>Install the GrowlSafari extra package.</li>
<li>Install the HardwareGrowler extra package.
<ol>
<li>Drag HardwareGrowler.app to /Applications</li>
<li>Disable the HardwareGrowler dock icon by following the instructions at <a title="HardwareGrowler documentation" href="http://growl.info/documentation/hardwaregrowler.php" target="_blank">http://growl.info/documentation/hardwaregrowler.php</a></li>
<li>Add HardwareGrowler to the start at login list by using System Preferences -&gt; Accounts -&gt; Login Items and dragging HardwareGrowler to the list.</li>
</ol>
</li>
<li>Enable Growl starting at login with System Preferences -&gt; Growl and enabling the <strong>Start Growl at login</strong> option.</li>
</ol>
</li>
<li>Remove unused printer drivers by deleting the appropriate folders in /Library/Printers folder (everything but Brother, hp and PPDs in my case).</li>
<li>Install the XcodeTools package from the Installation DVD&#8217;s Optional Installs directory.</li>
<li>Drag Xcode to the dock by going to /Developer/Applications and dragging the icon to the dock.</li>
<li>Add Activity Monitor to the dock by going to /Applications/Utilities and dragging the icon to the dock. Seondary-click on the icon and enable <strong>Open at Login</strong>.</li>
<li>Add Terminal to the dock by going to /Applications/Utilities and dragging the icon to the dock.
<ol>
<li>Change the default Terminal settings by starting Terminal.app, selecting Preferences (Cmd-,) and then changing the &#8220;new window with settings&#8221; to Pro.</li>
<li>Select the Pro scheme in the Settings tab and click default.</li>
<li>Choose the Window tab with the Pro scheme selected, click the Background color chooser and set the opacity level to 90%.</li>
<li>Change the window size to 80 columns and 36 rows.</li>
</ol>
</li>
<li>Customize vim by creating ~/.vimrc with the following content:<br />
<code><br />
:color elflord<br />
:syntax enable<br />
:set shiftwidth=4<br />
:set expandtab<br />
:set autoindent<br />
:set cindent<br />
:set enc=utf-8<br />
:set nu<br />
:set showmatch<br />
:set laststatus=2<br />
:set nocompatible<br />
:set gfn=Monaco:h15:a<br />
</code></li>
<li>Enable color highlighting for ls by adding the following lines to /etc/bashrc:<br />
<code><br />
alias ls='ls -CFG'<br />
alias dir='ls -FGlas'<br />
</code></li>
<li>Install the Safari 4 beta from <a title="Apple Safari download" href="http://www.apple.com/safari/download" target="_blank">http://www.apple.com/safari/download</a></li>
<li>Install Firefox 3 from <a title="Firefox download" href="http://getfirefox.com/" target="_blank">http://getfirefox.com/</a> and drag it to the dock.</li>
<li>Install iStat pro from <a title="iStat pro" href="http://www.islayer.com/apps/istatpro/" target="_blank">http://www.islayer.com/apps/istatpro/</a></li>
<li>Install MySQL 5.1 x86 community edition from <a title="MySQL 5.1 community downloads" href="http://dev.mysql.com/downloads/mysql/5.1.html" target="_blank">http://dev.mysql.com/downloads/mysql/5.1.html</a> be sure to install the StartupItem package as well as the preference pane.</li>
<li>Add MySQL to the shell profile by appending the following to /etc/bashrc:<br />
<code><br />
export PATH=/usr/local/mysql/bin:$PATH</code></li>
<li>Install EverNote from <a title="EverNote" href="http://www.evernote.com/">http://www.evernote.com/</a></li>
<li>Install DropBox from <a title="Get DropBox!" href="http://www.getdropbox.com/" target="_blank">http://www.getdropbox.com/</a></li>
<li>Install the Windows Media Components for QuickTime from <a title="Windows Media Components for QuickTime" href="http://www.microsoft.com/windows/windowsmedia/player/wmcomponents.mspx" target="_blank">http://www.microsoft.com/windows/windowsmedia/player/wmcomponents.mspx</a></li>
<li>Install Twitterrific from <a title="Twitterrific" href="http://iconfactory.com/software/twitterrific" target="_blank">http://iconfactory.com/software/twitterrific</a></li>
<li>Disable automatic synchronization for iPhones and iPods since this won&#8217;t be the primary iTunes machine by going to iTunes Preferences and enabling <strong>Disable automatic syncing for iPhones and iPods</strong> on the Devices tab.</li>
<li>Install the iPhone SDK from <a title="Apple Developer Portal" href="http://developer.apple.com/" target="_blank">http://developer.apple.com/</a></li>
<li>Party! Or maybe just nap.</li>
</ol>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F17%2Fnew-macbook-setup%2F&amp;title=new%20MacBook%20setup&amp;bodytext=I%20bought%20another%20Mac%20today%2C%20a%20nice%202.4%20GHz%2013-inch%20unibody%20MacBook.%20I%20had%20planned%20on%20buying%20a%2017-inch%20unibody%20MacBook%20Pro%2C%20and%20very%20nearly%20did%2C%20but%20luckily%20sanity%20won%20out%20and%20I%20remembered%20how%20much%20of%20a%20hassle%20it%20was%20to%20carry%20around%20those%20giant%20things" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F17%2Fnew-macbook-setup%2F&amp;title=new%20MacBook%20setup" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F17%2Fnew-macbook-setup%2F&amp;title=new%20MacBook%20setup&amp;notes=I%20bought%20another%20Mac%20today%2C%20a%20nice%202.4%20GHz%2013-inch%20unibody%20MacBook.%20I%20had%20planned%20on%20buying%20a%2017-inch%20unibody%20MacBook%20Pro%2C%20and%20very%20nearly%20did%2C%20but%20luckily%20sanity%20won%20out%20and%20I%20remembered%20how%20much%20of%20a%20hassle%20it%20was%20to%20carry%20around%20those%20giant%20things" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F17%2Fnew-macbook-setup%2F&amp;title=new%20MacBook%20setup&amp;annotation=I%20bought%20another%20Mac%20today%2C%20a%20nice%202.4%20GHz%2013-inch%20unibody%20MacBook.%20I%20had%20planned%20on%20buying%20a%2017-inch%20unibody%20MacBook%20Pro%2C%20and%20very%20nearly%20did%2C%20but%20luckily%20sanity%20won%20out%20and%20I%20remembered%20how%20much%20of%20a%20hassle%20it%20was%20to%20carry%20around%20those%20giant%20things" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F03%2F17%2Fnew-macbook-setup%2F&amp;t=new%20MacBook%20setup" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/03/17/new-macbook-setup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Oddities in Gathering Windows Performance Data</title>
		<link>http://blog.nuclearbunny.org/2009/02/17/oddities-in-gathering-windows-performance-data/</link>
		<comments>http://blog.nuclearbunny.org/2009/02/17/oddities-in-gathering-windows-performance-data/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 01:39:08 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[perfmon]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=252</guid>
		<description><![CDATA[At Zenoss we do quite a bit of remote monitoring of computers running Windows. In the Enterprise edition of the product, we collect raw performance counter data using the conventional remote Windows Registry APIs. We ran into an issue recently with a customer running Windows 2000 where the data from the remote server was being [...]]]></description>
			<content:encoded><![CDATA[<p>At <a href="http://www.zenoss.com/" target="_blank">Zenoss</a> we do quite a bit of remote monitoring of computers running Windows. In the Enterprise edition of the product, we collect raw performance counter data using the conventional remote Windows Registry APIs.</p>
<p>We ran into an issue recently with a customer running Windows 2000 where the data from the remote server was being truncated prematurely. Since we implement our own remote API (so we can run natively on Linux and with Python, rather than requiring Windows), there was some immediately concern we ran into a low-level bug in our protocol implementation. Thanks to the release of the <a href="http://msdn.microsoft.com/en-us/library/cc216513(PROT.10).aspx" target="_blank">Windows Communications Protocols (MCPP)</a> last year we have great detail on how our API layer should function.</p>
<p>Reviewing the MCPP in detail compared to our implementation showed no bugs against the specification, but I did notice some odd behavior. Normally when using the RegQueryValue API you specify a NULL buffer point and a zero-length buffer size so that the call will provide the actual size of the buffer needed. With this particular customer&#8217;s server I noticed that this behavior wasn&#8217;t behaving as documented in the MCPP.</p>
<p>An error code of ERROR_MORE_DATA was being returned. The MCPP says that when this value is returned the server will populate the size output variable with the actual size in bytes of the needed buffer. In this case, the size was always the same size as the input. After some experimentation I found that if I passed in approximately 64 Kbytes more data the call would finally succeed.</p>
<p>While quite odd behavior, this is actually the documented and expected state in the Win32 API documentation for <a href="http://msdn.microsoft.com/en-us/library/ms724911(VS.85).aspx" target="_blank">RegQueryValueEx</a>, but not in the MCPP. Specificially, when using the HKEY_PERFORMANCE_DATA key the ERROR_MORE_DATA behaves differently and the caller has more responsibility in guessing an appropriate buffer size.</p>
<p>The following pseudo-code shows the basic flow for how RegQueryValueEx should be used, either for locally or remote performance data access.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">size = <span style="color: #ff4500;">65536</span> <span style="color: #808080; font-style: italic;"># starting size, probably computed from a previous registry call</span>
params.<span style="color: #ff7700;font-weight:bold;">in</span>.<span style="color: black;">data</span> = params.<span style="color: black;">out</span>.<span style="color: black;">data</span> = buffer<span style="color: black;">&#40;</span>size<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
    params.<span style="color: #ff7700;font-weight:bold;">in</span>.<span style="color: black;">size</span> = size
    params.<span style="color: black;">out</span>.<span style="color: black;">size</span> = <span style="color: #ff4500;">0</span>
    dcerpc_winreg_QueryValue<span style="color: black;">&#40;</span>params<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> params.<span style="color: black;">out</span>.<span style="color: black;">result</span> == ERROR_MORE_DATA:
        size = size + <span style="color: #ff4500;">65536</span> <span style="color: #808080; font-style: italic;"># add another 64 Kbytes of data to the buffer</span>
        params.<span style="color: #ff7700;font-weight:bold;">in</span>.<span style="color: black;">data</span> = params.<span style="color: black;">out</span>.<span style="color: black;">data</span> = buffer<span style="color: black;">&#40;</span>size<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">continue</span>
    <span style="color: #ff7700;font-weight:bold;">break</span></pre></div></div>

<p>After fixing that issue I was still left with one oddity. Let&#8217;s say, for example, it took 293,500 bytes of data before the RegQueryValueEx call was successful. And yet, the actual amount of returned data would only be 195,000 bytes, or something similar. This behavior seems quite different than on the other Windows operating systems we have tried so far.</p>
<p>This is the first time we&#8217;ve tried our data collection against a Windows 2000 server running Exchange locally. Windows 2000 has also been the source of several other key behavior differences in how performance data is returned, so my current speculation is how the server actually determines what data to be returned varies greatly between operating system versions. We normally query the performance counter registry for only a subset of values. It may well be that on Windows 2000 a buffer size large enough to retrieve all performance counters is required, even though once the call is complete it actually used quite a bit less.</p>
<p>Quirky, but another bug gone.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F02%2F17%2Foddities-in-gathering-windows-performance-data%2F&amp;title=Oddities%20in%20Gathering%20Windows%20Performance%20Data&amp;bodytext=At%20Zenoss%20we%20do%20quite%20a%20bit%20of%20remote%20monitoring%20of%20computers%20running%20Windows.%20In%20the%20Enterprise%20edition%20of%20the%20product%2C%20we%20collect%20raw%20performance%20counter%20data%20using%20the%20conventional%20remote%20Windows%20Registry%20APIs.%0D%0A%0D%0AWe%20ran%20into%20an%20issue%20recently%20wit" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F02%2F17%2Foddities-in-gathering-windows-performance-data%2F&amp;title=Oddities%20in%20Gathering%20Windows%20Performance%20Data" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F02%2F17%2Foddities-in-gathering-windows-performance-data%2F&amp;title=Oddities%20in%20Gathering%20Windows%20Performance%20Data&amp;notes=At%20Zenoss%20we%20do%20quite%20a%20bit%20of%20remote%20monitoring%20of%20computers%20running%20Windows.%20In%20the%20Enterprise%20edition%20of%20the%20product%2C%20we%20collect%20raw%20performance%20counter%20data%20using%20the%20conventional%20remote%20Windows%20Registry%20APIs.%0D%0A%0D%0AWe%20ran%20into%20an%20issue%20recently%20wit" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F02%2F17%2Foddities-in-gathering-windows-performance-data%2F&amp;title=Oddities%20in%20Gathering%20Windows%20Performance%20Data&amp;annotation=At%20Zenoss%20we%20do%20quite%20a%20bit%20of%20remote%20monitoring%20of%20computers%20running%20Windows.%20In%20the%20Enterprise%20edition%20of%20the%20product%2C%20we%20collect%20raw%20performance%20counter%20data%20using%20the%20conventional%20remote%20Windows%20Registry%20APIs.%0D%0A%0D%0AWe%20ran%20into%20an%20issue%20recently%20wit" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F02%2F17%2Foddities-in-gathering-windows-performance-data%2F&amp;t=Oddities%20in%20Gathering%20Windows%20Performance%20Data" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/02/17/oddities-in-gathering-windows-performance-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Magic of a Quiet Fan</title>
		<link>http://blog.nuclearbunny.org/2009/01/10/the-magic-of-a-quiet-fan/</link>
		<comments>http://blog.nuclearbunny.org/2009/01/10/the-magic-of-a-quiet-fan/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 16:31:06 +0000</pubDate>
		<dc:creator>chadwick</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zenoss]]></category>

		<guid isPermaLink="false">http://blog.nuclearbunny.org/?p=214</guid>
		<description><![CDATA[A previous post discussed using an Intel D945GCLF2 Atom-based mainboard for a little mini server setup. It&#8217;s been working great, except for that damn fan for the memory controller. It was pretty noisy at first, but quickly degraded into a crunching worthless disaster. The product review comments at newegg described this exact behavior so I [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://blog.nuclearbunny.org/2008/11/25/using-zenoss-core-to-watch-the-home-network/" target="_blank">previous post</a> discussed using an <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16813121359" target="_blank">Intel D945GCLF2</a> Atom-based mainboard for a little mini server setup. It&#8217;s been working great, except for that damn fan for the memory controller. It was pretty noisy at first, but quickly degraded into a crunching worthless disaster.</p>
<p>The product review comments at newegg described this exact behavior so I wasn&#8217;t too surprised. My friend Matt replaced his with a $3 fan immediately and has been happy with it since.</p>
<p>I opted for a slightly more expensive fan that is supposed to run at less than 14 dBA &#8211; a <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16835191001" target="_blank">Silenx Ixtrema Pro Series</a>. It&#8217;s still a 40mm fan with the same depth but I can&#8217;t hear it run at all. Product reviews imply this fan won&#8217;t stay quiet after about 6 months, so we&#8217;ll see if that happens. Ideally I&#8217;d just replace the crappy heatsink with a larger one and maybe a heat pipe to the case.</p>
<p>Now the only noise in the system is the <a href="http://wdc.custhelp.com/cgi-bin/wdc.cfg/php/enduser/std_adp.php?p_faqid=1405" target="_blank">WD Raptor drive</a>. I&#8217;ve noticed the drive runs at between 50 and 55 degrees C since the case is not actively cool, so that is on the hot side (WD&#8217;s MTBF testing was done at 50 degrees). It is way overkill for this box, so I may replace it with a WD Green Power drive, or just give up and do a small SSD.</p>
<p>But hey, I&#8217;ve got over a month of cool looking graphs out of <a href="http://www.zenoss.com/" target="_blank">Zenoss</a> now, such as my router network traffic:</p>
<div id="attachment_215" class="wp-caption aligncenter" style="width: 655px"><img class="size-full wp-image-215" title="zenoss-network-graph" src="http://blog.nuclearbunny.org/wp-content/uploads/2009/01/picture-1.png" alt="Zenoss Network Performance Graph" width="645" height="453" /><p class="wp-caption-text">Zenoss Network Performance Graph</p></div>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F01%2F10%2Fthe-magic-of-a-quiet-fan%2F&amp;title=The%20Magic%20of%20a%20Quiet%20Fan&amp;bodytext=A%20previous%20post%20discussed%20using%20an%20Intel%20D945GCLF2%20Atom-based%20mainboard%20for%20a%20little%20mini%20server%20setup.%20It%27s%20been%20working%20great%2C%20except%20for%20that%20damn%20fan%20for%20the%20memory%20controller.%20It%20was%20pretty%20noisy%20at%20first%2C%20but%20quickly%20degraded%20into%20a%20crunching%20w" title="Digg"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F01%2F10%2Fthe-magic-of-a-quiet-fan%2F&amp;title=The%20Magic%20of%20a%20Quiet%20Fan" title="StumbleUpon"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F01%2F10%2Fthe-magic-of-a-quiet-fan%2F&amp;title=The%20Magic%20of%20a%20Quiet%20Fan&amp;notes=A%20previous%20post%20discussed%20using%20an%20Intel%20D945GCLF2%20Atom-based%20mainboard%20for%20a%20little%20mini%20server%20setup.%20It%27s%20been%20working%20great%2C%20except%20for%20that%20damn%20fan%20for%20the%20memory%20controller.%20It%20was%20pretty%20noisy%20at%20first%2C%20but%20quickly%20degraded%20into%20a%20crunching%20w" title="del.icio.us"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F01%2F10%2Fthe-magic-of-a-quiet-fan%2F&amp;title=The%20Magic%20of%20a%20Quiet%20Fan&amp;annotation=A%20previous%20post%20discussed%20using%20an%20Intel%20D945GCLF2%20Atom-based%20mainboard%20for%20a%20little%20mini%20server%20setup.%20It%27s%20been%20working%20great%2C%20except%20for%20that%20damn%20fan%20for%20the%20memory%20controller.%20It%20was%20pretty%20noisy%20at%20first%2C%20but%20quickly%20degraded%20into%20a%20crunching%20w" title="Google Bookmarks"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.nuclearbunny.org%2F2009%2F01%2F10%2Fthe-magic-of-a-quiet-fan%2F&amp;t=The%20Magic%20of%20a%20Quiet%20Fan" title="Facebook"><img src="http://blog.nuclearbunny.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nuclearbunny.org/2009/01/10/the-magic-of-a-quiet-fan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
