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

<channel>
	<title>A Developer&#039;s Blog &#187; Windows Live Writer</title>
	<atom:link href="http://blog.hoegaerden.be/tag/windows-live-writer/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hoegaerden.be</link>
	<description>SQL Server, BI, .NET, IT and anything else I have been playing with.</description>
	<lastBuildDate>Tue, 07 Sep 2010 18:29:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Windows Live Writer: Paste Code Plug-In</title>
		<link>http://blog.hoegaerden.be/2010/01/15/windows-live-writer-paste-code-plug-in/</link>
		<comments>http://blog.hoegaerden.be/2010/01/15/windows-live-writer-paste-code-plug-in/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 21:31:23 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Windows Live Writer]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/01/15/windows-live-writer-paste-code-plug-in/</guid>
		<description><![CDATA[Here’s a tip for anyone who’s using Windows Live Writer for blogging and wants to paste code into the articles.
Ever since my first code post back in July 2008 I have tried about four different Live Writer plug-ins to get the code formatting right.  Three of those are still installed today and I regularly use [...]]]></description>
			<content:encoded><![CDATA[<p>Here’s a tip for anyone who’s using <a title="Windows Live Writer - Download Here" href="http://download.live.com/writer">Windows Live Writer</a> for blogging and wants to paste code into the articles.</p>
<p>Ever since <a title="Excel Automation: the CultureInfo bug" href="http://blog.hoegaerden.be/2008/07/27/excel-automation-the-cultureinfo-bug/">my first code post back in July 2008</a> I have tried about four different Live Writer plug-ins to get the code formatting right.  Three of those are still installed today and I regularly use two of them.  As I post code samples in several languages (SQL, MDX, C#, VB, XML, &#8230;) I need the plug-in to support all those languages and to turn the code into decent output.  It would be ideal if I could do all this with just one plug-in.</p>
<p><em><strong>Disclaimer:</strong> the code shown in this article is copied from my own blog or from Microsoft code samples.  They are not guaranteed to be complete and are just for demonstration purposes.  No explanation is provided on what the code is supposed to be doing either.</em></p>
<h2>The Old Stuff</h2>
<p>Following three screenshots will show you those three plug-ins in action.</p>
<h3>Code Snippet</h3>
<p><a title="Code Snippet plugin for Windows Live Writer" href="http://gallery.live.com/liveItemDetail.aspx?li=d4409446-af7f-42ec-aa20-78aa5bac4748">More info through this link</a></p>
<blockquote><p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Code Snippet in action with some C# code" src="http://blog.hoegaerden.be/wp-content/uploads/image144.png" border="0" alt="Code Snippet in action with some C# code" width="640" height="564" /></p></blockquote>
<h3>Colorized Code</h3>
<p><a title="Windows Live Writer Plugin to Insert Colorized Code" href="http://www.carlosag.net/Tools/WindowsLiveWriter/">More info through this link</a></p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image145.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Code Colorizer in action with some T-SQL" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb38.png" border="0" alt="Code Colorizer in action with some T-SQL" width="669" height="325" /></a></p>
<h3>Source Code Formatter</h3>
<p><a title="Windows Live Writer Plugin - Source Code Formatter" href="http://www.amergerzic.com/post/WLWSourceCodePlugin.aspx">More info through this link</a></p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image146.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Source Code in action with some XML" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb39.png" border="0" alt="Source Code in action with some XML" width="673" height="334" /></a></p>
<p>This last one is the one that I don’t use very often – to be honest I don’t even remember what I’ve actually used it for…</p>
<p>Now, back to the real reason for this article.</p>
<h2>Time For Something New</h2>
<p>As I mentioned before, I’m not extremely happy with the fact that I need to use several plug-ins for a similar task.  I keep forgetting which one the more interesting one is for SQL, or for C#, or whatever, I think you get my point.  It would be perfect if one plug-in could do all this.  And it has taken me quite a while but I think I may finally have found that one plug-in.  You can see it in action in <a title="List All SSIS Packages Deployed On Your Integration Server" href="http://blog.hoegaerden.be/2010/01/10/list-all-ssis-packages-deployed-on-your-integration-server/">my previous post</a>.  Doesn’t that look nice?</p>
<p>What I like most about this plug-in is that the developer has taken a different approach to get the formatting done.  All other plug-ins that I&#8217;ve tried required me to paste the code into a pop-up window and select the right programming language, as I’ve shown you above.  This one is much simpler: it takes what is stored in the clipboard, including the formatting!</p>
<p>In my opinion this has two interesting advantages:</p>
<ul>
<li>
<ul>
<li><strong>Faster</strong>: no messing around with a pop-up window</li>
<li><strong>Accurate</strong>: as it uses the formatting as provided by the application from which it was copied, it will look exactly the same!  Which is something that I can’t say about the other plug-ins.</li>
</ul>
</li>
</ul>
<p>Okay, this means I don&#8217;t have any other options either, no line numbering, no alternating background coloring, &#8230;  But who cares when the output looks good?  And I don’t use those extra features anyway.</p>
<p>Here are some pasted snippets using my new favorite plug-in.</p>
<h3>SQL copied from the Management Studio (SSMS 2008)</h3>
<pre class="code"><span style="color: green">--a comment
</span><span style="color: blue">declare </span>@number <span style="color: blue">int </span><span style="color: gray">= </span>42<span style="color: gray">;
</span><span style="color: blue">declare </span>@character <span style="color: blue">char</span><span style="color: gray">(</span>1<span style="color: gray">) = </span><span style="color: red">'0'</span><span style="color: gray">;
</span><span style="color: blue">declare </span>@expectedLength <span style="color: blue">int </span><span style="color: gray">= </span>8<span style="color: gray">;
</span><span style="color: green">/* a block comment */
</span><span style="color: blue">select </span><span style="color: magenta">REPLICATE</span><span style="color: gray">(</span>@character<span style="color: gray">, </span>@expectedLength <span style="color: gray">- </span><span style="color: magenta">LEN</span><span style="color: gray">(</span>@number<span style="color: gray">)) </span>
<blockquote>

<span style="color: gray">+ </span><span style="color: magenta">CAST</span><span style="color: gray">(</span>@number <span style="color: blue">as varchar</span><span style="color: gray">(</span>8<span style="color: gray">)) </span><span style="color: blue">as </span>Result<span style="color: gray">;</span></blockquote>
</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h3>MDX Copied From SQL Server Management Studio (SSMS 2008)</h3>
<pre class="code"><span style="color: blue">SELECT NON EMPTY </span>{ [Measures].[Reseller Sales Amount], [Measures].[Reseller Order Quantity] } <span style="color: blue">ON COLUMNS</span>,
<span style="color: blue">NON EMPTY </span>{ ([Geography].[Geography].[Postal Code].<span style="color: maroon">ALLMEMBERS </span>) }
<span style="color: blue">DIMENSION PROPERTIES MEMBER_CAPTION</span>, <span style="color: blue">MEMBER_UNIQUE_NAME ON ROWS
FROM </span>[Adventure Works]
<span style="color: blue">CELL PROPERTIES VALUE</span>, <span style="color: blue">BACK_COLOR</span>, <span style="color: blue">FORE_COLOR</span>, <span style="color: blue">FORMATTED_VALUE</span>, <span style="color: blue">FORMAT_STRING</span>, <span style="color: blue">FONT_NAME</span>, <span style="color: blue">FONT_SIZE</span>, <span style="color: blue">FONT_FLAGS</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h3>C# Copied From Visual Studio (VS 2008)</h3>
<pre class="code"><span style="color: blue">public partial class </span><span style="color: #2b91af">StoredProcedures
</span>{
    [Microsoft.SqlServer.Server.<span style="color: #2b91af">SqlProcedure</span>]
    <span style="color: blue">public static void </span>WeatherSP(<span style="color: blue">string </span>zipCode)
    {
        <span style="color: #2b91af">Weather </span>myWeatherWS = <span style="color: blue">new </span><span style="color: #2b91af">Weather</span>();
        <span style="color: #2b91af">WeatherReturn </span>weatherResult = myWeatherWS.GetCityWeatherByZIP(zipCode);

        <span style="color: #2b91af">SqlMetaData</span>[] recordMetaData = <span style="color: blue">new </span><span style="color: #2b91af">SqlMetaData</span>[2];
        <span style="color: green">// layout of the records that we'll return
        </span>recordMetaData[0] = <span style="color: blue">new </span><span style="color: #2b91af">SqlMetaData</span>(<span style="color: #a31515">"Description"</span>, <span style="color: #2b91af">SqlDbType</span>.Char, 100);
        recordMetaData[1] = <span style="color: blue">new </span><span style="color: #2b91af">SqlMetaData</span>(<span style="color: #a31515">"Value"</span>, <span style="color: #2b91af">SqlDbType</span>.Char, 1000);

        <span style="color: green">// build a record based on the metadata
        </span><span style="color: #2b91af">SqlDataRecord </span>record = <span style="color: blue">new </span><span style="color: #2b91af">SqlDataRecord</span>(recordMetaData);

        <span style="color: green">// let's start sending result into the active pipe
        </span><span style="color: #2b91af">SqlContext</span>.Pipe.SendResultsStart(record);</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h3>XML Copied From Visual Studio (VS 2008)</h3>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>"<span style="color: blue">1.0</span>" <span style="color: red">encoding</span><span style="color: blue">=</span>"<span style="color: blue">utf-8</span>" <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">configuration</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">appSettings</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">add </span><span style="color: red">key</span><span style="color: blue">=</span>"<span style="color: blue">MyWebService</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">http://MyWebServiceServer:MyWSPort/PathTo/MyWebService.asmx</span>" <span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">appSettings</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">configuration</span><span style="color: blue">&gt;</span></pre>
<h3>VB.NET Copied From Visual Studio (VS 2005)</h3>
<pre class="code">#<span style="color: blue">Region </span><span style="color: #a31515">"AddColumnInformation"

    </span><span style="color: green">'/ &lt;summary&gt;
    '/ Stores the column information of the provided input and output objects in a ColumnInfo object.
    '/ This method is called by the RemoveDuplicates component during PreExecute when the BufferManager
    '/ is available, and assumes the exact same number of input and output columns.
    '/ &lt;/summary&gt;
    '/ &lt;param name="bufferManager"&gt;The IDTSBufferManager100; used to locate the columns
    '/ in the input and output buffers.&lt;/param&gt;
    '/ &lt;param name="output"&gt;The output of the component.&lt;/param&gt;
    '/ &lt;param name="input"&gt;The input of the component.&lt;/param&gt;
    </span>&lt;System.Diagnostics.CodeAnalysis.SuppressMessage(<span style="color: #a31515">"Microsoft.Usage"</span>, <span style="color: #a31515">"CA2201:DoNotRaiseReservedExceptionTypes"</span>)&gt; _
    &lt;System.Diagnostics.CodeAnalysis.SuppressMessage(<span style="color: #a31515">"Microsoft.Globalization"</span>, <span style="color: #a31515">"CA1303:DoNotPassLiteralsAsLocalizedParameters"</span>, MessageId:=<span style="color: #a31515">"System.Exception.#ctor(System.String)"</span>)&gt; _
    &lt;CLSCompliant(<span style="color: blue">False</span>)&gt; _
    <span style="color: blue">Public Sub </span>AddColumnInformation(<span style="color: blue">ByVal </span>bufferManager <span style="color: blue">As </span>IDTSBufferManager100, <span style="color: blue">ByVal </span>output <span style="color: blue">As </span>IDTSOutput100, <span style="color: blue">ByVal </span>input <span style="color: blue">As </span>IDTSInput100)
        <span style="color: blue">If </span>input <span style="color: blue">Is Nothing Then
            Throw New </span>ArgumentNullException(<span style="color: #a31515">"input"</span>)
        <span style="color: blue">End If

        If </span>output <span style="color: blue">Is Nothing Then
            Throw New </span>ArgumentNullException(<span style="color: #a31515">"output"</span>)
        <span style="color: blue">End If

        If </span>bufferManager <span style="color: blue">Is Nothing Then
            Throw New </span>ArgumentNullException(<span style="color: #a31515">"bufferManager"</span>)
        <span style="color: blue">End If

        If </span>input.InputColumnCollection.Count &lt;&gt; output.OutputColumnCollection.Count <span style="color: blue">Then
            Throw New </span>Exception(<span style="color: #a31515">"Input column collection does not match the output column collection."</span>)
        <span style="color: blue">End If

        For </span>x <span style="color: blue">As Integer </span>= 0 <span style="color: blue">To </span>output.OutputColumnCollection.Count - 1
            <span style="color: blue">Dim </span>colInfo <span style="color: blue">As New </span>ColumnInfo()
            <span style="color: blue">Dim </span>outCol <span style="color: blue">As </span>IDTSOutputColumn100 = output.OutputColumnCollection(x)
            <span style="color: blue">Dim </span>inCol <span style="color: blue">As </span>IDTSInputColumn100 = input.InputColumnCollection(x)

            <span style="color: green">' Set the buffer column index for the input column and the output column.
            </span>colInfo.inputBufferColumnIndex = bufferManager.FindColumnByLineageID(input.Buffer, inCol.LineageID)
            colInfo.outputBufferColumnIndex = bufferManager.FindColumnByLineageID(output.Buffer, outCol.LineageID)

            <span style="color: green">' Save the column
            </span>columnInfos.Add(colInfo)
        <span style="color: blue">Next </span>x
    <span style="color: blue">End Sub
</span>#<span style="color: blue">End Region
End Class</span></pre>
<p>One feature though that I&#8217;d like to see is a horizontal scrollbar when the code lines are longer than the width of the code block.  Right now it automatically wraps the text which makes it a bit difficult to read.  So I have to pay attention when pasting code.  Although it’s not always obvious, you can see this wrapping occur in three of the above code snippets (MDX, XML, VB.NET).</p>
<p>To conclude this article: the new plug-in that I’m using is called “Paste from Visual Studio” or VSPaste.  You can <a title="Paste from Visual Studio" href="http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&amp;l=8">download it here</a>.</p>
<p>Out of curiosity, I wonder how it performs when pasting formatted text from Word (2007):</p>
<p><span style="color: red"><a href="http://11011.net/software/vspaste"></a></span><span style="color: red"><a href="http://11011.net/software/vspaste"></a></span></p>
<pre class="code">PrFont34Bin0BinSub0Frac0Def1Margin0Margin0Jc1Indent1440Lim0Lim1Some bold text
And some italic
Italic, bold and underline in combination
Text in <span style="color: #548dd4">blue and </span><span style="color: #00b050">green and </span><span style="color: red">red on one line
</span></pre>
<p>Okay, ow, look at that, I’m writing in red now, that can’t be the intention!<span style="color: #000000;"> Luckily Live Writer allows me to switch back to black.</span></p>
<p><span style="color: #000000;">So, conclusion: VSPaste not only works when pasting from Visual Studio, SQL Server Management Studio is okay as well!  But Word is not…</span></p>
<p><span style="color: #000000;">Happy blogging!</span></p>
<p><span style="color: #000000;">Valentino.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/01/15/windows-live-writer-paste-code-plug-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress config changes for Windows Live Writer</title>
		<link>http://blog.hoegaerden.be/2008/07/27/wordpress-config-changes-for-windows-live-writer/</link>
		<comments>http://blog.hoegaerden.be/2008/07/27/wordpress-config-changes-for-windows-live-writer/#comments</comments>
		<pubDate>Sun, 27 Jul 2008 10:36:04 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Windows Live Writer]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2008/07/27/wordpress-config-changes-for-windows-live-writer/</guid>
		<description><![CDATA[I&#8217;m using Windows Live Writer (version 2008, build 12.0.1370.325) to write my posts on this WordPress 2.6 blog.  To be able to do this I had to make a couple of changes to the default configuration of WordPress.

Activate XML-RPC in Settings &#62; Writing, by default this is disabled.
Modify the upload folder in Settings &#62; Miscellaneous.  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using Windows Live Writer (version 2008, build 12.0.1370.325) to write my posts on this WordPress 2.6 blog.  To be able to do this I had to make a couple of changes to the default configuration of WordPress.</p>
<ol>
<li>Activate XML-RPC in Settings &gt; Writing, by default this is disabled.</li>
<li>Modify the upload folder in Settings &gt; Miscellaneous.  By default this was &#8220;wp-content&#8221;.  I changed it to &#8220;wp-content/uploads&#8221; and I created the uploads folder manually on the server (with 777 rights).  This is the folder where the images will end up.</li>
</ol>
<p>After these two changes I was able connect to the blog with WLW and post the article about the black background issue (which contains an image).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2008/07/27/wordpress-config-changes-for-windows-live-writer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
