<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" 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:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Programming</title>
        <link>http://lancerobinson.net/category/1855.aspx</link>
        <description>Programming</description>
        <language>en-US</language>
        <copyright>Lance Robinson</copyright>
        <managingEditor>lmrobins@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Setting a Master Page Dynamically</title>
            <link>http://lancerobinson.net/archive/2010/08/17/setting-a-master-page-dynamically.aspx</link>
            <description>&lt;p&gt;To set an ASPNET master page dynamically, use the Page_PreInit function and set the Page.MasterPageFile property.  For example:&lt;/p&gt;  &lt;p&gt;protected void Page_PreInit(object sender, EventArgs e)    &lt;br /&gt;{     &lt;br /&gt;  this.Page.MasterPageFile = "~/MasterPages/" + mymaster + ".Master";     &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;In the above example, mymaster should be set by whatever your requirements dictate – read from DB/CMS/whatever.  The page (aspx) itself shouldn’t have any other reference to the master page (ie, no “MasterPageFile attribute in the page directive), however it will still need the content placeholders, of course.&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:0767317B-992E-4b12-91E0-4F059A8CECA8:86992e1b-58c4-4e03-96ee-5e3bc518af92" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/ASPNET" rel="tag"&gt;ASPNET&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=141355"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=141355" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/141355.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2010/08/17/setting-a-master-page-dynamically.aspx</guid>
            <pubDate>Tue, 17 Aug 2010 19:04:10 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/141355.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2010/08/17/setting-a-master-page-dynamically.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/141355.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/141355.aspx</trackback:ping>
        </item>
        <item>
            <title>PowerShell TruncateAtWhitespace Function</title>
            <link>http://lancerobinson.net/archive/2010/08/16/powershell-truncateatwhitespace-function.aspx</link>
            <description>&lt;p&gt;Here’s a TruncateAtWhitespace function that takes an incoming parameter value and an incoming max length, and returns a substring broken at a whitespace position.  This way if you have “Lance has a blog” and you need to truncate it to 8 characters or less, you get “Lance” instead of “Lance ha”.&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;function TruncateAtWhitespace{
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    param(
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;]$&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;,
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;]$maxlength=200
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    )
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    $maxlength-=3; #allow &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; "&lt;span style="color: #8b0000"&gt;...&lt;/span&gt;" suffix
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.Length -le $maxlength) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; ($&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; + "&lt;span style="color: #8b0000"&gt;...&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    $closestwhitespaceindex = [&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;]$&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.Substring(0, $maxlength).LastIndexOf("&lt;span style="color: #8b0000"&gt; &lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($closestwhitespaceindex -gt 0) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; = $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.Substring(0, $closestwhitespaceindex) + "&lt;span style="color: #8b0000"&gt;...&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    } &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; = $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.Substring(0, $maxlength);
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dee978aa-edc6-4e5a-a49a-64642738047e" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/PowerShell" rel="tag"&gt;PowerShell&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=141340"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=141340" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/141340.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2010/08/16/powershell-truncateatwhitespace-function.aspx</guid>
            <pubDate>Mon, 16 Aug 2010 19:30:13 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/141340.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2010/08/16/powershell-truncateatwhitespace-function.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/141340.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/141340.aspx</trackback:ping>
        </item>
        <item>
            <title>CSharp TruncateAtWhitespace Function</title>
            <link>http://lancerobinson.net/archive/2010/08/16/csharp-truncateatwhitespace-function.aspx</link>
            <description>&lt;p&gt;Here’s a TruncateAtWhitespace function that takes an incoming parameter value and an incoming max length, and returns a substring broken at a whitespace position.  This way if you have “Lance has a blog” and you need to truncate it to 8 characters or less, you get “Lance” instead of “Lance ha”.&lt;/p&gt;
&lt;pre style="border: 1px solid rgb(206, 206, 206); padding: 5px; background-color: rgb(251, 251, 251); min-height: 40px; width: 650px; overflow: auto;"&gt;&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// Truncate at the end of a word&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;param name="value"&amp;gt;The original string&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;param name="maxlength"&amp;gt;The maximum length of string to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;returns&amp;gt;A substring of the original, broken at the end of a word&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; TruncateAtWhitespace(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; maxlength)
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    {
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      maxlength = maxlength - 3; &lt;span style="color: rgb(0, 128, 0);"&gt;//allow for ending "..."&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (&lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;.Length &amp;lt;= maxlength) &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt; + "&lt;span style="color: rgb(139, 0, 0);"&gt;...&lt;/span&gt;";
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; closestwhitespaceindex = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;.Substring(0, maxlength).LastIndexOf("&lt;span style="color: rgb(139, 0, 0);"&gt; &lt;/span&gt;");
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (closestwhitespaceindex &amp;gt; 0)
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      {
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
        &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt; = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;.Substring(0, closestwhitespaceindex) + "&lt;span style="color: rgb(139, 0, 0);"&gt;...&lt;/span&gt;";
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      }
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      {
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
        &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt; = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;.Substring(0, maxlength);
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      }
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    }&lt;/pre&gt;
&lt;/pre&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:23317c5c-c7bb-4cad-84ea-b0e0e5bc4bd4" style="padding: 0px; margin: 0px; display: inline; float: none;"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/ASPNET"&gt;ASPNET&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/C%23"&gt;C#&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=141339"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=141339" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/141339.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2010/08/16/csharp-truncateatwhitespace-function.aspx</guid>
            <pubDate>Mon, 16 Aug 2010 19:28:56 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/141339.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2010/08/16/csharp-truncateatwhitespace-function.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/141339.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/141339.aspx</trackback:ping>
        </item>
        <item>
            <title>Listing SPQuery FieldNameRefs</title>
            <link>http://lancerobinson.net/archive/2009/12/07/listing-spquery-fieldnamerefs.aspx</link>
            <description>&lt;p&gt;It took me a while to figure out how to get a list of all the available fields for a particular type of list in SharePoint (for performing custom queries in SPQuery).  I was looking for a published list of these fields, which as far as I know does not exist.  Instead, you just use the GetList method of the Lists SOAP service.  Here’s an example SOAP request:&lt;/p&gt;
&lt;div class="scrollarea"&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt;?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;SOAP-ENV:Envelope&lt;/span&gt; &lt;span class="attr"&gt;xmlns:SOAP-ENV&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.xmlsoap.org/soap/envelope/"&lt;/span&gt; &lt;span class="attr"&gt;SOAP-ENV:encodingStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.xmlsoap.org/soap/encoding/"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;SOAP-ENV:Body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;GetList&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/sharepoint/soap/"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;listName&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Private Documents&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;listName&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;GetList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;SOAP-ENV:Body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;SOAP-ENV:Envelope&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Just specify the name of the list you want the fields for as the value for the listName input element.&lt;/p&gt;
&lt;p&gt;One easy way to work with SharePoint services remotely is by using /n software’s &lt;a href="http://www.nsoftware.com/ibiz/sharepoint/default.aspx"&gt;SharePoint Integrator&lt;/a&gt; developer toolkit.  Using its SPSite component in Visual Studio I can whip together a few lines of code to consume get the results from the aforementioned service:&lt;/p&gt;
&lt;div class="scrollarea"&gt;
&lt;pre class="csharpcode"&gt;
spsite1.URL = "http://mysharepoint/mysite/";
spsite1.User = "DOMAIN\lancer";  
spsite1.Password = "password";  
spsite1.DescribeList("Private SharePoint Documents");; &lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;/n software SharePoint Integrator highlights:&lt;/p&gt;
&lt;ul&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;em&gt;Read, Write, and Create SharePoint Lists Items, Documents, and Attachments. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Programmatic control of SharePoint Sites, capabilities, and configuration &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;128-bit strong SSL encryption keeps sensitive transaction information confidential. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Small and lightweight components with no dependencies on external libraries. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Native development components for all supported platforms and component technologies. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Unlimited free Email technical support backed by an experienced &amp;amp; professional staff. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Compatible with Microsoft Office SharePoint Server (MOSS), and Windows SharePoint Services v3.0 + (WSS).&lt;/em&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:18f83815-f83e-49e0-833c-875e863c33e2" class="wlWriterEditableSmartContent" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/SPQuery"&gt;SPQuery&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/SharePoint"&gt;SharePoint&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=136811"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=136811" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/136811.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/12/07/listing-spquery-fieldnamerefs.aspx</guid>
            <pubDate>Mon, 07 Dec 2009 09:24:16 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/136811.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/12/07/listing-spquery-fieldnamerefs.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/136811.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/136811.aspx</trackback:ping>
        </item>
        <item>
            <title>How to embed Excel in a .NET WinForms App</title>
            <link>http://lancerobinson.net/archive/2009/09/17/how-to-embed-excel-in-a-.net-winforms-app.aspx</link>
            <description>&lt;ol&gt;   &lt;li&gt;&lt;a href="http://www.google.com/search?hl=en&amp;amp;q=Download+OWC11&amp;amp;aq=f&amp;amp;oq=&amp;amp;aqi="&gt;Download and install owc11&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;Run AxImp on OWC11.dll, which will have been installed in the microsoft shared\web components directory (ie C:\Program Files\Common Files\microsoft shared\Web Components\11\).  AxImp.exe can be found in the Windows SDK (ie, C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\AxImp.exe). &lt;/li&gt;    &lt;li&gt;In Visual Studio project, drag OWC11.dll to a toolbox tab and drop the Excel component on form. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Voila.  When it comes deployment time, you’ll need the AxInterop.OWC11.dll.&lt;/p&gt;  &lt;p&gt;Some sample code:&lt;/p&gt;  &lt;p&gt;Set a specific cell value:    &lt;br /&gt;Spreadsheet1.Cells.get_Item(row, col).set_Value(System.Reflection.Missing.Value, "BSXBW2183NN");&lt;/p&gt;  &lt;p&gt;Get the string value of a specific cell:    &lt;br /&gt;Spreadsheet1.Cells.get_Item(row, col).get_Value(System.Reflection.Missing.Value).ToString()     &lt;br /&gt;or     &lt;br /&gt;Spreadsheet1.Cells.get_Item(i, 1).Text.ToString();&lt;/p&gt;  &lt;p&gt;Set the background color of a row:    &lt;br /&gt;Object ob = "#66FF66";     &lt;br /&gt;Spreadsheet1.Rows.get_Item(row, System.Reflection.Missing.Value).Font.set_Color(ref ob);&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:0767317B-992E-4b12-91E0-4F059A8CECA8:c2bd0193-6f81-4a88-aaad-74d83262fe9b" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Excel" rel="tag"&gt;Excel&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET" rel="tag"&gt;.NET&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134874"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134874" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/134874.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/09/17/how-to-embed-excel-in-a-.net-winforms-app.aspx</guid>
            <pubDate>Thu, 17 Sep 2009 13:19:35 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/134874.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/09/17/how-to-embed-excel-in-a-.net-winforms-app.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/134874.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/134874.aspx</trackback:ping>
        </item>
        <item>
            <title>Four New Developer Toolkit Releases from /n software</title>
            <link>http://lancerobinson.net/archive/2009/07/15/four-new-developer-toolkit-releases-from-n-software.aspx</link>
            <description>&lt;p&gt;Last week /n software announced new versions of three different toolkits, and a brand new SharePoint Integrator product.  From &lt;a href="http://www.nsoftware.com/"&gt;nsoftware.com&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&lt;img align="absMiddle" src="http://www.nsoftware.com/img/redsmallarrow.gif" /&gt;&lt;/em&gt;&lt;a href="http://www.nsoftware.com/ibiz/ups/"&gt;&lt;strong&gt;&lt;em&gt;NEW: /n software UPS Integrator V2 Released!&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;Includes easy access to the most popular UPS mail capabilities including shipping, tracking, address verification, rate calculation, and much more. &lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;img align="absMiddle" src="http://www.nsoftware.com/img/redsmallarrow.gif" /&gt;&lt;/em&gt;&lt;a href="http://www.nsoftware.com/ibiz/sharepoint/"&gt;&lt;strong&gt;&lt;em&gt;NEW: /n software SharePoint Integrator Released!&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;Enables developers to build applications that integrate with Microsoft SharePoint Server, including components for working with popular constructs like Sites, Lists, and Documents. &lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;img align="absMiddle" src="http://www.nsoftware.com/img/redsmallarrow.gif" /&gt;&lt;/em&gt;&lt;a href="http://www.nsoftware.com/ibiz/paypal/"&gt;&lt;strong&gt;&lt;em&gt;NEW: PayPal Integrator V3 Released!&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;Now with support for PayPal Recurring Payments. Connect your application to PayPal merchant services without the use of client side certificates. &lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;img align="absMiddle" src="http://www.nsoftware.com/img/redsmallarrow.gif" /&gt;&lt;/em&gt;&lt;a href="http://www.nsoftware.com/ibiz/vital/"&gt;&lt;strong&gt;&lt;em&gt;NEW: Vital/TSYS Integrator V6 Released!&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;Now certified for FSA / Healthcare, Retail, Grocery, Restaurant, Hotel, Auto Rental, Direct Marketing, E-Commerce, Debit, EBT, GiftCard, Level II, Level III transactions, and PABP Compliance.&lt;/em&gt; &lt;/p&gt; &lt;/blockquote&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:0767317B-992E-4b12-91E0-4F059A8CECA8:9e588367-9356-4fa1-9318-9a83127f9b79" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/UPS" rel="tag"&gt;UPS&lt;/a&gt;, &lt;a href="http://technorati.com/tags/SharePoint" rel="tag"&gt;SharePoint&lt;/a&gt;, &lt;a href="http://technorati.com/tags/PayPal" rel="tag"&gt;PayPal&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Credit+Cards" rel="tag"&gt;Credit Cards&lt;/a&gt;, &lt;a href="http://technorati.com/tags/E-Commerce" rel="tag"&gt;E-Commerce&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133508"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133508" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/133508.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/07/15/four-new-developer-toolkit-releases-from-n-software.aspx</guid>
            <pubDate>Wed, 15 Jul 2009 05:53:57 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/133508.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/07/15/four-new-developer-toolkit-releases-from-n-software.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/133508.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/133508.aspx</trackback:ping>
        </item>
        <item>
            <title>Troubleshooting FTP connections with PowerShell</title>
            <link>http://lancerobinson.net/archive/2009/05/21/troubleshooting-ftp-connections-with-powershell.aspx</link>
            <description>&lt;p&gt;I find that helping people troubleshoot FTP connectivity issues is much easier if they have PowerShell installed.  I can just have them run the &lt;a title="NetCmdlets" href="http://www.nsoftware.com/powershell/"&gt;NetCmdlets&lt;/a&gt; ftp cmdlets with the –debug switch, which displays a trail of information about the communication over the wire.  In this way you can see every command send to the server and every response coming back from the server, including what ports a server is attempting to use for ftp data connections.  Very often ftp transfer connectivity errors are the result of firewall/ftp server configuration error, and being able to see this raw communication without a network sniffer is quite handy.&lt;/p&gt;  &lt;div class="scrollarea"&gt;   &lt;pre style="font: 9pt courier new; color: rgb(238,237,240); background-color: rgb(1,36,86); font-size-adjust: none; font-stretch: normal"&gt;PS C:\&amp;gt; get-ftp -server $myserver -user myusername –password ******* -debug                                                    &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: VerbsCommon.Get-FTP started processing.&lt;/span&gt;                                                                          &lt;br /&gt;                                                                                                                        &lt;br /&gt;&lt;span style="color: rgb(255,255,255); background-color: rgb(1,36,86)"&gt;Confirm&lt;/span&gt;                                                                                                                 &lt;br /&gt;Continue with this operation?                                                                                           &lt;br /&gt;&lt;span style="color: rgb(255,255,255); background-color: rgb(1,36,86)"&gt;[Y] Yes  &lt;/span&gt;[A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): a                                    &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Info: Connecting to FTP server.&lt;/span&gt;                                                                                  &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Server: 220 (vsFTPd 2.0.4)&lt;/span&gt;                                                                                       &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Client: USER myusername&lt;/span&gt;                                                                                                &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Server: 331 Please specify the password.&lt;/span&gt;                                                                         &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Client: PASS *******&lt;/span&gt;                                                                                             &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Server: 230 Login successful.&lt;/span&gt;                                                                                    &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Client: PASV&lt;/span&gt;                                                                                                     &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Server: 227 Entering Passive Mode (10,0,1,1,225,79)&lt;/span&gt;                                                              &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Client: LIST&lt;/span&gt;                                                                                                     &lt;br /&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG: Server: 425 Can’t open data connection.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255,255,0); background-color: rgb(0,0,0)"&gt;DEBUG:    at nsoftware.NetCmdlets.Commands.Core.cs.a(Int32 A_0)&lt;br /&gt;   at nsoftware.NetCmdlets.Commands.GetFTP.DoSSL()&lt;/span&gt;                                                                    &lt;br /&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;Send-FTP : FTP protocol error: 425 Can’t open data connection.&lt;/strong&gt;&lt;/font&gt;                                                                                                   &lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;In the example above, you can see that the get-ftp cmdlet sends the PASV command in order to transfer some data (a directory listing).  The server response to the PASV command shows the ip and port that the client should connect to (10.0.1.1 is the ip address, and (225*256) + 79 is the port).  That IP address (10.0.1.1) is obviously wrong since I am attempting to FTP to a server outside of my local network.  This is one example of a misconfigured FTP server.&lt;/p&gt;

