<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>DevHawk</title><link>http://devhawk.net/</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Devhawk" /><description>Passion * Technology * Ruthless Competence</description><language>en-us</language><copyright>Harry Pierson</copyright><managingEditor>harry@devhawk.net</managingEditor><lastBuildDate>Thu, 21 Jan 2010 23:38:51 PST</lastBuildDate><generator>newtelligence dasBlog 2.0.7226.0</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Devhawk" /><feedburner:info uri="devhawk" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><geo:lat>47.640972</geo:lat><geo:long>-122.033189</geo:long><feedburner:browserFriendly>(Enter a personal message you would like to have appear at the top of your feed.)</feedburner:browserFriendly><item><title>Fixing Powershell&amp;rsquo;s Busted Resolve-Path Cmdlet</title><link>http://devhawk.net/2010/01/22/Fixing+Powershellrsquos+Busted+ResolvePath+Cmdlet.aspx</link><category>PowerShell</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Thu, 21 Jan 2010 23:38:51 PST</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,0f11ab8d-df0d-458c-8ee5-105b1fdedcd3.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Usually, my <a href="http://devhawk.net/CategoryView,category,PowerShell.aspx">PowerShell
posts</a> are effusive in their praise. However, who thought up this “feature” gets
no praise from me:
</p>
        <div style="font-family: consolas,lucida console,courier,monospace">
          <span style="color: #008000; font-weight: bold">PS»</span>
          <span style="color: #19177c; font-weight: bold">Resolve-Path</span> ~\missing.file 
<br><span style="color: red">Resolve-Path : Cannot find path 'C:\Users\hpierson\missing.file'
because it does not exist. </span></div>
        <p>
In my opinion, this is a bad design. Resolve-Path assumes that if the filename being
resolved doesn’t exist, then it must be an error. But in the script I’m building,
I’m resolving the path of a file that I’m going to create. In other words, I know
a priori that the file doesn’t exist. Yet Resolve-Path insists on throwing an error.
I would have expected there to be some switch you could pass to Resolve-Path telling
it to skip path validation, but there’s not.
</p>
        <p>
And the worst thing is, I can see that Resolve-Path came up with the “right” answer
– it’s right there in the error message!
</p>
        <p>
Searching around, I found <a href="http://www.vistax64.com/powershell/24603-resolve-path-non-existing-file.html">a
thread</a> where someone else was having the same problem. Jeffrey Snover – aka Distinguished
Engineer, inventor of Powershell and <a href="http://www.langnetsymposium.com/2009/talks/23-ErikMeijer-LiveLabsReactiveFramework.html">target
of Erik Meijer’s Lang.NET coin throwing stunt</a> – suggested using <a href="http://blogs.msdn.com/powershell/archive/2006/11/03/erroraction-and-errorvariable.aspx">–ErrorAction
and –ErrorVariable</a> to ignore the error and retrieve the resolved path from the
TargetObject property error variable. Like Maximilian from the thread, using this
approach feels fragile and frankly kinda messy, but I needed a solution. So I wrote
the following function that wraps up access to the error variable so at least I don’t
have fragile messy code sprinkled through out my script.  
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:9c646c59-4051-4237-abb4-0d03e3b5e20d" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>function </b>
            </span>force-resolve-path<span style="color:#666666">(</span><span style="color:#19177C">$filename</span><span style="color:#666666">)</span><br><span style="color:#666666">{</span><br>
  <span style="color:#19177C">$filename</span> <span style="color:#666666">=</span> Resolve-Path <span style="color:#19177C">$filename</span> -ErrorAction SilentlyContinue<br>
                                     -ErrorVariable _frperror<br>
  <span style="color:#008000"><b>if</b></span> <span style="color:#666666">(</span>!<span style="color:#19177C">$filename</span><span style="color:#666666">)</span><br>
  <span style="color:#666666">{</span><br>
    <span style="color:#008000"><b>return</b></span> <span style="color:#19177C">$_frperror</span><span style="color:#666666">[</span>0<span style="color:#666666">]</span>.TargetObject<br>
  <span style="color:#666666">}</span><br>
  <span style="color:#008000"><b>return</b></span> <span style="color:#19177C">$filename</span><br><span style="color:#666666">}</span><br></div>
        </div>
        <p>
        </p>
        <p>
The script is pretty straightforward. –ErrorAction SilentlyContinue is PowerShell’s
version of <a href="http://msdn.microsoft.com/en-us/library/5hsw66as.aspx">On Error
Resume Next</a> in Visual Basic. If the cmdlet encounters an error, it gets stashed
away in the variable specified by ErrorVariable (it’s also added to $Error so you
can still retrieve the error object if ErrorVariable isn’t specified) and continues
processing. Then I manually check to see if resolve-path succeeded – i.e. did it return
a value – and return the TargetObject of the Error object if it didn’t. 
</p>
        <p>
As I said, fragile and kinda messy. But it works. 
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=0f11ab8d-df0d-458c-8ee5-105b1fdedcd3"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=xpjUpyr-K2o:hFyKaC9FtiA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=xpjUpyr-K2o:hFyKaC9FtiA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=xpjUpyr-K2o:hFyKaC9FtiA:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=xpjUpyr-K2o:hFyKaC9FtiA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=xpjUpyr-K2o:hFyKaC9FtiA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=xpjUpyr-K2o:hFyKaC9FtiA:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/xpjUpyr-K2o" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
Usually, my &lt;a href="http://devhawk.net/CategoryView,category,PowerShell.aspx"&gt;PowerShell
posts&lt;/a&gt; are effusive in their praise. However, who thought up this “feature” gets
no praise from me:
&lt;/p&gt;
&lt;div style="font-family: consolas,lucida console,courier,monospace"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;PS»&lt;/span&gt; &lt;span style="color: #19177c; font-weight: bold"&gt;Resolve-Path&lt;/span&gt; ~\missing.file 
&lt;br /&gt;
&lt;span style="color: red"&gt;Resolve-Path : Cannot find path 'C:\Users\hpierson\missing.file'
because it does not exist. &lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;
In my opinion, this is a bad design. Resolve-Path assumes that if the filename being
resolved doesn’t exist, then it must be an error. But in the script I’m building,
I’m resolving the path of a file that I’m going to create. In other words, I know
a priori that the file doesn’t exist. Yet Resolve-Path insists on throwing an error.
I would have expected there to be some switch you could pass to Resolve-Path telling
it to skip path validation, but there’s not.
&lt;/p&gt;
&lt;p&gt;
And the worst thing is, I can see that Resolve-Path came up with the “right” answer
– it’s right there in the error message!
&lt;/p&gt;
&lt;p&gt;
Searching around, I found &lt;a href="http://www.vistax64.com/powershell/24603-resolve-path-non-existing-file.html"&gt;a
thread&lt;/a&gt; where someone else was having the same problem. Jeffrey Snover – aka Distinguished
Engineer, inventor of Powershell and &lt;a href="http://www.langnetsymposium.com/2009/talks/23-ErikMeijer-LiveLabsReactiveFramework.html"&gt;target
of Erik Meijer’s Lang.NET coin throwing stunt&lt;/a&gt; – suggested using &lt;a href="http://blogs.msdn.com/powershell/archive/2006/11/03/erroraction-and-errorvariable.aspx"&gt;–ErrorAction
and –ErrorVariable&lt;/a&gt; to ignore the error and retrieve the resolved path from the
TargetObject property error variable. Like Maximilian from the thread, using this
approach feels fragile and frankly kinda messy, but I needed a solution. So I wrote
the following function that wraps up access to the error variable so at least I don’t
have fragile messy code sprinkled through out my script.&amp;#160; 
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:9c646c59-4051-4237-abb4-0d03e3b5e20d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;function&amp;#160;&lt;/b&gt;&lt;/span&gt;force-resolve-path&lt;span style="color:#666666"&gt;(&lt;/span&gt;&lt;span style="color:#19177C"&gt;$filename&lt;/span&gt;&lt;span style="color:#666666"&gt;)&lt;/span&gt;
&lt;br /&gt;
&lt;span style="color:#666666"&gt;{&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#19177C"&gt;$filename&lt;/span&gt;&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;Resolve-Path&amp;#160;&lt;span style="color:#19177C"&gt;$filename&lt;/span&gt;&amp;#160;-ErrorAction&amp;#160;SilentlyContinue&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;-ErrorVariable&amp;#160;_frperror&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#666666"&gt;(&lt;/span&gt;!&lt;span style="color:#19177C"&gt;$filename&lt;/span&gt;&lt;span style="color:#666666"&gt;)&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#666666"&gt;{&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#19177C"&gt;$_frperror&lt;/span&gt;&lt;span style="color:#666666"&gt;[&lt;/span&gt;0&lt;span style="color:#666666"&gt;]&lt;/span&gt;.TargetObject&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#666666"&gt;}&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#19177C"&gt;$filename&lt;/span&gt;
&lt;br /&gt;
&lt;span style="color:#666666"&gt;}&lt;/span&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
The script is pretty straightforward. –ErrorAction SilentlyContinue is PowerShell’s
version of &lt;a href="http://msdn.microsoft.com/en-us/library/5hsw66as.aspx"&gt;On Error
Resume Next&lt;/a&gt; in Visual Basic. If the cmdlet encounters an error, it gets stashed
away in the variable specified by ErrorVariable (it’s also added to $Error so you
can still retrieve the error object if ErrorVariable isn’t specified) and continues
processing. Then I manually check to see if resolve-path succeeded – i.e. did it return
a value – and return the TargetObject of the Error object if it didn’t. 
&lt;/p&gt;
&lt;p&gt;
As I said, fragile and kinda messy. But it works. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=0f11ab8d-df0d-458c-8ee5-105b1fdedcd3" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=0f11ab8d-df0d-458c-8ee5-105b1fdedcd3</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,0f11ab8d-df0d-458c-8ee5-105b1fdedcd3.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,0f11ab8d-df0d-458c-8ee5-105b1fdedcd3.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=0f11ab8d-df0d-458c-8ee5-105b1fdedcd3</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments></item><item><title>Job Opening on my Team</title><link>http://devhawk.net/2009/12/07/Job+Opening+On+My+Team.aspx</link><category>Other/Working at MSFT</category><category>Windows</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Mon, 07 Dec 2009 11:49:10 PST</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,8b7ad043-5c02-4753-b59a-c897bce205b5.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’m just starting the third week in my new job – though between Thanksgiving and an
intestinal virus, I’ve only been in my office for five days total so far. That’s not
enough time to establish enough groundwork to be comfortable talking about what my
team is doing yet. However, I just found out we’re still hiring and better yet there’s
a public description of the job opening. So if you’ve ever thought “I want to work
for Microsoft/Windows Division/With Harry”, here’s your chance! And if you aren’t
looking for a new job, at least you can get some small hints as to what I’m doing
in my new gig - “building substantial improvements into the Windows development platform”
sounds interesting, doesn’t it?
</p>
        <blockquote>
          <p>
            <strong>
              <a href="https://careers.microsoft.com/JobDetails.aspx?jid=9986">Senior Program
Manager(708846 -External)</a>
            </strong>
          </p>
          <p>
Job Category: Software Engineering: Program Management 
<br>
Location: United States, WA, Redmond 
<br>
Job ID: 708846 9986 
<br>
Product: Windows  
<br>
Division: Windows Division
</p>
          <p>
Developers! Developers! Developers!
</p>
          <p>
Developers are the key to the success of Windows and at the center of a software ecosystem
that represents hundreds of billions of dollars. Our team is chartered with reinvigorating
the Windows developer ecosystem by building substantial improvements into the Windows
development platform (APIs, tools and the underlying infrastructure) and making developing
for Windows fun!
</p>
          <p>
The team is currently seeking a Senior Program Manager to help us achieve our mission.
The ideal candidate will have:
</p>
          <ul>
            <li>
Strong core PM competencies with special emphasis on developer tools and collaboration
skills.</li>
            <li>
Proven track-record of delivering results in a cross-team (ideally cross-division)
environment. 
</li>
            <li>
Has been a Program Manager shipping key products for at least 6 years.</li>
            <li>
Deep empathy for the developer as a customer; ability to empathize through 1st hand
experience of writing apps some of the issues developers are facing with respect to
APIs, tooling such as Visual Studio and SDK.</li>
            <li>
A demonstrated track record of excellence and delivering in ambiguous V1 situations.</li>
            <li>
Has Bachelors in Computer Science or engineering.</li>
          </ul>
        </blockquote>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=8b7ad043-5c02-4753-b59a-c897bce205b5"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=-3KUfaai87Y:2UCHKDsC1v0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=-3KUfaai87Y:2UCHKDsC1v0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=-3KUfaai87Y:2UCHKDsC1v0:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=-3KUfaai87Y:2UCHKDsC1v0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=-3KUfaai87Y:2UCHKDsC1v0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=-3KUfaai87Y:2UCHKDsC1v0:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/-3KUfaai87Y" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
I’m just starting the third week in my new job – though between Thanksgiving and an
intestinal virus, I’ve only been in my office for five days total so far. That’s not
enough time to establish enough groundwork to be comfortable talking about what my
team is doing yet. However, I just found out we’re still hiring and better yet there’s
a public description of the job opening. So if you’ve ever thought “I want to work
for Microsoft/Windows Division/With Harry”, here’s your chance! And if you aren’t
looking for a new job, at least you can get some small hints as to what I’m doing
in my new gig - “building substantial improvements into the Windows development platform”
sounds interesting, doesn’t it?
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;&lt;a href="https://careers.microsoft.com/JobDetails.aspx?jid=9986"&gt;Senior Program
Manager(708846 -External)&lt;/a&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Job Category: Software Engineering: Program Management 
&lt;br /&gt;
Location: United States, WA, Redmond 
&lt;br /&gt;
Job ID: 708846 9986 
&lt;br /&gt;
Product: Windows&amp;#160; 
&lt;br /&gt;
Division: Windows Division
&lt;/p&gt;
&lt;p&gt;
Developers! Developers! Developers!
&lt;/p&gt;
&lt;p&gt;
Developers are the key to the success of Windows and at the center of a software ecosystem
that represents hundreds of billions of dollars. Our team is chartered with reinvigorating
the Windows developer ecosystem by building substantial improvements into the Windows
development platform (APIs, tools and the underlying infrastructure) and making developing
for Windows fun!
&lt;/p&gt;
&lt;p&gt;
The team is currently seeking a Senior Program Manager to help us achieve our mission.
The ideal candidate will have:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Strong core PM competencies with special emphasis on developer tools and collaboration
skills.&lt;/li&gt;
&lt;li&gt;
Proven track-record of delivering results in a cross-team (ideally cross-division)
environment. 
&lt;/li&gt;
&lt;li&gt;
Has been a Program Manager shipping key products for at least 6 years.&lt;/li&gt;
&lt;li&gt;
Deep empathy for the developer as a customer; ability to empathize through 1st hand
experience of writing apps some of the issues developers are facing with respect to
APIs, tooling such as Visual Studio and SDK.&lt;/li&gt;
&lt;li&gt;
A demonstrated track record of excellence and delivering in ambiguous V1 situations.&lt;/li&gt;
&lt;li&gt;
Has Bachelors in Computer Science or engineering.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=8b7ad043-5c02-4753-b59a-c897bce205b5" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=8b7ad043-5c02-4753-b59a-c897bce205b5</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,8b7ad043-5c02-4753-b59a-c897bce205b5.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,8b7ad043-5c02-4753-b59a-c897bce205b5.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=8b7ad043-5c02-4753-b59a-c897bce205b5</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments></item><item><title>The SOA Manifesto &amp;ndash; Pointlessness Manifested</title><link>http://devhawk.net/2009/10/28/The+SOA+Manifesto+Ndash+Pointlessness+Manifested.aspx</link><category>Architecture</category><category>Architecture/SOA</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Tue, 27 Oct 2009 17:31:37 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,5b689c6b-a26f-4f71-8a1a-fe2f1e876e42.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.agilemanifesto.org/">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" border="0" align="right" src="http://www.agilemanifesto.org/background.jpg" width="240" height="180"></img>
          </a>You
know what the <a href="http://www.agilemanifesto.org/">Agile Manifesto</a> doesn’t
have? Video of a “very formal ceremony” announcing said manifesto. Instead, we just
have <a href="http://www.agilemanifesto.org/background.jpg">artistically rendered
picture</a> of what sure looks like <a href="http://www.martinfowler.com/">Martin
Fowler</a> pointing at a white board while some of the other original signatories
look on. Sure, it’s a cool picture, but wouldn’t it have been much cooler if they
had captured that moment on video instead? Especially if it was video of them all
standing around looking vaguely uncomfortable while photographers took their picture
and someone gravely read the manifesto to give it artificially inflated importance. 
</p>
        <p>
I only watched ten seconds of the <a href="http://soa-manifesto.org/">SOA Manifesto</a><a href="http://www.youtube.com/watch?v=TCg16oTZSV0">announcement
video</a> before I realized there’s nothing to see here, move along, just a bunch
of navel gazing from the <a href="http://thomaserl.com/">usual SOA suspects</a>. 
</p>
        <p>
