<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Pragmatic Prose</title>
    <link>http://pragmaticprose.com/</link>
    <description>Code, Life, Wisdom, Practically</description>
    <language>en-us</language>
    <copyright>Chris Weber</copyright>
    <lastBuildDate>Tue, 24 Jun 2008 21:49:58 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.9.6264.0</generator>
    <managingEditor>webercj@gmail.com</managingEditor>
    <webMaster>webercj@gmail.com</webMaster>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=3548a7d0-6bc0-44f4-8e35-329d3bea7ec7</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,3548a7d0-6bc0-44f4-8e35-329d3bea7ec7.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,3548a7d0-6bc0-44f4-8e35-329d3bea7ec7.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3548a7d0-6bc0-44f4-8e35-329d3bea7ec7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <ol>
          <li>
Reduce dependencies<br />
Isolate them if you can't remove them.</li>
          <li>
Log Don't Explode</li>
          <li>
Don't Handle Errors if You Don't Know How<br />
Let them raise so they can get identified and fixed</li>
        </ol>
        <img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=3548a7d0-6bc0-44f4-8e35-329d3bea7ec7" />
      </body>
      <title>Tips for Robust Software</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,3548a7d0-6bc0-44f4-8e35-329d3bea7ec7.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,3548a7d0-6bc0-44f4-8e35-329d3bea7ec7.aspx</link>
      <pubDate>Tue, 24 Jun 2008 21:49:58 GMT</pubDate>
      <description>&lt;ol&gt;
&lt;li&gt;
Reduce dependencies&lt;br&gt;
Isolate them if you can't remove them.&lt;/li&gt;
&lt;li&gt;
Log Don't Explode&lt;/li&gt;
&lt;li&gt;
Don't Handle Errors if You Don't Know How&lt;br&gt;
Let them raise so they can get identified and fixed&lt;/li&gt;
&lt;/ol&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=3548a7d0-6bc0-44f4-8e35-329d3bea7ec7" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,3548a7d0-6bc0-44f4-8e35-329d3bea7ec7.aspx</comments>
      <category>Design</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=a0983813-66b9-49b5-8f3d-b9469333d476</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,a0983813-66b9-49b5-8f3d-b9469333d476.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,a0983813-66b9-49b5-8f3d-b9469333d476.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a0983813-66b9-49b5-8f3d-b9469333d476</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Occasionally I need to change a a camel
case or Pascal case string into a human readable string.  Since I find myself
doing this again and again, I figured I better post it here.<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"><br /></span></span></p><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">string</span> HumanizeString(<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">string</span> source)<br />
{<br />
StringBuilder sb <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">new</span> StringBuilder();<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">char</span> last <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">char</span>.MinValue;<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">foreach</span> (<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">char</span> c <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">in</span> source)<br />
{<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span> (<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">char</span>.IsLower(last)
&amp;&amp;<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">char</span>.IsUpper(c))<br />
{ sb.Append(' '); }<br />
sb.Append(c);<br />
last <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> c;<br />
}<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">return</span> sb.ToString();<br />
}</span></p><p></p><img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=a0983813-66b9-49b5-8f3d-b9469333d476" /></body>
      <title>Humanize String in C# (Split String On Capital Letters)</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,a0983813-66b9-49b5-8f3d-b9469333d476.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,a0983813-66b9-49b5-8f3d-b9469333d476.aspx</link>
      <pubDate>Thu, 12 Jun 2008 21:47:38 GMT</pubDate>
      <description>Occasionally I need to change a a camel case or Pascal case string into a human readable string.&amp;nbsp; Since I find myself doing this again and again, I figured I better post it here.&lt;br&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;private&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; HumanizeString(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; source)&lt;br&gt;
{&lt;br&gt;
StringBuilder sb &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; StringBuilder();&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;char&lt;/span&gt; last &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;char&lt;/span&gt;.MinValue;&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;char&lt;/span&gt; c &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; source)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;char&lt;/span&gt;.IsLower(last)
&amp;amp;&amp;amp;&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;char&lt;/span&gt;.IsUpper(c))&lt;br&gt;
{ sb.Append(' '); }&lt;br&gt;
sb.Append(c);&lt;br&gt;
last &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; c;&lt;br&gt;
}&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; sb.ToString();&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=a0983813-66b9-49b5-8f3d-b9469333d476" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,a0983813-66b9-49b5-8f3d-b9469333d476.aspx</comments>
      <category>ASP.NET;C#</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=f1be7312-3bd9-4861-8ef7-0365085c4860</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,f1be7312-3bd9-4861-8ef7-0365085c4860.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,f1be7312-3bd9-4861-8ef7-0365085c4860.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f1be7312-3bd9-4861-8ef7-0365085c4860</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Find controls in a page or another control<br /><br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">List&lt;T&gt;