&lt;p&gt;Right away, with one PowerShell command, I know the cause of the problem and where to go to fix it.&lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:1f62ad97-214f-47a2-970a-578bb2c25e77" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/PowerShell" rel="tag"&gt;PowerShell&lt;/a&gt;, &lt;a href="http://technorati.com/tags/FTP" rel="tag"&gt;FTP&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Troubleshooting" rel="tag"&gt;Troubleshooting&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132352"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132352" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/132352.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/05/21/troubleshooting-ftp-connections-with-powershell.aspx</guid>
            <pubDate>Thu, 21 May 2009 17:22:52 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/132352.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/05/21/troubleshooting-ftp-connections-with-powershell.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/132352.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/132352.aspx</trackback:ping>
        </item>
        <item>
            <title>PowerShell function to determine if running on 64 bit machine</title>
            <link>http://lancerobinson.net/archive/2009/02/20/powershell-function-to-determine-if-running-on-64-bit-machine.aspx</link>
            <description>&lt;p&gt;Easy a pie:&lt;/p&gt;
&lt;div class="scrollarea"&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; is64bit() {&lt;br /&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; ([IntPtr].Size -eq 4) { &lt;span class="kwrd"&gt;return&lt;/span&gt; $&lt;span class="kwrd"&gt;false&lt;/span&gt; }&lt;br /&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt; { &lt;span class="kwrd"&gt;return&lt;/span&gt; $&lt;span class="kwrd"&gt;true&lt;/span&gt; }&lt;br /&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Explanation: &lt;a href="http://msdn.microsoft.com/en-us/library/system.intptr.size.aspx"&gt;the size of an IntPtr&lt;/a&gt; will be 4 bytes on a 32 bit machine and 8 bytes on a 64 bit machine.&lt;/p&gt;
&lt;p&gt;I came across the tip somewhere (blog, usenet??) but I couldn't find it again - so I thought I'd share it here for anybody else who is looking for it.&lt;br /&gt;
&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:28cc0e90-e02e-4965-a6b5-9722d8616487" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/PowerShell" rel="tag"&gt;PowerShell&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129562"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129562" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/129562.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/02/20/powershell-function-to-determine-if-running-on-64-bit-machine.aspx</guid>
            <pubDate>Fri, 20 Feb 2009 15:21:14 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/129562.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/02/20/powershell-function-to-determine-if-running-on-64-bit-machine.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/129562.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/129562.aspx</trackback:ping>
        </item>
        <item>
            <title>Amazon SimpleDB Developer Tools</title>
            <link>http://lancerobinson.net/archive/2009/02/03/amazon-simpledb-developer-tools.aspx</link>
            <description>&lt;p&gt;According to a recent Amazon survey, “Developer Tools” were the most requested improvement for SimpleDB.  /n software’s &lt;a href="http://www.nsoftware.com/ibiz/amazon/"&gt;Amazon Integrator&lt;/a&gt; fits the bill for developers building in .NET, ASP.NET, .NETCF, Java, JSP, C++, C++ Builder, Delphi, VB6 (ActiveX), and even classic ASP.  You can download a &lt;a href="http://www.nsoftware.com/download/amazon.aspx"&gt;free trial version&lt;/a&gt;, which includes demos and API documentation for the SimpleDB component as well as the included AWS, EC2, S3, and SQS components.&lt;/p&gt;  &lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:31f0644e-657a-4cbd-8fe5-efc6813ba8a1" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Amazon" rel="tag"&gt;Amazon&lt;/a&gt;, &lt;a href="http://technorati.com/tags/AWS" rel="tag"&gt;AWS&lt;/a&gt;, &lt;a href="http://technorati.com/tags/SimpleDB" rel="tag"&gt;SimpleDB&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129168"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129168" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/129168.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/02/03/amazon-simpledb-developer-tools.aspx</guid>
            <pubDate>Tue, 03 Feb 2009 14:46:27 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/129168.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/02/03/amazon-simpledb-developer-tools.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/129168.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/129168.aspx</trackback:ping>
        </item>
        <item>
            <title>Pass by Reference Parameters in PowerShell</title>
            <link>http://lancerobinson.net/archive/2009/01/14/pass-by-reference-parameters-in-powershell.aspx</link>
            <description>&lt;a class="retweet vert self"&gt;&lt;/a&gt;
&lt;p&gt;A long time ago Jeffrey Snover &lt;a href="http://blogs.msdn.com/powershell/archive/2007/02/25/supporting-whatif-confirm-verbose-in-scripts.aspx"&gt;briefly mentioned the PowerShell [REF]&lt;/a&gt; parameter attribute, but otherwise there isn’t much mention around about how to use it.  It seems simple enough, but I kept getting this error from PowerShell:&lt;/p&gt;
&lt;p&gt;“Reference type is expected in argument.”&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.vistax64.com/powershell/2595-passing-variable-reference.html"&gt;This post by MOW&lt;/a&gt; cleared things up for me – I needed to wrap my [REF] parameters in parens in the function call, like so:&lt;/p&gt;
&lt;p&gt;Find-NewMessages $valvar1 ([REF]$refvar1) ([REF]$refvar2)&lt;/p&gt;
&lt;p&gt;For those looking to see how pass by reference params are used in the first place, its pretty simple.  Use the [REF] attribute on your function parameters and in your function call, ie:&lt;/p&gt;
&lt;p&gt;function Find-NewMessages($valvar1, [REF]$refvar1, [REF]$refvar2) {   &lt;br /&gt;
  //some stuff    &lt;br /&gt;
  $refvar1.Value = “hi”    &lt;br /&gt;
  $refvar2.Value = “bye”    &lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;$refvar1 = “1”   &lt;br /&gt;
$refvar2  “2”    &lt;br /&gt;
Find-NewMessages $valvar1 ([REF]$refvar1) ([REF]$refvar2)    &lt;br /&gt;
//now $refvar1 = “hi” and $refvar2 = “bye”&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:336eaf6e-497b-4d8d-9299-9eb996a73721" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/PowerShell" rel="tag"&gt;PowerShell&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Pass+By+Reference+Parameters" rel="tag"&gt;Pass By Reference Parameters&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128667"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128667" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://lancerobinson.net/aggbug/128667.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/01/14/pass-by-reference-parameters-in-powershell.aspx</guid>
            <pubDate>Wed, 14 Jan 2009 22:06:38 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/128667.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/01/14/pass-by-reference-parameters-in-powershell.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/128667.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/128667.aspx</trackback:ping>
        </item>
    </channel>
</rss>