Seriously, if you having a big announcement about how cool, earth shattering, significant
or, hell, even interesting your manifesto is, then it’s not any of those things. It’s
a waste of my time.
</p>
        <p>
Then I noticed that my previous manager and personal friend <a href="http://blogs.msdn.com/jdevados/">John
deVadoss</a> is one of the signatories. I have metric tons of respect for John, so
I gave the SOA Manifesto a second chance. 
</p>
        <p>
It lost me at the second sentence. 
</p>
        <blockquote>
          <p>
Service orientation is a paradigm that frames what you do. <strong>Service-oriented
architecture (SOA) is a type of architecture that results from applying service orientation. </strong>We
have been applying service orientation to help organizations consistently deliver
sustainable business value, with increased agility and cost effectiveness, in line
with changing business needs.
</p>
        </blockquote>
        <p>
Are you frakking kidding me? “Service-oriented architecture (SOA) is a type of architecture
that results from applying service orientation.” Who the hell came up with that? I
didn’t realize the <a href="http://soasymposium.com/">International SOA Symposium</a> had
a Department of Redundancy Department. 
</p>
        <p>
When you define SOA in terms of SO, then you can’t possibly score well on the practicality
quotient.
</p>
        <p>
The rest of the manifesto isn’t much better. What made the Agile manifesto great IMO
was that it ran counter to “common” beliefs like “changing requirements late in the
process is bad” and “shipping software cycles should take years”. Sure, we all realize
how right those Agile manifesto guys were <em><u>now</u></em>, but at the time it
was the next best thing to heresy for many organizations. Those guys were agents of
change. And I mean real change, not “this will help me sell books” change.
</p>
        <p>
SOA manifesto on the other hand is basically repackaged common sense. Stuff like “Recognize
that SOA ultimately demands change on many levels” and “The scope of SOA adoption
can vary. Keep efforts manageable and within meaningful boundaries” Any help figuring
out what that change is or what the scope should be? Nope. Thanks for the advice guys,
but I had your so called “Guiding Principles” figured out long ago. 
</p>
        <p>
But hey, I’m sure the manifesto will help Thomas Erl et. al. sell more SOA books.
So, I guess from that perspective it’s mission accomplished.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=5b689c6b-a26f-4f71-8a1a-fe2f1e876e42"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=fvP9DMqKzU0:lxyPeoNJc0E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=fvP9DMqKzU0:lxyPeoNJc0E:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=fvP9DMqKzU0:lxyPeoNJc0E:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=fvP9DMqKzU0:lxyPeoNJc0E:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=fvP9DMqKzU0:lxyPeoNJc0E:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=fvP9DMqKzU0:lxyPeoNJc0E:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/fvP9DMqKzU0" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
&lt;a href="http://www.agilemanifesto.org/"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" border="0" align="right" src="http://www.agilemanifesto.org/background.jpg" width="240" height="180" /&gt;&lt;/a&gt;You
know what the &lt;a href="http://www.agilemanifesto.org/"&gt;Agile Manifesto&lt;/a&gt; doesn’t
have? Video of a “very formal ceremony” announcing said manifesto. Instead, we just
have &lt;a href="http://www.agilemanifesto.org/background.jpg"&gt;artistically rendered
picture&lt;/a&gt; of what sure looks like &lt;a href="http://www.martinfowler.com/"&gt;Martin
Fowler&lt;/a&gt; pointing at a white board while some of the other original signatories
look on. Sure, it’s a cool picture, but wouldn’t it have been much cooler if they
had captured that moment on video instead? Especially if it was video of them all
standing around looking vaguely uncomfortable while photographers took their picture
and someone gravely read the manifesto to give it artificially inflated importance. 
&lt;/p&gt;
&lt;p&gt;
I only watched ten seconds of the &lt;a href="http://soa-manifesto.org/"&gt;SOA Manifesto&lt;/a&gt; &lt;a href="http://www.youtube.com/watch?v=TCg16oTZSV0"&gt;announcement
video&lt;/a&gt; before I realized there’s nothing to see here, move along, just a bunch
of navel gazing from the &lt;a href="http://thomaserl.com/"&gt;usual SOA suspects&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Seriously, if you having a big announcement about how cool, earth shattering, significant
or, hell, even interesting your manifesto is, then it’s not any of those things. It’s
a waste of my time.
&lt;/p&gt;
&lt;p&gt;
Then I noticed that my previous manager and personal friend &lt;a href="http://blogs.msdn.com/jdevados/"&gt;John
deVadoss&lt;/a&gt; is one of the signatories. I have metric tons of respect for John, so
I gave the SOA Manifesto a second chance. 
&lt;/p&gt;
&lt;p&gt;
It lost me at the second sentence. 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Service orientation is a paradigm that frames what you do. &lt;strong&gt;Service-oriented
architecture (SOA) is a type of architecture that results from applying service orientation. &lt;/strong&gt;We
have been applying service orientation to help organizations consistently deliver
sustainable business value, with increased agility and cost effectiveness, in line
with changing business needs.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Are you frakking kidding me? “Service-oriented architecture (SOA) is a type of architecture
that results from applying service orientation.” Who the hell came up with that? I
didn’t realize the &lt;a href="http://soasymposium.com/"&gt;International SOA Symposium&lt;/a&gt; had
a Department of Redundancy Department. 
&lt;/p&gt;
&lt;p&gt;
When you define SOA in terms of SO, then you can’t possibly score well on the practicality
quotient.
&lt;/p&gt;
&lt;p&gt;
The rest of the manifesto isn’t much better. What made the Agile manifesto great IMO
was that it ran counter to “common” beliefs like “changing requirements late in the
process is bad” and “shipping software cycles should take years”. Sure, we all realize
how right those Agile manifesto guys were &lt;em&gt;&lt;u&gt;now&lt;/u&gt;&lt;/em&gt;, but at the time it
was the next best thing to heresy for many organizations. Those guys were agents of
change. And I mean real change, not “this will help me sell books” change.
&lt;/p&gt;
&lt;p&gt;
SOA manifesto on the other hand is basically repackaged common sense. Stuff like “Recognize
that SOA ultimately demands change on many levels” and “The scope of SOA adoption
can vary. Keep efforts manageable and within meaningful boundaries” Any help figuring
out what that change is or what the scope should be? Nope. Thanks for the advice guys,
but I had your so called “Guiding Principles” figured out long ago. 
&lt;/p&gt;
&lt;p&gt;
But hey, I’m sure the manifesto will help Thomas Erl et. al. sell more SOA books.
So, I guess from that perspective it’s mission accomplished.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=5b689c6b-a26f-4f71-8a1a-fe2f1e876e42" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=5b689c6b-a26f-4f71-8a1a-fe2f1e876e42</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,5b689c6b-a26f-4f71-8a1a-fe2f1e876e42.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,5b689c6b-a26f-4f71-8a1a-fe2f1e876e42.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=5b689c6b-a26f-4f71-8a1a-fe2f1e876e42</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">3</slash:comments></item><item><title>IronPython 2.0.3 and 2.6 RC2</title><link>http://devhawk.net/2009/10/27/IronPython+203+And+26+RC2.aspx</link><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Tue, 27 Oct 2009 14:29:29 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,a105b675-f06a-4548-a8f3-3525a5b96654.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It has been a very busy week for the IronPython team. Just under a week ago, we shipped
a <a href="http://devhawk.net/2009/10/21/IronPython+And+IronRuby+CTPs+For+NET+40+Beta+2.aspx">CTP
for .NET Framework 4.0</a>. Since then, we’ve shipped two – yes, two! – more versions
of IronPython. Three releases in one week! If we could keep up that pace, we’d be
shipping like 27 more releases of IronPython by the end of the year!
</p>
        <p>
FYI, we’re not going to keep up the pace of shipping three releases a week for the
next two months. We may be a little crazy on the IronPython team, but we’re not THAT
crazy!
</p>
        <p>
Actually, all three of these releases represent fairly small changes in the IronPython
source tree. The .NET 4.0 beta was a CTP, so it’s basically whatever we had in our
main trunk when they forked .NET Framework for the beta. 
</p>
        <p>
          <a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30416">IronPython
2.0.3</a> is a minor point release in the 2.0 branch (duh). In addition to backporting
some fixes from 2.6, we had to fix an CLR breaking change in partial trust on Windows
7. If you’re using IronPython 2.0.x in partial trust on Windows 7 you *MUST* upgrade
to 2.0.3 (or 2.6 when it’s released). Sorry about that – but it was out of our hands. 
</p>
        <p>
          <a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34451">IronPython
2.6 RC2</a> is – as you would expect - a minor update over the first release candidate.
There was a memory leak discovered in the hosting APIs which forced us to do a second
release candidate. Since we had to fix that, we took in a few of other fixes including
some standard library changes (we left out json by accident in RC1 and Michael Foord
got logging updated to work better with IronPython so we took the latest version of
it). As per the release notes, we expect this to be the final RC and will re-ship
it as RTM in about a month. Please start using this latest release and let us know
if you find anything.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=a105b675-f06a-4548-a8f3-3525a5b96654"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=c-8lzy9AXWQ:C4wpam1egaI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=c-8lzy9AXWQ:C4wpam1egaI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=c-8lzy9AXWQ:C4wpam1egaI:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=c-8lzy9AXWQ:C4wpam1egaI:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=c-8lzy9AXWQ:C4wpam1egaI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=c-8lzy9AXWQ:C4wpam1egaI:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/c-8lzy9AXWQ" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
It has been a very busy week for the IronPython team. Just under a week ago, we shipped
a &lt;a href="http://devhawk.net/2009/10/21/IronPython+And+IronRuby+CTPs+For+NET+40+Beta+2.aspx"&gt;CTP
for .NET Framework 4.0&lt;/a&gt;. Since then, we’ve shipped two – yes, two! – more versions
of IronPython. Three releases in one week! If we could keep up that pace, we’d be
shipping like 27 more releases of IronPython by the end of the year!
&lt;/p&gt;
&lt;p&gt;
FYI, we’re not going to keep up the pace of shipping three releases a week for the
next two months. We may be a little crazy on the IronPython team, but we’re not THAT
crazy!
&lt;/p&gt;
&lt;p&gt;
Actually, all three of these releases represent fairly small changes in the IronPython
source tree. The .NET 4.0 beta was a CTP, so it’s basically whatever we had in our
main trunk when they forked .NET Framework for the beta. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30416"&gt;IronPython
2.0.3&lt;/a&gt; is a minor point release in the 2.0 branch (duh). In addition to backporting
some fixes from 2.6, we had to fix an CLR breaking change in partial trust on Windows
7. If you’re using IronPython 2.0.x in partial trust on Windows 7 you *MUST* upgrade
to 2.0.3 (or 2.6 when it’s released). Sorry about that – but it was out of our hands. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34451"&gt;IronPython
2.6 RC2&lt;/a&gt; is – as you would expect - a minor update over the first release candidate.
There was a memory leak discovered in the hosting APIs which forced us to do a second
release candidate. Since we had to fix that, we took in a few of other fixes including
some standard library changes (we left out json by accident in RC1 and Michael Foord
got logging updated to work better with IronPython so we took the latest version of
it). As per the release notes, we expect this to be the final RC and will re-ship
it as RTM in about a month. Please start using this latest release and let us know
if you find anything.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=a105b675-f06a-4548-a8f3-3525a5b96654" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=a105b675-f06a-4548-a8f3-3525a5b96654</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,a105b675-f06a-4548-a8f3-3525a5b96654.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,a105b675-f06a-4548-a8f3-3525a5b96654.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a105b675-f06a-4548-a8f3-3525a5b96654</wfw:commentRss></item><item><title>Joining Windows</title><link>http://devhawk.net/2009/10/27/Joining+Windows.aspx</link><category>IronPython</category><category>Other/Working at MSFT</category><category>Windows</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Mon, 26 Oct 2009 17:22:43 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,16570446-12d5-47c1-be94-5a8d1754110a.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Big news in DevHawk land: I’ll be taking on a new role in the <a href="http://www.microsoft.com/windows/">Windows</a> division
after I come back from <a href="http://www.msteched.com/europe/Public/">TechEd Europe</a> (plus
a week vacation visiting my bro-in-law in Germany after TechEd). 
</p>
        <p>
You guys have heard of Windows, right? They just released <a href="http://www.microsoft.com/Windows/windows-7/default.aspx">a
new version</a> recently you might be aware of…Actually, I hear it was <a href="http://seattletimes.nwsource.com/html/microsoftpri0/2010119125_windows_7_launch_microsoft_new_ads_say_windows_was.html">your
idea</a>!
</p>
        <p>
Seriously, I am <em><u>stoked</u></em>to be joining the Windows team. I can’t say
much about the new job beyond a) it’s in Windows Client (as opposed to Windows Server)
and b) I’m working on a team that’s focused on the Windows developer experience. The
Windows team is deep in what you might call “building on teh awesome that is Windows
7” but that they simply call “planning”, so sorry if specifics are kinda sparse. I’ll
be back working for <a href="http://twitter.com/maheshp">Mahesh Prakriya</a>, who
originally hired me into my current role on the IronPython team. Someday I might tell
you the Mahesh PyCon Lego Story, but for now I’ll just say I was great working for
Mahesh the first time and I think this time is going to be even better. 
</p>
        <p>
Working on Windows…focused on developer experience…for Mahesh - It’s like the perfect
storm of work geekdom for me.
</p>
        <p>
Of course, starting a new job means my time on the IronPython team is coming to an
end. As excited as I am about this new opportunity in the Windows division, I’m a
little sad to be leaving Developer Division and the IronPython team. I’ve joked with
audiences that I care about Python because Microsoft pays me to care about Python,
but that’s not completely true. <a href="http://python.org/">Python</a> is a fantastic
language and IronPython’s combination of Python + .NET is hard to beat in my opinion.
IronPython has made significant progress while I’ve been here the last eighteen months
– two major releases (well, 2.6 is almost done), redisting the Python standard library,
Visual Studio 2010 compat - but there’s still much for IronPython to accomplish. And
of course, leaving behind such great teammates like <a href="http://twitter.com/dinoviehland">Dino</a>, <a href="http://twitter.com/davefugate">Dave</a>, <a href="http://twitter.com/jredville">Jim</a> and <a href="http://twitter.com/jschementi">Jimmy</a> is
ALWAYS hard. 
</p>
        <p>
