<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>winstonfassett.com/blog</title>
	<atom:link href="http://winstonfassett.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://winstonfassett.com/blog</link>
	<description>that's just *crazy* talk</description>
	<pubDate>Wed, 21 Sep 2011 14:01:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>SharePoint Extension: Get-SPWebRelative</title>
		<link>http://winstonfassett.com/blog/2011/09/20/get-spwebrelative/</link>
		<comments>http://winstonfassett.com/blog/2011/09/20/get-spwebrelative/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 20:25:00 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Techno-Babble]]></category>

		<category><![CDATA[PowerShell]]></category>

		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[SharePoint 2010]]></category>

		<category><![CDATA[WF PowerShell]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=217</guid>
		<description><![CDATA[The main reason I began writing my PowerShell extensions was that I needed to do some in-depth traversal of the SharePoint farm and its content. &#160;I&#8217;m going to demonstrate some of those extensions now, using&#160;
Getting an SPWeb
The conventional way of obtaining a reference to an SPWeb is:

 get-spweb http://mybiglongservername:8080/path/to/web
 
Because this requires a fully-qualified URL, [...]]]></description>
			<content:encoded><![CDATA[<p>The main reason I began writing my <a href="http://wfpowershell.codeplex.com/">PowerShell extensions</a> was that I needed to do some in-depth traversal of the SharePoint farm and its content. &nbsp;I&#8217;m going to demonstrate some of those extensions now, using&nbsp;</p>
<p><strong>Getting an SPWeb</strong></p>
<p>The conventional way of obtaining a reference to an SPWeb is:</p>
<pre class="syntax-highlight:php">
 get-spweb http://mybiglongservername:8080/path/to/web
 </pre>
<p>Because this requires a fully-qualified URL, it gets when dealing with a lot of sites and webs. &nbsp;Sometimes I&#8217;ll just throw the web in a variable, but that&#8217;s not exactly good practice because it can lead to memory leaks. &nbsp;Instead, I wrote <strong>Get-SPWebRelative</strong>, which can be used like this:</p>
<pre class="syntax-highlight:php">
 get-spwebrelative /path/to/web
 </pre>
<p>You can even get the root web:</p>
<pre class="syntax-highlight:php">
 get-spwebrelative /
 </pre>
<p>Similarly, there is a <strong>Get-SPSiteRelative</strong> function that works the same way.</p>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2011/09/20/get-spwebrelative/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SharePoint PowerShell: Remove duplicate WebParts</title>
		<link>http://winstonfassett.com/blog/2011/09/20/sharepoint-powershell-remove-duplicate-webparts/</link>
		<comments>http://winstonfassett.com/blog/2011/09/20/sharepoint-powershell-remove-duplicate-webparts/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 18:09:37 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[PowerShell]]></category>

		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[SharePoint 2010]]></category>

		<category><![CDATA[WF PowerShell]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=210</guid>
		<description><![CDATA[Last week I received an email from a colleague who was having problems with a SharePoint 2007 upgrade. &#160;Actually, the upgrade went fine, but when he moved a Publishing Site Collection to a subsite of an existing site collection, he ran into several problems, one of which was that each page had a duplicate set [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I received an email from a colleague who was having problems with a SharePoint 2007 upgrade. &nbsp;Actually, the upgrade went fine, but when he moved a Publishing Site Collection to a subsite of an existing site collection, he ran into several problems, one of which was that each page had a duplicate set of web parts. &nbsp;</p>
<p>I was about to go on vacation, but <a href="../../blog/2011/09/14/new-codeplex-project-winstons-powershell-extensions/">I had just published my PowerShell extensions</a> and thought it would be a good opportunity to use them. &nbsp;So, in one of my prouder moments, I free-handed about 10 lines of PowerShell into an email and left town. &nbsp;I was delighted to find out that the code actually worked (once you removed the incorrect characters that Outlook had injected).</p>
<p>So, here&#8217;s a quick little blog post explaining what I did.</p>
<p>First, I spooled up a standalone SharePoint 2010 VM and ran PowerShell ISE.</p>
<p>Then I did the following to initialize my extensions:</p>
<pre class="syntax-highlight:php">
cd \VboxSvr\host_m\Development\wfPowerShell
. .\Boostrapper.ps1
</pre>
<p>Next I needed a page to play with, so I created a test web part page and added a couple of web parts:</p>
<p><img src="http://winstonfassett.com/blog/wp-content/uploads/2011/09/create-test-page.png" alt="" width="846" height="537" /></p>
<p>Now, I could have manually created the dupes, but it was more fun to try it with a script:</p>
<pre class="syntax-highlight:php">&lt;/p&gt;&lt;h1&gt;This function has virtually no practical application :)&lt;/h1&gt;&lt;p&gt;filter Duplicate-WebParts(){ $Page = $_
$webparts = $Page | Export-WebParts
$Page | Import-WebParts -WebPartInfos $webparts
}

$page = Get-SPWebRelative / | Get-SPFile &#039;Shared Documents/TestDupes.aspx&#039;
1..3 | % { $page | Duplicate-WebParts | out-null }
</pre>
<p>&nbsp;</p>
<div>This produced the following output:</div>
<p>
<pre class="syntax-highlight:php">
11:36:24 PM Imported web part: Web Part Page Title Bar    [Microsoft.SharePoint.WebPartPages.TitleBarWebPart]
11:36:27 PM Imported web part:     [Microsoft.SharePoint.WebPartPages.XsltListViewWebPart]
11:36:28 PM Imported web part: Content Editor    [Microsoft.SharePoint.WebPartPages.ContentEditorWebPart]
11:36:33 PM Imported web part: Web Part Page Title Bar    [Microsoft.SharePoint.WebPartPages.TitleBarWebPart]
11:36:33 PM Imported web part:     [Microsoft.SharePoint.WebPartPages.XsltListViewWebPart]
11:36:34 PM Imported web part: Content Editor    [Microsoft.SharePoint.WebPartPages.ContentEditorWebPart]
11:36:35 PM Imported web part: Web Part Page Title Bar    [Microsoft.SharePoint.WebPartPages.TitleBarWebPart]
11:36:36 PM Imported web part:     [Microsoft.SharePoint.WebPartPages.XsltListViewWebPart]
11:36:37 PM Imported web part: Content Editor    [Microsoft.SharePoint.WebPartPages.ContentEditorWebPart]
</pre>
</p>
<div>Since I ran it through my duplication function 2x, I now have 4 versions of each of the original webparts, as shown in the image below:</div>
<div><img src="http://winstonfassett.com/blog/wp-content/uploads/2011/09/pagewithdupes.png" alt="" width="955" height="719" /></div>
<div>Finally, I tweaked my free-handed script with some better arguments and logging:</div>
<pre class="syntax-highlight:php">

filter Remove-DuplicateWebParts([switch] $WhatIf, $DupeProperties = @(&#039;Title&#039;, { $_.GetType() })) {
    $Page = $_
    Log &quot;processing WebPart duplicates in $($page.ServerRelativeUrl)&quot;
    $webparts = $page | Get-WebParts
    $dupeGroups = $webparts | group $DupeProperties | where { $_.Count –gt 1 }
    $allDeletions = $dupeGroups | lwp -ActionLabel &quot;Processing Dupe Group&quot; -StatusReportBlock { $_.Name }  | % {
        $keep, $deletions = $_.Group
        return $deletions
    }
    if(!$WhatIf){
        $page | modify-webparts –delete –filter {
            ($allDeletions |&gt; Id ) -contains $_.Id
        } | lwp -Action Deleted -Status { &quot;$($_.Title) ($($_.Id))&quot; } | log-item -prefix &#039;deleted &#039;  -Process {&quot;$($_.Title) ($($_.Id))&quot;}  | out-null
    } else {
        $allDeletions | log-item -prefix &quot;Delete &quot; -Process {&quot;$($_.Title) ($($_.Id))&quot;} | out-null
    }
    return $Page
}

$page = Get-SPWebRelative / | Get-SPFile &#039;Shared Documents/TestDupes.aspx&#039;
#1..2 | % { $page | Duplicate-WebParts | out-null }
$page | Remove-DuplicateWebParts | out-null
</pre>
</p>
<div>A couple of notes about what is going on here:</div>
<div>
<ul>
<li>Using a <strong>filter</strong>&nbsp;is a quick/dirty way to support pipeline input, which is often terser and more fluid than using arguments</li>
<li>The simplest way to identify collections of dupes is to use the <strong>group</strong>&nbsp;function and supply a list of properties that, altogether, <strong>should</strong> make a webpart unique.</li>
<li>After identifying the dupes, loop through them, skipping the first one (which is the one we will $keep)</li>
<li><strong>modify-webparts</strong>&nbsp;is my catch-all cmdlet for modifying, deleting, and closing webparts. &nbsp;I could have also just obtained a webpart manager and manually deleted, but this cmdlet makes it a no-brainer (and I was also looking for an excuse to demo it)</li>
</ul>
</div>
<div>When executed, the script above produced the following output:</div>
<p>
<pre class="syntax-highlight:php">
11:36:39 PM processing WebPart duplicates in /Shared Documents/TestDupes.aspx
11:36:42 PM deleted Web Part Page Title Bar (g&lt;em&gt;7571f1e5&lt;/em&gt;1238&lt;em&gt;48d7&lt;/em&gt;a029&lt;em&gt;66acf59d7a9c)
11:36:42 PM deleted Shared Documents (g&lt;/em&gt;edb5d78a&lt;em&gt;c5ad&lt;/em&gt;4f75&lt;em&gt;b134&lt;/em&gt;01716c46f7eb)
11:36:43 PM deleted Content Editor (g&lt;em&gt;6f02ef6a&lt;/em&gt;6c52&lt;em&gt;4c1c&lt;/em&gt;864b&lt;em&gt;553dcddb27f8)
11:36:43 PM deleted Web Part Page Title Bar (g&lt;/em&gt;19c9e065&lt;em&gt;4ac6&lt;/em&gt;4329&lt;em&gt;9d3c&lt;/em&gt;445b63cfac4e)
11:36:43 PM deleted Shared Documents (g&lt;em&gt;d1c7659a&lt;/em&gt;6b26&lt;em&gt;43c2&lt;/em&gt;88d7&lt;em&gt;b767349f689b)
11:36:43 PM deleted Content Editor (g&lt;/em&gt;dc6cbcaf&lt;em&gt;0705&lt;/em&gt;462e&lt;em&gt;ba39&lt;/em&gt;a9fae18682fe)
11:36:43 PM deleted Web Part Page Title Bar (g&lt;em&gt;e1a26dc2&lt;/em&gt;cc6f&lt;em&gt;49b6&lt;/em&gt;bccd&lt;em&gt;ef825ab56dea)
11:36:43 PM deleted Shared Documents (g&lt;/em&gt;20d52916&lt;em&gt;1bad&lt;/em&gt;4c4c&lt;em&gt;9374&lt;/em&gt;2fb27296b6cb)
11:36:43 PM deleted Content Editor (g&lt;em&gt;e1847600&lt;/em&gt;d1f1&lt;em&gt;43c7&lt;/em&gt;a83d_08f2273ac7ba)
</pre>
</p>
<div>and my page now looks like this (again):</div>
<div><img src="http://winstonfassett.com/blog/wp-content/uploads/2011/09/dupesremoved.png" alt="" width="959" height="352" /></div>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2011/09/20/sharepoint-powershell-remove-duplicate-webparts/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PowerShell ISE:  Use it instead of PowerShell.exe</title>
		<link>http://winstonfassett.com/blog/2011/09/14/powershell-ise-use-it-instead-of-powershellexe/</link>
		<comments>http://winstonfassett.com/blog/2011/09/14/powershell-ise-use-it-instead-of-powershellexe/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 18:16:56 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[PowerShell]]></category>

		<category><![CDATA[PowerShell ISE]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/2011/09/14/powershell-ise-use-it-instead-of-powershellexe/</guid>
		<description><![CDATA[PowerShell.exe is for losers.]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Many of my colleagues seem to be unaware of any alternatives to the standard powershell.exe command prompt, which is a bit, um, &#8220;old school&#8221;.</p>
<p>If you weren&#8217;t aware of PowerShell ISE, the integrated development environment for PowerShell that you get for free, I&#8217;d recommend installing it and using it rather than the traditional PowerShell prompt. &nbsp;The ISE is superior for several reasons:</p>
<ul>
<li>It has a tabbed interface for editing scripts</li>
<li>It can host multiple PowerShell sessions at once</li>
<li>It has superior auto-completion. &nbsp;In fact, the auto-completion in the interpreter&#8217;s command-line is better than that of the normal PowerShell prompt, because you can re-position your cursor and get auto-completion without accidentally deleting everything after the cursor (as the command prompt-based one does)</li>
<li>It supports breakpoints and debugging</li>
</ul>
<p>For these reasons, I almost never use plain old powershell.exe.</p>
<p>&nbsp;</p>
<p>I <em>believe </em>that it comes included with PowerShell for Windows 7, and to install it on Windows 2008 Server, all you have to do is add the PowerShell ISE feature using the Server Manager (or <a href="http://wwrant.blogspot.com/2011/03/install-windows-powershell-ise-using.html">PowerShell</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2011/09/14/powershell-ise-use-it-instead-of-powershellexe/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Codeplex project: Winston&#8217;s PowerShell Extensions</title>
		<link>http://winstonfassett.com/blog/2011/09/14/new-codeplex-project-winstons-powershell-extensions/</link>
		<comments>http://winstonfassett.com/blog/2011/09/14/new-codeplex-project-winstons-powershell-extensions/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 17:55:00 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Featured]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[PowerShell]]></category>

		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[SharePoint 2010]]></category>

		<category><![CDATA[WF PowerShell]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=198</guid>
		<description><![CDATA[I've been using PowerShell since it came out, and along the way I cobbled together a bunch of cmdlets, functions, and filters to create a fairly robust PowerShell toolkit.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using PowerShell since it came out, and along the way I cobbled together a bunch of cmdlets, functions, and filters to create a fairly robust PowerShell toolkit. &nbsp;I&#8217;m particularly proud of the stuff I did around progress reporting, which I found to be essential when my tasks were long-running processes that dealt with over 10,000 items. &nbsp;I also wrote a bunch of stuff to simplify syntax so that I could just get stuff done.</p>
<p>I used it mostly for personal tasks and a handful of development tasks. &nbsp;When I worked on a big SharePoint 2010 migration at the beginning of the year (which I will also be blogging about), I ended up upgrading the whole library to PowerShell 2.0 and also writing a <strong>ton</strong>&nbsp;of stuff to manage SharePoint 2010. &nbsp;Since then, I&#8217;ve used it on an almost daily basis with every SharePoint 2010 project I encounter, and I will continue to enhance and refine it going forward.</p>
<p>Whereas most of the existing PowerShell API for SharePoint deals with administrative concerns (a la stsadm), I needed to manipulate a lot of SharePoint content. &nbsp;Lists, List Items, Documents, Pages, WebParts, Groups, Permissions, PropertyBags, etc. &nbsp;You get the gist. &nbsp;</p>
<p>I was surprised to find that there weren&#8217;t (m)any cmdlets that addressed those concerns. &nbsp;I&#8217;m still surprised, and maybe I missed something, but a deadline&#8217;s a deadline, so I wrote a bunch of my own cmdlets, which I am now sharing. &nbsp;If you&#8217;ve ever tried to do any of these things in PowerShell, I think you&#8217;ll find these functions very helpful. &nbsp;</p>
<p>I&#8217;ve just refactored everything into 2 major libraries (General PowerShell and SharePoint 2010) that are loaded using a dependency loader that is also part of the library. &nbsp;I tried to modularize everything so that if you wanted to just use a couple of parts of it, you should be able to do so with minimal concern over dependencies on other script files. &nbsp;I also just went through and added comment-based help and examples to many of the cmdlets. &nbsp;In the future, I may refactor it to take advantage of PowerShell 2.0 modules, but for the time being, I like the drop-and-go simplicity of my current approach.</p>
<p>The new codeplex project is here: &nbsp;wfpowershell.codeplex.com.</p>
<p>There&#8217;s no official release yet, but you can just download the latest revision from:</p>
<p><a href="http://wfpowershell.codeplex.com/SourceControl/list/changesets">http://wfpowershell.codeplex.com/SourceControl/list/changesets</a>.</p>
<p>The only thing you need to know is how to initialize the library once you&#8217;re in a PowerShell session. &nbsp;All you need to do is dot-execute the Bootstrapper script. &nbsp;Typically you would do something like this</p>
<pre class="syntax-highlight:php">
 cd [library directory]
 . .\Bootstrapper.ps1
 </pre>
<p>That&#8217;s about it. &nbsp;You&#8217;ll have to browse through the scripts yourself to see what&#8217;s inside while I work on blogging and documenting how to use it.</p>
<p>Let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2011/09/14/new-codeplex-project-winstons-powershell-extensions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hide a TABLE column with JQuery</title>
		<link>http://winstonfassett.com/blog/2011/08/03/hide-a-table-column-with-jquery/</link>
		<comments>http://winstonfassett.com/blog/2011/08/03/hide-a-table-column-with-jquery/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 14:56:33 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=194</guid>
		<description><![CDATA[Yesterday I helped debug an issue with migrating from SP2007 to SP2010.  There was some old JS code where a SELECT box was filtering a ListView based on some key columns, and consequently there were some columns with GUIDs that needed to be hidden.
First of all, let me be clear that this is not a [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I helped debug an issue with migrating from SP2007 to SP2010.  There was some old JS code where a SELECT box was filtering a ListView based on some key columns, and consequently there were some columns with GUIDs that needed to be hidden.</p>
<p>First of all, let me be clear that this is not a good practice.  Live filtering of tables doesn&#8217;t work very well, especially when you are using SP ListViews that are generating their own markup.  To make matters worse, the code was traversing the inner HTML of every TD on the page to examine its <em>contents</em> in order to determine whether to hide the page.  It was also 80 lines of JS.</p>
<p>I replaced it by adding a script link to JQuery and adding this function:</p>
<pre class="syntax-highlight:javascript">

function HideColumn(i, el){

$(&quot;th:nth-child(&quot; + i + &quot;), td:nth-child(&quot; + i + &quot;)&quot;, el).hide();

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2011/08/03/hide-a-table-column-with-jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>UX Anti-Patterns</title>
		<link>http://winstonfassett.com/blog/2010/10/01/ux-anti-patterns/</link>
		<comments>http://winstonfassett.com/blog/2010/10/01/ux-anti-patterns/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 20:56:38 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[UX anti-patterns]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=192</guid>
		<description><![CDATA[I refer to this so much, I figured I&#8217;d post it so that I don&#8217;t have to keep looking for it.
Great talk on user interaction anti-patterns by Bill Scott of Yahoo! and now Netflix.
Design Anti Patterns - How to Design a Poor Web Experience
View more presentations from Bill Scott.

He&#8217;s also got a good blog at http://looksgoodworkswell.blogspot.com/.

]]></description>
			<content:encoded><![CDATA[<p>I refer to this so much, I figured I&#8217;d post it so that I don&#8217;t have to keep looking for it.</p>
<p>Great talk on user interaction anti-patterns by Bill Scott of Yahoo! and now Netflix.</p>
<div id="__ss_386103" style="width: 425px;"><strong><a title="Design Anti Patterns - How to Design a Poor Web Experience" href="http://www.slideshare.net/billwscott/design-anti-patterns-how-to-design-a-poor-web-experience">Design Anti Patterns - How to Design a Poor Web Experience</a></strong><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="id" value="__sse386103" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=antipatterns2008-1209833346829334-9&amp;stripped_title=design-anti-patterns-how-to-design-a-poor-web-experience&amp;userName=billwscott" /><embed id="__sse386103" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=antipatterns2008-1209833346829334-9&amp;stripped_title=design-anti-patterns-how-to-design-a-poor-web-experience&amp;userName=billwscott" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/billwscott">Bill Scott</a>.</div>
<div style="padding:5px 0 12px"></div>
<div style="padding:5px 0 12px">He&#8217;s also got a good blog at <a href="http://looksgoodworkswell.blogspot.com/">http://looksgoodworkswell.blogspot.com/</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2010/10/01/ux-anti-patterns/feed/</wfw:commentRss>
		</item>
		<item>
		<title>HTML to Text conversion in PowerShell</title>
		<link>http://winstonfassett.com/blog/2010/09/21/html-to-text-conversion-in-powershell/</link>
		<comments>http://winstonfassett.com/blog/2010/09/21/html-to-text-conversion-in-powershell/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 19:33:50 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Techno-Babble]]></category>

		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=189</guid>
		<description><![CDATA[Here&#8217;s a snippet for you.  I was extracting SharePoint profile information and needed to display the &#8220;About Me&#8221; field in an application that couldn&#8217;t render HTML, so I needed to convert the HTML to text.  This is a bit more complex than simply stripping the HTML tags out of the content.  Doing that would preserve [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a snippet for you.  I was extracting SharePoint profile information and needed to display the &#8220;About Me&#8221; field in an application that couldn&#8217;t render HTML, so I needed to convert the HTML to text.  This is a bit more complex than simply stripping the HTML tags out of the content.  Doing that would preserve whitespace that should be ignored and would also ignore whitespace that is indicated by things like  br, P, H1 tags, etc.</p>
<pre class="syntax-highlight:csharp">

function Html-ToText {
 param([System.String] $html)

 # remove line breaks, replace with spaces
 $html = $html -replace &quot;(`r|`n|`t)&quot;, &quot; &quot;
 # write-verbose &quot;removed line breaks: `n`n$html`n&quot;

 # remove invisible content
 @(&#039;head&#039;, &#039;style&#039;, &#039;script&#039;, &#039;object&#039;, &#039;embed&#039;, &#039;applet&#039;, &#039;noframes&#039;, &#039;noscript&#039;, &#039;noembed&#039;) | % {
  $html = $html -replace &quot;&lt;$_[^&gt;]*?&gt;.*?&lt;/$_&gt;&quot;, &quot;&quot;
 }
 # write-verbose &quot;removed invisible blocks: `n`n$html`n&quot;

 # Condense extra whitespace
 $html = $html -replace &quot;( )+&quot;, &quot; &quot;
 # write-verbose &quot;condensed whitespace: `n`n$html`n&quot;

 # Add line breaks
 @(&#039;div&#039;,&#039;p&#039;,&#039;blockquote&#039;,&#039;h[1-9]&#039;) | % { $html = $html -replace &quot;&lt;/?$_[^&gt;]*?&gt;.*?&lt;/$_&gt;&quot;, (&quot;`n&quot; + &#039;$0&#039; )} 
 # Add line breaks for self-closing tags
 @(&#039;div&#039;,&#039;p&#039;,&#039;blockquote&#039;,&#039;h[1-9]&#039;,&#039;br&#039;) | % { $html = $html -replace &quot;&lt;$_[^&gt;]*?/&gt;&quot;, (&#039;$0&#039; + &quot;`n&quot;)} 
 # write-verbose &quot;added line breaks: `n`n$html`n&quot;

 #strip tags 
 $html = $html -replace &quot;&lt;[^&gt;]*?&gt;&quot;, &quot;&quot;
 # write-verbose &quot;removed tags: `n`n$html`n&quot;
  
 # replace common entities
 @( 
  @(&quot;&amp;amp;bull;&quot;, &quot; * &quot;),
  @(&quot;&amp;amp;lsaquo;&quot;, &quot;&lt;&quot;),
  @(&quot;&amp;amp;rsaquo;&quot;, &quot;&gt;&quot;),
  @(&quot;&amp;amp;(rsquo|lsquo);&quot;, &quot;&#039;&quot;),
  @(&quot;&amp;amp;(quot|ldquo|rdquo);&quot;, &#039;&quot;&#039;),
  @(&quot;&amp;amp;trade;&quot;, &quot;(tm)&quot;),
  @(&quot;&amp;amp;frasl;&quot;, &quot;/&quot;),
  @(&quot;&amp;amp;(quot|#34|#034|#x22);&quot;, &#039;&quot;&#039;),
  @(&#039;&amp;amp;(amp|#38|#038|#x26);&#039;, &quot;&amp;amp;&quot;),
  @(&quot;&amp;amp;(lt|#60|#060|#x3c);&quot;, &quot;&lt;&quot;),
  @(&quot;&amp;amp;(gt|#62|#062|#x3e);&quot;, &quot;&gt;&quot;),
  @(&#039;&amp;amp;(copy|#169);&#039;, &quot;(c)&quot;),
  @(&quot;&amp;amp;(reg|#174);&quot;, &quot;(r)&quot;),
  @(&quot;&amp;amp;nbsp;&quot;, &quot; &quot;),
  @(&quot;&amp;amp;(.{2,6});&quot;, &quot;&quot;)
 ) | % { $html = $html -replace $_[0], $_[1] }
 # write-verbose &quot;replaced entities: `n`n$html`n&quot;

 return $html

}
</pre>
<p>And you can run it like this:</p>
<pre class="syntax-highlight:csharp">

Html-ToText (new-object net.webclient).DownloadString(&quot;&lt;a href=&quot;http://winstonfassett.com&quot;&gt;http://winstonfassett.com&lt;/a&gt;&quot;)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2010/09/21/html-to-text-conversion-in-powershell/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Trying out XMind</title>
		<link>http://winstonfassett.com/blog/2009/03/31/trying-out-xmind/</link>
		<comments>http://winstonfassett.com/blog/2009/03/31/trying-out-xmind/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 15:35:06 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Techno-Babble]]></category>

		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[mind-mapping]]></category>

		<category><![CDATA[MindTree]]></category>

		<category><![CDATA[Piccolo]]></category>

		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=186</guid>
		<description><![CDATA[Trying out XMind again.  Looks about the same, and I&#8217;m not that impressed with the mind-mapping UI itself, but the application shell based on Eclipse RCP is pretty slick.  The whole thing makes me want to get back into MindTree (I need to think of a new name, too).  Maybe once things settle down.  The [...]]]></description>
			<content:encoded><![CDATA[<p>Trying out <a href="http://www.xmind.net/">XMind</a> again.  Looks about the same, and I&#8217;m not that impressed with the mind-mapping UI itself, but the application shell based on Eclipse RCP is pretty slick.  The whole thing makes me want to get back into <a href="http://mindtree.winstonfassett.com">MindTree</a> (I need to think of a new name, too).  Maybe once things settle down.  The big decision, though, is going to be: do I proceed with migrating from WinForms / Piccolo to WPF, or do I rebuild on an open platform (Java/Piccolo, maybe) so that it can run on Mac/Linux/Windows, at the cost of some UI sexiness (and a fair amount of time)?</p>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2009/03/31/trying-out-xmind/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JAD vanished from the internet</title>
		<link>http://winstonfassett.com/blog/2009/03/19/jad-vanished-from-the-internet/</link>
		<comments>http://winstonfassett.com/blog/2009/03/19/jad-vanished-from-the-internet/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:19:15 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Techno-Babble]]></category>

		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=184</guid>
		<description><![CDATA[I recently started doing Java development again and went off looking for the trusty Jad compiler, which I planned on using with the JadClipse so that I could browse straight into any class.  Not for the purpose of cribbing someone else&#8217;s code, but for faster, better comprehension of how to use other libraries.  In .NET I [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started doing Java development again and went off looking for the trusty Jad compiler, which I planned on using with the <a href="http://jadclipse.sourceforge.net/">JadClipse</a> so that I could browse straight into any class.  Not for the purpose of cribbing someone else&#8217;s code, but for faster, better comprehension of how to <em>use</em> other libraries.  In .NET I use <a href="http://www.red-gate.com/products/reflector/">Reflector</a> for the same purpose, although it doesn&#8217;t compare to the usability experience of JadClipse.  (really, nothing compares to the usability experience of using <a href="http://www.eclipse.org/">Eclipse</a> &#8212; I think it&#8217;s one of the single best pieces of software ever written).  </p>
<p>But unfortunately, the Jad website has <em>vanished from the internet</em>.  Can you believe that?  In this day and age, when all you need is a place to host a couple of pages and a couple of small zip files, it&#8217;s just gone, and in its place is a dumb generic domain landing page.  </p>
<p>It&#8217;s crazy that there is no where else to get Jad.  Crazy because there are <em>tons</em> of tools that sit on top of Jad.  JadClipse, cavaj, JD Decompiler, etc.  But the heart of the thing is Jad, and every one of those tools requires you to download Jad separately, but oops:  Jad has vanished from the internet.  </p>
<p>I managed to find an old version of the Jad exe on an old machine, but then today I tried looking around and found that <a href="http://paranoid-engineering.blogspot.com/2009/03/jad-java-decompiler-is-down.html">Tomas Varaneckas set up a mirror</a>.  It was hard to find however, so I&#8217;m posting the link here for posterity.  Thanks Tomas!</p>
<p>Fortunately, someone thought to set up a mirror.</p>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2009/03/19/jad-vanished-from-the-internet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Apple download failures are ruining my life</title>
		<link>http://winstonfassett.com/blog/2009/03/13/apple-download-failures-are-ruining-my-life/</link>
		<comments>http://winstonfassett.com/blog/2009/03/13/apple-download-failures-are-ruining-my-life/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 17:57:54 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Techno-Babble]]></category>

		<category><![CDATA[Annoyances]]></category>

		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://winstonfassett.com/blog/?p=177</guid>
		<description><![CDATA[For the past few weeks I&#8217;ve been trying to update my iPhone to the new 2.2.1 firmware, but the download always failed.  Same with downloading a new version iTunes.  Tried and tried and tried.
Then today I got fed up, tracked down the url for manually downloading it (this forum thread is a good source).  But [...]]]></description>
			<content:encoded><![CDATA[<p>For the past few weeks I&#8217;ve been trying to update my iPhone to the new 2.2.1 firmware, but the download always failed.  Same with downloading a new version iTunes.  Tried and tried and tried.</p>
<p>Then today I got fed up, tracked down the url for manually downloading it (<a href="http://www.hackint0sh.org/forum/f127/22056.htm">this forum thread</a> is a good source).  But it <strong>still</strong> didn&#8217;t work!  It kept hanging after a couple of minutes.</p>
<p>Eventually I realized that it might have something to do with my router settings.  I had set connections to time out after 120 seconds in order to better handle lots of bit torrent traffic.  It&#8217;s usually not a problem, as my browsers are usually able to resume downloads when connections are broken, even when I lose internet connectivity completely.  But perhaps there&#8217;s something about edge / content delivery network downloads that requires a persistent connection.  Anyway, I raised my connection timeout to 600 seconds and now all my Apple downloads are working fine.</p>
<p><strong>Update: </strong>scratch that.  Didn&#8217;t work totally fine.  The iPhone update still keeps hanging and eventually dying.  Now I&#8217;m trying to nurse it along by occasionally &#8220;pausing&#8221; and &#8220;resuming&#8221; the download in Google Chrome.  Looks like it might work, if I&#8217;m attentive.  What a beating.</p>
<p><strong>Update 2:</strong> So nursing it along proved to be too tedious.  After 45min of starting and stopping, it failed at 240/246M!  Arrgggh!  So now I&#8217;m thinking maybe it has something to do with the wifi.  So this time I SSH&#8217;d into my Linux server (which is wired to the net), used wget to download, and it took <strong>5 minutes</strong>.</p>
<p><strong>Update 3:</strong> Scratch <em>that</em>.  It turns out I downloaded the update for the 3G iPhone instead of my 1st generation iPhone.  The first generation firmware update keeps failing over and over and over.  It&#8217;s killing me.  Somehow I got the 3G version, 246M, in an amazing 5 minutes, but the download for <em>my phone</em> is coming in at 50k/s and stalling out at around 2% complete.  This is ridiculous.</p>
]]></content:encoded>
			<wfw:commentRss>http://winstonfassett.com/blog/2009/03/13/apple-download-failures-are-ruining-my-life/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

