<?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>Blake&#039;s Application Development Blog</title>
	<atom:link href="http://www.blakepell.com/Blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.blakepell.com/Blog</link>
	<description>.Net Framework, BI, Web/Client Development and more</description>
	<lastBuildDate>Thu, 17 May 2012 21:11:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>VB.Net &amp; C# ReplaceFirst and ReplaceLast Extension Methods</title>
		<link>http://www.blakepell.com/Blog/?p=484</link>
		<comments>http://www.blakepell.com/Blog/?p=484#comments</comments>
		<pubDate>Thu, 17 May 2012 20:57:14 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[extension method]]></category>
		<category><![CDATA[ReplaceFirst]]></category>
		<category><![CDATA[ReplaceLast]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=484</guid>
		<description><![CDATA[Here are two quick extension methods that will allow you to replace just the first or last occurrence in a string with another.&#160; I’ve provided them as extension methods but they could just as easily just be implemented as a function.&#160; Note, that if you use them as an extension method with the Extension() call&#8230;]]></description>
			<content:encoded><![CDATA[<p>Here are two quick extension methods that will allow you to replace just the first or last occurrence in a string with another.&#160; I’ve provided them as extension methods but they could just as easily just be implemented as a function.&#160; Note, that if you use them as an extension method with the Extension() call above the method you will want to import System.Runtime.CompilerServices at the top of that code file.</p>
<p><strong>VB.Net</strong></p>
<pre class="csharpcode">        <span class="rem">''' &lt;summary&gt;</span>
        <span class="rem">''' An extension method that replaces the first occurance of a specified string.</span>
        <span class="rem">''' &lt;/summary&gt;</span>
        <span class="rem">''' &lt;param name=&quot;str&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">''' &lt;param name=&quot;searchTxt&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">''' &lt;param name=&quot;replaceTxt&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">''' &lt;returns&gt;&lt;/returns&gt;</span>
        <span class="rem">''' &lt;remarks&gt;&lt;/remarks&gt;</span>
        &lt;Extension()&gt; _
        <span class="kwrd">Public</span> <span class="kwrd">Function</span> ReplaceFirst(<span class="kwrd">ByVal</span> str <span class="kwrd">As</span> <span class="kwrd">String</span>, searchTxt <span class="kwrd">As</span> <span class="kwrd">String</span>, replaceTxt <span class="kwrd">As</span> <span class="kwrd">String</span>) <span class="kwrd">As</span> <span class="kwrd">String</span>
            <span class="kwrd">Dim</span> pos <span class="kwrd">As</span> <span class="kwrd">Integer</span> = str.IndexOf(searchTxt)

            <span class="kwrd">If</span> pos &lt; 0 <span class="kwrd">Then</span>
                <span class="kwrd">Return</span> str
            <span class="kwrd">End</span> <span class="kwrd">If</span>

            <span class="kwrd">Return</span> str.Substring(0, pos) + replaceTxt + str.Substring(pos + searchTxt.Length)
        <span class="kwrd">End</span> <span class="kwrd">Function</span>

        <span class="rem">''' &lt;summary&gt;</span>
        <span class="rem">''' An extension method that replaces the last occurance of a specified string.</span>
        <span class="rem">''' &lt;/summary&gt;</span>
        <span class="rem">''' &lt;param name=&quot;str&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">''' &lt;param name=&quot;searchTxt&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">''' &lt;param name=&quot;replaceTxt&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">''' &lt;returns&gt;&lt;/returns&gt;</span>
        <span class="rem">''' &lt;remarks&gt;&lt;/remarks&gt;</span>
        &lt;Extension()&gt; _
        <span class="kwrd">Public</span> <span class="kwrd">Function</span> ReplaceLast(<span class="kwrd">ByVal</span> str <span class="kwrd">As</span> <span class="kwrd">String</span>, searchTxt <span class="kwrd">As</span> <span class="kwrd">String</span>, replaceTxt <span class="kwrd">As</span> <span class="kwrd">String</span>) <span class="kwrd">As</span> <span class="kwrd">String</span>
            <span class="kwrd">Dim</span> pos <span class="kwrd">As</span> <span class="kwrd">Integer</span> = str.LastIndexOf(searchTxt)

            <span class="kwrd">If</span> pos &lt; 0 <span class="kwrd">Then</span>
                <span class="kwrd">Return</span> str
            <span class="kwrd">End</span> <span class="kwrd">If</span>

            <span class="kwrd">Return</span> str.Substring(0, pos) + replaceTxt + str.Substring(pos + searchTxt.Length)
        <span class="kwrd">End</span> Function</pre>
<p><strong>C#</strong><br />
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<pre class="csharpcode">        <span class="rem">/// &lt;summary&gt;</span>
        <span class="rem">/// An extension method that replaces the first occurance of a specified string.</span>
        <span class="rem">/// &lt;/summary&gt;</span>
        <span class="rem">/// &lt;param name=&quot;str&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">/// &lt;param name=&quot;searchTxt&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">/// &lt;param name=&quot;replaceTxt&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">/// &lt;returns&gt;&lt;/returns&gt;</span>
        <span class="rem">/// &lt;remarks&gt;&lt;/remarks&gt;</span>
        [Extension()]
        <span class="kwrd">public</span> <span class="kwrd">string</span> ReplaceFirst(<span class="kwrd">string</span> str, <span class="kwrd">string</span> searchTxt, <span class="kwrd">string</span> replaceTxt)
        {
            <span class="kwrd">int</span> pos = str.IndexOf(searchTxt);

            <span class="kwrd">if</span> (pos &lt; 0)
            {
                <span class="kwrd">return</span> str;
            }

            <span class="kwrd">return</span> str.Substring(0, pos) + replaceTxt + str.Substring(pos + searchTxt.Length);
        } <span class="rem">// end ReplaceFirst</span>

        <span class="rem">/// &lt;summary&gt;</span>
        <span class="rem">/// An extension method that replaces the last occurance of a specified string.</span>
        <span class="rem">/// &lt;/summary&gt;</span>
        <span class="rem">/// &lt;param name=&quot;str&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">/// &lt;param name=&quot;searchTxt&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">/// &lt;param name=&quot;replaceTxt&quot;&gt;&lt;/param&gt;</span>
        <span class="rem">/// &lt;returns&gt;&lt;/returns&gt;</span>
        <span class="rem">/// &lt;remarks&gt;&lt;/remarks&gt;</span>
        [Extension()]
        <span class="kwrd">public</span> <span class="kwrd">string</span> ReplaceLast(<span class="kwrd">string</span> str, <span class="kwrd">string</span> searchTxt, <span class="kwrd">string</span> replaceTxt)
        {
            <span class="kwrd">int</span> pos = str.LastIndexOf(searchTxt);

            <span class="kwrd">if</span> (pos &lt; 0)
            {
                <span class="kwrd">return</span> str;
            }

            <span class="kwrd">return</span> str.Substring(0, pos) + replaceTxt + str.Substring(pos + searchTxt.Length);
        } // end ReplaceLast</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=484</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to see who can see your Outlook Calendar</title>
		<link>http://www.blakepell.com/Blog/?p=482</link>
		<comments>http://www.blakepell.com/Blog/?p=482#comments</comments>
		<pubDate>Thu, 17 May 2012 17:24:01 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[Microsoft Office]]></category>
		<category><![CDATA[2007]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[permissions]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=482</guid>
		<description><![CDATA[Pretty straight forward, you want to see who has permission to view your Outlook calendar via an Exchange Server. In Outlook, click on the “Calendar Tab” on the left hand side. Under “My Calendars”, right click on the calendar you want to see the permissions for and choose “Properties”. On the “Calendar Properties” dialog, choose&#8230;]]></description>
			<content:encoded><![CDATA[<p>Pretty straight forward, you want to see who has permission to view your Outlook calendar via an Exchange Server.</p>
<ol>
<li>In Outlook, click on the “Calendar Tab” on the left hand side.</li>
<li>Under “My Calendars”, right click on the calendar you want to see the permissions for and choose “Properties”.</li>
<li>On the “Calendar Properties” dialog, choose the “Permissions” tab.</li>
</ol>
<p>Here you can view/setup who has access to your calendar and how much access they have.&#160; You can add individuals to have permissions or you can also use groups, say if you wanted to give an entire department permissions.&#160; I’ve included a screenshot below with some of the key areas highlighted in red.</p>
<p><a href="http://www.blakepell.com/Blog/wp-content/uploads/2012/05/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.blakepell.com/Blog/wp-content/uploads/2012/05/image_thumb.png" width="527" height="475" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=482</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WinRT WebView.InvokeScript&#8211;Could not complete the operation due to error 8080000c</title>
		<link>http://www.blakepell.com/Blog/?p=475</link>
		<comments>http://www.blakepell.com/Blog/?p=475#comments</comments>
		<pubDate>Mon, 30 Apr 2012 20:20:45 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[8080000c InvokeScript eval]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=475</guid>
		<description><![CDATA[This error may occur when interacting with JavaScript and IE (version 10 beta in my case).&#160; My case came up with using the WebView’s InvokeScript method to get around some limitations in what the WebView exposes (in relation to what the old WinForms WebBrowser used to expose). In my case, this error comes about because&#8230;]]></description>
			<content:encoded><![CDATA[<p>This error may occur when interacting with JavaScript and IE (version 10 beta in my case).&#160; My case came up with using the WebView’s InvokeScript method to get around some limitations in what the WebView exposes (in relation to what the old WinForms WebBrowser used to expose).</p>
<p>In my case, this error comes about because you have bad JavaScript and/or a JavaScript error is being thrown.&#160; To test, I created a snippet of JavaScript that set the value on an HTML element on the page.&#160; It worked fine.&#160; If I navigate to a page that didn’t have that element and tried to execute it, I would get the above error.&#160; Here was my test code:</p>
<pre class="csharpcode"><span class="kwrd">Dim</span> buf <span class="kwrd">As</span> <span class="kwrd">String</span> = wv1.InvokeScript(<span class="str">&quot;eval&quot;</span>, <span class="kwrd">New</span> <span class="kwrd">String</span>() {<span class="str">&quot;document.getElementById(&quot;</span><span class="str">&quot;inputx&quot;</span><span class="str">&quot;).value = '500';&quot;</span>})</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=475</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Server Application Unavailable&#8221;</title>
		<link>http://www.blakepell.com/Blog/?p=472</link>
		<comments>http://www.blakepell.com/Blog/?p=472#comments</comments>
		<pubDate>Wed, 25 Apr 2012 20:11:08 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[Application Pool]]></category>
		<category><![CDATA[AppPool]]></category>
		<category><![CDATA[Server Application Unavailable]]></category>
		<category><![CDATA[Web Services Extensions]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=472</guid>
		<description><![CDATA[When upgrading a site to the .Net Framework 4.0 I received a “Server Application Unavailable” after I asked one of our system administrators to change the site from the .Net Framework 2.0 CLR (2.0/3.5) to the .Net Framework 4.0 CLR.&#160; After some Google searching I came across a blog entry here that had some good&#8230;]]></description>
			<content:encoded><![CDATA[<p>When upgrading a site to the .Net Framework 4.0 I received a “Server Application Unavailable” after I asked one of our system administrators to change the site from the .Net Framework 2.0 CLR (2.0/3.5) to the .Net Framework 4.0 CLR.&#160; After some Google searching I came across a blog entry here that had some good tips (and had the tip that fixed my problem):</p>
<ul>
<li><a href="http://www.denalimultimedia.com/info/Articles.aspx?cid=20&amp;topic=IIS-6-ASP-NET-4-0-page-not-found-404">http://www.denalimultimedia.com/info/Articles.aspx?cid=20&amp;topic=IIS-6-ASP-NET-4-0-page-not-found-404</a></li>
</ul>
<p>In short for my problem, .Net 2.0 web apps and .Net 4.0 web apps cannot run in the same app pool.&#160; After creating an application pool for the new 4.0 site the problem was gone.&#160; The last thing that Frank mentions is that the Web Services Extension must be set to “Allowed” for the .Net Framework 4.0 (mine was by default).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=472</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crystal Reports IDE to Crystal Reports .Net SDK Version</title>
		<link>http://www.blakepell.com/Blog/?p=470</link>
		<comments>http://www.blakepell.com/Blog/?p=470#comments</comments>
		<pubDate>Wed, 18 Apr 2012 20:30:47 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[Business intelligence]]></category>
		<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[CR2008]]></category>
		<category><![CDATA[CR2010]]></category>
		<category><![CDATA[Crystal Reports 10]]></category>
		<category><![CDATA[Crystal Reports 14]]></category>
		<category><![CDATA[Crystal Reports 2011]]></category>
		<category><![CDATA[Crystal Reports 9]]></category>
		<category><![CDATA[Crystal Reports XI]]></category>
		<category><![CDATA[VS2002]]></category>
		<category><![CDATA[VS2003]]></category>
		<category><![CDATA[VS2005]]></category>
		<category><![CDATA[VS2008]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=470</guid>
		<description><![CDATA[I don’t know if that title makes sense.&#160; This is a chart of what version of the Crystal Reports IDE matches up with which version of the Crystal Reports for .Net (according to my past knowledge + a conversation I just had with an SAP representative on the phone). Crystal Reports for .Net Version Full&#8230;]]></description>
			<content:encoded><![CDATA[<p>I don’t know if that title makes sense.&#160; This is a chart of what version of the Crystal Reports IDE matches up with which version of the Crystal Reports for .Net (according to my past knowledge + a conversation I just had with an SAP representative on the phone).</p>
<table border="1" cellspacing="0" cellpadding="2" width="597">
<tbody>
<tr>
<td valign="top" width="340"><strong><u>Crystal Reports for .Net Version</u></strong></td>
<td valign="top" width="255"><strong><u>Full Crystal IDE Version</u></strong></td>
</tr>
<tr>
<td valign="top" width="340">Crystal Reports for Visual Studio 2002 (Version 9)</td>
<td valign="top" width="255">Crystal Reports 9</td>
</tr>
<tr>
<td valign="top" width="340">Crystal Reports for Visual Studio 2003 (Version 9.2)</td>
<td valign="top" width="255">Crystal Reports 9</td>
</tr>
<tr>
<td valign="top" width="340">Crystal Reports for Visual Studio 2005 (Version 10.2)</td>
<td valign="top" width="255">Crystal Reports 10</td>
</tr>
<tr>
<td valign="top" width="370">Crystal Reports for Visual Studio 2008 (Version 10.5)</td>
<td valign="top" width="255">Crystal Reports 2008 (12)</td>
</tr>
<tr>
<td valign="top" width="370">Crystal Reports for Visual Studio 2010 (Version 13)</td>
<td valign="top" width="255">Crystal Reports 2011 (Version 14)</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=470</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Hey, go read a book&#8221;</title>
		<link>http://www.blakepell.com/Blog/?p=468</link>
		<comments>http://www.blakepell.com/Blog/?p=468#comments</comments>
		<pubDate>Mon, 16 Apr 2012 00:52:19 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[closed captioning]]></category>
		<category><![CDATA[netflix]]></category>
		<category><![CDATA[read a book]]></category>
		<category><![CDATA[roku]]></category>
		<category><![CDATA[sesame street]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=468</guid>
		<description><![CDATA[Had to share this.&#160; Woke up this morning, turned on Sesame Street via Netflix on my Roku box for my son while finding some food and was left with this screen.&#160; The closed captioning was on and the episode failed to load.&#160; A joke played by Netflix or whoever did the closed captioning for that&#8230;]]></description>
			<content:encoded><![CDATA[<p>Had to share this.&#160; Woke up this morning, turned on Sesame Street via Netflix on my Roku box for my son while finding some food and was left with this screen.&#160; The closed captioning was on and the episode failed to load.&#160; A joke played by Netflix or whoever did the closed captioning for that Sesame Street episode?&#160; I wondered if it something they were able to fit in only if the episode didn’t load, or on the first frame.&#160; I couldn’t find much Googling it.&#160; </p>
<p><a href="http://www.blakepell.com/Blog/wp-content/uploads/2012/04/543643_10151508962985153_543520152_23893826_852453518_n.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="543643_10151508962985153_543520152_23893826_852453518_n" border="0" alt="543643_10151508962985153_543520152_23893826_852453518_n" src="http://www.blakepell.com/Blog/wp-content/uploads/2012/04/543643_10151508962985153_543520152_23893826_852453518_n_thumb.jpg" width="698" height="525" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=468</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fill in a Bitmap with a solid color (Windows 8 Metro, WinRT)</title>
		<link>http://www.blakepell.com/Blog/?p=463</link>
		<comments>http://www.blakepell.com/Blog/?p=463#comments</comments>
		<pubDate>Wed, 11 Apr 2012 18:56:16 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Metro]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[AsStream]]></category>
		<category><![CDATA[Color]]></category>
		<category><![CDATA[Colors]]></category>
		<category><![CDATA[metro]]></category>
		<category><![CDATA[Pixel]]></category>
		<category><![CDATA[SetPixel]]></category>
		<category><![CDATA[windows 8]]></category>
		<category><![CDATA[Windows.UI]]></category>
		<category><![CDATA[WriteableBitmap]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=463</guid>
		<description><![CDATA[For those of you that found your way here, you’re probably wanting to learn how to fill in a bitmap with a specific color OR manipulate individual pixels.&#160; This example is the first I’ve got working and I will be posting more as I create more and then turn them into reusable objects. Unfortunately, the&#8230;]]></description>
			<content:encoded><![CDATA[<p>For those of you that found your way here, you’re probably wanting to learn how to fill in a bitmap with a specific color OR manipulate individual pixels.&#160; This example is the first I’ve got working and I will be posting more as I create more and then turn them into reusable objects.</p>
<p>Unfortunately, the ease of System.Drawing.Bitmap’s GetPixel and SetPixel are gone (for now).&#160; WinRT will not allow you to access that part of the framework (or many other parts of the framework) even if they exist.&#160; Here is my first example on how to fill in a WriteableBitmap with a solid color, pixel by pixel.&#160; </p>
<p>In my example, I’ve created a 128&#215;128 WriteableBitmap.&#160; Then, you have to return the PixelBuffer as a stream, to do so, Import (using in C#) System.Runtime.InteropServices.WindowsRuntime to allow the AsStream() extension to be called.&#160; The other class we’re going to use is Windows.UI.Color (and Windows.UI.Colors) so you may want to include an import to that also.</p>
<pre class="csharpcode">        <span class="kwrd">Dim</span> bmp <span class="kwrd">As</span> <span class="kwrd">New</span> WriteableBitmap(128, 128)
        <span class="kwrd">Dim</span> stream <span class="kwrd">As</span> Stream = bmp.PixelBuffer.AsStream()
        <span class="kwrd">Dim</span> c <span class="kwrd">As</span> Color = Colors.Red

        <span class="kwrd">For</span> x <span class="kwrd">As</span> <span class="kwrd">Integer</span> = 1 <span class="kwrd">To</span> bmp.PixelWidth
            <span class="kwrd">For</span> y <span class="kwrd">As</span> <span class="kwrd">Integer</span> = 1 <span class="kwrd">To</span> bmp.PixelHeight
                stream.WriteByte(c.B)
                stream.WriteByte(c.G)
                stream.WriteByte(c.R)
                stream.WriteByte(c.A)
            <span class="kwrd">Next</span>
        Next</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>For each pixel, 4 bytes are written to the stream (Blue, Green, Red, Alpha).&#160; Since this is a stream and not an array that’s 128&#215;128 it’s a little harder to get your head around (my natural instinct is to want to write to pixel 6,4).&#160; Ideally, I want to create something that has the simplicity of System.Drawing.Bitmap.&#160; For now, this is where I’m starting.&#160; Hope this helps sometime.&#160; Below is C# that has been run through a code converter, I haven’t tried to compile it but I thought I’d share it also.</p>
<pre class="csharpcode">WriteableBitmap bmp = <span class="kwrd">new</span> WriteableBitmap(128, 128);
Stream stream = bmp.PixelBuffer.AsStream();
Color c = Colors.Red;

<span class="kwrd">for</span> (<span class="kwrd">int</span> x = 1; x &lt;= bmp.PixelWidth; x++) {
    <span class="kwrd">for</span> (<span class="kwrd">int</span> y = 1; y &lt;= bmp.PixelHeight; y++) {
        stream.WriteByte(c.B);
        stream.WriteByte(c.G);
        stream.WriteByte(c.R);
        stream.WriteByte(c.A);
    }
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=463</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 8 Consumer Preview with VirtualBox Guest Additions (4.1.12r77245) Issues</title>
		<link>http://www.blakepell.com/Blog/?p=461</link>
		<comments>http://www.blakepell.com/Blog/?p=461#comments</comments>
		<pubDate>Mon, 09 Apr 2012 18:14:41 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[4.1.12r77245]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[vNext]]></category>
		<category><![CDATA[Windows 8 CP]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=461</guid>
		<description><![CDATA[Issues is putting it lightly.&#160; I’ve struggled to get a Windows 8 CP instance working correctly with Virtual Box.&#160; My first attempt worked, Windows 8 installed and seemingly worked.&#160; My issue came in that Visual Studio 11 either did not install correctly, didn’t have proper permissions to some folders or just wouldn’t work when it&#8230;]]></description>
			<content:encoded><![CDATA[<p>Issues is putting it lightly.&#160; I’ve struggled to get a Windows 8 CP instance working correctly with Virtual Box.&#160; My first attempt worked, Windows 8 installed and seemingly worked.&#160; My issue came in that Visual Studio 11 either did not install correctly, didn’t have proper permissions to some folders or just wouldn’t work when it came to using the XAML designer.&#160; I applied all fixes that Microsoft recommended to no avail.</p>
<p>My next attempt was to re-install Windows.&#160; Upon doing this (and every subsequent time) the OS would crash/lock up after the installation of the VirtualBox Guest Additions.&#160; The screen would go to the default color for Metro and nothing else would display.&#160; The only fix I found that has worked is to fully repair the OS (which is pretty much a re-install considering I have nothing else on the VM anyway).&#160; I should note, I did have the guest additions installed a few weeks ago so I don’t know if a recent update has caused new issues that didn’t occur before or not.&#160; The end result is, I cannot get Windows 8 functioning in a way that I can develop Metro apps with it (e.g. with Visual Studio 11).</p>
<p>On an up note, the WinForms editor seems to work as trusty as ever.&#160; There is something to be said for software that works (and works well).&#160; There’s also something to be said about software that doesn’t work well (*cough*, the XAML designer…. “Designer process terminated unexpectedly!”).&#160; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=461</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Execute JavaScript after a PostBack (VB and C#)</title>
		<link>http://www.blakepell.com/Blog/?p=459</link>
		<comments>http://www.blakepell.com/Blog/?p=459#comments</comments>
		<pubDate>Tue, 03 Apr 2012 15:29:30 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[ClientScript]]></category>
		<category><![CDATA[execute]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[postback]]></category>
		<category><![CDATA[RegisterClientScriptBlock]]></category>
		<category><![CDATA[synchronous]]></category>
		<category><![CDATA[Validate]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=459</guid>
		<description><![CDATA[Here is an example of how to execute JavaScript after a PostBack in a WebForms page (this specific case is not using ASP.NET Ajax, but rather a synchronous PostBack).&#160; This will allow you to run custom JavaScript after the server side code has executed. VB.Net Page.Validate If Page.IsValid = True Then Page.ClientScript.RegisterClientScriptBlock(Me.GetType, &#34;script&#34;, js, True)&#8230;]]></description>
			<content:encoded><![CDATA[<p>Here is an example of how to execute JavaScript after a PostBack in a WebForms page (this specific case is not using ASP.NET Ajax, but rather a synchronous PostBack).&#160; This will allow you to run custom JavaScript after the server side code has executed.</p>
<p><strong>VB.Net</strong></p>
<pre class="csharpcode">Page.Validate

<span class="kwrd">If</span> Page.IsValid = <span class="kwrd">True</span> <span class="kwrd">Then</span>
   Page.ClientScript.RegisterClientScriptBlock(<span class="kwrd">Me</span>.<span class="kwrd">GetType</span>, <span class="str">&quot;script&quot;</span>, js, <span class="kwrd">True</span>)
<span class="kwrd">End</span> If</pre>
<p><strong>C#</strong></p>
<pre class="csharpcode">Page.Validate();

<span class="kwrd">if</span> (Page.IsValid)
{
   Page.ClientScript.RegisterClientScriptBlock(<span class="kwrd">this</span>.GetType(), <span class="str">&quot;script&quot;</span>, js, <span class="kwrd">true</span>);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=459</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excel Formula to Subtract Hours</title>
		<link>http://www.blakepell.com/Blog/?p=457</link>
		<comments>http://www.blakepell.com/Blog/?p=457#comments</comments>
		<pubDate>Tue, 03 Apr 2012 13:43:37 +0000</pubDate>
		<dc:creator>bpell</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Microsoft Office]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[DateDiff]]></category>
		<category><![CDATA[Dates]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[Hours]]></category>
		<category><![CDATA[IF]]></category>
		<category><![CDATA[Subtract]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[Time Tracking]]></category>

		<guid isPermaLink="false">http://www.blakepell.com/Blog/?p=457</guid>
		<description><![CDATA[This is just a simple formula that will get the duration in between two times.&#160; If just a time is used (e.g. 9:00 PM) it will assume the two values are on the same day.&#160; If the date is also included (4/3/2012 9:00 PM) then it will get the difference that goes over days.&#160; If&#8230;]]></description>
			<content:encoded><![CDATA[<p>This is just a simple formula that will get the duration in between two times.&#160; If just a time is used (e.g. 9:00 PM) it will assume the two values are on the same day.&#160; If the date is also included (4/3/2012 9:00 PM) then it will get the difference that goes over days.&#160; If there isn’t a valid second cell or the difference is negative I’ve included a IF statement to return 0 (say, if you don’t have an end time yet because it hasn’t occurred, in the case of a time tracking spreadsheet).</p>
<pre class="csharpcode">=<span class="kwrd">IF</span>(B1-A1 &gt;= 0, B1-A1, 0)</pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The above assumes your values are in cells A1 and B1.&#160; Below is just an example of what it would look like on a sheet.</p>
<p><a href="http://www.blakepell.com/Blog/wp-content/uploads/2012/04/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.blakepell.com/Blog/wp-content/uploads/2012/04/image_thumb.png" width="732" height="189" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blakepell.com/Blog/?feed=rss2&#038;p=457</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