The Windows team is somewhat tighter lipped than the totally transparent approach
we use in IronPython. Not to worry, my evangelism skills were part of the reason I
got the job so you’ll be hearing plenty from me soon enough. However, my posting here
will be kinda sparse until I get my bearings over there. Until then, I’m sure that
you will be absolutely fascinated by non-work-related-but-still-sometimes-geeky minutia
I <a href="http://twitter.com/devhawk">post on Twitter</a>.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=16570446-12d5-47c1-be94-5a8d1754110a"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=cdg-0GFJTHU:OuyJwrL5PoQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=cdg-0GFJTHU:OuyJwrL5PoQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=cdg-0GFJTHU:OuyJwrL5PoQ:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=cdg-0GFJTHU:OuyJwrL5PoQ:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=cdg-0GFJTHU:OuyJwrL5PoQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=cdg-0GFJTHU:OuyJwrL5PoQ:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/cdg-0GFJTHU" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
Big news in DevHawk land: I’ll be taking on a new role in the &lt;a href="http://www.microsoft.com/windows/"&gt;Windows&lt;/a&gt; division
after I come back from &lt;a href="http://www.msteched.com/europe/Public/"&gt;TechEd Europe&lt;/a&gt; (plus
a week vacation visiting my bro-in-law in Germany after TechEd). 
&lt;/p&gt;
&lt;p&gt;
You guys have heard of Windows, right? They just released &lt;a href="http://www.microsoft.com/Windows/windows-7/default.aspx"&gt;a
new version&lt;/a&gt; recently you might be aware of…Actually, I hear it was &lt;a href="http://seattletimes.nwsource.com/html/microsoftpri0/2010119125_windows_7_launch_microsoft_new_ads_say_windows_was.html"&gt;your
idea&lt;/a&gt;!
&lt;/p&gt;
&lt;p&gt;
Seriously, I am &lt;em&gt;&lt;u&gt;stoked&lt;/u&gt; &lt;/em&gt;to be joining the Windows team. I can’t say
much about the new job beyond a) it’s in Windows Client (as opposed to Windows Server)
and b) I’m working on a team that’s focused on the Windows developer experience. The
Windows team is deep in what you might call “building on teh awesome that is Windows
7” but that they simply call “planning”, so sorry if specifics are kinda sparse. I’ll
be back working for &lt;a href="http://twitter.com/maheshp"&gt;Mahesh Prakriya&lt;/a&gt;, who
originally hired me into my current role on the IronPython team. Someday I might tell
you the Mahesh PyCon Lego Story, but for now I’ll just say I was great working for
Mahesh the first time and I think this time is going to be even better. 
&lt;/p&gt;
&lt;p&gt;
Working on Windows…focused on developer experience…for Mahesh - It’s like the perfect
storm of work geekdom for me.
&lt;/p&gt;
&lt;p&gt;
Of course, starting a new job means my time on the IronPython team is coming to an
end. As excited as I am about this new opportunity in the Windows division, I’m a
little sad to be leaving Developer Division and the IronPython team. I’ve joked with
audiences that I care about Python because Microsoft pays me to care about Python,
but that’s not completely true. &lt;a href="http://python.org/"&gt;Python&lt;/a&gt; is a fantastic
language and IronPython’s combination of Python + .NET is hard to beat in my opinion.
IronPython has made significant progress while I’ve been here the last eighteen months
– two major releases (well, 2.6 is almost done), redisting the Python standard library,
Visual Studio 2010 compat - but there’s still much for IronPython to accomplish. And
of course, leaving behind such great teammates like &lt;a href="http://twitter.com/dinoviehland"&gt;Dino&lt;/a&gt;, &lt;a href="http://twitter.com/davefugate"&gt;Dave&lt;/a&gt;, &lt;a href="http://twitter.com/jredville"&gt;Jim&lt;/a&gt; and &lt;a href="http://twitter.com/jschementi"&gt;Jimmy&lt;/a&gt; is
ALWAYS hard. 
&lt;/p&gt;
&lt;p&gt;
The Windows team is somewhat tighter lipped than the totally transparent approach
we use in IronPython. Not to worry, my evangelism skills were part of the reason I
got the job so you’ll be hearing plenty from me soon enough. However, my posting here
will be kinda sparse until I get my bearings over there. Until then, I’m sure that
you will be absolutely fascinated by non-work-related-but-still-sometimes-geeky minutia
I &lt;a href="http://twitter.com/devhawk"&gt;post on Twitter&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=16570446-12d5-47c1-be94-5a8d1754110a" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=16570446-12d5-47c1-be94-5a8d1754110a</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,16570446-12d5-47c1-be94-5a8d1754110a.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,16570446-12d5-47c1-be94-5a8d1754110a.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=16570446-12d5-47c1-be94-5a8d1754110a</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">5</slash:comments></item><item><title>IronPython and IronRuby CTPs for .NET 4.0 Beta 2</title><link>http://devhawk.net/2009/10/21/IronPython+And+IronRuby+CTPs+For+NET+40+Beta+2.aspx</link><category>IronPython</category><category>IronRuby</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 21 Oct 2009 15:27:16 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,f7eb4d9e-0459-4fc6-a8be-0dd56f902d9d.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="VS_v_rgb" border="0" alt="VS_v_rgb" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/IronPythonandIronRubyCTPsfor.NET4.0Beta2_D952/VS_v_rgb_3.png" width="300" height="117"></img>
          </a> In
case you’ve been hiding under a rock (or maybe just aren’t tracking developments in
the .NET community outside of IronPython), Microsoft <a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx">released
Visual Studio 2010 beta 2</a> this week. Of course for me personally, the most important
feature in Visual Studio 2010 is <a href="http://msdn.microsoft.com/en-us/library/dd264736(VS.100).aspx">C#
4.0 new dynamic type</a> (<a href="http://msdn.microsoft.com/en-us/library/dd537660(VS.100).aspx">also
available in Visual Basic</a>, but since VB already supported some level of late binding
it’s not exactly “new” to VB). 
</p>
        <p>
For those of you who want to experiment with this cool new feature, may I present <a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28125">IronPython
2.6 CTP for .NET 4.0 Beta 2</a>. If you can’t think of any cool things to try with
this new feature, the VB team blog <a href="http://blogs.msdn.com/vbteam/archive/2008/12/17/walkthrough-dynamic-programming-in-visual-basic-10-0-and-c-4-0-lisa-feigenbaum.aspx">has
some scenarios</a> to get your started. 
</p>
        <p>
Also available: <a href="http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33305">IronRuby
CTP for .NET 4.0 Beta 2</a> if you’re more into gemstones than snakes.
</p>
        <p>
These are preview releases, which means they’ve gone thru basic testing. If you find
any bugs, PLEASE report them via <a href="http://ironpython.codeplex.com/WorkItem/Create.aspx">the
usual channel</a>. I wrote in my Post 2.6 Roadmap post, “we are committed to shipping
the RTM of our .NET 4.0 version the day that Visual Studio 2010 is publicly available”
but that means shaking out the bugs between now and then. We need your help so we’re
ready to go by Visual Studio 2010 launch - March 22, 2010 <a href="http://blogs.msdn.com/somasegar/archive/2009/10/19/announcing-visual-studio-2010-and-net-fx-4-beta-2.aspx">as
per Soma’s blog</a>.
</p>
        <p>
