<?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>MikeBevers.be</title>
	<atom:link href="http://www.mikebevers.be/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikebevers.be/blog</link>
	<description>Putting it out there...</description>
	<lastBuildDate>Mon, 08 Aug 2011 14:39:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mailbox unavailable. The server response was: No such user here</title>
		<link>http://www.mikebevers.be/blog/2011/08/mailbox-unavailable-the-server-response-was-no-such-user-here/</link>
		<comments>http://www.mikebevers.be/blog/2011/08/mailbox-unavailable-the-server-response-was-no-such-user-here/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 14:39:32 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[E-Mail]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[Website]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=510</guid>
		<description><![CDATA[The Problem
I recently acquired a new Windows hosting space. Everything ran fine and smooth until I tried to sent an E-Mail from my website. I received the following error: Mailbox unavailable. The server response was: No such user here. Which was weird to me, because I re-used my mailer class which worked fine on other [...]]]></description>
			<content:encoded><![CDATA[<h1>The Problem</h1>
<p>I recently acquired a new Windows hosting space. Everything ran fine and smooth until I tried to sent an E-Mail from my website. I received the following error: <i>Mailbox unavailable. The server response was: No such user here</i>. Which was weird to me, because I re-used my mailer class which worked fine on other websites. Usually I would setup my Web.Config like this:</p>
<pre class="brush: xml;">
&lt;configuration&gt;
  &lt;system.net&gt;
    &lt;mailSettings&gt;
      &lt;smtp&gt;
        &lt;network host=&quot;my.host.com&quot; port=&quot;25&quot; defaultCredentials=&quot;true&quot; /&gt;
      &lt;/smtp&gt;
    &lt;/mailSettings&gt;
  &lt;/system.net&gt;
&lt;/configuration&gt;
</pre>
<p class="endParagraph">&#8230; and I would set the Sender information in code to whatever I want.</p>
<h1>The solution</h1>
<p>Apparently some servers don&#8217;t allow anonymous SMTP. You need to configure an E-Mail account registered on your domain.</p>
<p>Then your Web.config will look:</p>
<pre class="brush: xml;">
&lt;configuration&gt;
  &lt;system.net&gt;
    &lt;mailSettings&gt;
      &lt;smtp from=&quot;noreply@host.com&quot; deliveryMethod=&quot;Network&quot;&gt;
        &lt;network host=&quot;my.host.com&quot; port=&quot;25&quot; defaultCredentials=&quot;true&quot; /&gt;
      &lt;/smtp&gt;
    &lt;/mailSettings&gt;
  &lt;/system.net&gt;
&lt;/configuration&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2011/08/mailbox-unavailable-the-server-response-was-no-such-user-here/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Ajax support in ASP.NET MVC 3</title>
		<link>http://www.mikebevers.be/blog/2011/04/adding-ajax-support-in-asp-net-mvc-3/</link>
		<comments>http://www.mikebevers.be/blog/2011/04/adding-ajax-support-in-asp-net-mvc-3/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 23:38:18 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[ASP.NET MVC 3]]></category>
		<category><![CDATA[Blank page]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=497</guid>
		<description><![CDATA[Problem
I recently started using ASP.NET MVC 3 with the new Razor view engine. Everything looks great and cool at first sight. I tried to implement a simple Ajax postback form, without any success. Every time I tried to submit the form, it returned a new blank page with my data on it. A common mistake [...]]]></description>
			<content:encoded><![CDATA[<h1>Problem</h1>
<p class="endParagraph">I recently started using ASP.NET MVC 3 with the new Razor view engine. Everything looks great and cool at first sight. I tried to implement a simple Ajax postback form, without any success. Every time I tried to submit the form, it returned a new blank page with my data on it. A common mistake is to forget referencing the MicrosoftAjax.js and MicrosoftMvcAjax.js libraries in your master layout. After spending half an hour trying to figure out what I might have done wrong, I turned to google and MSDN.</p>
<h1>Solution</h1>
<p><b><u>UnobtrusiveJavaScriptEnabled</u></b> was the buzzkill. By default, you&#8217;ll find this in your root web.config file:</p>
<pre class="brush: xml;">&lt;add key=&quot;UnobtrusiveJavaScriptEnabled&quot; value=&quot;true&quot;/&gt;</pre>
<p>If you change the value from &#8220;true&#8221; to &#8220;false&#8221;, your Ajax will start working. I don&#8217;t know why it&#8217;s enabled by default. I&#8217;ll guess you&#8217;ll have to google it yourselves.</p>
<p class="endParagraph">If you want to know more on Unobtrusive JavaScript, visit <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript">Wikipedia</a>.</p>
<h1>A simple Ajax form example</h1>
<p>Some people asked me for a very basic example using Ajax and ASP.NET MVC 3. So here goes:</p>
<p>For starters, change the UnobtrusiveJavaScriptEnabled entry in your root web.config to &#8220;false&#8221;</p>
<pre class="brush: xml;">&lt;add key=&quot;UnobtrusiveJavaScriptEnabled&quot; value=&quot;false&quot;/&gt;</pre>
<p>Next, add the javascript references in your Master layout</p>
<pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;@ViewBag.Title&lt;/title&gt;
    &lt;link href=&quot;@Url.Content(&quot;~/Content/Site.css&quot;)&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery-1.5.1.min.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;

    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/MicrosoftAjax.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/MicrosoftMvcAjax.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    @RenderBody()
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Your HomeController has the default View and handles the PostBack</p>
<pre class="brush: csharp;">
public class HomeController : Controller
{
    public ActionResult Index()
    {
        return View();
    }

    [HttpPost]
    public PartialViewResult Index(FormCollection data)
    {
        List&lt;string&gt; result = new List&lt;string&gt;();
        string[] input = data[&quot;MyInput&quot;].Split(new string[] { &quot;\n&quot; }, StringSplitOptions.None);

        result.Add(&quot;&lt;b&gt;&lt;i&gt;&lt;u&gt;I said&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;:&lt;br /&gt;&quot;);

        foreach (var line in input)
            result.Add(line + &quot;&lt;br /&gt;&quot;);

        return PartialView(&quot;_IndexPartial&quot;, result);
    }
}
</pre>
<p>You&#8217;ll have the Index view that looks like:</p>
<pre class="brush: xml;">
@{
    ViewBag.Title = &quot;Index&quot;;
}

&lt;h2&gt;Hello!&lt;/h2&gt;
&lt;p&gt;Please tell me something...&lt;/p&gt;

@using (Ajax.BeginForm(new AjaxOptions { UpdateTargetId = &quot;targetDiv&quot; }))
{
    @Html.TextArea(&quot;MyInput&quot;, new { @style = &quot;width:100%;height:200px;&quot; });
    &lt;br /&gt;&lt;br /&gt;
    &lt;input type=&quot;submit&quot; value=&quot;What did you say?&quot; /&gt;
}

&lt;div id=&quot;targetDiv&quot; style=&quot;width:100%;margin-top:20px;padding:10px;&quot;&gt;
    ...
&lt;/div&gt;
</pre>
<p>The _IndexPartial.cshtml will look like this:</p>
<pre class="brush: csharp;">
@if (Model != null)
{
    foreach (string line in (Model as List&lt;string&gt;))
    {
       @Html.Raw(line)
    }
}
</pre>
<p>Eventually, it will look like this:</p>
<div id="attachment_499" class="wp-caption aligncenter" style="width: 290px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2011/04/result.jpg"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2011/04/result.jpg" alt="Ajax form" title="Ajax form" width="280" height="425" class="size-full wp-image-499" /></a><p class="wp-caption-text">Ajax form - result</p></div>
<p>The source code is also available: <a href='http://www.mikebevers.be/blog/wp-content/uploads/2011/04/AjaxSupportMvc3.zip'>Ajax Support Mvc3 Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2011/04/adding-ajax-support-in-asp-net-mvc-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a MD5 function in SQL Server</title>
		<link>http://www.mikebevers.be/blog/2011/04/creating-a-md5-function-in-sql-server/</link>
		<comments>http://www.mikebevers.be/blog/2011/04/creating-a-md5-function-in-sql-server/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 13:45:35 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[Databases & Query Languages]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=494</guid>
		<description><![CDATA[The MD5 function
When you&#8217;re working with hashed passwords, it might be useful to have the MD5 encryption feature in your database.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ==================================================
-- Author:		Mike Bevers
-- Create date: 07/04/2011
-- Description:	Hashes a value with the MD5 algorithm
-- ==================================================
CREATE FUNCTION MD5
(
	@value varchar(255)
)
RETURNS varchar(32)
AS
BEGIN
	RETURN SUBSTRING(sys.fn_sqlvarbasetostr(HASHBYTES('MD5', @value)),3,32);
END
GO

Usage:

select dbo.MD5('test')
-- Will return '098f6bcd4621d373cade4e832627b4f6'

]]></description>
			<content:encoded><![CDATA[<h1>The MD5 function</h1>
<p>When you&#8217;re working with hashed passwords, it might be useful to have the MD5 encryption feature in your database.</p>
<pre class="brush: sql;">
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ==================================================
-- Author:		Mike Bevers
-- Create date: 07/04/2011
-- Description:	Hashes a value with the MD5 algorithm
-- ==================================================
CREATE FUNCTION MD5
(
	@value varchar(255)
)
RETURNS varchar(32)
AS
BEGIN
	RETURN SUBSTRING(sys.fn_sqlvarbasetostr(HASHBYTES('MD5', @value)),3,32);
END
GO
</pre>
<p>Usage:</p>
<pre class="brush: sql;">
select dbo.MD5('test')
-- Will return '098f6bcd4621d373cade4e832627b4f6'
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2011/04/creating-a-md5-function-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Missing region encapsultation with &#8220;Implement interface&#8221;</title>
		<link>http://www.mikebevers.be/blog/2011/03/missing-region-encapsultation-with-implement-interface/</link>
		<comments>http://www.mikebevers.be/blog/2011/03/missing-region-encapsultation-with-implement-interface/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 12:42:26 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[Microsoft Products]]></category>
		<category><![CDATA[regions]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=487</guid>
		<description><![CDATA[Where are my regions?
When I implemented my first interface with Visual Studio 2010, I noticed that the implemented methods were not enclosed with the Region directive.

If you want your regions back, you explicitly need to tell Visual Studio by enabling them in the options dialog.

After you&#8217;ve enabled them, all is back to normal&#8230;
]]></description>
			<content:encoded><![CDATA[<h1>Where are my regions?</h1>
<p>When I implemented my first interface with Visual Studio 2010, I noticed that the implemented methods were not enclosed with the Region directive.</p>
<div id="attachment_488" class="wp-caption aligncenter" style="width: 342px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2011/03/interface_noregions.png"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2011/03/interface_noregions.png" alt="Interface without regions" title="Interface without regions" width="332" height="136" class="size-full wp-image-488" /></a><p class="wp-caption-text">Interface implementation without regions</p></div>
<p class="endParagraph" />
<p>If you want your regions back, you explicitly need to tell Visual Studio by enabling them in the options dialog.</p>
<div id="attachment_490" class="wp-caption aligncenter" style="width: 654px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2011/03/options_texteditor_advanced.png"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2011/03/options_texteditor_advanced.png" alt="Options - Texteditor - Advanced" title="Options - Texteditor - Advanced" width="644" height="375" class="size-full wp-image-490" /></a><p class="wp-caption-text">Options - Texteditor - Advanced</p></div>
<p class="endParagraph" />
<p>After you&#8217;ve enabled them, all is back to normal&#8230;</p>
<div id="attachment_489" class="wp-caption aligncenter" style="width: 342px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2011/03/interface_withregions.png"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2011/03/interface_withregions.png" alt="Interface with regions" title="Interface with regions" width="332" height="182" class="size-full wp-image-489" /></a><p class="wp-caption-text">Interface implementation with regions</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2011/03/missing-region-encapsultation-with-implement-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Raising events without receiving a NullReferenceException</title>
		<link>http://www.mikebevers.be/blog/2011/03/raising-events-without-receiving-a-nullreferenceexception/</link>
		<comments>http://www.mikebevers.be/blog/2011/03/raising-events-without-receiving-a-nullreferenceexception/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 12:06:43 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Events]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=481</guid>
		<description><![CDATA[Problem
If you don&#8217;t place a &#8216;not null&#8217; condition before raising an event, you might get a NullReferenceException. That&#8217;s why we usually type something like:

event EventHandler MyEvent;

void RaiseMyEvent()
{
    if (MyEvent!= null) MyEvent(this, EventArgs.Empty);
}


Solution
Why not use the following pattern:

event EventHandler MyEvent = delegate { };

void RaiseMyEvent()
{
    MyEvent(this, EventArgs.Empty);
}

This way we can [...]]]></description>
			<content:encoded><![CDATA[<h1>Problem</h1>
<p>If you don&#8217;t place a &#8216;not null&#8217; condition before raising an event, you might get a <i>NullReferenceException</i>. That&#8217;s why we usually type something like:</p>
<pre class="brush: csharp;">
event EventHandler MyEvent;

void RaiseMyEvent()
{
    if (MyEvent!= null) MyEvent(this, EventArgs.Empty);
}
</pre>
<p class="endParagraph">
<h1>Solution</h1>
<p>Why not use the following pattern:</p>
<pre class="brush: csharp;">
event EventHandler MyEvent = delegate { };

void RaiseMyEvent()
{
    MyEvent(this, EventArgs.Empty);
}
</pre>
<p>This way we can avoid the following:</p>
<div id="attachment_482" class="wp-caption aligncenter" style="width: 522px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2011/03/raisingeventsnullreference.png"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2011/03/raisingeventsnullreference.png" alt="Raising Events" title="Raising Events" width="512" height="469" class="size-full wp-image-482" /></a><p class="wp-caption-text">Raising Events</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2011/03/raising-events-without-receiving-a-nullreferenceexception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2008 and Team Foundation Server 2010</title>
		<link>http://www.mikebevers.be/blog/2011/03/visual-studio-2008-and-team-foundation-server-2010/</link>
		<comments>http://www.mikebevers.be/blog/2011/03/visual-studio-2008-and-team-foundation-server-2010/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 12:10:20 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[Microsoft Products]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[TFS 2010]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=476</guid>
		<description><![CDATA[Source
I found a nice tutorial on Josip Medved&#8217;s blog. I&#8217;ve copied the article below for back-up purposes.
How to connect VS2008 with TFS 2010
Team Foundation Server 2010 works great when combined with Visual Studio 2010. However, if you wish to combine it with Visual Studio 2008, some additional setup is required.
First thing that you need to [...]]]></description>
			<content:encoded><![CDATA[<h1>Source</h1>
<p class="endParagraph">I found a nice tutorial on <a href="http://www.jmedved.com/2009/11/visual-studio-2008-and-team-foundation-server-2010/" target="_blank">Josip Medved&#8217;s</a> blog. I&#8217;ve copied the article below for back-up purposes.</p>
<h1>How to connect VS2008 with TFS 2010</h1>
<p>Team Foundation Server 2010 works great when combined with Visual Studio 2010. However, if you wish to combine it with Visual Studio 2008, some additional setup is required.</p>
<p>First thing that you need to install is <a href="http://www.microsoft.com/downloadS/details.aspx?familyid=0ED12659-3D41-4420-BBB0-A46E51BFCA86&#038;displaylang=en" target="_blank">Team Explorer 2008</a>. If you already used source control, you may have it. Easiest way to check is to go into Tools > Options and select Source Control. If there is “Visual Studio Team Foundation Server” in plug-in list, you can skip this download.</p>
<p>Another thing I installed was <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=cf13ea45-d17b-4edc-8e6c-6c5b208ec54d&#038;displaylang=en" target="_blank">Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010</a>. I do not think that this long-named update is really “must” but I decided to install it anyhow – just in case.</p>
<p>Once you install everything, you can try adding Team Foundation Server 2010 as destination, but you will be greeted with error “TF31002: Unable to connect to this Team Foundation Server …”. Reason behind this is that old Team Explorer 2008 does not know anything about collections.</p>
<p>Solution would be to add it as full path (e.g “http://server:8080/tfs/collection”). I could not do it because every time I entered full path, I also got error “TF30335: The server name cannot contain characters ‘/’ or ‘:’ …”. Since official way would not work it was time to come up with alternative.</p>
<p>In order to add TFS 2010 server, you will need to exit Visual Studio 2008 and go into Registry editor. Find key “HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers” and at this location just add string value. Name of this value will be what Team Explorer 2008 will use for display. It’s value is full address of your server. It should be something like “http://server:8080/tfs/collection”.</p>
<p class="endParagraph">Now you can go into Visual Studio 2008 and Team Explorer will have new entry. As you work with it, you will notice that not everything is “bump-free” (e.g. tasks). However, source control it self will work perfectly and that was enough for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2011/03/visual-studio-2008-and-team-foundation-server-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hardware Information: CPU-Z</title>
		<link>http://www.mikebevers.be/blog/2010/11/hardware-information-cpu-z/</link>
		<comments>http://www.mikebevers.be/blog/2010/11/hardware-information-cpu-z/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 09:37:02 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=472</guid>
		<description><![CDATA[What type of motherboard is in this PC?
The other day, I was at a friend&#8217;s house. His PC was running slow and wanted to know how he could improve performance.
After I perfomed some general clean-up actions (Windows disk clean-up, defragmenting, uninstalling crappy software/spyware), my friend wanted to know if he could add some RAM memory. [...]]]></description>
			<content:encoded><![CDATA[<h1>What type of motherboard is in this PC?</h1>
<p>The other day, I was at a friend&#8217;s house. His PC was running slow and wanted to know how he could improve performance.</p>
<p>After I perfomed some general clean-up actions (Windows disk clean-up, defragmenting, uninstalling crappy software/spyware), my friend wanted to know if he could add some RAM memory. I didn&#8217;t want to open up his machine, but I did need info about the motherboard. I had a utility I found a long time, called: <a href="http://www.cpuid.com/softwares/cpu-z.html" target="_blank">CPU-Z</a>. This utility is &#8230; <b>awesome and free</b>!</p>
<div id="attachment_473" class="wp-caption aligncenter" style="width: 424px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2010/11/cpuz.jpg"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2010/11/cpuz.jpg" alt="CPU-Z" title="CPU-Z" width="414" height="398" class="size-full wp-image-473" /></a><p class="wp-caption-text">CPU-Z Motherboard Information</p></div>
<p class="endParagraph">With this information I could do a look-up on the manufacturer&#8217;s website. I found out that he had 4 RAM slots, so he could add extra memory&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2010/11/hardware-information-cpu-z/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Online RegEx Testing Tool</title>
		<link>http://www.mikebevers.be/blog/2010/11/free-online-regex-testing-tool/</link>
		<comments>http://www.mikebevers.be/blog/2010/11/free-online-regex-testing-tool/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 14:18:02 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[RegEx]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=467</guid>
		<description><![CDATA[Developing RegEx patterns
Recently I was creating some regular expressions. Because I’m not very experienced with RegEx, I was kind of &#8220;debugging&#8221; in my TDD approach. A colleague of mine recommended a website which helped a lot: http://www.gskinner.com/RegExr/.
It’s completely free and you can use it online!
]]></description>
			<content:encoded><![CDATA[<h1>Developing RegEx patterns</h1>
<p>Recently I was creating some regular expressions. Because I’m not very experienced with RegEx, I was kind of &#8220;debugging&#8221; in my TDD approach. A colleague of mine recommended a website which helped a lot: <a href="http://www.gskinner.com/RegExr/" target="_blank">http://www.gskinner.com/RegExr/</a>.</p>
<p class="endParagraph">It’s completely <u>free</u> and you can use it <u>online</u>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2010/11/free-online-regex-testing-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging Web Service applications: ASMX vs WCF</title>
		<link>http://www.mikebevers.be/blog/2010/10/debugging-web-service-applications-asmx-vs-wcf/</link>
		<comments>http://www.mikebevers.be/blog/2010/10/debugging-web-service-applications-asmx-vs-wcf/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 13:27:28 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[ASMX]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[wcfTestClient.exe]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=458</guid>
		<description><![CDATA[Context
Before WCF, there was ASMX aka ASP.NET Web Services. Debugging ASMX or WCF are quite different. Let&#8217;s take a look how we can enable debugging in ASMX and WCF.
Basics of running a web application
When you hit the F5 button and your startup project is an ASP.NET, ASP.NET Web Services or WCF application, Visual Studio will [...]]]></description>
			<content:encoded><![CDATA[<h1>Context</h1>
<p class="endParagraph">Before WCF, there was ASMX aka ASP.NET Web Services. Debugging ASMX or WCF are quite different. Let&#8217;s take a look how we can enable debugging in ASMX and WCF.</p>
<h1>Basics of running a web application</h1>
<p>When you hit the F5 button and your startup project is an ASP.NET, ASP.NET Web Services or WCF application, Visual Studio will start an ASP.NET Development Server. This is what we call Client-side hosting using Cassini. If want to know more check <a href="http://msdn.microsoft.com/en-us/magazine/cc188791.aspx" target="_blank">Dino Esposito&#8217;s article on MSDN</a>. Wikipedia also has a description about <a href="http://en.wikipedia.org/wiki/UltiDev_Cassini_Web_Server" target="_blank">UltiDev Cassini Web Server</a>.</p>
<p class="endParagraph">After Cassini is loaded, by default an Internet Explorer (IE) window will open and browse to the Cassini URL on your localhost.</p>
<h1>Debugging ASMX</h1>
<p>When you hit the F5 button, IE will open a webpage which looks like the image below:</p>
<div id="attachment_460" class="wp-caption aligncenter" style="width: 634px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/browsewebservice.jpg"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/browsewebservice.jpg" alt="Browse ASP.NET Web Service" title="Browse ASP.NET Web Service" width="624" height="276" class="size-full wp-image-460" /></a><p class="wp-caption-text">Browse ASP.NET Web Service</p></div>
<p>You&#8217;ll notice that all Web Methods are listed as hyperlinks. So when I click &#8220;HelloWorld&#8221; in my example, it will browse forward:</p>
<div id="attachment_461" class="wp-caption aligncenter" style="width: 638px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/invokewebservice.jpg"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/invokewebservice.jpg" alt="Invoke ASP.NET Web Service" title="Invoke ASP.NET Web Service" width="628" height="359" class="size-full wp-image-461" /></a><p class="wp-caption-text">Invoke ASP.NET Web Service</p></div>
<p>Before we invoke the Web Method using IE, first we need to attach the Visual Studio instance with our sources to Cassini! In Visual Studio, navigate to &#8220;Debug&#8221; > &#8220;Attach to Process &#8230;&#8221;. In the list of Available Processes there should be a process called &#8220;WebDev.WebServer.exe&#8221; and the Title should be &#8220;ASP.NET Development Server &#8211; Port XXXX&#8221;. The Port XXXX is the port on which Cassini is active. Click the &#8220;Attach&#8221; button and you are ready to go!</p>
<p>Now, click the button &#8220;Invoke&#8221; in Internet Explorer and your Visual Studio will stop at the first breakpoint it encounters. When the method has returned its result, a new IE window will open and display the result as XML, like below:</p>
<div id="attachment_464" class="wp-caption aligncenter" style="width: 456px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/webserviceresult.jpg"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/webserviceresult.jpg" alt="ASP.NET Web Service Result" title="ASP.NET Web Service Result" width="446" height="157" class="size-full wp-image-464" /></a><p class="wp-caption-text">ASP.NET Web Service Result</p></div>
<p>&nbsp;</p>
<h1>Debugging WCF</h1>
<p>Like ASMX, Visual Studio will open a browser by default:</p>
<div id="attachment_459" class="wp-caption aligncenter" style="width: 628px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/browsewcfservice.jpg"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/browsewcfservice.jpg" alt="Browse WCF Service" title="Browse WCF Service" width="618" height="535" class="size-full wp-image-459" /></a><p class="wp-caption-text">Browse WCF Service</p></div>
<p>At first it shows the directory listing. When you open your Service1.svc, you&#8217;ll notice that no hyperlinks or Invoke buttons are available on our Operation Contracts. To debug the WCF service, Microsoft provided a small tool in your Visual Studio installation directory, called &#8220;wcfTestClient.exe&#8221;. The tool is usually located in &#8220;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\wcfTestClient.exe&#8221;. If not, you can download and install the Windows SDK from the Microsoft website.</p>
<p>In order to automatically start the &#8220;wcfTestClient.exe&#8221; <u>and</u> load our Services, we need to edit the WCF application project:</p>
<div id="attachment_462" class="wp-caption aligncenter" style="width: 741px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/startwcftestclient.jpg"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/startwcftestclient.jpg" alt="Start wcfTestClient.exe" title="Start wcfTestClient.exe" width="731" height="256" class="size-full wp-image-462" /></a><p class="wp-caption-text">Start wcfTestClient.exe</p></div>
<p>You can add multiple svc&#8217;s by leaving a space between the addresses.</p>
<p>When your WCF Service is loaded, you can double click an Operation Contract and invoke it. You don&#8217;t need to attach your Visual Studio to another process, it&#8217;s already attached for you.</p>
<div id="attachment_463" class="wp-caption aligncenter" style="width: 595px"><a href="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/wcftestclient.jpg"><img src="http://www.mikebevers.be/blog/wp-content/uploads/2010/10/wcftestclient.jpg" alt="wcfTestClient Method Invokation" title="wcfTestClient Method Invokation" width="585" height="341" class="size-full wp-image-463" /></a><p class="wp-caption-text">wcfTestClient Method Invokation</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2010/10/debugging-web-service-applications-asmx-vs-wcf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting text to DateTime objects: DateTimeParser</title>
		<link>http://www.mikebevers.be/blog/2010/10/converting-text-to-datetime-objects-datetimeparser/</link>
		<comments>http://www.mikebevers.be/blog/2010/10/converting-text-to-datetime-objects-datetimeparser/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 11:45:39 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[How They Did It]]></category>
		<category><![CDATA[DateTime]]></category>
		<category><![CDATA[Parsing]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=447</guid>
		<description><![CDATA[Context
When you&#8217;re working with a UI or plain text data integration, conversions are often an issue. In this case I would like to talk about DateTime objects.
Recently, there was an issue in one of the other teams. They had a WinForms UI where they wanted to display a DateTime property in two different textboxes, one [...]]]></description>
			<content:encoded><![CDATA[<h1>Context</h1>
<p>When you&#8217;re working with a UI or plain text data integration, conversions are often an issue. In this case I would like to talk about DateTime objects.</p>
<p>Recently, there was an issue in one of the other teams. They had a WinForms UI where they wanted to display a DateTime property in two different textboxes, one for the date and another for the time. They had their reasons for not using a DateTimePicker control or any other method. That wasn&#8217;t really the problem. One of the business users discovered an error when trying to save changes. The development team figured out what went wrong, apparently it was a &#8220;Culture&#8221; thing.</p>
<p>The business user&#8217;s computer was using Windows XP and its regional settings were set to English – United States. When the application tried to parse the textboxes and store the value back in the property, the month and day were swapped. In Europe we usually use &#8220;dd/MM/yyyy&#8221;, in the US they use &#8220;MM/dd/yyyy&#8221;.</p>
<p class="endParagraph">Normally this should not pose a problem, the date was successfully loaded, so why wouldn&#8217;t it convert back as expected. Well, one of the main reasons is VB.NET. VB.NET has a feature called <a href="http://msdn.microsoft.com/en-us/library/2dt118h2(VS.85).aspx" target="_blank">CDate</a>, which can convert a string to a <a href="http://msdn.microsoft.com/en-us/library/cd9w2te4(VS.85).aspx" target="_blank">Date</a> object. In C#, you only have a DateTime object. What happened? The CDate takes the regional settings and when you enter 16/10/2010, it will crash, because there is no 16th month.</p>
<h1>Enter Mike</h1>
<p>I overheard an intense discussion going on and decided to see if I could be of use. Call it interfering if you want; I see it as helping colleagues <img src='http://www.mikebevers.be/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . They explained the situation of the custom controls (the two textboxes) and the error. One of them was telling they needed to use DateTimePicker controls, another wanted to change regional settings in the database and application (I missed the point of that one), and so.</p>
<p>After a bit of evaluating, I noticed they were only complicating the solution/problem. I told them they only needed to parse the string into a DateTime object with specific format, and then assign the DateTime to the Date object. So instead of doing a lot of changes, add a single line of code&#8230;</p>
<p class="endParagraph">I created a helper/utility class on the fly, so they could end their discussion and get back to work (and stop bothering the rest of us <img src='http://www.mikebevers.be/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). </p>
<h1>DateTimeParser</h1>
<pre class="brush: csharp;">
using System;
using System.Globalization;

namespace MyNamespace
{
    public static class DateTimeParser
    {
        public static DateTime ParseDateTime(string value, string inputFormat)
        {
            return ParseDateTime(value, inputFormat, CultureInfo.InvariantCulture);
        }

        public static DateTime ParseDateTime(string value, string inputFormat, CultureInfo provider)
        {
            if (string.IsNullOrEmpty(value))
                throw new ArgumentNullException(&quot;value&quot;);

            try
            {
                return DateTime.ParseExact(value, inputFormat, provider);
            }
            catch (Exception ex)
            {
                throw new Exception(&quot;Could not parse date: &quot; + value, ex);
            }
        }
    }

	public class DateTimeParserDemo
	{
		public DateTime Test()
		{
			string myDate = &quot;31/12/2010 23:59:59&quot;;
			return DateTimeParser.ParseDateTime(myDate, &quot;dd/MM/yyyy HH:mm:ss&quot;);
		}
	}
}
</pre>
<p>&nbsp;</p>
<h1>VB.NET code</h1>
<p class="endParagraph">If you prefer the code in VB.NET head to the website of DeveloperFusion.com, they have an excellent <a href="http://www.developerfusion.com/tools/convert/csharp-to-vb/" target="_blank">C# to VB.NET converter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2010/10/converting-text-to-datetime-objects-datetimeparser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

