<?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, 22 Oct 2012 10:10:50 +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>Resolving SQL Server collation conflicts</title>
		<link>http://www.mikebevers.be/blog/2012/10/resolving-sql-server-collation-conflicts/</link>
		<comments>http://www.mikebevers.be/blog/2012/10/resolving-sql-server-collation-conflicts/#comments</comments>
		<pubDate>Mon, 22 Oct 2012 10:10:50 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[Databases & Query Languages]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=528</guid>
		<description><![CDATA[The Problem
At a customer, I had to gather data from two databases. So I started writing a SQL query that combined data from two databases and wanted to join them on an ID field. Then this popped up: &#8220;Cannot resolve the collation conflict between &#8220;SQL_Latin1_General_CP1_CI_AS&#8221; and &#8220;Latin1_General_BIN&#8221; in the equal to operation&#8220;. Apparently along the [...]]]></description>
			<content:encoded><![CDATA[<h1>The Problem</h1>
<p class="endParagraph">At a customer, I had to gather data from two databases. So I started writing a SQL query that combined data from two databases and wanted to join them on an ID field. Then this popped up: &#8220;<i>Cannot resolve the collation conflict between &#8220;SQL_Latin1_General_CP1_CI_AS&#8221; and &#8220;Latin1_General_BIN&#8221; in the equal to operation</i>&#8220;. Apparently along the way they decided, or by accident, switched collations.</p>
<h1>The Solution</h1>
<p>It&#8217;s actually very simple, you have to explicitly specify the collation in your query. I posted the code because it&#8217;s too lengthy and error-prone to write it manually several times a day&#8230;</p>
<pre class="brush: sql;">
SELECT p.KeyField
FROM DB1.PrimaryTable p
INNER JOIN DB2.SecondaryTable s ON LTRIM(RTRIM(p.KeyField))COLLATE SQL_Latin1_General_CP1_CI_AS = s.KeyField
</pre>
<p class="endParagraph">That should do the trick!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2012/10/resolving-sql-server-collation-conflicts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing a TFS server URL in Visual Studio 2010</title>
		<link>http://www.mikebevers.be/blog/2012/08/changing-a-tfs-server-url-in-visual-studio-2010/</link>
		<comments>http://www.mikebevers.be/blog/2012/08/changing-a-tfs-server-url-in-visual-studio-2010/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 22:21:55 +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 2010]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=525</guid>
		<description><![CDATA[The problem
Recently we&#8217;ve changed the extension of the external url of our TFS server. Strange enough Visual Studio doesn&#8217;t provide an edit feature in the TFS servers window. Maybe that&#8217;s why it&#8217;s called &#8220;Add/Remove Team Foundation Server&#8221;.
The solution
I went looking where Visual Studio stored the TFS info. After a bit of searching in the Registry [...]]]></description>
			<content:encoded><![CDATA[<h1>The problem</h1>
<p class="endParagraph">Recently we&#8217;ve changed the extension of the external url of our TFS server. Strange enough Visual Studio doesn&#8217;t provide an edit feature in the TFS servers window. Maybe that&#8217;s why it&#8217;s called &#8220;Add/Remove Team Foundation Server&#8221;.</p>
<h1>The solution</h1>
<p>I went looking where Visual Studio stored the TFS info. After a bit of searching in the Registry I ended up in: &#8220;CURRENT_USER\Software\Microsoft\VisualStudio\10.0\TeamFoundation\Instances&#8221;.</p>
<p>In the Instances folder you&#8217;ll see all your added TFS servers. You can start by changing the name of the folder, this text is used as the name label. What is important, is to change all the Uri entries you&#8217;ll find in the subfolders. There is one per TFS server and one for each collection!</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2012/08/changing-a-tfs-server-url-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Killing active connections in SQL Server 2008</title>
		<link>http://www.mikebevers.be/blog/2012/07/killing-active-connections-in-sql-server-2008/</link>
		<comments>http://www.mikebevers.be/blog/2012/07/killing-active-connections-in-sql-server-2008/#comments</comments>
		<pubDate>Fri, 06 Jul 2012 12:28:09 +0000</pubDate>
		<dc:creator>Mike Bevers</dc:creator>
				<category><![CDATA[Databases & Query Languages]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.mikebevers.be/blog/?p=518</guid>
		<description><![CDATA[The problem
I was trying to &#8220;DropCreate&#8221; a database using Entity Framework 4.3. Suddenly I get an exception that EF was unable to drop the database. I fired up my SQL Server Mngt Studio and tried to take the database offline. Again, an error message that it couldn&#8217;t get an exclusive lock because of open connections.
The [...]]]></description>
			<content:encoded><![CDATA[<h1>The problem</h1>
<p class="endParagraph">I was trying to &#8220;DropCreate&#8221; a database using Entity Framework 4.3. Suddenly I get an exception that EF was unable to drop the database. I fired up my SQL Server Mngt Studio and tried to take the database offline. Again, an error message that it couldn&#8217;t get an exclusive lock because of open connections.</p>
<h1>The solution</h1>
<p>After a bit of searching on the SQL Server processes I ended up with this:</p>
<pre class="brush: sql;">
USE master
go

DECLARE @dbname sysname
SET @dbname = 'MyDbName'

DECLARE @spid int
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname)
WHILE @spid IS NOT NULL
BEGIN
EXECUTE ('KILL ' + @spid)
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) AND spid &gt; @spid
END
</pre>
<p>And instantly, it was <b>my!</b> database yet again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikebevers.be/blog/2012/07/killing-active-connections-in-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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>
	</channel>
</rss>