BTW, <a href="http://alcidesfonseca.com">Alcides Fonseca</a> <a href="http://devhawk.net/CommentView,guid,dbf7d543-5a65-4642-a1f0-44f25aa1ff37.aspx#commentstart">suggested</a> we
call this release “IronPython 2.6 N4” since it’s designed to run on .NET Framework
4.0. I like that. What do you think?
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=f7eb4d9e-0459-4fc6-a8be-0dd56f902d9d"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=5op03ATVAuw:Na1n86xIm4A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=5op03ATVAuw:Na1n86xIm4A:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=5op03ATVAuw:Na1n86xIm4A:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=5op03ATVAuw:Na1n86xIm4A:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=5op03ATVAuw:Na1n86xIm4A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=5op03ATVAuw:Na1n86xIm4A:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/5op03ATVAuw" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="VS_v_rgb" border="0" alt="VS_v_rgb" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/IronPythonandIronRubyCTPsfor.NET4.0Beta2_D952/VS_v_rgb_3.png" width="300" height="117" /&gt;&lt;/a&gt; In
case you’ve been hiding under a rock (or maybe just aren’t tracking developments in
the .NET community outside of IronPython), Microsoft &lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;released
Visual Studio 2010 beta 2&lt;/a&gt; this week. Of course for me personally, the most important
feature in Visual Studio 2010 is &lt;a href="http://msdn.microsoft.com/en-us/library/dd264736(VS.100).aspx"&gt;C#
4.0 new dynamic type&lt;/a&gt; (&lt;a href="http://msdn.microsoft.com/en-us/library/dd537660(VS.100).aspx"&gt;also
available in Visual Basic&lt;/a&gt;, but since VB already supported some level of late binding
it’s not exactly “new” to VB). 
&lt;/p&gt;
&lt;p&gt;
For those of you who want to experiment with this cool new feature, may I present &lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28125"&gt;IronPython
2.6 CTP for .NET 4.0 Beta 2&lt;/a&gt;. If you can’t think of any cool things to try with
this new feature, the VB team blog &lt;a href="http://blogs.msdn.com/vbteam/archive/2008/12/17/walkthrough-dynamic-programming-in-visual-basic-10-0-and-c-4-0-lisa-feigenbaum.aspx"&gt;has
some scenarios&lt;/a&gt; to get your started. 
&lt;/p&gt;
&lt;p&gt;
Also available: &lt;a href="http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33305"&gt;IronRuby
CTP for .NET 4.0 Beta 2&lt;/a&gt; if you’re more into gemstones than snakes.
&lt;/p&gt;
&lt;p&gt;
These are preview releases, which means they’ve gone thru basic testing. If you find
any bugs, PLEASE report them via &lt;a href="http://ironpython.codeplex.com/WorkItem/Create.aspx"&gt;the
usual channel&lt;/a&gt;. I wrote in my Post 2.6 Roadmap post, “we are committed to shipping
the RTM of our .NET 4.0 version the day that Visual Studio 2010 is publicly available”
but that means shaking out the bugs between now and then. We need your help so we’re
ready to go by Visual Studio 2010 launch - March 22, 2010 &lt;a href="http://blogs.msdn.com/somasegar/archive/2009/10/19/announcing-visual-studio-2010-and-net-fx-4-beta-2.aspx"&gt;as
per Soma’s blog&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
BTW, &lt;a href="http://alcidesfonseca.com"&gt;Alcides Fonseca&lt;/a&gt;&amp;#160;&lt;a href="http://devhawk.net/CommentView,guid,dbf7d543-5a65-4642-a1f0-44f25aa1ff37.aspx#commentstart"&gt;suggested&lt;/a&gt; we
call this release “IronPython 2.6 N4” since it’s designed to run on .NET Framework
4.0. I like that. What do you think?
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=f7eb4d9e-0459-4fc6-a8be-0dd56f902d9d" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=f7eb4d9e-0459-4fc6-a8be-0dd56f902d9d</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,f7eb4d9e-0459-4fc6-a8be-0dd56f902d9d.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,f7eb4d9e-0459-4fc6-a8be-0dd56f902d9d.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=f7eb4d9e-0459-4fc6-a8be-0dd56f902d9d</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments></item><item><title>Hybrid App Debugging &amp;ndash; The Debug Window</title><link>http://devhawk.net/2009/10/09/Hybrid+App+Debugging+Ndash+The+Debug+Window.aspx</link><category>Debugger</category><category>IronPython</category><category>Lightweight Debugger</category><category>Polyglot</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Fri, 09 Oct 2009 11:18:35 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,fe530c58-39d6-46d5-ad44-40acd2c1cfdc.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In my <a href="http://devhawk.net/2009/10/09/Hybrid+App+Debugging+Ndash+Threading.aspx">last
installment</a>, I added support for a separate debug window on a separate thread
from the main window thread. That way, I can pause the execution of the main window
while the debug window stays responsive to user input. Now, let’s add some functionality
to the debug window. I’m going to start by showing the source code of the python file
being executed.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:dcfea840-226c-4ee4-b08d-2fc450756d73" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">OnTraceback</span>(TraceBackFrame frame, <span style="color:#B00040">string</span> result, <span style="color:#B00040">object</span> payload)<br>
{<br>
    FunctionCode code = (FunctionCode)frame.f_code;<br>
    <span style="color:#008000"><b>if</b></span> (_curCode == <span style="color:#008000"><b>null</b></span> || _curCode.co_filename != code.co_filename)<br>
    {<br>
        _source.Inlines.Clear();<br>
        <span style="color:#008000"><b>foreach</b></span> (var line <span style="color:#008000"><b>in</b></span> System.IO.File.ReadAllLines(code.co_filename))<br>
        {<br>
            _source.Inlines.Add(<span style="color:#008000"><b>new</b></span> Run(line + <span style="color:#BA2121">"\r\n"</span>));<br>
        }<br>
    }<br></div>
        </div>
        <p>
The TraceBackFrame instance has a property f_code that represents the FunctionCode
object being executed in this frame. We have to explicitly cast to FunctionCode type
because currently we’re exposing all properties that hang off TraceBackFrame as object
type. Since Python is a dynamic language, we’re going to use reflection against the
instance itself anyway so it doesn’t really matter what the return type is. However,
I’ve asked Dino to change the TraceBackFrame type to use explicit types in order to
make it easier to use SetTrace from statically typed languages like C#. Look for that
in RC2.
</p>
        <p>
After we cast the code object so it can be used from C#, we check to see if the currently
loaded file matches the file currently loaded into the UI. I’ve <a href="http://devhawk.net/2009/07/09/Syntax+Highlighting+TextBoxes+In+WPF+Ndash+A+Sad+Story.aspx">ranted
recently</a> about the limitations of WPF’s TextBox but I didn’t want to get hung
up syntax highlighting for this sample so I just went ahead and used the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.aspx">RichTextBox</a>.
In the DebugWindow Loaded event handler, I create _source as a WPF <a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.paragraph.aspx">Paragraph</a> and
then wrap it in a FlowDocument and use it as the RichTextBox’s Document. I set the
FlowDocument to be extremely wide, so as to avoid word wrapping. Then when I need
to load a new source file, I clear _source of it’s current contents and add a single
line run for every line of code in the file. This convention becomes useful later
when I go to highlight the current line of code. 
</p>
        <p>
Once I load the current file, I save the current frame, code, result and payload in
instance fields and then switch on result to determine what to do next. Currently,
I’m just highlighting the relevant line of code and setting a TextBlock control in
the menu bar.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:03ae047a-7cf1-445b-b5ab-78bcbf912b7d" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">TracebackCall</span>()<br>
{<br>
    dbgStatus.Text = <span style="color:#B00040">string</span>.Format(<span style="color:#BA2121">"Call {0}"</span>, _curCode.co_name);<br>
    HighlightLine((<span style="color:#B00040">int</span>)_curFrame.f_lineno, <br>
        Brushes.LightGreen, Brushes.Black);<br>
}<br><br><span style="color:#008000"><b>private</b></span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">TracebackReturn</span>()<br>
{<br>
    dbgStatus.Text = <span style="color:#B00040">string</span>.Format(<span style="color:#BA2121">"Return {0}"</span>, _curCode.co_name);<br>
    HighlightLine(_curCode.co_firstlineno, <br>
        Brushes.LightPink, Brushes.Black);<br>
}<br><br><span style="color:#008000"><b>private</b></span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">TracebackLine</span>()<br>
{<br>
    dbgStatus.Text = <span style="color:#B00040">string</span>.Format(<span style="color:#BA2121">"Line {0}"</span>, _curFrame.f_lineno);<br>
    HighlightLine((<span style="color:#B00040">int</span>)_curFrame.f_lineno, <br>
        Brushes.Yellow, Brushes.Black);<br>
}<br></div>
        </div>
        <p>
        </p>
        <p>
In Visual Studio, we typically highlight the current line of code in yellow. However,
that doesn’t work as great in a language like Python that delineates code blocks with
whitespace. In ipydbg, I <a href="http://devhawk.net/2009/03/19/Writing+An+IronPython+Debugger+Colorful+Console.aspx">indicated
function return</a> with three carets. But I didn’t want to be modifying the text
in the RichTextBox here so instead I used different colors for the different traceback
event types: light green for call, light pink for return and yellow for line. The
frame object contains the current line number, which I use for call and line, while
the code object has the first line of the current code object, which I use for return.
HighlightLine highlights the line in question with the colors provided and also scrolls
that line into view if it isn’t already visible.
</p>
        <p>
So now when a traceback is handled, it shows the text for the file being executed
and highlights the appropriate line, based on the type of traceback event that happened.
Now all we need is to have some way be able to continue execution. In the code, you’ll
see I’ve <a href="http://github.com/devhawk/LightweightDebuggerDemo/blob/deac85aaf14b37352ce4248917fd857c173d8997/LightweightDebuggerDemo/DebugWindow.xaml.cs#L21">defined
a series</a> of RoutedUICommands for common debugger commands. I’ve got the StepIn
command wired up in the <a href="http://github.com/devhawk/LightweightDebuggerDemo/blob/deac85aaf14b37352ce4248917fd857c173d8997/LightweightDebuggerDemo/DebugWindow.xaml">DebugWindow
XAML</a> to a menu item and the “S” keystroke. All that remains is to define StepInExecuted.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:58f8f796-27f2-414a-9bf3-e4001a05861b" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">StepInExecuted</span>(<span style="color:#B00040">object</span> sender, ExecutedRoutedEventArgs e)<br>
{<br>
    dbgStatus.Text = <span style="color:#BA2121">"Running"</span>;<br><br>
    <span style="color:#008000"><b>foreach</b></span> (var i <span style="color:#008000"><b>in</b></span> _source.Inlines)<br>
    {<br>
        i.Background = rtbSource.Background;<br>
        i.Foreground = rtbSource.Foreground;<br>
    }<br><br>
    _dbgContinue.Set();<br>
}<br></div>
        </div>
        <p>
This function does three basic things: changes the dbgStatus text, resets all the
text in the RichTextBox back to the default coloring, and sets the _dbgContinue AutoResetEvent
which signals the main window thread that’s been blocked in OnTracebackReceived to
continue.
</p>
        <p>
With this post, I’m about even with the code that’s <a href="http://github.com/devhawk/LightweightDebuggerDemo">up
on GitHub</a>. That code has a few other capabilities – notably it will stop tracing
if you close the debug window and it supports StepOut command which disables traceback
for the current scope by returning null in OnTracebackReceived. But I haven’t implemented
things like:
</p>
        <ul>
          <li>
Set Next Statement</li>
          <li>
Viewing and changing variables</li>
          <li>
Debugger REPL</li>
          <li>
Breakpoint Management</li>
        </ul>
        <p>
Any suggestions on which of those would you like to see next? 
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=fe530c58-39d6-46d5-ad44-40acd2c1cfdc"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=zHp7UN5CGtc:2lUM1bFXrVs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=zHp7UN5CGtc:2lUM1bFXrVs:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=zHp7UN5CGtc:2lUM1bFXrVs:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=zHp7UN5CGtc:2lUM1bFXrVs:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=zHp7UN5CGtc:2lUM1bFXrVs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=zHp7UN5CGtc:2lUM1bFXrVs:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/zHp7UN5CGtc" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
In my &lt;a href="http://devhawk.net/2009/10/09/Hybrid+App+Debugging+Ndash+Threading.aspx"&gt;last
installment&lt;/a&gt;, I added support for a separate debug window on a separate thread
from the main window thread. That way, I can pause the execution of the main window
while the debug window stays responsive to user input. Now, let’s add some functionality
to the debug window. I’m going to start by showing the source code of the python file
being executed.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:dcfea840-226c-4ee4-b08d-2fc450756d73" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;OnTraceback&lt;/span&gt;(TraceBackFrame&amp;#160;frame,&amp;#160;&lt;span style="color:#B00040"&gt;string&lt;/span&gt;&amp;#160;result,&amp;#160;&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;#160;payload)&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;FunctionCode&amp;#160;code&amp;#160;=&amp;#160;(FunctionCode)frame.f_code;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&amp;#160;(_curCode&amp;#160;==&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&amp;#160;||&amp;#160;_curCode.co_filename&amp;#160;!=&amp;#160;code.co_filename)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;_source.Inlines.Clear();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;foreach&lt;/b&gt;&lt;/span&gt;&amp;#160;(var&amp;#160;line&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/span&gt;&amp;#160;System.IO.File.ReadAllLines(code.co_filename))&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;_source.Inlines.Add(&lt;span style="color:#008000"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt;&amp;#160;Run(line&amp;#160;+&amp;#160;&lt;span style="color:#BA2121"&gt;"\r\n"&lt;/span&gt;));&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The TraceBackFrame instance has a property f_code that represents the FunctionCode
object being executed in this frame. We have to explicitly cast to FunctionCode type
because currently we’re exposing all properties that hang off TraceBackFrame as object
type. Since Python is a dynamic language, we’re going to use reflection against the
instance itself anyway so it doesn’t really matter what the return type is. However,
I’ve asked Dino to change the TraceBackFrame type to use explicit types in order to
make it easier to use SetTrace from statically typed languages like C#. Look for that
in RC2.
&lt;/p&gt;
&lt;p&gt;
After we cast the code object so it can be used from C#, we check to see if the currently
loaded file matches the file currently loaded into the UI. I’ve &lt;a href="http://devhawk.net/2009/07/09/Syntax+Highlighting+TextBoxes+In+WPF+Ndash+A+Sad+Story.aspx"&gt;ranted
recently&lt;/a&gt; about the limitations of WPF’s TextBox but I didn’t want to get hung
up syntax highlighting for this sample so I just went ahead and used the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.aspx"&gt;RichTextBox&lt;/a&gt;.
In the DebugWindow Loaded event handler, I create _source as a WPF &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.paragraph.aspx"&gt;Paragraph&lt;/a&gt; and
then wrap it in a FlowDocument and use it as the RichTextBox’s Document. I set the
FlowDocument to be extremely wide, so as to avoid word wrapping. Then when I need
to load a new source file, I clear _source of it’s current contents and add a single
line run for every line of code in the file. This convention becomes useful later
when I go to highlight the current line of code. 
&lt;/p&gt;
&lt;p&gt;
Once I load the current file, I save the current frame, code, result and payload in
instance fields and then switch on result to determine what to do next. Currently,
I’m just highlighting the relevant line of code and setting a TextBlock control in
the menu bar.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:03ae047a-7cf1-445b-b5ab-78bcbf912b7d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;TracebackCall&lt;/span&gt;()&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;dbgStatus.Text&amp;#160;=&amp;#160;&lt;span style="color:#B00040"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#BA2121"&gt;"Call&amp;#160;{0}"&lt;/span&gt;,&amp;#160;_curCode.co_name);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;HighlightLine((&lt;span style="color:#B00040"&gt;int&lt;/span&gt;)_curFrame.f_lineno,&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Brushes.LightGreen,&amp;#160;Brushes.Black);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;TracebackReturn&lt;/span&gt;()&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;dbgStatus.Text&amp;#160;=&amp;#160;&lt;span style="color:#B00040"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#BA2121"&gt;"Return&amp;#160;{0}"&lt;/span&gt;,&amp;#160;_curCode.co_name);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;HighlightLine(_curCode.co_firstlineno,&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Brushes.LightPink,&amp;#160;Brushes.Black);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;TracebackLine&lt;/span&gt;()&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;dbgStatus.Text&amp;#160;=&amp;#160;&lt;span style="color:#B00040"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#BA2121"&gt;"Line&amp;#160;{0}"&lt;/span&gt;,&amp;#160;_curFrame.f_lineno);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;HighlightLine((&lt;span style="color:#B00040"&gt;int&lt;/span&gt;)_curFrame.f_lineno,&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Brushes.Yellow,&amp;#160;Brushes.Black);&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
In Visual Studio, we typically highlight the current line of code in yellow. However,
that doesn’t work as great in a language like Python that delineates code blocks with
whitespace. In ipydbg, I &lt;a href="http://devhawk.net/2009/03/19/Writing+An+IronPython+Debugger+Colorful+Console.aspx"&gt;indicated
function return&lt;/a&gt; with three carets. But I didn’t want to be modifying the text
in the RichTextBox here so instead I used different colors for the different traceback
event types: light green for call, light pink for return and yellow for line. The
frame object contains the current line number, which I use for call and line, while
the code object has the first line of the current code object, which I use for return.
HighlightLine highlights the line in question with the colors provided and also scrolls
that line into view if it isn’t already visible.
&lt;/p&gt;
&lt;p&gt;
So now when a traceback is handled, it shows the text for the file being executed
and highlights the appropriate line, based on the type of traceback event that happened.
Now all we need is to have some way be able to continue execution. In the code, you’ll
see I’ve &lt;a href="http://github.com/devhawk/LightweightDebuggerDemo/blob/deac85aaf14b37352ce4248917fd857c173d8997/LightweightDebuggerDemo/DebugWindow.xaml.cs#L21"&gt;defined
a series&lt;/a&gt; of RoutedUICommands for common debugger commands. I’ve got the StepIn
command wired up in the &lt;a href="http://github.com/devhawk/LightweightDebuggerDemo/blob/deac85aaf14b37352ce4248917fd857c173d8997/LightweightDebuggerDemo/DebugWindow.xaml"&gt;DebugWindow
XAML&lt;/a&gt; to a menu item and the “S” keystroke. All that remains is to define StepInExecuted.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:58f8f796-27f2-414a-9bf3-e4001a05861b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;StepInExecuted&lt;/span&gt;(&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;#160;sender,&amp;#160;ExecutedRoutedEventArgs&amp;#160;e)&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;dbgStatus.Text&amp;#160;=&amp;#160;&lt;span style="color:#BA2121"&gt;"Running"&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;foreach&lt;/b&gt;&lt;/span&gt;&amp;#160;(var&amp;#160;i&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/span&gt;&amp;#160;_source.Inlines)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;i.Background&amp;#160;=&amp;#160;rtbSource.Background;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;i.Foreground&amp;#160;=&amp;#160;rtbSource.Foreground;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;_dbgContinue.Set();&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
This function does three basic things: changes the dbgStatus text, resets all the
text in the RichTextBox back to the default coloring, and sets the _dbgContinue AutoResetEvent
which signals the main window thread that’s been blocked in OnTracebackReceived to
continue.
&lt;/p&gt;
&lt;p&gt;
With this post, I’m about even with the code that’s &lt;a href="http://github.com/devhawk/LightweightDebuggerDemo"&gt;up
on GitHub&lt;/a&gt;. That code has a few other capabilities – notably it will stop tracing
if you close the debug window and it supports StepOut command which disables traceback
for the current scope by returning null in OnTracebackReceived. But I haven’t implemented
things like:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Set Next Statement&lt;/li&gt;
&lt;li&gt;
Viewing and changing variables&lt;/li&gt;
&lt;li&gt;
Debugger REPL&lt;/li&gt;
&lt;li&gt;
Breakpoint Management&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Any suggestions on which of those would you like to see next? 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=fe530c58-39d6-46d5-ad44-40acd2c1cfdc" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=fe530c58-39d6-46d5-ad44-40acd2c1cfdc</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,fe530c58-39d6-46d5-ad44-40acd2c1cfdc.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,fe530c58-39d6-46d5-ad44-40acd2c1cfdc.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=fe530c58-39d6-46d5-ad44-40acd2c1cfdc</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">5</slash:comments></item><item><title>Hybrid App Debugging &amp;ndash; Threading</title><link>http://devhawk.net/2009/10/09/Hybrid+App+Debugging+Ndash+Threading.aspx</link><category>Debugger</category><category>IronPython</category><category>Lightweight Debugger</category><category>Polyglot</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Thu, 08 Oct 2009 18:42:38 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,d69568b9-9021-46d6-aeb4-0e1bb554fbf1.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I <a href="http://devhawk.net/2009/10/07/Hybrid+App+Debugging+Ndash+TracebackDelegate+And+SetTrace.aspx">added
traceback</a> to my GetThings app in just two lines of code, but so far it doesn’t
actually do anything that you would expect a debugger to do. But before we get to
that, we need understand a little about how threading works for traceback debugging.
</p>
        <p>
As I mentioned last time, the traceback debugger works by calling into the registered
traceback handler at various times (entering/exiting a function, before executing
a line of code and on exceptions). Execution of the Python code continues when the
traceback function exits. That means that you have to block the execution thread while
you let the user poke around with the debugger UI. For a console based app, that’s
easy. For a GUI app, not so much.
</p>
        <p>
At a minimum, you need to run your debugger UI on a separate thread from your main
app window. If you want your main app window to be responsive while you debug, you’ll
need to pump messages at a minimum (<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx">DoEvents</a> in
Windows Forms, <a href="http://social.msdn.microsoft.com/forums/en-US/wpf/thread/a2988ae8-e7b8-4a62-a34f-b851aaf13886">similar
approaches are available</a> for WPF) or preferably run your python scripts on a background
thread separate from either the main window UI thread or the debugger UI thread. To
keep things simple, I’m going to simply block the main window thread while the debugger
is active.
</p>
        <p>
Since I’m going to have to setup a new thread for the debugger window, I decided to
use a static constructor to centralize creating the thread, creating the window and
registering the traceback handler all in one place.
</p>
        <p>
        </p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:5f7cd0e0-2bf2-4bd7-9a08-f107b029bee1" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>static</b>
            </span> Thread _debugThread;<br><span style="color:#008000"><b>static</b></span> DebugWindow _debugWindow;<br><span style="color:#008000"><b>static</b></span> ManualResetEvent _debugWindowReady = <span style="color:#008000"><b>new</b></span> ManualResetEvent(<span style="color:#008000"><b>false</b></span>);<br><br><span style="color:#008000"><b>public</b></span> <span style="color:#008000"><b>static</b></span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">InitDebugWindow</span>(ScriptEngine engine)<br><span style="color:#008000"><b>{</b></span><br>
    _debugThread = <span style="color:#008000"><b>new</b></span> Thread(() =&gt;<br>
    <span style="color:#008000"><b>{</b></span><br>
        _debugWindow = <span style="color:#008000"><b>new</b></span> DebugWindow(engine);<br>
        _debugWindow.Show();<br>
        Dispatcher.Run();<br>
    <span style="color:#008000"><b>}</b></span>);<br>
    _debugThread.SetApartmentState(ApartmentState.STA);<br>
    _debugThread.Start();<br><br>
    _debugWindowReady.WaitOne();<br>
    engine.SetTrace(_debugWindow.OnTracebackReceived);<br><span style="color:#008000"><b>}</b></span><br></div>
        </div>
        <p>
        </p>
        <p>
As you can see, InitDebugWindow spins up a new thread and creates the debug window
on that thread. Since it’s not the main WPF application thread, you have to explicitly
call <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.run.aspx">Dispatcher.Run</a> to
get the event queue pumping. You also have to explicitly <a href="http://msdn.microsoft.com/en-us/library/system.threading.thread.setapartmentstate.aspx">set
the apartment state</a> to be single threaded for any threads creating WPF objects.
Finally, I wait for the window to signal that it’s ready (it set’s the _debugWindowReady
AutoResetEvent in the Window Loaded event) and then call SetTrace, passing in the
debug window’s OnTracebackReceived event, on the thread that called InitDebugWindow.
</p>
        <p>
It’s critical that you call SetTrace – and thus InitDebugWindow – on the thread that’s
going to execute the Python code. Debugging in Python is <em>per thread</em>. Even
if you execute the same code in the same ScriptScope with the same ScriptEngine but
on a different thread, the traceback handler calls won’t fire. The way DebugWindow
is written, it will only support debugging a single thread, but it would be pretty
straightforward to support multiple threads by changing the way OnTracebackReceived
gets signaled to continue.
</p>
        <p>
Speaking of OnTracebackReceived, this was my initial basic implementation of it:
</p>
        <p>
        </p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:5d65e913-c52d-4aa8-b658-b3a8440c2f9d" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> TracebackDelegate <span style="color:#0000FF">OnTracebackReceived</span><br>
    (TraceBackFrame frame, <span style="color:#B00040">string</span> result, <span style="color:#B00040">object</span> payload)<br><span style="color:#008000"><b>{</b></span><br>
    Action&lt;TraceBackFrame, <span style="color:#B00040">string</span>, <span style="color:#B00040">object</span>&gt; tbAction = <span style="color:#008000"><b>this</b></span>.OnTraceback;<br>
    <span style="color:#008000"><b>this</b></span>.Dispatcher.BeginInvoke(tbAction, frame, result, payload);<br>
    _dbgContinue.WaitOne();<br>
    <span style="color:#008000"><b>return</b></span> <span style="color:#008000"><b>this</b></span>.OnTracebackReceived;<br><span style="color:#008000"><b>}</b></span><br></div>
        </div>
        <p>
        </p>
        <p>
As we saw, the DebugWindow is running on a different thread than the traceback handler
call will come in on. So OnTracebackReceived needs to invoke a new call on the correct
thread by using <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.begininvoke.aspx">Dispatcher.BeginInvoke</a>.
Even though OnTracebackReceived is always called on the main window thread, it still
has access to the properties of the debug window thread like its Dispatcher. I used
BeginInvoke to invoke OnTraceback asynchronously – OnTraceback isn’t going to return
anything interesting and we’re going to wait on an AutoResetEvent before continuing
anyway so I didn’t see any reason to use a synchronous call. 
</p>
        <p>
We’ll discuss OnTraceback more next post, but basically it will configure the UI for
the traceback event that happened. Then DebugWindow will wait for user input. When
the user indicates they want to resume execution, the command handler in question
will set _dbgContinue and the original traceback will return so execution can continue. 
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=d69568b9-9021-46d6-aeb4-0e1bb554fbf1"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=nQURz_4Y9JA:leL1WorzP6c:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=nQURz_4Y9JA:leL1WorzP6c:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=nQURz_4Y9JA:leL1WorzP6c:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=nQURz_4Y9JA:leL1WorzP6c:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=nQURz_4Y9JA:leL1WorzP6c:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=nQURz_4Y9JA:leL1WorzP6c:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/nQURz_4Y9JA" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
I &lt;a href="http://devhawk.net/2009/10/07/Hybrid+App+Debugging+Ndash+TracebackDelegate+And+SetTrace.aspx"&gt;added
traceback&lt;/a&gt; to my GetThings app in just two lines of code, but so far it doesn’t
actually do anything that you would expect a debugger to do. But before we get to
that, we need understand a little about how threading works for traceback debugging.
&lt;/p&gt;
&lt;p&gt;
As I mentioned last time, the traceback debugger works by calling into the registered
traceback handler at various times (entering/exiting a function, before executing
a line of code and on exceptions). Execution of the Python code continues when the
traceback function exits. That means that you have to block the execution thread while
you let the user poke around with the debugger UI. For a console based app, that’s
easy. For a GUI app, not so much.
&lt;/p&gt;
&lt;p&gt;
At a minimum, you need to run your debugger UI on a separate thread from your main
app window. If you want your main app window to be responsive while you debug, you’ll
need to pump messages at a minimum (&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx"&gt;DoEvents&lt;/a&gt; in
Windows Forms, &lt;a href="http://social.msdn.microsoft.com/forums/en-US/wpf/thread/a2988ae8-e7b8-4a62-a34f-b851aaf13886"&gt;similar
approaches are available&lt;/a&gt; for WPF) or preferably run your python scripts on a background
thread separate from either the main window UI thread or the debugger UI thread. To
keep things simple, I’m going to simply block the main window thread while the debugger
is active.
&lt;/p&gt;
&lt;p&gt;
Since I’m going to have to setup a new thread for the debugger window, I decided to
use a static constructor to centralize creating the thread, creating the window and
registering the traceback handler all in one place.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:5f7cd0e0-2bf2-4bd7-9a08-f107b029bee1" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt;&amp;#160;Thread&amp;#160;_debugThread;&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt;&amp;#160;DebugWindow&amp;#160;_debugWindow;&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt;&amp;#160;ManualResetEvent&amp;#160;_debugWindowReady&amp;#160;=&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt;&amp;#160;ManualResetEvent(&lt;span style="color:#008000"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/span&gt;);&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;InitDebugWindow&lt;/span&gt;(ScriptEngine&amp;#160;engine)&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;_debugThread&amp;#160;=&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt;&amp;#160;Thread(()&amp;#160;=&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;_debugWindow&amp;#160;=&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt;&amp;#160;DebugWindow(engine);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;_debugWindow.Show();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Dispatcher.Run();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;_debugThread.SetApartmentState(ApartmentState.STA);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;_debugThread.Start();&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;_debugWindowReady.WaitOne();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;engine.SetTrace(_debugWindow.OnTracebackReceived);&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
As you can see, InitDebugWindow spins up a new thread and creates the debug window
on that thread. Since it’s not the main WPF application thread, you have to explicitly
call &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.run.aspx"&gt;Dispatcher.Run&lt;/a&gt; to
get the event queue pumping. You also have to explicitly &lt;a href="http://msdn.microsoft.com/en-us/library/system.threading.thread.setapartmentstate.aspx"&gt;set
the apartment state&lt;/a&gt; to be single threaded for any threads creating WPF objects.
Finally, I wait for the window to signal that it’s ready (it set’s the _debugWindowReady
AutoResetEvent in the Window Loaded event) and then call SetTrace, passing in the
debug window’s OnTracebackReceived event, on the thread that called InitDebugWindow.
&lt;/p&gt;
&lt;p&gt;
It’s critical that you call SetTrace – and thus InitDebugWindow – on the thread that’s
going to execute the Python code. Debugging in Python is &lt;em&gt;per thread&lt;/em&gt;. Even
if you execute the same code in the same ScriptScope with the same ScriptEngine but
on a different thread, the traceback handler calls won’t fire. The way DebugWindow
is written, it will only support debugging a single thread, but it would be pretty
straightforward to support multiple threads by changing the way OnTracebackReceived
gets signaled to continue.
&lt;/p&gt;
&lt;p&gt;
Speaking of OnTracebackReceived, this was my initial basic implementation of it:
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:5d65e913-c52d-4aa8-b658-b3a8440c2f9d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;TracebackDelegate&amp;#160;&lt;span style="color:#0000FF"&gt;OnTracebackReceived&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;(TraceBackFrame&amp;#160;frame,&amp;#160;&lt;span style="color:#B00040"&gt;string&lt;/span&gt;&amp;#160;result,&amp;#160;&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;#160;payload)&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;Action&amp;lt;TraceBackFrame,&amp;#160;&lt;span style="color:#B00040"&gt;string&lt;/span&gt;,&amp;#160;&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;gt;&amp;#160;tbAction&amp;#160;=&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;.OnTraceback;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;.Dispatcher.BeginInvoke(tbAction,&amp;#160;frame,&amp;#160;result,&amp;#160;payload);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;_dbgContinue.WaitOne();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;.OnTracebackReceived;&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
As we saw, the DebugWindow is running on a different thread than the traceback handler
call will come in on. So OnTracebackReceived needs to invoke a new call on the correct
thread by using &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.begininvoke.aspx"&gt;Dispatcher.BeginInvoke&lt;/a&gt;.
Even though OnTracebackReceived is always called on the main window thread, it still
has access to the properties of the debug window thread like its Dispatcher. I used
BeginInvoke to invoke OnTraceback asynchronously – OnTraceback isn’t going to return
anything interesting and we’re going to wait on an AutoResetEvent before continuing
anyway so I didn’t see any reason to use a synchronous call. 
&lt;/p&gt;
&lt;p&gt;
We’ll discuss OnTraceback more next post, but basically it will configure the UI for
the traceback event that happened. Then DebugWindow will wait for user input. When
the user indicates they want to resume execution, the command handler in question
will set _dbgContinue and the original traceback will return so execution can continue. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=d69568b9-9021-46d6-aeb4-0e1bb554fbf1" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=d69568b9-9021-46d6-aeb4-0e1bb554fbf1</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,d69568b9-9021-46d6-aeb4-0e1bb554fbf1.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,d69568b9-9021-46d6-aeb4-0e1bb554fbf1.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=d69568b9-9021-46d6-aeb4-0e1bb554fbf1</wfw:commentRss></item><item><title>Hybrid App Debugging Aside - The DLR Hosting API</title><link>http://devhawk.net/2009/10/07/Hybrid+App+Debugging+Aside+The+DLR+Hosting+API.aspx</link><category>DLR</category><category>Hosting API</category><category>IronPython</category><category>Lightweight Debugger</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 07 Oct 2009 15:58:15 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,96e3d1b3-5adc-4e69-b414-e69a6e5a05d0.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In my series on <a href="http://devhawk.net/2009/10/06/Lightweight+Debugging+For+Hybrid+CIronPython+Apps.aspx">Hybrid
App Debugging</a>, I showed the following code for executing a Python file in a hybrid
C#/IronPython app.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:08436bdc-960e-4b10-a9f6-5784d3fdaad4" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">Window_Loaded</span>(<span style="color:#B00040">object</span> sender, RoutedEventArgs e)<br>
{<br>
    ScriptEngine engine = Python.CreateEngine();<br>
    ScriptScope  scope = engine.CreateScope();<br>
    scope.SetVariable(<span style="color:#BA2121">"items"</span>, lbThings.Items);<br>
    engine.ExecuteFile(<span style="color:#BA2121">"getthings.py"</span>, scope);<br>
}<br></div>
        </div>
        <p>
The <a href="javascript:window.location.href='http://dlr.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=84001';">DLR
Hosting API</a> has three distinct levels of functionality. As simple as this is,
technically it’s level 2 since it’s using a ScriptEngine directly. If you wanted to
use the simplest level 1 hosting API, you could use runtimes instead of engines and
save a line of code.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:69036e31-2f47-461b-a06e-6f9784a7caeb" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">Window_Loaded</span>(<span style="color:#B00040">object</span> sender, RoutedEventArgs e)<br>
{<br>
    ScriptRuntime runtime = Python.CreateRuntime();<br>
    runtime.Globals.SetVariable(<span style="color:#BA2121">"items"</span>, lbThings.Items);<br>
    runtime.ExecuteFile(<span style="color:#BA2121">"getthings.py"</span>);<br>
}<br></div>
        </div>
        <p>
The ScriptRuntime version of ExecuteFile doesn’t include an overload that takes a
ScriptScope like ScriptEngine does, so instead you add the items variable to the globals
scope. However, this doesn’t automatically add the items object to every child scope
– you have to explicitly import items into the local scope if you want to use it.
So for Python, that means you need to add “import items” to the top of the GetThings.py
script. Nothing else changes.
</p>
        <p>
Personally, I find DLR Hosting API Level 2 to be straightforward and easy enough to
understand, so I tend to code to that level by default. I actually had to go read
the doc to discover the ScriptRuntime.Globals property and talk to Dino about importing
those variables into a local scope. However, I wanted to point out that nothing in
my Hybrid App Debugging sample so far is really dependent on the level 2 API. If you
just want to execute some Python files in the context of your C# application, you
can stick with the simpler level 1 API if you want. You can even use lightweight debugging
with the level 1 API – there’s an overload of the SetTrace extension method for ScriptRuntimes
just as there is for ScriptEngines. Just something to keep in mind.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=96e3d1b3-5adc-4e69-b414-e69a6e5a05d0"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=B88byMgjtpo:xKv25WVxCZQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=B88byMgjtpo:xKv25WVxCZQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=B88byMgjtpo:xKv25WVxCZQ:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=B88byMgjtpo:xKv25WVxCZQ:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=B88byMgjtpo:xKv25WVxCZQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=B88byMgjtpo:xKv25WVxCZQ:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/B88byMgjtpo" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
In my series on &lt;a href="http://devhawk.net/2009/10/06/Lightweight+Debugging+For+Hybrid+CIronPython+Apps.aspx"&gt;Hybrid
App Debugging&lt;/a&gt;, I showed the following code for executing a Python file in a hybrid
C#/IronPython app.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:08436bdc-960e-4b10-a9f6-5784d3fdaad4" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;Window_Loaded&lt;/span&gt;(&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;#160;sender,&amp;#160;RoutedEventArgs&amp;#160;e)&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;ScriptEngine&amp;#160;engine&amp;#160;=&amp;#160;Python.CreateEngine();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;ScriptScope&amp;#160;&amp;#160;scope&amp;#160;=&amp;#160;engine.CreateScope();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;scope.SetVariable(&lt;span style="color:#BA2121"&gt;"items"&lt;/span&gt;,&amp;#160;lbThings.Items);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;engine.ExecuteFile(&lt;span style="color:#BA2121"&gt;"getthings.py"&lt;/span&gt;,&amp;#160;scope);&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The &lt;a href="javascript:window.location.href='http://dlr.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=84001';"&gt;DLR
Hosting API&lt;/a&gt; has three distinct levels of functionality. As simple as this is,
technically it’s level 2 since it’s using a ScriptEngine directly. If you wanted to
use the simplest level 1 hosting API, you could use runtimes instead of engines and
save a line of code.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:69036e31-2f47-461b-a06e-6f9784a7caeb" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;Window_Loaded&lt;/span&gt;(&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;#160;sender,&amp;#160;RoutedEventArgs&amp;#160;e)&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;ScriptRuntime&amp;#160;runtime&amp;#160;=&amp;#160;Python.CreateRuntime();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;runtime.Globals.SetVariable(&lt;span style="color:#BA2121"&gt;"items"&lt;/span&gt;,&amp;#160;lbThings.Items);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;runtime.ExecuteFile(&lt;span style="color:#BA2121"&gt;"getthings.py"&lt;/span&gt;);&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The ScriptRuntime version of ExecuteFile doesn’t include an overload that takes a
ScriptScope like ScriptEngine does, so instead you add the items variable to the globals
scope. However, this doesn’t automatically add the items object to every child scope
– you have to explicitly import items into the local scope if you want to use it.
So for Python, that means you need to add “import items” to the top of the GetThings.py
script. Nothing else changes.
&lt;/p&gt;
&lt;p&gt;
Personally, I find DLR Hosting API Level 2 to be straightforward and easy enough to
understand, so I tend to code to that level by default. I actually had to go read
the doc to discover the ScriptRuntime.Globals property and talk to Dino about importing
those variables into a local scope. However, I wanted to point out that nothing in
my Hybrid App Debugging sample so far is really dependent on the level 2 API. If you
just want to execute some Python files in the context of your C# application, you
can stick with the simpler level 1 API if you want. You can even use lightweight debugging
with the level 1 API – there’s an overload of the SetTrace extension method for ScriptRuntimes
just as there is for ScriptEngines. Just something to keep in mind.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=96e3d1b3-5adc-4e69-b414-e69a6e5a05d0" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=96e3d1b3-5adc-4e69-b414-e69a6e5a05d0</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,96e3d1b3-5adc-4e69-b414-e69a6e5a05d0.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,96e3d1b3-5adc-4e69-b414-e69a6e5a05d0.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=96e3d1b3-5adc-4e69-b414-e69a6e5a05d0</wfw:commentRss></item><item><title>Hybrid App Debugging &amp;ndash; TracebackDelegate and SetTrace</title><link>http://devhawk.net/2009/10/07/Hybrid+App+Debugging+Ndash+TracebackDelegate+And+SetTrace.aspx</link><category>Debugger</category><category>IronPython</category><category>Lightweight Debugger</category><category>Polyglot</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 07 Oct 2009 13:43:27 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,0cbc8971-2ce0-4098-b3b4-23a7f852cc86.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Now that I’ve introduced my <a href="http://devhawk.net/2009/10/06/Lightweight+Debugging+For+Hybrid+CIronPython+Apps.aspx">simple
hybrid GetThings app</a>, we need to set about adding support for debugging just the
IronPython part of the app via the new lightweight debugging functionality we’re introducing
in 2.6. Note, the code is <a href="http://github.com/devhawk/LightweightDebuggerDemo">up
on github</a>, but isn’t going to exactly match what I show on the blog. Also, I have
a post RC1 daily build of IronPython in the <a href="http://github.com/devhawk/LightweightDebuggerDemo/tree/deac85aaf14b37352ce4248917fd857c173d8997/External">Externals
folder</a> since I discovered a few issues while building this sample that Dino had
to fix after RC1. Those assemblies will be updated as needed as the sample progresses.
</p>
        <p>
We saw last time how how easy it is to execute a Python script to configure a C# app
– only four lines of code. If we want to support debugging, we need to add a fifth:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:8307bd4c-8d81-422a-9938-c547f25696e0" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">Window_Loaded</span>(<span style="color:#B00040">object</span> sender, RoutedEventArgs e)<br>
{<br>
    ScriptEngine engine = Python.CreateEngine();<br>
    engine.SetTrace(<span style="color:#008000"><b>this</b></span>.OnTraceback);<br><br>
    ScriptScope s = engine.CreateScope();<br>
    s.SetVariable(<span style="color:#BA2121">"items"</span>, lbThings.Items);<br>
    engine.ExecuteFile(<span style="color:#BA2121">"getthings.py"</span>, s);<br>
}<br></div>
        </div>
        <p>
You’ll notice the one new line – the call to engine.SetTrace. This is actually an
extension method – ScriptEngine is a DLR hosting API class and but SetTrace is IronPython
specific functionality [1]. If you look at the source of Python.SetTrace, you’ll see
that it’s just a wrapper around SysModule.settrace, but it avoids needing to get the
engine’s shared PythonContext yourself.
</p>
        <p>
SetTrace takes a TracebackDelegate as a parameter. That delegate gets registered as
the global traceback handler for the Python engine (on that thread, but we’ll ignore
threading for now). Whenever that engine enters a new scope (i.e. a new function),
the IronPython runtime calls into the global traceback handler. While the traceback
handler runs, execution of the python code in that engine is paused. When the traceback
handler returns, the engine resumes executing python code.
</p>
        <p>
In addition to the global traceback handler, each scope has a local traceback handler
as well. The TracebackDelegate type returns a TracebackDelegate which is used as the
local traceback handler for the next traceback event within that scope. Traceback
handlers can return themselves, some other TracebackDelegate, or null if they don’t
want any more traceback events for the current scope. It’s kinda confusing, so here’s
a picture:
</p>
        <p>
          <a href="http://devhawk.net/content/binary/WindowsLiveWriter/HybridAppDebuggingTracebackDelegateandSe_F502/image_10.png">
            <img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://devhawk.net/content/binary/WindowsLiveWriter/HybridAppDebuggingTracebackDelegateandSe_F502/image_thumb_4.png" width="514" height="206"></img>
          </a>
        </p>
        <p>
You’ll notice three different traceback event types in the picture above: call, line
and return. Call indicates the start of a scope, and is always invoked on the global
traceback handler (i.e. the traceback passed to SetTrace). Line indicates the Python
engine is about to execute a line of code and return indicates the end of a scopes
execution. As you can see, the runtime uses the return value of the traceback for
the next tracing call until the end of the scope. The return value from the “return”
event handler is ignored. 
</p>
        <p>
So now that we know the basics of traceback handlers, here’s a simple TracebackDelegate
that simply returns itself. The “Hello, world!” of traceback debugging if you will.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:bd6a1c57-94d2-4d29-9e6d-e8894c3097e3" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> TracebackDelegate <span style="color:#0000FF">OnTraceback</span><br>
    (TraceBackFrame frame, <span style="color:#B00040">string</span> result, <span style="color:#B00040">object</span> payload)<br>
{<br>
    <span style="color:#008000"><b>return</b></span> <span style="color:#008000"><b>this</b></span>.OnTraceback;<br>
}<br></div>
        </div>
        <p>
If you run this code, there will be no functional difference from the code before
you added the SetTrace call. That’s because we’re not doing anything in the traceback
handler. But if you run this in the debugger with a breakpoint on this function, you’ll
see that it gets called a bunch of times. In the python code <a href="http://devhawk.net/2009/10/06/Lightweight+Debugging+For+Hybrid+CIronPython+Apps.aspx">from
the last post</a>, there are three scopes – module scope, download_stuff function
scope and the get_nodes function scope. Each of those function scopes will have a
call and return event, plus a bunch of line events in between. 
</p>
        <p>
The parameters for TracebackDelegate are described <a href="http://docs.python.org/library/sys.html#sys.settrace">in
the Python docs</a>. The frame parameter is the current stack frame – it has information
about the local and global variables, the code object currently executing, the line
number being executed and a pointer to the previous stack frame if there is one. More
information on code and frame objects is available in the <a href="http://docs.python.org/reference/datamodel.html#the-standard-type-hierarchy">python
data model</a> (look for “internal types”). Result is the reason why the traceback
function is being called (in Python docs, it’s called “event” but that’s a keyword
in C#). IronPython supports four traceback results: “call”, “line” and “return” as
described above plus “exception” when an exception is thrown. Finally, the payload
value’s meaning depends on the traceback result. For call and line, payload is null.
For return, payload is the value being returned from the function. For exception,
the payload is information about the exception and where it was thrown. 
</p>
        <p>
As I mentioned above, python code execution is paused while the traceback handler
executes and then continues when the traceback handler returns. That means you need
to block in that function if you want to let the user interact with the debugger.
For a console app like PDB, you can do that with a single thread of execution easily
enough. For a GUI app like GetThings, that means running the debugger and debugee
windows on separate threads. And as I alluded to, tracing for Python script engines
is per thread. So next time, we’ll look deeper into how to use multiple threads for
lightweight debugging a hybrid app.
</p>
        <hr></hr>
        <p>
[1] Eventually, I’d like to see IronRuby support lightweight debugging as well. However,
there’s no built in mechanism for Ruby debugging the way there is for Python, so it’s
less clear how we should expose debugging to the Ruby developer. We’d also want to
build a language neutral DLR Hosting API mechanism for lightweight debugging as well
at that point. But honestly, we have higher priorities at this point.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=0cbc8971-2ce0-4098-b3b4-23a7f852cc86"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=0W0kYj5M25A:P42ofQqDp2E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=0W0kYj5M25A:P42ofQqDp2E:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=0W0kYj5M25A:P42ofQqDp2E:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=0W0kYj5M25A:P42ofQqDp2E:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=0W0kYj5M25A:P42ofQqDp2E:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=0W0kYj5M25A:P42ofQqDp2E:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/0W0kYj5M25A" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
Now that I’ve introduced my &lt;a href="http://devhawk.net/2009/10/06/Lightweight+Debugging+For+Hybrid+CIronPython+Apps.aspx"&gt;simple
hybrid GetThings app&lt;/a&gt;, we need to set about adding support for debugging just the
IronPython part of the app via the new lightweight debugging functionality we’re introducing
in 2.6. Note, the code is &lt;a href="http://github.com/devhawk/LightweightDebuggerDemo"&gt;up
on github&lt;/a&gt;, but isn’t going to exactly match what I show on the blog. Also, I have
a post RC1 daily build of IronPython in the &lt;a href="http://github.com/devhawk/LightweightDebuggerDemo/tree/deac85aaf14b37352ce4248917fd857c173d8997/External"&gt;Externals
folder&lt;/a&gt; since I discovered a few issues while building this sample that Dino had
to fix after RC1. Those assemblies will be updated as needed as the sample progresses.
&lt;/p&gt;
&lt;p&gt;
We saw last time how how easy it is to execute a Python script to configure a C# app
– only four lines of code. If we want to support debugging, we need to add a fifth:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:8307bd4c-8d81-422a-9938-c547f25696e0" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;Window_Loaded&lt;/span&gt;(&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;#160;sender,&amp;#160;RoutedEventArgs&amp;#160;e)&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;ScriptEngine&amp;#160;engine&amp;#160;=&amp;#160;Python.CreateEngine();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;engine.SetTrace(&lt;span style="color:#008000"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;.OnTraceback);&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;ScriptScope&amp;#160;s&amp;#160;=&amp;#160;engine.CreateScope();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;s.SetVariable(&lt;span style="color:#BA2121"&gt;"items"&lt;/span&gt;,&amp;#160;lbThings.Items);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;engine.ExecuteFile(&lt;span style="color:#BA2121"&gt;"getthings.py"&lt;/span&gt;,&amp;#160;s);&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
You’ll notice the one new line – the call to engine.SetTrace. This is actually an
extension method – ScriptEngine is a DLR hosting API class and but SetTrace is IronPython
specific functionality [1]. If you look at the source of Python.SetTrace, you’ll see
that it’s just a wrapper around SysModule.settrace, but it avoids needing to get the
engine’s shared PythonContext yourself.
&lt;/p&gt;
&lt;p&gt;
SetTrace takes a TracebackDelegate as a parameter. That delegate gets registered as
the global traceback handler for the Python engine (on that thread, but we’ll ignore
threading for now). Whenever that engine enters a new scope (i.e. a new function),
the IronPython runtime calls into the global traceback handler. While the traceback
handler runs, execution of the python code in that engine is paused. When the traceback
handler returns, the engine resumes executing python code.
&lt;/p&gt;
&lt;p&gt;
In addition to the global traceback handler, each scope has a local traceback handler
as well. The TracebackDelegate type returns a TracebackDelegate which is used as the
local traceback handler for the next traceback event within that scope. Traceback
handlers can return themselves, some other TracebackDelegate, or null if they don’t
want any more traceback events for the current scope. It’s kinda confusing, so here’s
a picture:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://devhawk.net/content/binary/WindowsLiveWriter/HybridAppDebuggingTracebackDelegateandSe_F502/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://devhawk.net/content/binary/WindowsLiveWriter/HybridAppDebuggingTracebackDelegateandSe_F502/image_thumb_4.png" width="514" height="206" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You’ll notice three different traceback event types in the picture above: call, line
and return. Call indicates the start of a scope, and is always invoked on the global
traceback handler (i.e. the traceback passed to SetTrace). Line indicates the Python
engine is about to execute a line of code and return indicates the end of a scopes
execution. As you can see, the runtime uses the return value of the traceback for
the next tracing call until the end of the scope. The return value from the “return”
event handler is ignored. 
&lt;/p&gt;
&lt;p&gt;
So now that we know the basics of traceback handlers, here’s a simple TracebackDelegate
that simply returns itself. The “Hello, world!” of traceback debugging if you will.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:bd6a1c57-94d2-4d29-9e6d-e8894c3097e3" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;TracebackDelegate&amp;#160;&lt;span style="color:#0000FF"&gt;OnTraceback&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;(TraceBackFrame&amp;#160;frame,&amp;#160;&lt;span style="color:#B00040"&gt;string&lt;/span&gt;&amp;#160;result,&amp;#160;&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;#160;payload)&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;.OnTraceback;&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
If you run this code, there will be no functional difference from the code before
you added the SetTrace call. That’s because we’re not doing anything in the traceback
handler. But if you run this in the debugger with a breakpoint on this function, you’ll
see that it gets called a bunch of times. In the python code &lt;a href="http://devhawk.net/2009/10/06/Lightweight+Debugging+For+Hybrid+CIronPython+Apps.aspx"&gt;from
the last post&lt;/a&gt;, there are three scopes – module scope, download_stuff function
scope and the get_nodes function scope. Each of those function scopes will have a
call and return event, plus a bunch of line events in between. 
&lt;/p&gt;
&lt;p&gt;
The parameters for TracebackDelegate are described &lt;a href="http://docs.python.org/library/sys.html#sys.settrace"&gt;in
the Python docs&lt;/a&gt;. The frame parameter is the current stack frame – it has information
about the local and global variables, the code object currently executing, the line
number being executed and a pointer to the previous stack frame if there is one. More
information on code and frame objects is available in the &lt;a href="http://docs.python.org/reference/datamodel.html#the-standard-type-hierarchy"&gt;python
data model&lt;/a&gt; (look for “internal types”). Result is the reason why the traceback
function is being called (in Python docs, it’s called “event” but that’s a keyword
in C#). IronPython supports four traceback results: “call”, “line” and “return” as
described above plus “exception” when an exception is thrown. Finally, the payload
value’s meaning depends on the traceback result. For call and line, payload is null.
For return, payload is the value being returned from the function. For exception,
the payload is information about the exception and where it was thrown. 
&lt;/p&gt;
&lt;p&gt;
As I mentioned above, python code execution is paused while the traceback handler
executes and then continues when the traceback handler returns. That means you need
to block in that function if you want to let the user interact with the debugger.
For a console app like PDB, you can do that with a single thread of execution easily
enough. For a GUI app like GetThings, that means running the debugger and debugee
windows on separate threads. And as I alluded to, tracing for Python script engines
is per thread. So next time, we’ll look deeper into how to use multiple threads for
lightweight debugging a hybrid app.
&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;
[1] Eventually, I’d like to see IronRuby support lightweight debugging as well. However,
there’s no built in mechanism for Ruby debugging the way there is for Python, so it’s
less clear how we should expose debugging to the Ruby developer. We’d also want to
build a language neutral DLR Hosting API mechanism for lightweight debugging as well
at that point. But honestly, we have higher priorities at this point.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=0cbc8971-2ce0-4098-b3b4-23a7f852cc86" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=0cbc8971-2ce0-4098-b3b4-23a7f852cc86</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,0cbc8971-2ce0-4098-b3b4-23a7f852cc86.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,0cbc8971-2ce0-4098-b3b4-23a7f852cc86.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=0cbc8971-2ce0-4098-b3b4-23a7f852cc86</wfw:commentRss></item><item><title>Lightweight Debugging for Hybrid C#/IronPython Apps</title><link>http://devhawk.net/2009/10/06/Lightweight+Debugging+For+Hybrid+CIronPython+Apps.aspx</link><category>Debugger</category><category>IronPython</category><category>Lightweight Debugger</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Tue, 06 Oct 2009 14:11:38 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,3cf0678c-d21a-4569-8d9c-2a3ae2996605.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.zazzle.com/you_had_me_at_dynamic_shirt-235421109922997983">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="designallCAZM93SM" border="0" alt="designallCAZM93SM" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/EmbeddedDebuggingIntroduction_AD18/designallCAZM93SM_3.jpg" width="240" height="221"></img>
          </a>
        </p>
        <p>
One of the IronPython scenarios that I’m hearing more and more about recently is for <a href="http://en.wikipedia.org/wiki/Polyglot_%28computing%29">polyglot</a> programs.
In these scenarios, part of the application is built in IronPython other parts are
build in compiled, statically typed languages like C# or Visual Basic. Sometimes,
programs are written this way to allow the C# app to access a Python library, like
my <a href="http://devhawk.net/2009/04/05/Pygments+For+Windows+Live+Writer.aspx">Pygments
for WL Writer</a> plugin. Other programs want to be customizable by the end user,
like <a href="http://blogs.msdn.com/intellipad/archive/2008/11/11/newbie-experience-writing-a-custom-command.aspx">Intellipad</a>.
Whatever the reason, I think that the number of these hybrid polyglot programs is
going up, which partially explains why the C# team added the <a href="http://msdn.microsoft.com/en-us/library/dd264741(VS.100).aspx">new
dynamic type</a> to C# 4.0.
</p>
        <p>
(FYI: the <a href="http://www.zazzle.com/you_had_me_at_dynamic_shirt-235421109922997983">You
had me at “dynamic”</a> shirt above is available for sale in my Zazzle store along
with my <a href="http://www.zazzle.com/architecture_help_dark_t_shirt-235848130425737882">Architecture
Help 5¢</a> shirt)
</p>
        <p>
The thing is that if you’re going to build polyglot apps, you’re probably going to
want the ability to debug polyglot apps as well. I’ve <a href="http://devhawk.net/2009/02/27/Writing+An+IronPython+Debugger+Introduction.aspx">written
extensively</a> about building a debugger for IronPython. However, <a href="http://github.com/devhawk/ipydbg/">ipydbg</a> uses
the CLR debugger under the hood which means you have to have the debugger and the
code it’s debugging in separate processes. That’s a huge design burden for building
a debuggable polyglot application. Luckily, as of IronPython 2.6, we support Python’s
built-in trace debugging capability (aka <a href="http://docs.python.org/library/sys.html#sys.settrace">sys.settrace</a>).
While you can use this in pure Python apps (like <a href="http://docs.python.org/library/pdb.html">PDB</a>),
you can also use it polyglot C# (or VB)/IronPython apps as well. If only someone were
to take the time to build a sample and document what he did along the way…
</p>
        <p>
Hey, that sounds like PM work!
</p>
        <p>
Seriously, let me introduce you to the worlds simplest Twitter application: GetThings.
The app downloads a list of my tweets via the Twitter API and displays them in a list
box. The UI is written in C# while the tweet download code is written in Python. Clearly,
this is a pretty brain dead app – but the point isn’t to build a great Twitter app
but rather to show how to use the settrace API from C#.
</p>
        <p>
I’ve stuck the <a href="http://github.com/devhawk/LightweightDebuggerDemo">code up
on GitHub</a>. If you want to see the basic app in action sans debugging, start with
the <a href="http://github.com/devhawk/LightweightDebuggerDemo/commit/92bd5fc330e2a48ae84fc185f3e397aefb4be1eb">initial
checkin</a>. As you can see here, basic C# / IronPython integration is pretty trivial.
I’m simply creating an engine and a scope, adding the list boxes’ Items property to
the scope, and executing the getthings.py file from the disk.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:73f1a3b9-a8dc-4c38-880a-c9ef836bf0c3" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>private</b>
            </span> <span style="color:#008000"><b>void</b></span> <span style="color:#0000FF">Window_Loaded</span>(<span style="color:#B00040">object</span> sender, RoutedEventArgs e)<br>
{<br>
    ScriptEngine engine = Python.CreateEngine();<br>
    ScriptScope  scope = engine.CreateScope();<br>
    scope.SetVariable(<span style="color:#BA2121">"items"</span>, lbThings.Items);<br>
    engine.ExecuteFile(<span style="color:#BA2121">"getthings.py"</span>, scope);<br>
}<br></div>
        </div>
        <p>
Since GetThings.py is just a text file, the user can modify it to get a list of anything
they want – some other user’s timeline, the public timeline, or even – gasp! – something
not from Twitter! In fact, as you see below, I’ve actually modified it to pull the
tweets from a file on disk so I can avoid hitting the network on every run.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:c699ee34-4a59-40a5-a49c-eb135389af0a" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>import</b>
            </span> <span style="color:#0000FF"><b>clr</b></span><br>
clr<span style="color:#666666">.</span>AddReference(<span style="color:#BA2121">"System.Xml"</span>)<br><span style="color:#008000"><b>from</b></span> <span style="color:#0000FF"><b>System.Xml</b></span> <span style="color:#008000"><b>import</b></span> XmlDocument<br><br><span style="color:#008000"><b>def</b></span> <span style="color:#0000FF">get_nodes</span>(xml):<br>
    <span style="color:#008000"><b>return</b></span> xml<span style="color:#666666">.</span>SelectNodes(<span style="color:#BA2121">"statuses/status/text"</span>)<br><br><span style="color:#008000"><b>def</b></span> <span style="color:#0000FF">download_stuff</span>():<br>
    x <span style="color:#666666">=</span> XmlDocument()<br><br>
    <span style="color:#408080"><i>#load from disk to save time in development</i></span><br>
    <span style="color:#408080"><i>#x.Load("http://twitter.com/statuses/user_timeline/devhawk.xml")</i></span><br>
    x<span style="color:#666666">.</span>Load(<span style="color:#BA2121">"devhawk.xml"</span>)<br><br>
    <span style="color:#008000"><b>for</b></span> n <span style="color:#AA22FF"><b>in</b></span> get_nodes(x):<br>
        txt <span style="color:#666666">=</span> n<span style="color:#666666">.</span>InnerText<br>
        items<span style="color:#666666">.</span>Add(txt)<br><br>
download_stuff()<br></div>
        </div>
        <p>
OK, so that’s the basics of the world’s simplest hybrid C#/IronPython Twitter application.
Next up, I’ll add the settrace basics.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=3cf0678c-d21a-4569-8d9c-2a3ae2996605"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=gOGI9U1cXkY:2RulaMM8AmQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=gOGI9U1cXkY:2RulaMM8AmQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=gOGI9U1cXkY:2RulaMM8AmQ:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=gOGI9U1cXkY:2RulaMM8AmQ:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=gOGI9U1cXkY:2RulaMM8AmQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=gOGI9U1cXkY:2RulaMM8AmQ:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/gOGI9U1cXkY" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
&lt;a href="http://www.zazzle.com/you_had_me_at_dynamic_shirt-235421109922997983"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="designallCAZM93SM" border="0" alt="designallCAZM93SM" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/EmbeddedDebuggingIntroduction_AD18/designallCAZM93SM_3.jpg" width="240" height="221" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
One of the IronPython scenarios that I’m hearing more and more about recently is for &lt;a href="http://en.wikipedia.org/wiki/Polyglot_%28computing%29"&gt;polyglot&lt;/a&gt; programs.
In these scenarios, part of the application is built in IronPython other parts are
build in compiled, statically typed languages like C# or Visual Basic. Sometimes,
programs are written this way to allow the C# app to access a Python library, like
my &lt;a href="http://devhawk.net/2009/04/05/Pygments+For+Windows+Live+Writer.aspx"&gt;Pygments
for WL Writer&lt;/a&gt; plugin. Other programs want to be customizable by the end user,
like &lt;a href="http://blogs.msdn.com/intellipad/archive/2008/11/11/newbie-experience-writing-a-custom-command.aspx"&gt;Intellipad&lt;/a&gt;.
Whatever the reason, I think that the number of these hybrid polyglot programs is
going up, which partially explains why the C# team added the &lt;a href="http://msdn.microsoft.com/en-us/library/dd264741(VS.100).aspx"&gt;new
dynamic type&lt;/a&gt; to C# 4.0.
&lt;/p&gt;
&lt;p&gt;
(FYI: the &lt;a href="http://www.zazzle.com/you_had_me_at_dynamic_shirt-235421109922997983"&gt;You
had me at “dynamic”&lt;/a&gt; shirt above is available for sale in my Zazzle store along
with my &lt;a href="http://www.zazzle.com/architecture_help_dark_t_shirt-235848130425737882"&gt;Architecture
Help 5¢&lt;/a&gt; shirt)
&lt;/p&gt;
&lt;p&gt;
The thing is that if you’re going to build polyglot apps, you’re probably going to
want the ability to debug polyglot apps as well. I’ve &lt;a href="http://devhawk.net/2009/02/27/Writing+An+IronPython+Debugger+Introduction.aspx"&gt;written
extensively&lt;/a&gt; about building a debugger for IronPython. However, &lt;a href="http://github.com/devhawk/ipydbg/"&gt;ipydbg&lt;/a&gt; uses
the CLR debugger under the hood which means you have to have the debugger and the
code it’s debugging in separate processes. That’s a huge design burden for building
a debuggable polyglot application. Luckily, as of IronPython 2.6, we support Python’s
built-in trace debugging capability (aka &lt;a href="http://docs.python.org/library/sys.html#sys.settrace"&gt;sys.settrace&lt;/a&gt;).
While you can use this in pure Python apps (like &lt;a href="http://docs.python.org/library/pdb.html"&gt;PDB&lt;/a&gt;),
you can also use it polyglot C# (or VB)/IronPython apps as well. If only someone were
to take the time to build a sample and document what he did along the way…
&lt;/p&gt;
&lt;p&gt;
Hey, that sounds like PM work!
&lt;/p&gt;
&lt;p&gt;
Seriously, let me introduce you to the worlds simplest Twitter application: GetThings.
The app downloads a list of my tweets via the Twitter API and displays them in a list
box. The UI is written in C# while the tweet download code is written in Python. Clearly,
this is a pretty brain dead app – but the point isn’t to build a great Twitter app
but rather to show how to use the settrace API from C#.
&lt;/p&gt;
&lt;p&gt;
I’ve stuck the &lt;a href="http://github.com/devhawk/LightweightDebuggerDemo"&gt;code up
on GitHub&lt;/a&gt;. If you want to see the basic app in action sans debugging, start with
the &lt;a href="http://github.com/devhawk/LightweightDebuggerDemo/commit/92bd5fc330e2a48ae84fc185f3e397aefb4be1eb"&gt;initial
checkin&lt;/a&gt;. As you can see here, basic C# / IronPython integration is pretty trivial.
I’m simply creating an engine and a scope, adding the list boxes’ Items property to
the scope, and executing the getthings.py file from the disk.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:73f1a3b9-a8dc-4c38-880a-c9ef836bf0c3" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;Window_Loaded&lt;/span&gt;(&lt;span style="color:#B00040"&gt;object&lt;/span&gt;&amp;#160;sender,&amp;#160;RoutedEventArgs&amp;#160;e)&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;ScriptEngine&amp;#160;engine&amp;#160;=&amp;#160;Python.CreateEngine();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;ScriptScope&amp;#160;&amp;#160;scope&amp;#160;=&amp;#160;engine.CreateScope();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;scope.SetVariable(&lt;span style="color:#BA2121"&gt;"items"&lt;/span&gt;,&amp;#160;lbThings.Items);&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;engine.ExecuteFile(&lt;span style="color:#BA2121"&gt;"getthings.py"&lt;/span&gt;,&amp;#160;scope);&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Since GetThings.py is just a text file, the user can modify it to get a list of anything
they want – some other user’s timeline, the public timeline, or even – gasp! – something
not from Twitter! In fact, as you see below, I’ve actually modified it to pull the
tweets from a file on disk so I can avoid hitting the network on every run.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8647342E-C6F6-4230-979C-77E8BB3FA682:c699ee34-4a59-40a5-a49c-eb135389af0a" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;clr&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
clr&lt;span style="color:#666666"&gt;.&lt;/span&gt;AddReference(&lt;span style="color:#BA2121"&gt;"System.Xml"&lt;/span&gt;)&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;from&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;System.Xml&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt;&amp;#160;XmlDocument&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;get_nodes&lt;/span&gt;(xml):&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;xml&lt;span style="color:#666666"&gt;.&lt;/span&gt;SelectNodes(&lt;span style="color:#BA2121"&gt;"statuses/status/text"&lt;/span&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;download_stuff&lt;/span&gt;():&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;x&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;XmlDocument()&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#408080"&gt;&lt;i&gt;#load&amp;#160;from&amp;#160;disk&amp;#160;to&amp;#160;save&amp;#160;time&amp;#160;in&amp;#160;development&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#408080"&gt;&lt;i&gt;#x.Load("http://twitter.com/statuses/user_timeline/devhawk.xml")&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;x&lt;span style="color:#666666"&gt;.&lt;/span&gt;Load(&lt;span style="color:#BA2121"&gt;"devhawk.xml"&lt;/span&gt;)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt;&amp;#160;n&amp;#160;&lt;span style="color:#AA22FF"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/span&gt;&amp;#160;get_nodes(x):&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;txt&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;n&lt;span style="color:#666666"&gt;.&lt;/span&gt;InnerText&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;items&lt;span style="color:#666666"&gt;.&lt;/span&gt;Add(txt)&lt;br /&gt;
&lt;br /&gt;
download_stuff()&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
OK, so that’s the basics of the world’s simplest hybrid C#/IronPython Twitter application.
Next up, I’ll add the settrace basics.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=3cf0678c-d21a-4569-8d9c-2a3ae2996605" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=3cf0678c-d21a-4569-8d9c-2a3ae2996605</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,3cf0678c-d21a-4569-8d9c-2a3ae2996605.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,3cf0678c-d21a-4569-8d9c-2a3ae2996605.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=3cf0678c-d21a-4569-8d9c-2a3ae2996605</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments></item><item><title>IronPython Post 2.6 Roadmap</title><link>http://devhawk.net/2009/09/28/IronPython+Post+26+Roadmap.aspx</link><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Mon, 28 Sep 2009 10:33:02 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,dbf7d543-5a65-4642-a1f0-44f25aa1ff37.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It’s not quite out the door yet, but things have gotten quieter around here since
we shipped the <a href="http://devhawk.net/2009/09/23/IronPython+26+Release+Candidate.aspx">Release
Candidate of 2.6</a>. But there’s no rest for the dynamic, so we’ve already started
thinking about what we do next.
</p>
        <p>
Since we shipped 2.0 last December, we’ve shipped two service releases: 2.0.1 two
months later in February and 2.0.2 four months after that in June. We weren’t planning
on doing a 2.0.3 release, but then we discovered the CLR folks made a breaking change
to partial trust in Windows 7. David <a href="http://lists.ironpython.com/pipermail/users-ironpython.com/2009-September/011268.html">recently
emailed</a> the IronPython mailing list looking for feedback on other must-fix bugs
we can get to for 2.0.3. If you’ve got an opinion on 2.0.3 must-fix bugs, please respond
to that thread.
</p>
        <p>
For 2.6 service releases, we’re looking to tighten up the timeframe a bit from last
time. We’re planning to ship service releases of 2.6 in December and February. However,
since we don’t have a major release ship vehicle in the 2.x branch until Python 2.7
next summer, these service releases may contain new functionality in addition to bug
fixes. In particular, we will look to include any missing modules work that I discussed
in my <a href="http://devhawk.net/2009/09/23/IronPython+26+Release+Candidate.aspx">RC
announcement post</a> in these service releases.
</p>
        <p>
In addition to the IronPython 2.6 service releases, we’ll also continue to track the <a href="http://www.microsoft.com/visualstudio/2010">Visual
Studio 2010</a> beta cycle as it heads to RTM. I can’t comment on VS2010 dates, but
I can say that we will ship a CTP of IronPython 2.6 for .NET Framework 4.0 for Visual
Studio 2010 Beta 2 and that we are committed to shipping the RTM of our .NET 4.0 version
the day that Visual Studio 2010 is publicly available. Given that dynamic the <a href="http://msdn.microsoft.com/en-us/library/dd264736(VS.100).aspx">big
new feature of C# 4.0</a>, we want to make sure IronPython is ready to go as soon
as C# 4.0 is available. 
</p>
        <p>
BTW, we are well aware that “IronPython 2.6 for .NET Framework 4.0” is a long ugly
name. Any suggestions on a different one? We’ve been thinking “IronPython 2.6 R2”
since the “R2” nomenclature is <a href="http://technet.microsoft.com/en-us/windowsserver/bb428898.aspx">big</a><a href="http://www.microsoft.com/sqlserver/2008/en/us/R2.aspx">around</a><a href="http://www.microsoft.com/windowsserver2008/en/us/r2-editions-overview.aspx">here</a>.
But “R2” doesn’t really capture the essence of the .NET 4.0 compatible release. Besides,
when has the dynamic languages team at Microsoft ever done ANYTHING because it was
popular with the Microsoft marketing folks? :)
</p>
        <p>
At this point, we’ve got the next few months mapped out, but not much more beyond
that. Specifically, we have two gaping holes in the roadmap:
</p>
        <ul>
          <li>
Visual Studio Integration 
</li>
          <li>
IronPython 3.x 
</li>
        </ul>
        <p>
For now, I’m going to leave these holes unfilled. Currently, the rest of my VS Languages
teammates (along with the rest of DevDiv) are heads down driving towards beta 2 of
Visual Studio 2010. Once they reach that milestone, planning on Visual Studio v.next
will begin. Those plans have the potential for impacting how the IronPython team proceeds
going forward. 
</p>
        <p>
Frankly, several members of the dynamic languages team have been pitching in with
the “drive to beta 2” effort so we’re a little more short handed than usual. If we
get those people back, then we’re in a much better position to execute on both VS
Integration and IronPython 3.x. If we don’t, then we have to make some hard choices
about how to proceed. I’m guessing most would agree that VS integration is more important
IronPython 3.x support. However, those aren’t equal efforts by any stretch of the
imagination. How valuable is VS integration if, for example, we don’t have the bandwidth
to build decent intellisense? As I said, hard choices.
</p>
        <p>
If you want to make your voice heard on Microsoft’s level of commitment to IronPython,
make sure you go rate the <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=475830">IronPython
integration issue</a> on Microsoft Connect. (while you’re there, rate the <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=479957">IronRuby
integration issue</a> too.) The IronPython integration is currently the top rated
open issue on the VS Connect site and is the second highest vote getter out of all
the Connect issues (active or otherwise) logged since VS 2010 shipped it’s first CTP!
[1] 
</p>
        <hr></hr>
        <p>
[1] Seriously, the next most recent Connect issue with more votes than IronPython
integration is <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=308352">HttpRuntime.ProcessRequest()
does not work in IIS7 Integrated Pipeline Mode</a> from November 2007. The next one
before that was <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=106007">Create
Service Pack for Visual Studio 2005</a> from November 2005. 
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=dbf7d543-5a65-4642-a1f0-44f25aa1ff37"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=-B1DYqhXsa4:gkcWEPkIQk0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=-B1DYqhXsa4:gkcWEPkIQk0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=-B1DYqhXsa4:gkcWEPkIQk0:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=-B1DYqhXsa4:gkcWEPkIQk0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=-B1DYqhXsa4:gkcWEPkIQk0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=-B1DYqhXsa4:gkcWEPkIQk0:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/-B1DYqhXsa4" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
It’s not quite out the door yet, but things have gotten quieter around here since
we shipped the &lt;a href="http://devhawk.net/2009/09/23/IronPython+26+Release+Candidate.aspx"&gt;Release
Candidate of 2.6&lt;/a&gt;. But there’s no rest for the dynamic, so we’ve already started
thinking about what we do next.
&lt;/p&gt;
&lt;p&gt;
Since we shipped 2.0 last December, we’ve shipped two service releases: 2.0.1 two
months later in February and 2.0.2 four months after that in June. We weren’t planning
on doing a 2.0.3 release, but then we discovered the CLR folks made a breaking change
to partial trust in Windows 7. David &lt;a href="http://lists.ironpython.com/pipermail/users-ironpython.com/2009-September/011268.html"&gt;recently
emailed&lt;/a&gt; the IronPython mailing list looking for feedback on other must-fix bugs
we can get to for 2.0.3. If you’ve got an opinion on 2.0.3 must-fix bugs, please respond
to that thread.
&lt;/p&gt;
&lt;p&gt;
For 2.6 service releases, we’re looking to tighten up the timeframe a bit from last
time. We’re planning to ship service releases of 2.6 in December and February. However,
since we don’t have a major release ship vehicle in the 2.x branch until Python 2.7
next summer, these service releases may contain new functionality in addition to bug
fixes. In particular, we will look to include any missing modules work that I discussed
in my &lt;a href="http://devhawk.net/2009/09/23/IronPython+26+Release+Candidate.aspx"&gt;RC
announcement post&lt;/a&gt; in these service releases.
&lt;/p&gt;
&lt;p&gt;
In addition to the IronPython 2.6 service releases, we’ll also continue to track the &lt;a href="http://www.microsoft.com/visualstudio/2010"&gt;Visual
Studio 2010&lt;/a&gt; beta cycle as it heads to RTM. I can’t comment on VS2010 dates, but
I can say that we will ship a CTP of IronPython 2.6 for .NET Framework 4.0 for Visual
Studio 2010 Beta 2 and that we are committed to shipping the RTM of our .NET 4.0 version
the day that Visual Studio 2010 is publicly available. Given that dynamic the &lt;a href="http://msdn.microsoft.com/en-us/library/dd264736(VS.100).aspx"&gt;big
new feature of C# 4.0&lt;/a&gt;, we want to make sure IronPython is ready to go as soon
as C# 4.0 is available. 
&lt;/p&gt;
&lt;p&gt;
BTW, we are well aware that “IronPython 2.6 for .NET Framework 4.0” is a long ugly
name. Any suggestions on a different one? We’ve been thinking “IronPython 2.6 R2”
since the “R2” nomenclature is &lt;a href="http://technet.microsoft.com/en-us/windowsserver/bb428898.aspx"&gt;big&lt;/a&gt; &lt;a href="http://www.microsoft.com/sqlserver/2008/en/us/R2.aspx"&gt;around&lt;/a&gt; &lt;a href="http://www.microsoft.com/windowsserver2008/en/us/r2-editions-overview.aspx"&gt;here&lt;/a&gt;.
But “R2” doesn’t really capture the essence of the .NET 4.0 compatible release. Besides,
when has the dynamic languages team at Microsoft ever done ANYTHING because it was
popular with the Microsoft marketing folks? :)
&lt;/p&gt;
&lt;p&gt;
At this point, we’ve got the next few months mapped out, but not much more beyond
that. Specifically, we have two gaping holes in the roadmap:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Visual Studio Integration 
&lt;/li&gt;
&lt;li&gt;
IronPython 3.x 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
For now, I’m going to leave these holes unfilled. Currently, the rest of my VS Languages
teammates (along with the rest of DevDiv) are heads down driving towards beta 2 of
Visual Studio 2010. Once they reach that milestone, planning on Visual Studio v.next
will begin. Those plans have the potential for impacting how the IronPython team proceeds
going forward. 
&lt;/p&gt;
&lt;p&gt;
Frankly, several members of the dynamic languages team have been pitching in with
the “drive to beta 2” effort so we’re a little more short handed than usual. If we
get those people back, then we’re in a much better position to execute on both VS
Integration and IronPython 3.x. If we don’t, then we have to make some hard choices
about how to proceed. I’m guessing most would agree that VS integration is more important
IronPython 3.x support. However, those aren’t equal efforts by any stretch of the
imagination. How valuable is VS integration if, for example, we don’t have the bandwidth
to build decent intellisense? As I said, hard choices.
&lt;/p&gt;
&lt;p&gt;
If you want to make your voice heard on Microsoft’s level of commitment to IronPython,
make sure you go rate the &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=475830"&gt;IronPython
integration issue&lt;/a&gt; on Microsoft Connect. (while you’re there, rate the &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=479957"&gt;IronRuby
integration issue&lt;/a&gt; too.) The IronPython integration is currently the top rated
open issue on the VS Connect site and is the second highest vote getter out of all
the Connect issues (active or otherwise) logged since VS 2010 shipped it’s first CTP!
[1] 
&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;
[1] Seriously, the next most recent Connect issue with more votes than IronPython
integration is &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=308352"&gt;HttpRuntime.ProcessRequest()
does not work in IIS7 Integrated Pipeline Mode&lt;/a&gt; from November 2007. The next one
before that was &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=106007"&gt;Create
Service Pack for Visual Studio 2005&lt;/a&gt; from November 2005. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=dbf7d543-5a65-4642-a1f0-44f25aa1ff37" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=dbf7d543-5a65-4642-a1f0-44f25aa1ff37</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,dbf7d543-5a65-4642-a1f0-44f25aa1ff37.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,dbf7d543-5a65-4642-a1f0-44f25aa1ff37.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=dbf7d543-5a65-4642-a1f0-44f25aa1ff37</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">4</slash:comments></item><item><title>IronPython 2.6 Release Candidate</title><link>http://devhawk.net/2009/09/23/IronPython+26+Release+Candidate.aspx</link><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 23 Sep 2009 10:26:00 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,e87976bd-9c06-47b4-ae1e-8729dc4e32d6.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://ironpython.codeplex.com/">
            <img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://devhawk.net/content/binary/WindowsLiveWriter/IronPython2.6ReleaseCandidate_EDEE/image_3.png" width="507" height="147"></img>
          </a>
        </p>
        <p>
We released the <a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30315">IronPython
2.6 release candidate</a> on CodePlex yesterday. If all goes well, this will be the
ONLY RC and we’ll republish it as the RTW build in about a month. So if you’ve been
holding off on experimenting with the 2.6 release, now’s the time to jump in with
both feet. 
</p>
        <p>
As I’ve written before on this blog, this is a HUGE release for us:
</p>
        <ul>
          <li>
Python 2.6 features such as <a href="http://docs.python.org/whatsnew/2.6.html#pep-343-the-with-statement">with
statement</a>, <a href="http://docs.python.org/whatsnew/2.6.html#pep-3129-class-decorators">class
decorators</a> and <a href="http://docs.python.org/whatsnew/2.6.html#pep-3112-byte-literals">byte
literals</a></li>
          <li>
            <a href="http://devhawk.net/2009/03/27/IronPython+26+Alpha+1.aspx">Adaptive Compilation</a>
          </li>
          <li>
            <a href="http://devhawk.net/CategoryView,category,__clrtype__.aspx">__clrtype__ Metaclasses</a>
          </li>
          <li>
            <a href="http://devhawk.net/2009/05/21/IronPython+26+Beta+1.aspx">ctypes and Frames
support</a>
          </li>
          <li>
            <a href="http://devhawk.net/2009/07/08/MicrosoftScriptingDebugging.aspx">Lightweight
Debugging</a>
          </li>
          <li>
417 bugs fixed! 
</li>
        </ul>
        <p>
Anyway, with 2.6 winding down, the IronPython team finds ourselves in a unique position
that we’ve never been in before: <u>caught up</u>. As far as I can tell, most of the
Python community hasn’t made the move to <a href="http://www.python.org/download/releases/3.1">Python
3.1</a> and <a href="http://www.python.org/dev/peps/pep-0373/">Python 2.7</a> is looking
like it will be released <a href="http://mail.python.org/pipermail/python-dev/2009-September/092005.html">next
summer</a>. So IronPython is caught up with the latest version of Python most of the
Python community appears to be using. 
</p>
        <p>
So that begs the question: what do we do now?
</p>
        <p>
Of course, we want to hear from you regarding our next steps, but some things we are
looking at include:
</p>
        <ul>
          <li>
            <u>.NET Framework 4.0 
<br></u>We’ve shipped CTP releases of IronPython for each public beta of Visual Studio
2010 and  .NET Framework 4.0. You can expect that to continue as Visual Studio
2010 winds down and ships. 
</li>
          <li>
            <u>Fixing Bugs 
<br></u>417 bugs fixed is good, but there are still 839 active work items in our issue
tracker. In previous releases, we’ve done minor bug fix releases every few months
so we’ll probably keep up that cadence. Make sure you go vote for bugs you think are
important. 
</li>
          <li>
            <u>App Compatibility 
<br></u>One thing we can do is take some of the more popular Python apps such as Django
and Mercurial and make sure they run well on IronPython. In some cases, there may
need to be changes to the Python apps to get them to run on IronPython (for example,
see <a href="http://jdhardy.blogspot.com/2008/07/django-on-ironpython.html">Jeff Hardy’s
patch</a> for running Django on IronPython) which assuredly means more time with lawyers
for me. 
</li>
          <li>
            <u>Missing Modules 
<br></u>While IronPython 2.6 is our implementation of Python 2.6, there are binary modules
we haven’t implemented yet like <a href="http://docs.python.org/library/csv.html">_csv</a>, <a href="http://docs.python.org/library/ast.html">_ast</a> and <a href="http://docs.python.org/library/pyexpat.html">pyexpat</a>.
You could consider this App Compatibility work, but we have a different internal process
for bug fixing and implementing new features so I broke this out separately.</li>
          <li>
            <u>Documentation</u>
            <br>
Invariably an area for improvement in all software, our doc story today is pretty
much “go look at docs.python.org”. Of course, that doesn’t cover any IronPython specific
functionality. Of course, what would be great would be to combine existing Python
docs with IronPython specific docs in a single reference, which also assuredly means
more time with lawyers for me. 
</li>
          <li>
            <u>Tutorials 
<br></u>If you haven’t seen Michael Foord’s <a href="http://www.trypython.org/">Try Python</a>,
it’s awesome. However, it was recently pointed out to me that it doesn’t include any
IronPython specific behavior (importing and interoperating with .NET types for example).
The <a href="http://jimmy.schementi.com/silverlight/Tutorial/">IronRuby Tutorial</a> has
specific IronRuby features and it would be awesome to do the same for IronPython.
Of course, if we wrote new tutorials in <a href="http://docutils.sourceforge.net/rst.html">reStructured
Text</a>, then I’m guessing it would be easy for Michael to include it in Try Python
via his <a href="http://code.google.com/p/rst2xaml/">rst2xaml</a> tool. 
</li>
          <li>
            <u>“Just Text” in Silverlight 
<br></u>If you haven’t seen MIX Online Labs <a href="http://www.visitmix.com/Labs/gestalt/">Gestalt
project</a>, browse to <a href="http://www.visitmix.com/labs/gestalt/samples/getting.started/05_final.html">one
of the samples</a> and View Source. Python as “just text” in the browser. Cool, eh? <a href="http://blog.jimmy.schementi.com/">Jimmy</a> is
working on <a href="http://rubyforge.org/pipermail/ironruby-core/2009-September/005245.html">implementing
the “just text” model</a> for the Silverlight version of IronPython (and <a href="http://www.visitmix.com/labs/gestalt/samples/getting.started/01_ruby.html">IronRuby</a>). 
</li>
          <li>
            <u>Visual Studio 
<br></u>There’s no work item for VS Integration in our issue tracker, but there have been <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=475830">112
votes for IronPython integration</a> (as well as <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=479957">79
votes for IronRuby integration</a>) in the VS 2010 connect bug database. No promises
here, but we are acutely aware of how popular this suggestion is. 
</li>
          <li>
            <u>CodePlex Foundation</u>
            <br>
The <a href="http://codeplex.org/">CodePlex Foundation</a> is a new non-profit foundation
sponsored by Microsoft with the explicit mission “to enable the exchange of code and
understanding among software companies and open source communities.” As one of the
oldest open source projects at Microsoft, we are very interested in the CodePlex Foundation
as you might imagine. However, CodePlex Foundation is VERY new - everything is tagged
“interim” for the first 100 days. Once the Foundation elects non-interim board members
and establishes things like a charter and by-laws, you can be sure we’ll be investigating
it more thoroughly. In other words, definitely more time with lawyers for me. 
</li>
        </ul>
        <p>
In case I haven’t said it lately, it’s great working on the IronPython team with <a href="http://blogs.msdn.com/dinoviehland/">Dino
Viehland</a>, <a href="http://knowbody.livejournal.com">Dave Fugate</a> and <a href="http://lists.ironpython.com/pipermail/users-ironpython.com/2008-December/009154.html">David
DiCato</a> (The IronRuby guys aren’t bad either!). Also, I may whine about the amount
of time I spend with lawyers, but honestly Yong, Kathryn and Kevin – our main LCA
contacts – do a great job helping us figure out how and where to push the envelope
so thanks to them as well.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=e87976bd-9c06-47b4-ae1e-8729dc4e32d6"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=lkw_phkatTs:LPS9n8y7Sl8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=lkw_phkatTs:LPS9n8y7Sl8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=lkw_phkatTs:LPS9n8y7Sl8:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=lkw_phkatTs:LPS9n8y7Sl8:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=lkw_phkatTs:LPS9n8y7Sl8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=lkw_phkatTs:LPS9n8y7Sl8:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/lkw_phkatTs" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
&lt;a href="http://ironpython.codeplex.com/"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://devhawk.net/content/binary/WindowsLiveWriter/IronPython2.6ReleaseCandidate_EDEE/image_3.png" width="507" height="147" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
We released the &lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30315"&gt;IronPython
2.6 release candidate&lt;/a&gt; on CodePlex yesterday. If all goes well, this will be the
ONLY RC and we’ll republish it as the RTW build in about a month. So if you’ve been
holding off on experimenting with the 2.6 release, now’s the time to jump in with
both feet. 
&lt;/p&gt;
&lt;p&gt;
As I’ve written before on this blog, this is a HUGE release for us:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Python 2.6 features such as &lt;a href="http://docs.python.org/whatsnew/2.6.html#pep-343-the-with-statement"&gt;with
statement&lt;/a&gt;, &lt;a href="http://docs.python.org/whatsnew/2.6.html#pep-3129-class-decorators"&gt;class
decorators&lt;/a&gt; and &lt;a href="http://docs.python.org/whatsnew/2.6.html#pep-3112-byte-literals"&gt;byte
literals&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://devhawk.net/2009/03/27/IronPython+26+Alpha+1.aspx"&gt;Adaptive Compilation&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://devhawk.net/CategoryView,category,__clrtype__.aspx"&gt;__clrtype__ Metaclasses&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://devhawk.net/2009/05/21/IronPython+26+Beta+1.aspx"&gt;ctypes and Frames
support&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://devhawk.net/2009/07/08/MicrosoftScriptingDebugging.aspx"&gt;Lightweight
Debugging&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
417 bugs fixed! 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Anyway, with 2.6 winding down, the IronPython team finds ourselves in a unique position
that we’ve never been in before: &lt;u&gt;caught up&lt;/u&gt;. As far as I can tell, most of the
Python community hasn’t made the move to &lt;a href="http://www.python.org/download/releases/3.1"&gt;Python
3.1&lt;/a&gt; and &lt;a href="http://www.python.org/dev/peps/pep-0373/"&gt;Python 2.7&lt;/a&gt; is looking
like it will be released &lt;a href="http://mail.python.org/pipermail/python-dev/2009-September/092005.html"&gt;next
summer&lt;/a&gt;. So IronPython is caught up with the latest version of Python most of the
Python community appears to be using. 
&lt;/p&gt;
&lt;p&gt;
So that begs the question: what do we do now?
&lt;/p&gt;
&lt;p&gt;
Of course, we want to hear from you regarding our next steps, but some things we are
looking at include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;u&gt;.NET Framework 4.0 
&lt;br /&gt;
&lt;/u&gt;We’ve shipped CTP releases of IronPython for each public beta of Visual Studio
2010 and&amp;#160; .NET Framework 4.0. You can expect that to continue as Visual Studio
2010 winds down and ships. 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Fixing Bugs 
&lt;br /&gt;
&lt;/u&gt;417 bugs fixed is good, but there are still 839 active work items in our issue
tracker. In previous releases, we’ve done minor bug fix releases every few months
so we’ll probably keep up that cadence. Make sure you go vote for bugs you think are
important. 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;App Compatibility 
&lt;br /&gt;
&lt;/u&gt;One thing we can do is take some of the more popular Python apps such as Django
and Mercurial and make sure they run well on IronPython. In some cases, there may
need to be changes to the Python apps to get them to run on IronPython (for example,
see &lt;a href="http://jdhardy.blogspot.com/2008/07/django-on-ironpython.html"&gt;Jeff Hardy’s
patch&lt;/a&gt; for running Django on IronPython) which assuredly means more time with lawyers
for me. 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Missing Modules 
&lt;br /&gt;
&lt;/u&gt;While IronPython 2.6 is our implementation of Python 2.6, there are binary modules
we haven’t implemented yet like &lt;a href="http://docs.python.org/library/csv.html"&gt;_csv&lt;/a&gt;, &lt;a href="http://docs.python.org/library/ast.html"&gt;_ast&lt;/a&gt; and &lt;a href="http://docs.python.org/library/pyexpat.html"&gt;pyexpat&lt;/a&gt;.
You could consider this App Compatibility work, but we have a different internal process
for bug fixing and implementing new features so I broke this out separately.&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Documentation&lt;/u&gt; 
&lt;br /&gt;
Invariably an area for improvement in all software, our doc story today is pretty
much “go look at docs.python.org”. Of course, that doesn’t cover any IronPython specific
functionality. Of course, what would be great would be to combine existing Python
docs with IronPython specific docs in a single reference, which also assuredly means
more time with lawyers for me. 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Tutorials 
&lt;br /&gt;
&lt;/u&gt;If you haven’t seen Michael Foord’s &lt;a href="http://www.trypython.org/"&gt;Try Python&lt;/a&gt;,
it’s awesome. However, it was recently pointed out to me that it doesn’t include any
IronPython specific behavior (importing and interoperating with .NET types for example).
The &lt;a href="http://jimmy.schementi.com/silverlight/Tutorial/"&gt;IronRuby Tutorial&lt;/a&gt; has
specific IronRuby features and it would be awesome to do the same for IronPython.
Of course, if we wrote new tutorials in &lt;a href="http://docutils.sourceforge.net/rst.html"&gt;reStructured
Text&lt;/a&gt;, then I’m guessing it would be easy for Michael to include it in Try Python
via his &lt;a href="http://code.google.com/p/rst2xaml/"&gt;rst2xaml&lt;/a&gt; tool. 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;“Just Text” in Silverlight 
&lt;br /&gt;
&lt;/u&gt;If you haven’t seen MIX Online Labs &lt;a href="http://www.visitmix.com/Labs/gestalt/"&gt;Gestalt
project&lt;/a&gt;, browse to &lt;a href="http://www.visitmix.com/labs/gestalt/samples/getting.started/05_final.html"&gt;one
of the samples&lt;/a&gt; and View Source. Python as “just text” in the browser. Cool, eh? &lt;a href="http://blog.jimmy.schementi.com/"&gt;Jimmy&lt;/a&gt; is
working on &lt;a href="http://rubyforge.org/pipermail/ironruby-core/2009-September/005245.html"&gt;implementing
the “just text” model&lt;/a&gt; for the Silverlight version of IronPython (and &lt;a href="http://www.visitmix.com/labs/gestalt/samples/getting.started/01_ruby.html"&gt;IronRuby&lt;/a&gt;). 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Visual Studio 
&lt;br /&gt;
&lt;/u&gt;There’s no work item for VS Integration in our issue tracker, but there have been &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=475830"&gt;112
votes for IronPython integration&lt;/a&gt; (as well as &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=479957"&gt;79
votes for IronRuby integration&lt;/a&gt;) in the VS 2010 connect bug database. No promises
here, but we are acutely aware of how popular this suggestion is. 
&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;CodePlex Foundation&lt;/u&gt; 
&lt;br /&gt;
The &lt;a href="http://codeplex.org/"&gt;CodePlex Foundation&lt;/a&gt; is a new non-profit foundation
sponsored by Microsoft with the explicit mission “to enable the exchange of code and
understanding among software companies and open source communities.” As one of the
oldest open source projects at Microsoft, we are very interested in the CodePlex Foundation
as you might imagine. However, CodePlex Foundation is VERY new - everything is tagged
“interim” for the first 100 days. Once the Foundation elects non-interim board members
and establishes things like a charter and by-laws, you can be sure we’ll be investigating
it more thoroughly. In other words, definitely more time with lawyers for me. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In case I haven’t said it lately, it’s great working on the IronPython team with &lt;a href="http://blogs.msdn.com/dinoviehland/"&gt;Dino
Viehland&lt;/a&gt;, &lt;a href="http://knowbody.livejournal.com"&gt;Dave Fugate&lt;/a&gt; and &lt;a href="http://lists.ironpython.com/pipermail/users-ironpython.com/2008-December/009154.html"&gt;David
DiCato&lt;/a&gt; (The IronRuby guys aren’t bad either!). Also, I may whine about the amount
of time I spend with lawyers, but honestly Yong, Kathryn and Kevin – our main LCA
contacts – do a great job helping us figure out how and where to push the envelope
so thanks to them as well.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=e87976bd-9c06-47b4-ae1e-8729dc4e32d6" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=e87976bd-9c06-47b4-ae1e-8729dc4e32d6</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,e87976bd-9c06-47b4-ae1e-8729dc4e32d6.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,e87976bd-9c06-47b4-ae1e-8729dc4e32d6.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=e87976bd-9c06-47b4-ae1e-8729dc4e32d6</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">12</slash:comments></item></channel></rss>