FindControls&lt;T&gt;(Control control) where T : Control<br />
{<br />
List&lt;T&gt; list <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">new</span> List&lt;T&gt;();<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">foreach</span> (Control
c <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">in</span> control.Controls)<br />
{<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span> (c <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">is</span> T)<br />
{<br />
Global.LogDebug(c.ID);<br />
list.Add(c <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">as</span> T);<br />
}<br /><br />
list.AddRange(FindControls&lt;T&gt;(c));<br />
}<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">return</span> list;<br />
}<br /><br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span> Control
FindControlRecursive(Control root, <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">string</span> id)<br />
{<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span> (root.ID
== id)<br />
{<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">return</span> root;<br />
}<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">foreach</span> (Control
c <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">in</span> root.Controls)<br />
{<br />
Control t <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> FindControlRecursive(c,
id);<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span> (t
!<span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">null</span>)<br />
{<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">return</span> t;<br />
}<br />
}<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">return</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">null</span>;<br />
}</span></p><br /><p></p><img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=f1be7312-3bd9-4861-8ef7-0365085c4860" /></body>
      <title>Find controls in a page or another control</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,f1be7312-3bd9-4861-8ef7-0365085c4860.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,f1be7312-3bd9-4861-8ef7-0365085c4860.aspx</link>
      <pubDate>Wed, 26 Mar 2008 15:35:09 GMT</pubDate>
      <description>Find controls in a page or another control&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;List&amp;lt;T&amp;gt;
FindControls&amp;lt;T&amp;gt;(Control control) where T : Control&lt;br&gt;
{&lt;br&gt;
List&amp;lt;T&amp;gt; list &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; List&amp;lt;T&amp;gt;();&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (Control
c &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; control.Controls)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (c &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; T)&lt;br&gt;
{&lt;br&gt;
Global.LogDebug(c.ID);&lt;br&gt;
list.Add(c &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; T);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
list.AddRange(FindControls&amp;lt;T&amp;gt;(c));&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; list;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;private&lt;/span&gt; Control
FindControlRecursive(Control root, &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; id)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (root.ID
== id)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; root;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (Control
c &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; root.Controls)&lt;br&gt;
{&lt;br&gt;
Control t &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; FindControlRecursive(c,
id);&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (t
!&lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; t;&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;;&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=f1be7312-3bd9-4861-8ef7-0365085c4860" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,f1be7312-3bd9-4861-8ef7-0365085c4860.aspx</comments>
      <category>ASP.NET;C#</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=59f5b37c-7ae3-4d49-a701-2a4aa93f017e</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,59f5b37c-7ae3-4d49-a701-2a4aa93f017e.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,59f5b37c-7ae3-4d49-a701-2a4aa93f017e.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=59f5b37c-7ae3-4d49-a701-2a4aa93f017e</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Find the compatible types in an assembly:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">static</span> Type[]
FindCompatibleTypes(Assembly assembly, Type baseType)<br />
{<br />
List&lt;Type&gt; types <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">new</span> List&lt;Type&gt;();<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">foreach</span> (Type
type <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">in</span> assembly.GetTypes())<br />
{<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span> (type
!<span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> baseType
&amp;&amp; baseType.IsAssignableFrom(type))<br />
types.Add(type);<br />
}<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">return</span> types.ToArray();<br />
}</span></p><p></p><img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=59f5b37c-7ae3-4d49-a701-2a4aa93f017e" /></body>
      <title>C# Find Compatible Types</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,59f5b37c-7ae3-4d49-a701-2a4aa93f017e.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,59f5b37c-7ae3-4d49-a701-2a4aa93f017e.aspx</link>
      <pubDate>Wed, 26 Mar 2008 14:43:39 GMT</pubDate>
      <description>Find the compatible types in an assembly:&lt;br&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;static&lt;/span&gt; Type[]
FindCompatibleTypes(Assembly assembly, Type baseType)&lt;br&gt;
{&lt;br&gt;
List&amp;lt;Type&amp;gt; types &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; List&amp;lt;Type&amp;gt;();&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (Type
type &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; assembly.GetTypes())&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (type
!&lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; baseType
&amp;amp;&amp;amp; baseType.IsAssignableFrom(type))&lt;br&gt;
types.Add(type);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; types.ToArray();&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=59f5b37c-7ae3-4d49-a701-2a4aa93f017e" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,59f5b37c-7ae3-4d49-a701-2a4aa93f017e.aspx</comments>
      <category>C#</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">In the last few years, I've come to believe
very strongly in personality as a key to understanding yourself and your relationship
with others.<br /><br />
I've come across an article that I agree with and have seen work in person:<br /><br /><a href="http://www.softwarebyrob.com/2006/08/20/personality-traits-of-the-best-software-developers/">http://www.softwarebyrob.com/2006/08/20/personality-traits-of-the-best-software-developers/</a><br /><br />
Personally, I've seen the example of flaky people writing flaky code, where the invere
is also true; solid people writing solid code.<br /><p></p><img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771" /></body>
      <title>Programmer Personality Types</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771.aspx</link>
      <pubDate>Sun, 24 Feb 2008 15:43:16 GMT</pubDate>
      <description>In the last few years, I've come to believe very strongly in personality as a key to understanding yourself and your relationship with others.&lt;br&gt;
&lt;br&gt;
I've come across an article that I agree with and have seen work in person:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.softwarebyrob.com/2006/08/20/personality-traits-of-the-best-software-developers/"&gt;http://www.softwarebyrob.com/2006/08/20/personality-traits-of-the-best-software-developers/&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
Personally, I've seen the example of flaky people writing flaky code, where the invere
is also true; solid people writing solid code.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,bdf7cdf5-3cd4-4d00-a7e1-5b5ece906771.aspx</comments>
      <category>General;Productivity</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=56a39978-7597-4af3-ac03-30aa117f5c29</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,56a39978-7597-4af3-ac03-30aa117f5c29.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,56a39978-7597-4af3-ac03-30aa117f5c29.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=56a39978-7597-4af3-ac03-30aa117f5c29</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Interpolation is just a fancy word for
variable substitutioin in a string.<br /><br />
According to the free dictionary interpolate means:<br /><div class="ds-list"><b>1. </b> To insert or introduce between other elements or parts.
</div><b>2. </b><div class="sds-list"><b>    a. </b> To insert (material) into a text.
</div><br />
Perl does this very well, other language less so.  Less is a hybrid of the C#
method for string formatting.  I find it pretty convenient when creating a lot
of dynamic html to insert using that oh so hander innerHTML property.  Remember,
innerHTML is usually the fastest way to add dynamic html.<br /><br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">function
format(format) {<br />
var <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">params</span><span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> arguments;<br />
var toReturn <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> format;<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">for</span> (var
i <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> 0;
i &lt; <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">params</span>.length <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">-</span> 1;
i++) {<br />
var rString <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> '\\$\\{' <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> (i) <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> '\\}';<br />
var regex <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">new</span> RegExp(rString, <span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"g"</span>);<br />
toReturn <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> toReturn.replace(regex, <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">params</span>[i <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> 1]);<br />
}<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">return</span> toReturn;<br />
}</span></p>
Here's the <a href="http://pragmaticprose.com/PermaLink,guid,abf25df7-5696-4bb3-bf8b-ddb42019975b.aspx">original
interpolation function that extended the string object</a>.  I don't really think
that extending builtin objects is a great idea unless there is no other way.<br /><p></p><img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=56a39978-7597-4af3-ac03-30aa117f5c29" /></body>
      <title>Updated JavaScript String Interpolation (Formatting) Function</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,56a39978-7597-4af3-ac03-30aa117f5c29.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,56a39978-7597-4af3-ac03-30aa117f5c29.aspx</link>
      <pubDate>Mon, 21 Jan 2008 01:46:19 GMT</pubDate>
      <description>Interpolation is just a fancy word for variable substitutioin in a string.&lt;br&gt;
&lt;br&gt;
According to the free dictionary interpolate means:&lt;br&gt;
&lt;div class="ds-list"&gt;&lt;b&gt;1. &lt;/b&gt; To insert or introduce between other elements or parts.
&lt;/div&gt;
&lt;b&gt;2. &lt;/b&gt;
&lt;div class="sds-list"&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. &lt;/b&gt; To insert (material) into a text.
&lt;/div&gt;
&lt;br&gt;
Perl does this very well, other language less so.&amp;nbsp; Less is a hybrid of the C#
method for string formatting.&amp;nbsp; I find it pretty convenient when creating a lot
of dynamic html to insert using that oh so hander innerHTML property.&amp;nbsp; Remember,
innerHTML is usually the fastest way to add dynamic html.&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;function
format(format) {&lt;br&gt;
var &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;params&lt;/span&gt; &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; arguments;&lt;br&gt;
var toReturn &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; format;&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;for&lt;/span&gt; (var
i &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; 0;
i &amp;lt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;params&lt;/span&gt;.length &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;-&lt;/span&gt; 1;
i++) {&lt;br&gt;
var rString &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; '\\$\\{' &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;+&lt;/span&gt; (i) &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;+&lt;/span&gt; '\\}';&lt;br&gt;
var regex &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; RegExp(rString, &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"g"&lt;/span&gt;);&lt;br&gt;
toReturn &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; toReturn.replace(regex, &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;params&lt;/span&gt;[i &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;+&lt;/span&gt; 1]);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; toReturn;&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
Here's the &lt;a href="http://pragmaticprose.com/PermaLink,guid,abf25df7-5696-4bb3-bf8b-ddb42019975b.aspx"&gt;original
interpolation function that extended the string object&lt;/a&gt;.&amp;nbsp; I don't really think
that extending builtin objects is a great idea unless there is no other way.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=56a39978-7597-4af3-ac03-30aa117f5c29" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,56a39978-7597-4af3-ac03-30aa117f5c29.aspx</comments>
      <category>javascript;Web</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
OK, so I've been using Python quite a bit lately and I've been enjoying it. 
I've been getting stuff done with it too.  Python inter-operates with COM quite
well and that saved me a lot of pain yesterday.  However, learning Python has
caused me pain in other areas.
</p>
        <p>
Yesterday I had to perform some maintenance in a C# ASP.NET app that I had written
not too long ago.  Even though I use the CoolStorage.NET and some other nice
time savers, it has become painful to write C# code.  It's just too verbose.
</p>
        <p>
I used to marvel at people who claimed that you don't need an IDE to develop with
Python.  I thought that was blasphemy as Visual Studio was the bee's knees in
C# development.  However, I'm amazed at how much more I'm engaged in coding when
I'm writing Python (or JavaScript).  You have to pay attention to what you're
doing, no IDE is going to help you out.  However, this heightened state of concentration
is actually fantastic for writing good code.
</p>
        <p>
I use Notepad++ as my editor for Python (and JavaScript and HTML, etc) when I'm not
using C# and Visual Studio.  I find its adequate for the job and it does have
a function/method browser built in.  It also does HTML auto-complete and it can
highlight a psp template file where I have Python, HTML and JavaScript all in one
file.  It's also very stable, something that Visual Studio is not.
</p>
        <p>
Visual Studio 2005 is flaky.  Sometimes all my Windows will rearrange or reset. 
Other odd things happen and I find myself re configuring my layout from scratch. 
Actually worse than scratch because every thing is helter skelter around.  
</p>
        <p>
The worst part though is the amount of code I have to write to keep the compiler happy. 
I know what I want to do and I know how I want to do it but I have to tell the compiler
what I'm doing ahead of time so that it's happy.  Honestly, this is a great feature
for a newbie or someone who really doesn't want to learn the language.  However,
it becomes a burden after a while.  The C family of language has so many tokens
(symbols like { [ ( ; , for while do foreach if) that your code becomes very noisy
very fast.  Python is nice and clean which is something that I've come to appreciate.
</p>
        <p>
I think I've found a better appreciation for Python (and JavaScript) because I've
used C#/C++/Java.  For my everyday programming needs Python can handle everything
I need to do.  However, at my current job getting Python into the mix might be
a bit hard.  However, it might be worth it.  We spend so much of our day
writing Programs that should just be nice and easy scripts.  We have so many
programs and projects that could easily be one python file.  We do a lot of file
transfer and validation.  
</p>
        <p>
So yes, I'm feeling the pain of C#.  I just don't need/want that bug IDE and
big language for what I need to do.  
</p>
        <p>
Python does it faster, smaller and cleaner.  
</p>
        <img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599" />
      </body>
      <title>Feeling the Pain in C#</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599.aspx</link>
      <pubDate>Wed, 09 Jan 2008 15:33:53 GMT</pubDate>
      <description>&lt;p&gt;
OK, so I've been using Python quite a bit lately and I've been enjoying it.&amp;nbsp;
I've been getting stuff done with it too.&amp;nbsp; Python inter-operates with COM quite
well and that saved me a lot of pain yesterday.&amp;nbsp; However, learning Python has
caused me pain in other areas.
&lt;/p&gt;
&lt;p&gt;
Yesterday I had to perform some maintenance in a C# ASP.NET app that I had written
not too long ago.&amp;nbsp; Even though I use the CoolStorage.NET and some other nice
time savers, it has become painful to write C# code.&amp;nbsp; It's just too verbose.
&lt;/p&gt;
&lt;p&gt;
I used to marvel at people who claimed that you don't need an IDE to develop with
Python.&amp;nbsp; I thought that was blasphemy as Visual Studio was the bee's knees in
C# development.&amp;nbsp; However, I'm amazed at how much more I'm engaged in coding when
I'm writing Python (or JavaScript).&amp;nbsp; You have to pay attention to what you're
doing, no IDE is going to help you out.&amp;nbsp; However, this heightened state of concentration
is actually fantastic for writing good code.
&lt;/p&gt;
&lt;p&gt;
I use Notepad++ as my editor for Python (and JavaScript and HTML, etc) when I'm not
using C# and Visual Studio.&amp;nbsp; I find its adequate for the job and it does have
a function/method browser built in.&amp;nbsp; It also does HTML auto-complete and it can
highlight a psp template file where I have Python, HTML and JavaScript all in one
file.&amp;nbsp; It's also very stable, something that Visual Studio is not.
&lt;/p&gt;
&lt;p&gt;
Visual Studio 2005 is flaky.&amp;nbsp; Sometimes all my Windows will rearrange or reset.&amp;nbsp;
Other odd things happen and I find myself re configuring my layout from scratch.&amp;nbsp;
Actually worse than scratch because every thing is helter skelter around.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
The worst part though is the amount of code I have to write to keep the compiler happy.&amp;nbsp;
I know what I want to do and I know how I want to do it but I have to tell the compiler
what I'm doing ahead of time so that it's happy.&amp;nbsp; Honestly, this is a great feature
for a newbie or someone who really doesn't want to learn the language.&amp;nbsp; However,
it becomes a burden after a while.&amp;nbsp; The C family of language has so many tokens
(symbols like { [ ( ; , for while do foreach if) that your code becomes very noisy
very fast.&amp;nbsp; Python is nice and clean which is something that I've come to appreciate.
&lt;/p&gt;
&lt;p&gt;
I think I've found a better appreciation for Python (and JavaScript) because I've
used C#/C++/Java.&amp;nbsp; For my everyday programming needs Python can handle everything
I need to do.&amp;nbsp; However, at my current job getting Python into the mix might be
a bit hard.&amp;nbsp; However, it might be worth it.&amp;nbsp; We spend so much of our day
writing Programs that should just be nice and easy scripts.&amp;nbsp; We have so many
programs and projects that could easily be one python file.&amp;nbsp; We do a lot of file
transfer and validation.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
So yes, I'm feeling the pain of C#.&amp;nbsp; I just don't need/want that bug IDE and
big language for what I need to do.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Python does it faster, smaller and cleaner.&amp;nbsp; 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,5cc0ffab-74f2-48bd-b0fc-1ee96a5cb599.aspx</comments>
      <category>ASP.NET;C#;Languages;Productivity;Python</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=b006db76-0573-4380-a901-72876f2bebff</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,b006db76-0573-4380-a901-72876f2bebff.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,b006db76-0573-4380-a901-72876f2bebff.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b006db76-0573-4380-a901-72876f2bebff</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Have you ever need to browse to several pages and print them?  It seems like
it should be easy and it is with this little Python script.
</p>
        <p>
I had an Intranet based system that displayed items in a browser.  The manager
of the group I built this for asked for a hard copy of every item that fit a certain
criteria.  So instead of them going to over 400 pages by hand I just created
this simple script.  
</p>
        <p>
It worked like a charm.
</p>
        <p>
#start script
</p>
        <p>
from win32com import client 
<br />
import time
</p>
        <p>
ie = client.Dispatch("InternetExplorer.Application")
</p>
        <p>
def printPage(url):
</p>
        <p>
    print "printing " + url<br />
    ie.Navigate(url)
</p>
        <p>
    while ie.Busy:<br />
        time.sleep(1)<br />
        print 'navigating...'
</p>
        <p>
    print 'starting print job...'<br />
    ie.ExecWB(6, 2)<br />
    print 'executed print job.'<br />
   
<br />
    while ie.Busy:<br />
        time.sleep(1)<br />
        print 'printing...'
</p>
        <p>
          <br />
printPage("<a href="http://google.com">http://google.com</a>")<br />
ie.Quit()
</p>
        <p>
#end script
</p>
        <p>
Sources:
</p>
        <p>
          <a href="http://www.darkcoding.net/software/printing-word-and-pdf-files-from-python/">http://www.darkcoding.net/software/printing-word-and-pdf-files-from-python/</a>
        </p>
        <p>
          <a href="http://www.grimsworld.org.uk/printie.html">http://www.grimsworld.org.uk/printie.html</a>
        </p>
        <img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=b006db76-0573-4380-a901-72876f2bebff" />
      </body>
      <title>Automate Internet Explorer Printing</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,b006db76-0573-4380-a901-72876f2bebff.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,b006db76-0573-4380-a901-72876f2bebff.aspx</link>
      <pubDate>Tue, 08 Jan 2008 21:44:48 GMT</pubDate>
      <description>&lt;p&gt;
Have you ever need to browse to several pages and print them?&amp;nbsp; It seems like
it should be easy and it is with this little Python script.
&lt;/p&gt;
&lt;p&gt;
I had an Intranet based system that displayed items in a browser.&amp;nbsp; The manager
of the group I built this for asked for a hard copy of every item that fit a certain
criteria.&amp;nbsp; So instead of them going to over 400 pages by hand I just created
this simple script.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
It worked like a charm.
&lt;/p&gt;
&lt;p&gt;
#start script
&lt;/p&gt;
&lt;p&gt;
from win32com import client 
&lt;br&gt;
import time
&lt;/p&gt;
&lt;p&gt;
ie = client.Dispatch("InternetExplorer.Application")
&lt;/p&gt;
&lt;p&gt;
def printPage(url):
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "printing " + url&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ie.Navigate(url)
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; while ie.Busy:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time.sleep(1)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'navigating...'
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'starting print job...'&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ie.ExecWB(6, 2)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'executed print job.'&lt;br&gt;
&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; while ie.Busy:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time.sleep(1)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'printing...'
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
printPage("&lt;a href="http://google.com"&gt;http://google.com&lt;/a&gt;")&lt;br&gt;
ie.Quit()
&lt;/p&gt;
&lt;p&gt;
#end script
&lt;/p&gt;
&lt;p&gt;
Sources:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.darkcoding.net/software/printing-word-and-pdf-files-from-python/"&gt;http://www.darkcoding.net/software/printing-word-and-pdf-files-from-python/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.grimsworld.org.uk/printie.html"&gt;http://www.grimsworld.org.uk/printie.html&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=b006db76-0573-4380-a901-72876f2bebff" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,b006db76-0573-4380-a901-72876f2bebff.aspx</comments>
      <category>Web;Windows;Python</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=50c1eda0-7737-474d-8e1d-09d0b569e27c</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,50c1eda0-7737-474d-8e1d-09d0b569e27c.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,50c1eda0-7737-474d-8e1d-09d0b569e27c.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=50c1eda0-7737-474d-8e1d-09d0b569e27c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <b>Or ORM's Are Not the Whole Answer</b>
        <br />
        <b>OR Some ORM's Are A Better Answer</b>
        <br />
        <br />
One point I feel I need to make.  So many people seem to think that at some point
an ORM will appear that will just magically work.  It will map all your entities
to objects and "just work."<br /><br />
So an endless parade of ORM's continue to lurch forth from the hinterlands.  
<br /><br />
I'm amazed that people like Bruce <a href="http://www.artima.com/forums/flat.jsp?forum=106&amp;thread=150834">Eckel
think that an ORM powerful enough</a> will just solve the problem.<br /><br />
The thinking is usually something like "we can shield the user from that ugly, mean
SQL with some nice procedural and markup tricks."  
<br /><br />
I've come to believe that anytime you try to hide/wrap/abstract a powerful technology/language
(SQL, JavaScript, HTML, etc) you end up with at best a leaky abstraction and at worst
a complete mess.<br /><br />
SQL is concise and powerful.  It doesn't need to be hidden.  It's not that
hard to understand.  It's at least easier to understand than most of the ORM
frameworks.  It's quite ridiculous what kind of code acrobatics you must perform
to add parameters to a query.  
<br /><br />
One of the biggest problems with an ORM is predicting what kind of code they will
generate/execute.  The more considerate frameworks include a logging function
of some sort.  This is nice but when I go to look at some code and I find a bunch
of ORM garbage code, I find myself wishing for the SQL.<br /><br />
I used to hate embedded SQL, then I realized there really is nothing wrong with it,
and it fact it's preferable as I found out what a web page is doing all in one file,
without analyzing a (now unsupported) ORM or trying to find a stored procedure in
the database.<br /><br />
The stored procedure approach is not that bad, I just find myself shying away from
them as code re-use is a myth.  Yes, now I've become a true OOP Heretic. 
Code re-use, especially between projects, is a rarity.  And this is the major
problem with ORM's, they tend to emphasize the one object for every situation paradigm.<br /><br />
If I have an employee table, naturally I will have an employee object, if I'm an OOP
ORM <a href="http://en.wikipedia.org/wiki/Myrmidons">Myrmidon</a>.  So I try
to use this Employee object for my employee edit screen, my employee absence report,
my employee salary report, my company org chart, etc, etc.  However, I soon find
my nice clean ERD and UML diagrams become corrupted by the business needs.  We
have to join in extra tables.  Pretty soon we are writing all manner of custom
logic in our programming language of choice.  We have to use a little somthing
like join_to(tables.employee_benefits).get_by(table.columns.user_name='a%').limit(10).sort_by(table.columns.user_name).  
<br /><br />
We are wasting resources by bringing back unneeded columns.  Because the One
True Employee contains fields for every situation, we populate the whole object for
every request.  We can resort to lazy loading and other performance optimizations
for expensive entities.  
<br /><br /><b>The <i>Better</i> Solution</b><br /><a href="http://en.wikipedia.org/wiki/Myrmidons"></a><br />
The answer is that there is no answer.  However, I think the frameworks like <a href="http://www.codeplex.com/CoolStorage">CoolStorage.NET</a> and
the db library in <a href="http://webpy.org">Web.Py</a> have a nice ability to load
data from queries into objects.  This takes away about 80 percent of the pain
of Database/Object interaction and let's us use queries specific to the Use Case at
hand.<br /><br />
I think the best we can do is to use the best tool for the job, in the case of talking
to databases that tool is SQL.  We should use SQL and take advantage of automatic
mapping.  
<br /><br />
Learning SQL one time is much better than learning a new ORM every year.  I feel
the same for HTML, JavaScript, CSS and the rest of fundamental technologies of our
trade.  
<br /><br /><br /><br /><a href="http://en.wikipedia.org/wiki/Myrmidons"></a><p></p><img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=50c1eda0-7737-474d-8e1d-09d0b569e27c" /></body>
      <title>ORM's Are Not The Answer</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,50c1eda0-7737-474d-8e1d-09d0b569e27c.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,50c1eda0-7737-474d-8e1d-09d0b569e27c.aspx</link>
      <pubDate>Sun, 16 Dec 2007 21:54:42 GMT</pubDate>
      <description>&lt;b&gt;Or ORM's Are Not the Whole Answer&lt;/b&gt;
&lt;br&gt;
&lt;b&gt;OR Some ORM's Are A Better Answer&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
One point I feel I need to make.&amp;nbsp; So many people seem to think that at some point
an ORM will appear that will just magically work.&amp;nbsp; It will map all your entities
to objects and "just work."&lt;br&gt;
&lt;br&gt;
So an endless parade of ORM's continue to lurch forth from the hinterlands.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
I'm amazed that people like Bruce &lt;a href="http://www.artima.com/forums/flat.jsp?forum=106&amp;amp;thread=150834"&gt;Eckel
think that an ORM powerful enough&lt;/a&gt; will just solve the problem.&lt;br&gt;
&lt;br&gt;
The thinking is usually something like "we can shield the user from that ugly, mean
SQL with some nice procedural and markup tricks."&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
I've come to believe that anytime you try to hide/wrap/abstract a powerful technology/language
(SQL, JavaScript, HTML, etc) you end up with at best a leaky abstraction and at worst
a complete mess.&lt;br&gt;
&lt;br&gt;
SQL is concise and powerful.&amp;nbsp; It doesn't need to be hidden.&amp;nbsp; It's not that
hard to understand.&amp;nbsp; It's at least easier to understand than most of the ORM
frameworks.&amp;nbsp; It's quite ridiculous what kind of code acrobatics you must perform
to add parameters to a query.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
One of the biggest problems with an ORM is predicting what kind of code they will
generate/execute.&amp;nbsp; The more considerate frameworks include a logging function
of some sort.&amp;nbsp; This is nice but when I go to look at some code and I find a bunch
of ORM garbage code, I find myself wishing for the SQL.&lt;br&gt;
&lt;br&gt;
I used to hate embedded SQL, then I realized there really is nothing wrong with it,
and it fact it's preferable as I found out what a web page is doing all in one file,
without analyzing a (now unsupported) ORM or trying to find a stored procedure in
the database.&lt;br&gt;
&lt;br&gt;
The stored procedure approach is not that bad, I just find myself shying away from
them as code re-use is a myth.&amp;nbsp; Yes, now I've become a true OOP Heretic.&amp;nbsp;
Code re-use, especially between projects, is a rarity.&amp;nbsp; And this is the major
problem with ORM's, they tend to emphasize the one object for every situation paradigm.&lt;br&gt;
&lt;br&gt;
If I have an employee table, naturally I will have an employee object, if I'm an OOP
ORM &lt;a href="http://en.wikipedia.org/wiki/Myrmidons"&gt;Myrmidon&lt;/a&gt;.&amp;nbsp; So I try
to use this Employee object for my employee edit screen, my employee absence report,
my employee salary report, my company org chart, etc, etc.&amp;nbsp; However, I soon find
my nice clean ERD and UML diagrams become corrupted by the business needs.&amp;nbsp; We
have to join in extra tables.&amp;nbsp; Pretty soon we are writing all manner of custom
logic in our programming language of choice.&amp;nbsp; We have to use a little somthing
like join_to(tables.employee_benefits).get_by(table.columns.user_name='a%').limit(10).sort_by(table.columns.user_name).&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
We are wasting resources by bringing back unneeded columns.&amp;nbsp; Because the One
True Employee contains fields for every situation, we populate the whole object for
every request.&amp;nbsp; We can resort to lazy loading and other performance optimizations
for expensive entities.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;The &lt;i&gt;Better&lt;/i&gt; Solution&lt;/b&gt;
&lt;br&gt;
&lt;a href="http://en.wikipedia.org/wiki/Myrmidons"&gt;&lt;/a&gt;
&lt;br&gt;
The answer is that there is no answer.&amp;nbsp; However, I think the frameworks like &lt;a href="http://www.codeplex.com/CoolStorage"&gt;CoolStorage.NET&lt;/a&gt; and
the db library in &lt;a href="http://webpy.org"&gt;Web.Py&lt;/a&gt; have a nice ability to load
data from queries into objects.&amp;nbsp; This takes away about 80 percent of the pain
of Database/Object interaction and let's us use queries specific to the Use Case at
hand.&lt;br&gt;
&lt;br&gt;
I think the best we can do is to use the best tool for the job, in the case of talking
to databases that tool is SQL.&amp;nbsp; We should use SQL and take advantage of automatic
mapping.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
Learning SQL one time is much better than learning a new ORM every year.&amp;nbsp; I feel
the same for HTML, JavaScript, CSS and the rest of fundamental technologies of our
trade.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://en.wikipedia.org/wiki/Myrmidons"&gt;&lt;/a&gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=50c1eda0-7737-474d-8e1d-09d0b569e27c" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,50c1eda0-7737-474d-8e1d-09d0b569e27c.aspx</comments>
      <category>C#;Design;Languages;SQL</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=8f21021e-3f68-4ede-affd-a13fa3ee7c28</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,8f21021e-3f68-4ede-affd-a13fa3ee7c28.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,8f21021e-3f68-4ede-affd-a13fa3ee7c28.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=8f21021e-3f68-4ede-affd-a13fa3ee7c28</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <a href="http://www.aspfaqs.com/webtech/042606-1.shtml">http://www.aspfaqs.com/webtech/042606-1.shtml</a>
        <br />
        <br />
One of the best (not to mention easiest) paging methods I've seen.  In fact it
requires no temp tables or table variables.  
<br /><br />
Paging is something that is so common yet seems to hard to get right and keep performant
that it pays to have a nice easy template to start from.  I've posted this mainly
for my own benefit so I have a permanant bookmark to this code.<br /><br />
The example uses a stored procedure, but its important to understand that a stored
procedure is not required to make this work.<br /><br />
Here's the code:<br /><br /><blockquote><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">CREATE</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">PROCEDURE</span> [dbo].[usp_PageResults_NAI] 
<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">(<br />
@startRowIndex <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>,<br />
@maximumRows <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span><br />
)<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">AS</span><br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">DECLARE</span> @first_id <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>,
@startRow <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span><br />
    <br /><span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;">--
A check can be added to make sure @startRowIndex isn't &gt; count(1)</span><br /><span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;">--
from employees before doing any actual work unless it is guaranteed</span><br /><span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;">--
the caller won't do that</span><br /><br /><span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;">--
Get the first employeeID for our page of records</span><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">SET</span> ROWCOUNT
@startRowIndex<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">SELECT</span> @first_id
= employeeID <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">FROM</span> employees <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">ORDER</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">BY</span> employeeid<br /><br /><span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;">--
Now, set the row count to MaximumRows and get</span><br /><span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;">--
all records &gt;= @first_id</span><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">SET</span> ROWCOUNT
@maximumRows<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">SELECT</span> e.*,
d.name <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">as</span> DepartmentName 
<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">FROM</span> employees
e<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">INNER</span><span style="color: Silver; background-color: transparent; font-family: Courier New; font-size: 11px;">JOIN</span> Departments
D <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">ON</span><br />
e.DepartmentID = d.DepartmentID<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">WHERE</span> employeeid
&gt;= @first_id<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">ORDER</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">BY</span> e.EmployeeID<br /><br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">SET</span> ROWCOUNT
0<br /><br />
GO </span></p></blockquote><pre><br /></pre><br /><br /><br /><br /><img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=8f21021e-3f68-4ede-affd-a13fa3ee7c28" /></body>
      <title>A great paging mechanism for SQL Server and ASP.NET</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,8f21021e-3f68-4ede-affd-a13fa3ee7c28.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,8f21021e-3f68-4ede-affd-a13fa3ee7c28.aspx</link>
      <pubDate>Wed, 05 Dec 2007 20:43:40 GMT</pubDate>
      <description>&lt;a href="http://www.aspfaqs.com/webtech/042606-1.shtml"&gt;http://www.aspfaqs.com/webtech/042606-1.shtml&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
One of the best (not to mention easiest) paging methods I've seen.&amp;nbsp; In fact it
requires no temp tables or table variables.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
Paging is something that is so common yet seems to hard to get right and keep performant
that it pays to have a nice easy template to start from.&amp;nbsp; I've posted this mainly
for my own benefit so I have a permanant bookmark to this code.&lt;br&gt;
&lt;br&gt;
The example uses a stored procedure, but its important to understand that a stored
procedure is not required to make this work.&lt;br&gt;
&lt;br&gt;
Here's the code:&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;CREATE&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;PROCEDURE&lt;/span&gt; [dbo].[usp_PageResults_NAI] 
&lt;br&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;(&lt;br&gt;
@startRowIndex &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt;,&lt;br&gt;
@maximumRows &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt;
&lt;br&gt;
)&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;AS&lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;DECLARE&lt;/span&gt; @first_id &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt;,
@startRow &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&lt;span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;--
A check can be added to make sure @startRowIndex isn't &amp;gt; count(1)&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;--
from employees before doing any actual work unless it is guaranteed&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;--
the caller won't do that&lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;--
Get the first employeeID for our page of records&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;SET&lt;/span&gt; ROWCOUNT
@startRowIndex&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;SELECT&lt;/span&gt; @first_id
= employeeID &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;FROM&lt;/span&gt; employees &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;ORDER&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;BY&lt;/span&gt; employeeid&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;--
Now, set the row count to MaximumRows and get&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Teal; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;--
all records &amp;gt;= @first_id&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;SET&lt;/span&gt; ROWCOUNT
@maximumRows&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;SELECT&lt;/span&gt; e.*,
d.name &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; DepartmentName 
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;FROM&lt;/span&gt; employees
e&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;INNER&lt;/span&gt; &lt;span style="color: Silver; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;JOIN&lt;/span&gt; Departments
D &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;ON&lt;/span&gt;
&lt;br&gt;
e.DepartmentID = d.DepartmentID&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;WHERE&lt;/span&gt; employeeid
&amp;gt;= @first_id&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;ORDER&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;BY&lt;/span&gt; e.EmployeeID&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;SET&lt;/span&gt; ROWCOUNT
0&lt;br&gt;
&lt;br&gt;
GO &lt;/span&gt;
&lt;/p&gt;
&lt;/blockquote&gt;&lt;pre&gt;
&lt;br&gt;
&lt;/pre&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=8f21021e-3f68-4ede-affd-a13fa3ee7c28" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,8f21021e-3f68-4ede-affd-a13fa3ee7c28.aspx</comments>
      <category>ASP.NET;SQL;Web</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=565809fb-e7e1-405e-ba73-0d0b145120fe</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,565809fb-e7e1-405e-ba73-0d0b145120fe.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,565809fb-e7e1-405e-ba73-0d0b145120fe.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=565809fb-e7e1-405e-ba73-0d0b145120fe</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In my previous post about <a href="http://pragmaticprose.com/PermaLink,guid,01fb6351-eb8c-4e36-af8b-2b7917749c2c.aspx">what
people use computers for</a>, I stated that computers are for saving state. 
Duh.  I felt I needed to make that clear to myself as I explored functional programming
languages like Erlang, F# and Scheme.  State seems to be a dirty word relegated
to second class citizenry in a functional world.
</p>
        <p>
I think that functional language have an uphill battle for mainstream acceptance. 
A bit bolder, I think they are a small niche and always will be a small niche. 
In fairness, I think most of literature on functional languages portray them as a
special purpose languages.  As the saying goes, the right tool for the job. 
Microsoft is looking for F# developers to write driver validation software. 
</p>
        <p>
My goal is to find languages that are applicable to general purpose problems. 
I'm not a mathematician and I don't need so solve theorems.  Most of the programming
jobs I've completed involved storing and manipulating some shared stated, a database.
</p>
        <p>
Yet another realization courtesy of a man seeking to <a href="http://www.dreamsongs.com/Files/PatternsOfSoftware.pdf">explain
the failure of the best language on earth</a>.  
</p>
        <p>
Local state in programming is just like scratch paper for mathematics.  Some
rare gifted individuals don't need it and can do the calculus in their head. 
For the rest of us scratch paper and number two pencils are the only alternative.
</p>
        <p>
While debugging, I can inspect the state of the system, either with the debugging
facilities or with well placed print statements.  
</p>
        <p>
So local state helps us understand our systems.  Global state, again databases,
are the reason our systems exist.  Some in the Erlang camp want to wish this
away.  However, I think Erlang advocates understand that Erlang was built for
telecom switches.  Erlang's usefulness in general purpose programming is yet
to be determined.  If you're building a system that manipulates global shared
state (most of the web applications in existence), choosing a language that waves
its hands at shared state in the name of concurrency might not be your best choice.
</p>
        <p>
Now we come to the revelation stage of our journey.  What can we do in mainstream
languages to deal with global  shared state (databases) effectively?  I've
found something in my own development work that is effective for me.  It's not
a new language, but in fact, works in many languages, including C# and Python.
</p>
        <p>
My solution may not be a silver bullet, but then I might not be hunting werewolves. 
I can't claim to have invented it.  For from it.  All I can claim is that
I've seen this pattern work across languages.  I can also tell you that it might
be a wooden stake, useful if you are hunting vampires. 
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=565809fb-e7e1-405e-ba73-0d0b145120fe" />
      </body>
      <title>What People Really Use Computers For II</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,565809fb-e7e1-405e-ba73-0d0b145120fe.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,565809fb-e7e1-405e-ba73-0d0b145120fe.aspx</link>
      <pubDate>Sat, 24 Nov 2007 16:16:25 GMT</pubDate>
      <description>&lt;p&gt;
In my previous post about &lt;a href="http://pragmaticprose.com/PermaLink,guid,01fb6351-eb8c-4e36-af8b-2b7917749c2c.aspx"&gt;what
people use&amp;nbsp;computers for&lt;/a&gt;, I stated that computers are for saving state.&amp;nbsp;
Duh.&amp;nbsp; I felt I needed to make that clear to myself as I explored functional programming
languages like Erlang, F# and Scheme.&amp;nbsp; State seems to be a dirty word relegated
to second class citizenry in a functional world.
&lt;/p&gt;
&lt;p&gt;
I think that functional language have an uphill battle for mainstream acceptance.&amp;nbsp;
A bit bolder, I think they are a small niche and always will be&amp;nbsp;a small niche.&amp;nbsp;
In fairness, I think most of literature on functional languages portray them as a
special purpose languages.&amp;nbsp; As the saying goes, the right tool for the job.&amp;nbsp;
Microsoft is looking for F# developers to write driver validation software.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
My goal is to find languages that are applicable to general purpose problems.&amp;nbsp;
I'm not a mathematician and I don't need so solve theorems.&amp;nbsp; Most of the programming
jobs I've completed involved storing and manipulating some shared stated, a database.
&lt;/p&gt;
&lt;p&gt;
Yet another realization courtesy of a man seeking to &lt;a href="http://www.dreamsongs.com/Files/PatternsOfSoftware.pdf"&gt;explain
the failure of the best language on earth&lt;/a&gt;.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Local state in programming is just like scratch paper for mathematics.&amp;nbsp; Some
rare gifted individuals don't need it and can do the calculus in their head.&amp;nbsp;
For the rest of us scratch paper and number two pencils are the only alternative.
&lt;/p&gt;
&lt;p&gt;
While debugging, I can inspect the state of the system, either with the debugging
facilities or with well placed print statements.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
So local state helps us understand our systems.&amp;nbsp; Global state, again databases,
are the reason our systems exist.&amp;nbsp; Some in the Erlang camp want to wish this
away.&amp;nbsp; However, I think Erlang advocates understand that Erlang was built for
telecom switches.&amp;nbsp; Erlang's usefulness in general purpose programming is yet
to be determined.&amp;nbsp; If you're building a system that manipulates global shared
state (most of the web applications in existence), choosing a language that waves
its hands at shared state in the name of concurrency might not be your best choice.
&lt;/p&gt;
&lt;p&gt;
Now we come to the revelation stage of our journey.&amp;nbsp; What can we do in mainstream
languages to deal with global&amp;nbsp; shared state (databases) effectively?&amp;nbsp; I've
found something in my own development work that is effective for me.&amp;nbsp; It's not
a new language, but in fact, works in many languages, including C# and Python.
&lt;/p&gt;
&lt;p&gt;
My solution may not be a silver bullet, but then I might not be hunting werewolves.&amp;nbsp;
I can't claim to have invented it.&amp;nbsp; For from it.&amp;nbsp; All I can claim is that
I've seen this pattern work across languages.&amp;nbsp; I can also tell you that it might
be a wooden stake, useful if you are hunting vampires. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=565809fb-e7e1-405e-ba73-0d0b145120fe" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,565809fb-e7e1-405e-ba73-0d0b145120fe.aspx</comments>
      <category>Languages</category>
    </item>
    <item>
      <trackback:ping>http://pragmaticprose.com/Trackback.aspx?guid=b285ed6f-e9ea-443e-ad93-b540b2064120</trackback:ping>
      <pingback:server>http://pragmaticprose.com/pingback.aspx</pingback:server>
      <pingback:target>http://pragmaticprose.com/PermaLink,guid,b285ed6f-e9ea-443e-ad93-b540b2064120.aspx</pingback:target>
      <dc:creator>Chris Weber</dc:creator>
      <wfw:comment>http://pragmaticprose.com/CommentView,guid,b285ed6f-e9ea-443e-ad93-b540b2064120.aspx</wfw:comment>
      <wfw:commentRss>http://pragmaticprose.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b285ed6f-e9ea-443e-ad93-b540b2064120</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For a (brief) while, I was learning F#.  It proved an interesting excursion. 
If you into mathematical correctness F# and OCaml maybe just the languages for you. 
Myself?  Well I'm looking for something with a little more to offer in the functionality
department.  I want a language where I can do most anything.  I'm willing
to sacrifice mathematical niceties.
</p>
        <p>
Python seems to be that language.  Python is one of the languages I knew I would
love when I tried it, so I've held off diving into it until I had gone through almost
every other one.  I've journeyed through Lisp, Scheme, C++, C#, Java, Ruby, F#/OCaml
and dabbled in a few less known like Factor and Cat.  
</p>
        <p>
Python Advantages:
</p>
        <ul>
          <li>
Available and almost every platform (every platform I'm interested in)</li>
          <li>
Terse clear syntax</li>
          <li>
Whitespace (yes, I do enjoy the whitespace!)</li>
          <li>
Easy to learn, easy to teach (I taught C++ to undergrads during my time in Hell)</li>
          <li>
More complete than Ruby</li>
          <li>
Better documented than Ruby</li>
          <li>
Good riddance to the Edit/Compile/Wait/Debug loop (hello Edit/Test, Edit/Test, Edit/Test...)</li>
          <li>
Python is available on the CLR as Iron Python and on Java as Jython.</li>
        </ul>
        <p>
Disadvantages
</p>
        <ul>
          <li>
It's not C# (heh)</li>
          <li>
It's not Java (heh, heh)</li>
          <li>
Performance (slower than the above)</li>
        </ul>
        <p>
I believe that <a href="http://www.dreamsongs.com/Files/PatternsOfSoftware.pdf">Gabriel</a> is
correct and that worse is better.  Worse as in Python is not Lisp.  Even
Dr Norvig, chief brain in a jar at Google, thinks <a href="http://www.norvig.com/python-lisp.html">Python
is good for something</a>.
</p>
        <p>
Note that Python is one of the four languages in use at Google.  Google has,
in fact, hired the <a href="http://www.python.org/~guido/">Frost Giant</a>.
</p>
        <p>
Python is used in game scripting.  My <a href="http://www.civilization.com/">favorite
game series of all time</a> uses Python as the scripting engine.
</p>
        <p>
I've also found one of the best Web Frameworks to date to use with Python.  I'll
detail that it a future post.  
</p>
        <p>
Right now Project X is moving forward on rockets fueled by Python.  This is the
most complete proof of concept I've completed in an alternate language (not C#) and
I'm LOVING it.
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=b285ed6f-e9ea-443e-ad93-b540b2064120" />
      </body>
      <title>Onto Python</title>
      <guid isPermaLink="false">http://pragmaticprose.com/PermaLink,guid,b285ed6f-e9ea-443e-ad93-b540b2064120.aspx</guid>
      <link>http://pragmaticprose.com/PermaLink,guid,b285ed6f-e9ea-443e-ad93-b540b2064120.aspx</link>
      <pubDate>Sat, 24 Nov 2007 03:59:18 GMT</pubDate>
      <description>&lt;p&gt;
For a (brief) while, I was learning F#.&amp;nbsp; It proved an interesting excursion.&amp;nbsp;
If you into mathematical correctness F# and OCaml maybe just the languages for you.&amp;nbsp;
Myself?&amp;nbsp; Well I'm looking for something with a little more to offer in the functionality
department.&amp;nbsp; I want a language where I can do most anything.&amp;nbsp; I'm willing
to sacrifice mathematical niceties.
&lt;/p&gt;
&lt;p&gt;
Python seems to be that language.&amp;nbsp; Python is one of the languages I knew I would
love when I tried it, so I've held off diving into it until I had gone through almost
every other one.&amp;nbsp; I've journeyed through Lisp, Scheme, C++, C#, Java, Ruby, F#/OCaml
and dabbled in a few less known like Factor and Cat.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Python Advantages:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Available and almost every platform (every platform I'm interested in)&lt;/li&gt;
&lt;li&gt;
Terse clear syntax&lt;/li&gt;
&lt;li&gt;
Whitespace (yes, I do enjoy the whitespace!)&lt;/li&gt;
&lt;li&gt;
Easy to learn, easy to teach (I taught C++ to undergrads during my time in Hell)&lt;/li&gt;
&lt;li&gt;
More complete than Ruby&lt;/li&gt;
&lt;li&gt;
Better documented than Ruby&lt;/li&gt;
&lt;li&gt;
Good riddance to the Edit/Compile/Wait/Debug loop (hello Edit/Test, Edit/Test, Edit/Test...)&lt;/li&gt;
&lt;li&gt;
Python is available on the CLR as Iron Python and on Java as Jython.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Disadvantages
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
It's not C# (heh)&lt;/li&gt;
&lt;li&gt;
It's not Java (heh, heh)&lt;/li&gt;
&lt;li&gt;
Performance (slower than the above)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I believe that &lt;a href="http://www.dreamsongs.com/Files/PatternsOfSoftware.pdf"&gt;Gabriel&lt;/a&gt; is
correct and that worse is better.&amp;nbsp; Worse as in Python is not Lisp.&amp;nbsp; Even
Dr Norvig, chief brain in a jar at Google, thinks &lt;a href="http://www.norvig.com/python-lisp.html"&gt;Python
is good for something&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Note that Python is one of the four languages in use at Google.&amp;nbsp; Google has,
in fact, hired the &lt;a href="http://www.python.org/~guido/"&gt;Frost Giant&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Python is used in game scripting.&amp;nbsp; My &lt;a href="http://www.civilization.com/"&gt;favorite
game series of all time&lt;/a&gt;&amp;nbsp;uses Python as the scripting engine.
&lt;/p&gt;
&lt;p&gt;
I've also found one of the best Web Frameworks to date to use with Python.&amp;nbsp; I'll
detail that it a future post.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Right now Project X is moving forward on rockets fueled by Python.&amp;nbsp; This is the
most complete proof of concept I've completed in an alternate language (not C#) and
I'm LOVING it.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://pragmaticprose.com/aggbug.ashx?id=b285ed6f-e9ea-443e-ad93-b540b2064120" /&gt;</description>
      <comments>http://pragmaticprose.com/CommentView,guid,b285ed6f-e9ea-443e-ad93-b540b2064120.aspx</comments>
      <category>Languages</category>
    </item>
  </channel>
</rss>