<?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>Refactored scope &#187; David</title>
	<atom:link href="http://ominian.com/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://ominian.com</link>
	<description>PyMethius project notes</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:56:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sencha Touch v2 with style</title>
		<link>http://ominian.com/2012/02/06/sencha-touch-v2-with-style/</link>
		<comments>http://ominian.com/2012/02/06/sencha-touch-v2-with-style/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 17:56:10 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[sencha-touch]]></category>
		<category><![CDATA[compass]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[sass]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=182</guid>
		<description><![CDATA[You wouldn&#8217;t write a HTML form like this: &#60;form style=&#34;radius-border:12px; border: thin solid black; background-color: blue&#34;&#62; &#60;label style=&#34;background: none !important; width: 45%&#34; &#62;Username&#60;/label&#62; &#60;input style=&#34;background-color: white !important; border: thin solid white !important&#34; name=&#34;username&#34;/&#62;&#60;br/&#62; &#160; &#60;label style=&#34;background: none !important; width: 45%&#34;&#62;Password&#60;/label&#62; &#60;input style=&#34;background-color: white !important; border: thin solid white !important&#34; type=&#34;password&#34; name=&#34;password&#34;/&#62;&#60;br/&#62; &#160; &#60;input type=&#34;submit&#34;/&#62; &#60;/form&#62; <a href='http://ominian.com/2012/02/06/sencha-touch-v2-with-style/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>You wouldn&#8217;t write a HTML form like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form style=&quot;radius-border:12px; border: thin solid black; background-color: blue&quot;&gt;
    &lt;label style=&quot;background: none !important; width: 45%&quot; &gt;Username&lt;/label&gt;
    &lt;input style=&quot;background-color: white !important; border: thin solid white !important&quot; name=&quot;username&quot;/&gt;&lt;br/&gt;
&nbsp;
    &lt;label style=&quot;background: none !important; width: 45%&quot;&gt;Password&lt;/label&gt;
    &lt;input style=&quot;background-color: white !important; border: thin solid white !important&quot; type=&quot;password&quot; name=&quot;password&quot;/&gt;&lt;br/&gt;
&nbsp;
    &lt;input type=&quot;submit&quot;/&gt;
&lt;/form&gt;</pre></div></div>

<p>So why the hell would you write a Sencha Touch form like</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">define</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;SoopaForm&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
   config<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
         style<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;radius-border:12px; border: thin solid black; background-color: blue&quot;</span><span style="color: #339933;">,</span>
         items<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
             <span style="color: #009900;">&#123;</span>
                xtype<span style="color: #339933;">:</span> <span style="color: #3366CC;">'textfield'</span><span style="color: #339933;">,</span>
                <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'username'</span><span style="color: #339933;">,</span>
                label<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Username'</span><span style="color: #339933;">,</span>
                labelStyle<span style="color: #339933;">:</span> <span style="color: #3366CC;">'background: none !important; width: 45%'</span><span style="color: #339933;">,</span>
                style<span style="color: #339933;">:</span> <span style="color: #3366CC;">'background-color: white !important; border: thin solid white !important'</span>
             <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
             <span style="color: #009900;">&#123;</span>
                xtype<span style="color: #339933;">:</span> <span style="color: #3366CC;">'passwordfield'</span><span style="color: #339933;">,</span>
                <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'password'</span><span style="color: #339933;">,</span>
                label<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Password'</span><span style="color: #339933;">,</span>
                labelStyle<span style="color: #339933;">:</span> <span style="color: #3366CC;">'background: none !important; width: 45%'</span><span style="color: #339933;">,</span>
                style<span style="color: #339933;">:</span> <span style="color: #3366CC;">'background-color: white !important; border: thin solid white !important'</span>
             <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
             <span style="color: #009900;">&#123;</span>
                  xtype<span style="color: #339933;">:</span> <span style="color: #3366CC;">'button'</span><span style="color: #339933;">,</span>
                  text<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Submit'</span><span style="color: #339933;">,</span>
                  action<span style="color: #339933;">:</span> <span style="color: #3366CC;">'submit'</span>
             <span style="color: #009900;">&#125;</span>
&nbsp;
         <span style="color: #009900;">&#93;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>ExtJS 4 AND Sencha Touch 2 come with a feature complete <a href="http://sass-lang.com/">Sass</a>/<a href="http://compass-style.org/">Compass </a> sencha-touch css package ( just need to ruby gem install sass &#038; compass ).   From there, you can easily style your ExtJS4/Touch UI with some housekeeping similar to compass watch ( background polling compile on detection system ).  You&#8217;re business logic will be cleaner, you styling will be more consistent, and more importantly it will make you totally look like a badass when you restyle an entire mobile app in minutes instead of days.</p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2012/02/06/sencha-touch-v2-with-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Tour de Force with Sencha Touch v2</title>
		<link>http://ominian.com/2012/02/03/a-tour-de-force-with-sencha-touch-v2/</link>
		<comments>http://ominian.com/2012/02/03/a-tour-de-force-with-sencha-touch-v2/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 23:08:24 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=181</guid>
		<description><![CDATA[The team I am working with just passed the 1,000 man hour mark on a flagship Mobile application using Sencha Touch version 2 pr3 and phone gap. Until the business people make a PR statement I can&#8217;t say much&#8230; so in the interim, things I&#8217;ve discovered. Don&#8217;t trust Ext.Loader to get it right &#8211; eventually <a href='http://ominian.com/2012/02/03/a-tour-de-force-with-sencha-touch-v2/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>The team I am working with just passed the 1,000 man hour mark on a flagship Mobile application using Sencha Touch version 2 pr3 and phone gap.  Until the business people make a PR statement I can&#8217;t say much&#8230; so in the interim, things I&#8217;ve discovered.</p>
<ol>
<li>Don&#8217;t trust Ext.Loader to get it right &#8211; eventually using some cheap tricks I wrote an automatic dependancy handler that writes script tags in the correct order for all needed components.  Holding @ 12K lines of JS and the &#8220;good&#8221; mobile devices are performent</li>
<li> Ext.layout.Vbox will test your sanity &#8211; http://www.sencha.com/forum/showthread.php?140185-vbox-gives-components-0-height-hbox-gives-components-0-width  Their is a provided solution but I&#8217;ve found it&#8217;s best to use a Ext.env or Ext.os controlled magic height/width variables instead of relying soley on the rendering logic to get it right</li>
<li> I re-implemented <a href="http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/simple-widgets/progress-bar.html">this ExtJS 4 widget </a>in Sencha Touch 2.  My original estimate was 2.5 hours but that became 12 hours later to learn the Ext.component system to get it right.  At this point I&#8217;ve read 60% of Sencha Touch&#8217;s source code, line by line, so I guess this was a positive serendipity tour.  That said, you&#8217;re going to pay dearly to make exotic custom components until some more tools are ported from ExtJS4 to Sencha Touch</li>
<li> Last, Android&#8217;s mobile rendering engine is the MSIE of Smart phones.</li>
</ol>
<p>On a sadder note, I am finally breaking down and purchasing an Apple computing device of some sort as the jail break toolchain I&#8217;ve got isn&#8217;t exactly professional grade.</p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2012/02/03/a-tour-de-force-with-sencha-touch-v2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pynarcissus parser post-parse analysis with a visitor like pattern</title>
		<link>http://ominian.com/2012/01/11/pynarcissus-parser-post-parse-analysis-with-a-visitor-like-pattern/</link>
		<comments>http://ominian.com/2012/01/11/pynarcissus-parser-post-parse-analysis-with-a-visitor-like-pattern/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 04:54:18 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=180</guid>
		<description><![CDATA[Someone recently asked me how the more time involved analyzer I wrote works, unfortunately I can&#8217;t post it as its targeted for a client project&#8230; but I can post a simpler mockup of it combined with the person&#8217;s function print logic. Sure this loses the ability to step back up the chain of tokens, but <a href='http://ominian.com/2012/01/11/pynarcissus-parser-post-parse-analysis-with-a-visitor-like-pattern/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Someone recently asked me how the more time involved analyzer I wrote works, unfortunately I can&#8217;t post it as its targeted for a client project&#8230; but I can post a simpler mockup of it combined with the person&#8217;s function print logic. </p>
<p><script src="https://gist.github.com/1598830.js"> </script></p>
<p>Sure this loses the ability to step back up the chain of tokens, but for most cases like detecting functions or in my case line numbers to intrument, this construct works for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2012/01/11/pynarcissus-parser-post-parse-analysis-with-a-visitor-like-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with &amp; using pynarcissus to parse Javascript in Python</title>
		<link>http://ominian.com/2012/01/06/working-with-using-pynarcissus-to-parse-javascript-in-python/</link>
		<comments>http://ominian.com/2012/01/06/working-with-using-pynarcissus-to-parse-javascript-in-python/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 19:50:33 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=178</guid>
		<description><![CDATA[If you&#8217;re reading this, you&#8217;re either one of the 10-15 user-agents stalking my blog or one of the search engines sent you here because you&#8217;d like to analyze Javascript from inside of Python. In my cursory research phase, the best option seems to be pynarcissus. As of 2012/01/6 there has been no commits or updates <a href='http://ominian.com/2012/01/06/working-with-using-pynarcissus-to-parse-javascript-in-python/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re reading this, you&#8217;re either one of the 10-15 user-agents stalking my blog or one of the search engines sent you here because you&#8217;d like to analyze Javascript from inside of Python.  In my cursory research phase, the best option seems to be <a href="http://code.google.com/p/pynarcissus/">pynarcissus</a>.</p>
<p>As of 2012/01/6 there has been no commits or updates to the project which seemed disheartening until I gave it a try.  From my tests, pynarcissus DOES WORK.</p>
<p>Below is proof of concept code I wrote to walk through the entire token tree of a ExtJS Sencha touch file which is probably the most extreme JS compatible test I could come up with, mostly because ExtJS code reliably and utterly confuses Komodo IDE and other IDE&#8217;s I use on a daily basis.</p>
<p>The codez:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> pynarcissus <span style="color: #ff7700;font-weight:bold;">import</span> parse
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">collections</span> <span style="color: #ff7700;font-weight:bold;">import</span> defaultdict
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot;
    Syntax analysis done dirty
&nbsp;
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Linenums JSCoverage said were correct</span>
targetnums = <span style="color: black;">&#91;</span><span style="color: #ff4500;">28</span>,<span style="color: #ff4500;">44</span>,<span style="color: #ff4500;">51</span>,<span style="color: #ff4500;">53</span>,<span style="color: #ff4500;">57</span>,<span style="color: #ff4500;">59</span>,<span style="color: #ff4500;">60</span>,<span style="color: #ff4500;">68</span>,<span style="color: #ff4500;">69</span>,<span style="color: #ff4500;">70</span>,<span style="color: #ff4500;">77</span>,<span style="color: #ff4500;">78</span>,<span style="color: #ff4500;">79</span>,<span style="color: #ff4500;">86</span>,<span style="color: #ff4500;">87</span>,<span style="color: #ff4500;">88</span>,<span style="color: #ff4500;">95</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Operands/tokens unique to these lines</span>
injectionOPS = <span style="color: black;">&#123;</span><span style="color: #483d8b;">'IF'</span>,<span style="color: #483d8b;">'CALL'</span>,<span style="color: #483d8b;">'VAR'</span>,<span style="color: #483d8b;">'RETURN'</span><span style="color: black;">&#125;</span>
<span style="color: #808080; font-style: italic;">#operands/tokens that should be avoided</span>
exclusionOPS = <span style="color: black;">&#123;</span><span style="color: #483d8b;">''</span><span style="color: black;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#test file</span>
raw = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;./juggernaut/parser/test/test_original.js&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
tokens = parse<span style="color: black;">&#40;</span>raw,<span style="color: #483d8b;">'test_original.js'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#Master list of linenums to TOKEN types</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> findlines<span style="color: black;">&#40;</span>node, pr_linenums = <span style="color: #008000;">None</span>, capture_all = <span style="color: #008000;">False</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
        Walk over the hills and through the valleys and hope
        we hit every single token in the tree along the way.
    &quot;&quot;&quot;</span>
    linenums = defaultdict<span style="color: black;">&#40;</span><span style="color: #008000;">set</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">if</span> pr_linenums <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span> <span style="color: #ff7700;font-weight:bold;">else</span> pr_linenums
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> node.<span style="color: #008000;">type</span> == <span style="color: #483d8b;">'IF'</span>:
        dbgp = <span style="color: #ff4500;">1</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> node.<span style="color: #008000;">type</span> <span style="color: #ff7700;font-weight:bold;">in</span> injectionOPS <span style="color: #ff7700;font-weight:bold;">or</span> capture_all:
        linenums<span style="color: black;">&#91;</span>node.<span style="color: black;">lineno</span><span style="color: black;">&#93;</span>.<span style="color: black;">add</span><span style="color: black;">&#40;</span>node.<span style="color: #008000;">type</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">for</span> sub <span style="color: #ff7700;font-weight:bold;">in</span> node:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>sub<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">0</span>:
            linenums = findlines<span style="color: black;">&#40;</span>sub, linenums, capture_all<span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">for</span> attr <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">'thenPart'</span>, <span style="color: #483d8b;">'elsePart'</span>, <span style="color: #483d8b;">'expression'</span>, <span style="color: #483d8b;">'body'</span> <span style="color: black;">&#93;</span>:
            child = <span style="color: #008000;">getattr</span><span style="color: black;">&#40;</span>sub, attr, <span style="color: #008000;">None</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">if</span> child:
                linenums = findlines<span style="color: black;">&#40;</span>child, linenums, capture_all<span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">if</span> sub.<span style="color: #008000;">type</span> <span style="color: #ff7700;font-weight:bold;">in</span> injectionOPS <span style="color: #ff7700;font-weight:bold;">or</span> capture_all:
            linenums<span style="color: black;">&#91;</span>sub.<span style="color: black;">lineno</span><span style="color: black;">&#93;</span>.<span style="color: black;">add</span><span style="color: black;">&#40;</span>sub.<span style="color: #008000;">type</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> linenums
&nbsp;
linenums = findlines<span style="color: black;">&#40;</span>tokens, defaultdict<span style="color: black;">&#40;</span><span style="color: #008000;">set</span><span style="color: black;">&#41;</span>, <span style="color: #008000;">False</span><span style="color: black;">&#41;</span>
injectionTargets = <span style="color: #008000;">sorted</span><span style="color: black;">&#40;</span>linenums.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
source = raw.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">cStringIO</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">StringIO</span>
buffer = <span style="color: #dc143c;">StringIO</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> lineno, line <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">enumerate</span><span style="color: black;">&#40;</span>source, <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> lineno <span style="color: #ff7700;font-weight:bold;">in</span> injectionTargets:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #66cc66;">&gt;&gt;</span> buffer, <span style="color: #483d8b;">&quot;$_injectionjs['testfile'][%s] += 1;&quot;</span> <span style="color: #66cc66;">%</span> lineno
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #66cc66;">&gt;&gt;</span> buffer, line
&nbsp;
buffer.<span style="color: black;">reset</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'test_file.js'</span>,<span style="color: #483d8b;">'wb'</span><span style="color: black;">&#41;</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span>buffer.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
dbgp = <span style="color: #ff4500;">1</span></pre></div></div>

<p>Briefly, the above code is a unstructured test to attempt to match what JSCoverage thinks are the correct lines to instrument and for the most part it works well.  The most crucial needed to be able to blindly traverse the token node tree is the logic inside the findlines function.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">&nbsp;
    <span style="color: #483d8b;">&quot;&quot;&quot;
         the product of pynarcissus.parse is a Node object.
         Node's inherit lists, so for some JS structures you will
         iterate over it's children.  Other times, you might not be
         so lucky, hence the inner loop to detect Node elements.
&nbsp;
         For instance, for Node.type == 'IF' the thenPart and elsePart
         properties will be populated alongside with 'expression'.
&nbsp;
         Othertimes, specially for function/method nodes, there will be a body
         attribute.
&nbsp;
        All of these attributes, if not None, are instances of pynarcissus's Node class.
&nbsp;
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> sub <span style="color: #ff7700;font-weight:bold;">in</span> node:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>sub<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">0</span>:
            linenums = findlines<span style="color: black;">&#40;</span>sub, linenums, capture_all<span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">for</span> attr <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">'thenPart'</span>, <span style="color: #483d8b;">'elsePart'</span>, <span style="color: #483d8b;">'expression'</span>, <span style="color: #483d8b;">'body'</span> <span style="color: black;">&#93;</span>:
            child = <span style="color: #008000;">getattr</span><span style="color: black;">&#40;</span>sub, attr, <span style="color: #008000;">None</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">if</span> child:
                linenums = findlines<span style="color: black;">&#40;</span>child, linenums, capture_all<span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">if</span> sub.<span style="color: #008000;">type</span> <span style="color: #ff7700;font-weight:bold;">in</span> injectionOPS <span style="color: #ff7700;font-weight:bold;">or</span> capture_all:
            linenums<span style="color: black;">&#91;</span>sub.<span style="color: black;">lineno</span><span style="color: black;">&#93;</span>.<span style="color: black;">add</span><span style="color: black;">&#40;</span>sub.<span style="color: #008000;">type</span><span style="color: black;">&#41;</span></pre></div></div>

<p>As you can see, there&#8217;s a linenums variable being passed around like the village bicycle, here is what it looks like.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #dc143c;">pprint</span>.<span style="color: #dc143c;">pprint</span><span style="color: black;">&#40;</span>linenums.<span style="color: black;">items</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: black;">&#91;</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'SCRIPT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">28</span>,
  <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'CALL'</span>,
       <span style="color: #483d8b;">'DOT'</span>,
       <span style="color: #483d8b;">'IDENTIFIER'</span>,
       <span style="color: #483d8b;">'LIST'</span>,
       <span style="color: #483d8b;">'OBJECT_INIT'</span>,
       <span style="color: #483d8b;">'SEMICOLON'</span>,
       <span style="color: #483d8b;">'STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">29</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span>, <span style="color: #483d8b;">'STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">30</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'ARRAY_INIT'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span>, <span style="color: #483d8b;">'STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">31</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'OBJECT_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">32</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'NULL'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">33</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">34</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'OBJECT_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">35</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span>, <span style="color: #483d8b;">'STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">36</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'FALSE'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">37</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span>, <span style="color: #483d8b;">'TRUE'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">38</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span>, <span style="color: #483d8b;">'STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">39</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span>, <span style="color: #483d8b;">'TRUE'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">40</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'PROPERTY_INIT'</span>, <span style="color: #483d8b;">'STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">41</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">43</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'FUNCTION'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'SCRIPT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">44</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'BLOCK'</span>, <span style="color: #483d8b;">'IF'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">45</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'CALL'</span>, <span style="color: #483d8b;">'DOT'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'LIST'</span>, <span style="color: #483d8b;">'SEMICOLON'</span>, <span style="color: #483d8b;">'STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">46</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IF'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">52</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">57</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'FUNCTION'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'SCRIPT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">58</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'VAR'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">60</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'VAR'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">64</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'CALL'</span>, <span style="color: #483d8b;">'DOT'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'LIST'</span>, <span style="color: #483d8b;">'SEMICOLON'</span>, <span style="color: #483d8b;">'THIS'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">66</span>,
  <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'CALL'</span>, <span style="color: #483d8b;">'DOT'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'LIST'</span>, <span style="color: #483d8b;">'SEMICOLON'</span>, <span style="color: #483d8b;">'STRING'</span>, <span style="color: #483d8b;">'THIS'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">67</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'RETURN'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">68</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">74</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'FUNCTION'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'SCRIPT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">75</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'VAR'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">76</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'VAR'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">77</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'RETURN'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">78</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">83</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'FUNCTION'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'SCRIPT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">84</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'VAR'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">85</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'VAR'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">86</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'CALL'</span>, <span style="color: #483d8b;">'DOT'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'LIST'</span>, <span style="color: #483d8b;">'SEMICOLON'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">87</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">92</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'FUNCTION'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'SCRIPT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">93</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'VAR'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">94</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'VAR'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">95</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'CALL'</span>, <span style="color: #483d8b;">'DOT'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'LIST'</span>, <span style="color: #483d8b;">'SEMICOLON'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">96</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">101</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'FUNCTION'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'SCRIPT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">102</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'CALL'</span>, <span style="color: #483d8b;">'DOT'</span>, <span style="color: #483d8b;">'IDENTIFIER'</span>, <span style="color: #483d8b;">'LIST'</span>, <span style="color: #483d8b;">'SEMICOLON'</span>, <span style="color: #483d8b;">'STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
 <span style="color: black;">&#40;</span><span style="color: #ff4500;">103</span>, <span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PROPERTY_INIT'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span></pre></div></div>

<p>This is enough information for me to be able to safely determine injection points for an instrumentation line.   I am still working through some problems with this whole mess, specifically line 46 looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">       <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
$_injectionjs<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'testfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">45</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;REDACTED&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$_injectionjs<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'testfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">46</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;boop&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;bleep&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span></pre></div></div>

<p>after being instrumented.  As you can see, I am skipping over the else if chain&#8230; which leads me to believe I am missing YET ANOTHER dynamically assigned Node property.</p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2012/01/06/working-with-using-pynarcissus-to-parse-javascript-in-python/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The US Federal government cannot be trusted.</title>
		<link>http://ominian.com/2011/11/17/the-us-federal-government-cannot-be-trusted/</link>
		<comments>http://ominian.com/2011/11/17/the-us-federal-government-cannot-be-trusted/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 02:43:55 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=176</guid>
		<description><![CDATA[This is my one and only political, totally off subject post, and it&#8217;s damn important. In my youth I was a heavily proactive individual, when the bridges got washed out in my neighborhood I made up maps to help the wayward tourists find their way, I&#8217;ve donated my time to Habitat for humanity, built community <a href='http://ominian.com/2011/11/17/the-us-federal-government-cannot-be-trusted/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This is my one and only political, totally off subject post, and it&#8217;s damn important.</p>
<p>In my youth I was a heavily proactive individual, when the bridges got washed out in my neighborhood I made up maps to help the wayward tourists find their way, I&#8217;ve donated my time to Habitat for humanity, built community parks, worked as a special need&#8217;s teacher&#8217;s assistant, volunteered for Al Gore&#8217;s 2000 presidential bid, and then I did a stint in the US military.  To some extent I am disenfranchised with my government, specifically I think Capital Hill should be renamed Imperial Hill but at the same time the US democratic foundation isn&#8217;t completely dead yet.</p>
<p>After the attacks of 9/11, opportunistic and deeply self serving people set the US on a dead end course to destruction.  One of the things done while the country was numb and fearful was deploy the Patriot Act, a bill purported to make America safer and prevent future terrorist attacks.  The truth isn&#8217;t really close in how the Patriot Act has been used ( <a href="http://www.aclu.org/national-security/aclu-releases-comprehensive-report-patriot-act-abuses">http://www.aclu.org/national-security/aclu-releases-comprehensive-report-patriot-act-abuses</a> ), instead eroding constitution rights and making it easier for the greedy to ransack the country under the guise of national security.</p>
<p>For anyone naive enough to believe the latest anti-piracy internet bill won&#8217;t be abused, well I&#8217;d like to talk to you about a fantastic Real estate propspect for a bridge connecting Manhatten island.  Please contact your representative ( if you are a US Citzen ).  <em>Those who sacrifice their freedom for security deserve neither.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2011/11/17/the-us-federal-government-cannot-be-trusted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lose a car window, lose a day</title>
		<link>http://ominian.com/2011/11/15/lose-a-car-window-lose-a-day/</link>
		<comments>http://ominian.com/2011/11/15/lose-a-car-window-lose-a-day/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 19:27:36 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=175</guid>
		<description><![CDATA[Yesterday morning I walked out to my carport to discover someone had bashed in my wife&#8217;s back window and one of her quarter panel windows on her Volvo. So began a fun filled journey to hunt down replacement glass ( Safelite had the back window but not the Quarter, speciality shop had quarter but at <a href='http://ominian.com/2011/11/15/lose-a-car-window-lose-a-day/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>   Yesterday morning I walked out to my carport to discover someone had bashed in my wife&#8217;s back window and one of her quarter panel windows on her Volvo.  So began a fun filled journey to hunt down replacement glass ( Safelite had the back window but not the Quarter, speciality shop had quarter but at a steep price ).   The truly fascinating part is that my car, a $36,000 price tag Volkswagen GTI was left unscathed sitting next to her old Volvo.  </p>
<p>Eh, going to see if I can finish up Veterans Guide today and spend a little bit on the security service.  In the interim, I think I&#8217;ve found a bug in txmongo but its posing to be a doozy to narrow down WHERE exactly the problem lies and how to make a unit-test to repeat the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2011/11/15/lose-a-car-window-lose-a-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two startup&#8217;s for half the sleep!!!</title>
		<link>http://ominian.com/2011/11/12/two-startups-for-half-the-sleep/</link>
		<comments>http://ominian.com/2011/11/12/two-startups-for-half-the-sleep/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 06:41:47 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[subjective]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=172</guid>
		<description><![CDATA[This weekend I enrolled into Startup Weekend Denver #3 AND also started a personnel project for the LinkedIn Veteran&#8217;s hackday. For SWDenver, the project is an penetration testing service. Thanks to my experiences with EC2, I&#8217;m relatively confident I can make it marginally profitable by implementing an intelligent booking/scheduling system and the power of twisted. <a href='http://ominian.com/2011/11/12/two-startups-for-half-the-sleep/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This weekend I enrolled into Startup Weekend Denver #3 AND also started a personnel project for the LinkedIn Veteran&#8217;s hackday.</p>
<p>For SWDenver, the project is an penetration testing service.  Thanks to my experiences with EC2, I&#8217;m relatively confident I can make it marginally profitable by implementing an intelligent booking/scheduling system and the power of twisted.  At this point I&#8217;ve had a couple Venture Capitalist minions peak in on my team and they&#8217;ve walked with a gleam in their eye.  Who knows?</p>
<p>For LinkedIn Vet&#8217;s day, I&#8217;ve been building a Veteran Events and Services national directory using Django and Mongodb.  My goal is to run this as a charity/public service to my peers ( USAF Senior Airmen Dev Dave 2001-2005 IYAAYAS ).  That said I&#8217;ve got the models done, view scaffolding is in place, working on setting up a UserAuth submission pipeline.</p>
<p>As it stands, looks like I will have the SaaS for SWDenver on its way out the door by tomorrow afternoon and the VetDay directory by Monday morning.  Nice to flex my RockStar muscles and kick out a distributed SOA project and a national directory in the space of a weekend.</p>
<p>The mess that is the Veterans hack day project is here @ <a href="https://github.com/devdave/VetHackday">https://github.com/devdave/VetHackday</a> minus 6-7 pushes.</p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2011/11/12/two-startups-for-half-the-sleep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://ominian.com/2011/11/10/170/</link>
		<comments>http://ominian.com/2011/11/10/170/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 23:54:07 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[subjective]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=170</guid>
		<description><![CDATA[For Hire Despite sometimes major butchering of English grammar, I think this blog covers that I am at least competent and well versed in software development. That said, for US citizens I&#8217;m willing to pay out a $500 bounty for anyone who can point me in the direction of a Python contract or full time <a href='http://ominian.com/2011/11/10/170/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h3>For Hire</h3>
<p>Despite sometimes major butchering of English grammar, I think this blog covers that I am at least competent and well versed in software development.  That said, for US citizens I&#8217;m willing to pay out a $500 bounty for anyone who can point me in the direction of a Python contract or full time remote position that I get placed into.</p>
<p>contact me at fromthewordress at ominian dot net or dot com.</p>
<h3>Philosophy on getting it done</h3>
<p>I think a few times now I&#8217;ve lamented my experiences with PHP. I&#8217;ve been accused by a few people of being two-faced in this regards; openly saying I don&#8217;t want to work with PHP any more as a tool set while when faced with a client seeking my advice on what platform to use I have pointed them towards PHP.  The truth is really simple, I want to get my client up and going or back on the road.  Sure Ruby on rails or Django are superior products in many ways but they are also more expensive in professional resources to maintain.  A good example is one of my clients that is the IT department for a major corporation with tens of thousands of customers and just as many computers to maintain.  My client is well versed in system administration but not in software engineering.  So I wrote up a Kohana v3 application that uses mod_php and jquery.  If I get hit by a bus tomorrow they will still be alright and happy.</p>
<p>I don&#8217;t think I&#8217;m explaining myself too well just yet, so a much better written tale from the industy is in order via the DailyWTF @ ( <a href="http://thedailywtf.com/Articles/The_Complicator_0x27_s_Gloves.aspx">article</a> ).  Yes PHP is not sexy, its almost downright ugly, but it does what the client needs and is mostly reliable in that regard.  If tomorrow someone said they needed an asyncronous event handler and they wanted it in PHP5; I&#8217;d probably laugh in their face then proceed to start crying when I realized they were serious.  Still, if tomorrow someone said they needed a simple low-traffic inventory management system and they already have on hand people competent in LAMP then I&#8217;d lean towards PHP.</p>
<p>Why I&#8217;m like this, going for the simplest most reliable solution originates with some of my more desperate past clients.</p>
<h3>The super website constructor&#8230; of doom</h3>
<p>Directory websites are usually fairly simple MVC applications that parse browser get requests and dump out a nice simple web structure on demand.  This client&#8217;s system did all of that work upfront by ingesting a hierarchical data structure and generated a root page, regional pages, sub-pages, and detail pages in one go into a static 4.7GB structure.  The plus was that the sales/marketing people could make rudimentary hand changes to pages and they would work&#8230; but the MAJOR downside was that structural changes were not possible. </p>
<p>The complexity required to build such a builder was unbelievable and as such was not very future safe.  In fact it was generator 1-2 GigaBytes of error/warning messages a day to syslog.  In reflection I think the project was built the way it was because of two reasons:  first was my predecessors lack of experience/knowledge and secondly more so was from sheer boredom.  They made this because it was challenging to implement.  Once implemented and the stack went into a maintain and feature addition state, they left.</p>
<h3>I hate PHP so I shall do something else.</h3>
<p>Another client horror story was a scenario where the company Rockstar got bored with the languages currently in use.  Having read an extensive amount of this Rockstar&#8217;s code I could clearly see they were a very brilliant individual but at the same time they were shooting their client in the foot with their perpetual need to be brilliant.  I would often lament in private conversation with my peers that Rockstar while brilliant always leaned towards the path less taken, making code that was harder to maintain or sometimes understand without a long analysis period.</p>
<p>The final straw for this rock star was when they started writing backend services in a language no one else in the company knew.  I think the grand total was half a mega-byte of code that was super critical to the company, very pretty, but also seriously fragile.  As expected, the Rock star grew bored and moved on.  A few months later it was a somewhat horrifying moment when one of these almost forgetton gems broke under unexpected circumstances and brought an entire application array of 30 servers to a dead stop.  The culprit was a UTF-8 character that broke a high volume data extraction script and caused the producer to block, waiting for the stdout pipe to clear up some space.</p>
<p>Fixing that took all of the King&#8217;s men, some of the horses, the company CTO, and me.  I won&#8217;t go into specifics but it turned out to be a combination of weak code and a bug in the target language.</p>
<h3>Summary</h3>
<p>I don&#8217;t resent these people for getting bored; more so I resent that they got bored and didn&#8217;t realize it until they had abused an unspoken trust between professional and employer.  Code monkeys write code to make their client money, not to entertain themselves.  Whenever I get bored I will go on a serendipity hike with my personnel time to see what I can pull off, ultimately a lot of these<a href="https://github.com/devdave/repositories"> pet projects </a><br />
end of going no where&#8230; but it&#8217;s more about the journey then the destination for me.  Each one of my pet&#8217;s has ended up teaching me more about things I might not work with professionally then any book or blog post could.  Just because you are a professional and work in your vocation doesn&#8217;t mean you are going to wake up one day and be a master in that profession, just like martial arts and any other vocation professional or hobby, it takes continual investment of time and energy, striving for harder and more unusual problems to solve to become a master.</p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2011/11/10/170/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures in SSH: Agent authentication</title>
		<link>http://ominian.com/2011/11/10/adventures-in-ssh-agent-authentication/</link>
		<comments>http://ominian.com/2011/11/10/adventures-in-ssh-agent-authentication/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 21:25:15 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[twisted ssh twisted.conch]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=169</guid>
		<description><![CDATA[As mentioned previously; I&#8217;m working on hacking/implementing agent support to Twisted.conch. Fortunately, Exarkun pointed me in the direction of twisted.conch.ssh.agent.SSHAgentClient which implements the wire protocol logic of communicating with the Agent, but there is still a gaping hole to fill in. Briefly, when a user configures their ssh client to allow for agent forwarding, almost <a href='http://ominian.com/2011/11/10/adventures-in-ssh-agent-authentication/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>As mentioned previously; I&#8217;m working on hacking/implementing agent support to Twisted.conch.  Fortunately, Exarkun pointed me in the direction of <a href="http://twistedmatrix.com/documents/current/api/twisted.conch.ssh.agent.SSHAgentClient.html">twisted.conch.ssh.agent.SSHAgentClient</a> which implements the wire protocol logic of communicating with the Agent, but there is still a gaping hole to fill in.</p>
<p>Briefly, when a user configures their ssh client to allow for agent forwarding, almost immediately after userauth completion, the client sends a session request for  ‘auth-agent-req@openssh.com’.  For openssh, the service then kicks off a process of creating a named socket that usually resides in /tmp/ , announces the user&#8217;s agent presence in the shell environment, and then binds a specialized TCP port forwarding channel from the named socket back to the client on a channel called &#8220;auth agent&#8221;.  When a service local ssh client then begins it&#8217;s own authentication process, it finds this special socket and sends down the wire a request identities or sign request Agent protocol message.  Ideally the response will be a correctly counter-signed value and the user can progress.</p>
<p>The last point can be found in the session.c file of OpenSSH as:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #0000dd;">239</span>		nc <span style="color: #339933;">=</span> channel_new<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;auth socket&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000dd;">240</span>		    SSH_CHANNEL_AUTH_SOCKET<span style="color: #339933;">,</span> sock<span style="color: #339933;">,</span> sock<span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">,</span>
<span style="color: #0000dd;">241</span>		    CHAN_X11_WINDOW_DEFAULT<span style="color: #339933;">,</span> CHAN_X11_PACKET_DEFAULT<span style="color: #339933;">,</span>
<span style="color: #0000dd;">242</span>		    <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;auth socket&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Unfortunately I haven&#8217;t hunted down what the global const SSH_CHANNEL_AUTH_SOCKET correlates to in regards to Python.  I believe argument 1 &#8220;auth socket&#8221; is equivalent to the class attribute name in channel.SSHChannel.  So the skeleton for an &#8220;Auth socket&#8221; channel might look like:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> AuthAgentChannel<span style="color: black;">&#40;</span>SSHListenForwardingFactory<span style="color: black;">&#41;</span>:
   name = <span style="color: #483d8b;">&quot;auth agent&quot;</span></pre></div></div>

<p>Alas I haven&#8217;t had time to test.  I&#8217;m debating hacking up some sort of SSH/twisted.conch testing platform to allow for me to execute arbitrary calls, that would probably make this exercise a tad easier to figure out.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2011/11/10/adventures-in-ssh-agent-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All you need to know about SSH, you can learn from session.c</title>
		<link>http://ominian.com/2011/11/06/all-you-need-to-know-about-ssh-you-can-learn-from-session-c/</link>
		<comments>http://ominian.com/2011/11/06/all-you-need-to-know-about-ssh-you-can-learn-from-session-c/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 06:24:13 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ominian.com/?p=167</guid>
		<description><![CDATA[For a secret squirrel project, I&#8217;ve been diving fairly deep into SSH land. While in the process of implementing my own SSH service via Twisted.Conch, I ran into the problem of trying to figure out how to support agent forwarding. While tracing through an SSH connection, I got the session request name &#8216;auth-agent-req@openssh.com&#8217; and after <a href='http://ominian.com/2011/11/06/all-you-need-to-know-about-ssh-you-can-learn-from-session-c/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>For a secret squirrel project, I&#8217;ve been diving fairly deep into SSH land.  While in the process of implementing my own SSH service via Twisted.Conch, I ran into the problem of trying to figure out how to support agent forwarding.</p>
<p>While tracing through an SSH connection, I got the session request name &#8216;auth-agent-req@openssh.com&#8217; and after grepping over the openSSH code, sure enough there&#8217;s a check for that exact request type.</p>
<p>Will update when/if I can figure out how to translate to Python/Twisted.  In the interim, session.c can be viewed here <a href="http://anoncvs.mindrot.org/index.cgi/openssh/session.c?view=markup">http://anoncvs.mindrot.org/index.cgi/openssh/session.c?view=markup</a>.  In passing, I have to say this is some of the most immaculate C code I have ever seen in my life.</p>
]]></content:encoded>
			<wfw:commentRss>http://ominian.com/2011/11/06/all-you-need-to-know-about-ssh-you-can-learn-from-session-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

