<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
  <id>http://www.sagara.net/</id>
  <title>Sagara.NET</title>
  <updated>2009-09-23T04:41:56+00:00</updated>
  <link href="http://www.sagara.net/" />
  
  <subtitle>Yet Another .NET Programming Blog</subtitle>
  <author>
    <name>Jon Sagara</name>
  </author>
  <generator uri="http://dotnetblogengine.net/" version="1.0.0.0">BlogEngine.Net Syndication Generator</generator>
  <blogChannel:blogRoll>http://www.sagara.net/opml.axd</blogChannel:blogRoll>
  <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
  <dc:creator>Jon Sagara</dc:creator>
  <dc:description>Yet Another .NET Programming Blog</dc:description>
  <dc:language>en-US</dc:language>
  <dc:title>Sagara.NET</dc:title>
  <geo:lat>0.000000</geo:lat>
  <geo:long>0.000000</geo:long>
  <link rel="self" href="http://feeds.feedburner.com/SagaraNET" type="application/atom+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
    <id>http://www.sagara.net/post/2009/09/22/GuidHelperTryParse.aspx</id>
    <title>GuidHelper.TryParse</title>
    <updated>2009-09-23T02:53:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=884e757d-460d-4db7-af84-6ff651f91446" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/bsHjfoJceH8/GuidHelperTryParse.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;&lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94072"&gt;Microsoft has apparently added Guid.TryParse() to .NET 4.0&lt;/a&gt;, but if you're stuck using an older version of the framework, you're still kind of left flapping out in the wind. &amp;nbsp;Luckily, the great minds of the world have converged upon StackOverflow.com and provided a solution: &lt;a href="http://stackoverflow.com/questions/104850/c-test-if-string-is-a-guid-without-throwing-exceptions/287877#287877"&gt;call the Win32 function CLSIDFromString&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I have taken the code and created a little helper class with one public static method called TryParse. &amp;nbsp;Its usage is just like that of any other TryParse() method in the .NET Framework today. &amp;nbsp;Here is the code:&lt;/p&gt;
&lt;pre class="brush:c-sharp;"&gt;
using System;
using System.Runtime.InteropServices;


/// &amp;lt;summary&amp;gt;
/// Class that encapsulates the Win32 function CLSIDFromString.
/// &amp;lt;/summary&amp;gt;
public static class GuidHelper
{
    /// &amp;lt;summary&amp;gt;
    /// Converts the string representation of a GUID to its System.Guid equivalent.  A return value 
    /// indicates whether the conversion succeeded.
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;param name="s"&amp;gt;A string containing the GUID to convert.&amp;lt;/param&amp;gt;
    /// &amp;lt;param name="value"&amp;gt;When this method returns, contains the System.Guid value equivalent to 
    /// the GUID contained in s, if the conversion succeeded, or Guid.Empty if the conversion 
    /// failed. The conversion fails if the s parameter is null or is not of the correct format.  
    /// This parameter is passed uninitialized.&amp;lt;/param&amp;gt;
    /// &amp;lt;returns&amp;gt;true if s was converted successfully; otherwise, false.&amp;lt;/returns&amp;gt;
    public static bool TryParse(string s, out Guid value)
    {
        if (string.IsNullOrEmpty(s))
        {
            value = Guid.Empty;
            return false;
        }


        // CLSIDFromString requires enclosing curly braces on its GUIDs.
        if (!s.StartsWith("{"))
        {
            s = "{" + s;
        }
        if (!s.EndsWith("}"))
        {
            s += "}";
        }


        int result = CLSIDFromString(s, out value);
        if (result &amp;gt;= 0)
        {
            return true;
        }
        else
        {
            value = Guid.Empty;
            return false;
        }
    }


    /// &amp;lt;summary&amp;gt;
    /// This function converts a string generated by the StringFromCLSID function back into the 
    /// original class identifier.
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;param name="sz"&amp;gt;String that represents the class identifier&amp;lt;/param&amp;gt;
    /// &amp;lt;param name="clsid"&amp;gt;On return will contain the class identifier&amp;lt;/param&amp;gt;
    /// &amp;lt;returns&amp;gt;
    /// Positive or zero if class identifier was obtained successfully
    /// Negative if the call failed
    /// &amp;lt;/returns&amp;gt;
    [DllImport("ole32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, PreserveSig = true)]
    private static extern int CLSIDFromString(string sz, out Guid clsid);
}
&lt;/pre&gt;
&lt;p&gt;Fair warning: I verified the author's performance numbers, but I have not yet run this through a profiler or done any checking for memory leaks.  &lt;strong&gt;Use it at your own risk&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I suppose since the original is licensed under the &lt;a href="http://creativecommons.org/licenses/by-sa/2.5/"&gt;cc-wiki&lt;/a&gt; license with attribution required, this is, too.&lt;/p&gt;
&lt;p&gt;Anyway, enjoy!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/bsHjfoJceH8" height="1" width="1"/&gt;</summary>
    <published>2009-09-23T02:53:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2009/09/22/GuidHelperTryParse.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=884e757d-460d-4db7-af84-6ff651f91446</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=884e757d-460d-4db7-af84-6ff651f91446</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2009/09/22/GuidHelperTryParse.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=884e757d-460d-4db7-af84-6ff651f91446</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2009/09/22/GuidHelperTryParse.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2009/09/21/HTTP-Error-4011-Unauthorized-when-using-Windows-Authentication-on-IIS75.aspx</id>
    <title>"HTTP Error 401.1 - Unauthorized" when using Windows Authentication on IIS7.5</title>
    <updated>2009-09-21T20:37:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=02b6f2c5-7813-456f-8006-162c3b5ac0fd" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/pAEYrjWMALo/HTTP-Error-4011-Unauthorized-when-using-Windows-Authentication-on-IIS75.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;You may have run into this error while trying to develop a site that uses Integrated Windows Authentication on Windows Server 2008 R2 with IIS7.5. &amp;nbsp;I sure did, and I beat my head against the wall for a couple of hours trying to figure it out.&lt;/p&gt;
&lt;p&gt;It turns out to be a security mechanism built into Windows, and the workaround is simple. &amp;nbsp;Just choose one of the two methods listed in this Microsoft KB article:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://support.microsoft.com/kb/896861"&gt;KB #896861&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can find a more detailed explanation here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://harbar.net/archive/2009/07/02/disableloopbackcheck-amp-sharepoint-what-every-admin-and-developer-should-know.aspx"&gt;DisableLoopbackCheck &amp;amp; SharePoint: What every admin and developer should know.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hope this saves you some time.&lt;/p&gt;
&lt;p&gt;(h/t to this ServerFault.com question/answer: &lt;a href="http://serverfault.com/questions/32345/ie-8-authentication-denied-on-local-sharepoint-site/32485#32485"&gt;IE 8 Authentication Denied on local SharePoint Site&lt;/a&gt;)&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/pAEYrjWMALo" height="1" width="1"/&gt;</summary>
    <published>2009-09-21T20:37:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2009/09/21/HTTP-Error-4011-Unauthorized-when-using-Windows-Authentication-on-IIS75.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=02b6f2c5-7813-456f-8006-162c3b5ac0fd</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=02b6f2c5-7813-456f-8006-162c3b5ac0fd</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2009/09/21/HTTP-Error-4011-Unauthorized-when-using-Windows-Authentication-on-IIS75.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=02b6f2c5-7813-456f-8006-162c3b5ac0fd</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2009/09/21/HTTP-Error-4011-Unauthorized-when-using-Windows-Authentication-on-IIS75.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2009/08/29/GraffitiCMS-12-export-utility.aspx</id>
    <title>GraffitiCMS 1.2 export utility</title>
    <updated>2009-08-29T17:14:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=b1366751-410c-42f3-a2aa-e4c07720ce49" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/P4BAjF3Qgrs/GraffitiCMS-12-export-utility.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; This is a little one-off utility that I modified to export to mtimport, MovableType's import format (the original version of the utility was written in VB.NET, and exported BlogML; this function still exists, though it is not called).  It is not polished, it probably has a bug or two in it, and it likely does not do everything you need it to do.  Unfortunately, I don't have the time to make it do everything perfectly; I could only put in the time to make it good enough for me.  That being said, the source code is available and is being released under the MIT License, so feel free to take it and modify it as you see fit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Credit:&lt;/strong&gt; This is a C# port and derivative of Curt C's &lt;a href="http://darkfalz.com/post/2009/04/14/Graffiti-To-BlogML-Exporter.aspx"&gt;Graffiti To BlogML Exporter&lt;/a&gt;.  He did the hard work of writing the original BlogML export routine.  Thanks, Curt!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Dependencies:&lt;/strong&gt; From your Graffiti CMS installation, you will need to copy DataBuddy.dll and Graffiti.Core.dll into the Solution Items folder of the attached Visual Studio 2008 solution.  These are Telligent's DLLs, and I'm pretty sure I don't have rights to redistribute them, so you'll need to get them yourself. &amp;nbsp;Also, you'll obviously need Visual Studio 2008.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Usage:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Copy DataBudy.dll and Graffiti.core.dll from your Graffiti installation into the Solution Items folder&lt;/li&gt;
&lt;li&gt;Open GraffitiToBlogML.sln in Visual Studio 2008&lt;/li&gt;
&lt;li&gt;Edit the connection string in App.config to point to your Graffiti instance&lt;/li&gt;
&lt;li&gt;Click the "..." button to select an output folder&lt;/li&gt;
&lt;li&gt;Click the Run button&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;After execution finishes, you should have a viable mtimport.txt file that you can import into MovableType. &amp;nbsp;If you need a MovableType instance to test with, you can download one for free from &lt;a href="http://www.jumpbox.com/app/movabletype"&gt;JumpBox&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;If WordPress is your final destination, then, after you have imported your data into MovableType, you can export it again (I recommend doing this extra step so that WordPress will be importing a file exported by MovableType itself, and not my little utility). &amp;nbsp;Once you have this new export file, WordPress can then import it.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;If you're an end user, I apologize for not providing a runnable executable, but time is money. &amp;nbsp;:)&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;If you have questions, please post them in the comments. &amp;nbsp;I will do my best to answer them, though I can't guarantee any level of support.&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.sagara.net/file.axd?file=2009%2f8%2fGraffitiToBlogML.zip"&gt;GraffitiToBlogML.zip (14.14 kb)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 2009-09-22:&lt;/strong&gt; The MovableType-to-WordPress importer built into WordPress does not appear to import tags.  I found this tool that imports your tags after you have already done the main import from MovableType: &lt;a href="http://www.simonecarletti.com/blog/2009/02/movable-type-to-wordpress-importer-utilities/"&gt;http://www.simonecarletti.com/blog/2009/02/movable-type-to-wordpress-importer-utilities/&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/P4BAjF3Qgrs" height="1" width="1"/&gt;</summary>
    <published>2009-08-29T17:14:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2009/08/29/GraffitiCMS-12-export-utility.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=b1366751-410c-42f3-a2aa-e4c07720ce49</pingback:target>
    <slash:comments>1</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=b1366751-410c-42f3-a2aa-e4c07720ce49</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2009/08/29/GraffitiCMS-12-export-utility.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=b1366751-410c-42f3-a2aa-e4c07720ce49</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2009/08/29/GraffitiCMS-12-export-utility.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2009/07/22/Yet-another-code-snippet-of-the-day.aspx</id>
    <title>Yet another code snippet of the day</title>
    <updated>2009-07-22T18:53:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=8beca62d-6865-45bc-b2ae-c493c34d605f" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/g2Z56dMdByM/Yet-another-code-snippet-of-the-day.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;Man, this is getting bad.  See anything wrong with this?&lt;/p&gt;
&lt;pre class="brush:sql;"&gt;
INSERT INTO [dbo].[MyTable]
(
    &amp;lt;snip /&amp;gt;
    [CreatedUtcDate],
    [ModifiedUtcDate]
)
VALUES
(
    &amp;lt;snip /&amp;gt;
    GETDATE(),
    GETDATE()
)
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/g2Z56dMdByM" height="1" width="1"/&gt;</summary>
    <published>2009-07-22T18:53:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2009/07/22/Yet-another-code-snippet-of-the-day.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=8beca62d-6865-45bc-b2ae-c493c34d605f</pingback:target>
    <slash:comments>1</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=8beca62d-6865-45bc-b2ae-c493c34d605f</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2009/07/22/Yet-another-code-snippet-of-the-day.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=8beca62d-6865-45bc-b2ae-c493c34d605f</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2009/07/22/Yet-another-code-snippet-of-the-day.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2009/07/22/Another-code-snippet-of-the-day.aspx</id>
    <title>Another code snippet of the day</title>
    <updated>2009-07-22T17:45:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=5a8f9398-7ae6-4ddb-990b-af61bf33fbcc" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/3UpB54fcvmM/Another-code-snippet-of-the-day.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;Today's a good day.  Check this out:&lt;/p&gt;
&lt;pre class="brush:c-sharp;"&gt;
private static Dictionary&amp;lt;string, string&amp;gt; _dict = new Dictionary&amp;lt;string, string&amp;gt;();

static MyPage()
{
    //_dict.Add("item1", "val1");
    //_dict.Add("item2", "val2");
    //_dict.Add("item3", "val3");
    //_dict.Add("item4", "val4");
}

private void InitDictionary()
{
    try
    {
        _dict.Add("item1", "val1");
        _dict.Add("item2", "val2");
        _dict.Add("item3", "val3");
        _dict.Add("item4", "val4");
    }//END TRY
    catch
    {
        _dict.Clear();
        _dict.Add("item1", "val1");
        _dict.Add("item2", "val2");
        _dict.Add("item3", "val3");
        _dict.Add("item4", "val4");
    }//END CATCH
}
&lt;/pre&gt;
&lt;p&gt;So what happened here?  The guy decided that initializing the &lt;b&gt;static&lt;/b&gt; dictionary variable in the &lt;b&gt;static&lt;/b&gt; constructor wasn't good enough, and that he needed to do it on every page request, so he created an instance method to do the initialization.  For some reason, though, he kept getting an exception when initializing the dictionary after the first page view.  Hmm... bettter just swallow the exception, clear the dictionary, and try again.&lt;/p&gt;
&lt;p&gt;*slaps forehead*&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/3UpB54fcvmM" height="1" width="1"/&gt;</summary>
    <published>2009-07-22T17:45:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2009/07/22/Another-code-snippet-of-the-day.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=5a8f9398-7ae6-4ddb-990b-af61bf33fbcc</pingback:target>
    <slash:comments>1</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=5a8f9398-7ae6-4ddb-990b-af61bf33fbcc</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2009/07/22/Another-code-snippet-of-the-day.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=5a8f9398-7ae6-4ddb-990b-af61bf33fbcc</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2009/07/22/Another-code-snippet-of-the-day.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2009/07/22/Code-snippet-of-the-day.aspx</id>
    <title>Code snippet of the day</title>
    <updated>2009-07-22T14:54:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=19e53b4c-fef0-4d05-a3f4-212622f21399" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/SA_it3IM6AA/Code-snippet-of-the-day.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;Just ran across this awesomeness today:&lt;/p&gt;
&lt;pre class="brush:c-sharp;"&gt;
string campaignId = null;

/* ------------------------------------------------------------------------
 * see if the campaign id is in the request query params, so that a default
 * based on the url can be set.
*/
foreach (object key in Request.Params)
{
    string objCampaign = Convert.ToString(key);
    if (string.Compare(objCampaign, "campaignid", true) == 0)
    {
        campaignId = Request[Convert.ToString(objCampaign)];
        break;
    }//END IF
}//END FOREACH
/* ---------------------------------------------------------------------- */
&lt;/pre&gt;
&lt;p&gt;Huh.  Well, that's one way to do a Request.QueryString["campaignid"] lookup.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/SA_it3IM6AA" height="1" width="1"/&gt;</summary>
    <published>2009-07-22T14:54:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2009/07/22/Code-snippet-of-the-day.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=19e53b4c-fef0-4d05-a3f4-212622f21399</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=19e53b4c-fef0-4d05-a3f4-212622f21399</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2009/07/22/Code-snippet-of-the-day.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=19e53b4c-fef0-4d05-a3f4-212622f21399</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2009/07/22/Code-snippet-of-the-day.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2009/06/04/Some-more-LINQ-love.aspx</id>
    <title>Some more LINQ love</title>
    <updated>2009-06-04T20:32:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=c9e70a57-c6f9-4597-88e6-160b889fd36b" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/G8rrKhARPXc/Some-more-LINQ-love.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;Here's another example of how I feel LINQ improves the readability of my code.  This is the before version, using standard looping to populate a list of objects:&lt;/p&gt;
&lt;pre class="brush:c-sharp;"&gt;
private IEnumerable&amp;lt;Album&amp;gt; ReadAlbums(LLAlbum[] llAlbums)
{
	Album album;
	IList&amp;lt;Album&amp;gt; albums = new List&amp;lt;Album&amp;gt;(llAlbums.Length);

	foreach (LLAlbum llAlbum in llAlbums)
	{
		album = new Album()
		{
			AlbumId = llAlbum.Id
		};

		albums.Add(album);
	}

	return albums;
}
&lt;/pre&gt;
&lt;p&gt;And here is the after version, using a LINQ query:&lt;/p&gt;
&lt;pre class="brush:c-sharp;"&gt;
private IEnumerable&amp;lt;Album&amp;gt; ReadAlbums(LLAlbum[] llAlbums)
{
	return from llAlbum in llAlbums
		   select new Album
		   {
			   AlbumId = llAlbum.Id
		   };
}
&lt;/pre&gt;
&lt;p&gt;Now, depending on your familiarity with LINQ, you may or may not agree with me, but I love it!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/G8rrKhARPXc" height="1" width="1"/&gt;</summary>
    <published>2009-06-04T20:32:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2009/06/04/Some-more-LINQ-love.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=c9e70a57-c6f9-4597-88e6-160b889fd36b</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=c9e70a57-c6f9-4597-88e6-160b889fd36b</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2009/06/04/Some-more-LINQ-love.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=c9e70a57-c6f9-4597-88e6-160b889fd36b</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2009/06/04/Some-more-LINQ-love.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2009/05/23/Project-Euler-Problem-1.aspx</id>
    <title>Project Euler: Problem 1</title>
    <updated>2009-05-23T17:32:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=092742da-2122-41ca-8634-5b09910fba8a" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/NOkj2sxZHw8/Project-Euler-Problem-1.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;I just put my son down for a nap, so since I had a little spare time, I thought I'd try my hand at &lt;a href="http://projecteuler.net"&gt;Project Euler&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://projecteuler.net/index.php?section=problems&amp;id=2"&gt;Problem 1&lt;/a&gt; was very simple.  Right off the bat, I knew how I wanted to solve it:&lt;/p&gt;
&lt;pre class="brush: c-sharp;"&gt;
int sum = 0;
for (int ix = 0; ix &lt; 1000; ix++)
{
	if (ix % 3 == 0 || ix % 5 == 0)
	{
		sum += ix;
	}
}
&lt;/pre&gt;
&lt;p&gt;However, I've been reading &lt;a href="http://msmvps.com/blogs/jon_skeet/default.aspx"&gt;Jon Skeet's&lt;/a&gt; excellent book, &lt;a href="http://www.manning.com/skeet/"&gt;C# in Depth&lt;/a&gt;, so I wanted to see if I could solve it using LINQ:&lt;/p&gt;
&lt;pre class="brush: c-sharp;"&gt;
int sum = Enumerable.Range(0, 1000)
	.Where(x =&gt; (x % 3 == 0 || x % 5 == 0))
	.Sum();
&lt;/pre&gt;
&lt;p&gt;It still looks weird to me, but it works, so who am I to complain?  :)&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/NOkj2sxZHw8" height="1" width="1"/&gt;</summary>
    <published>2009-05-23T17:32:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2009/05/23/Project-Euler-Problem-1.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=092742da-2122-41ca-8634-5b09910fba8a</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=092742da-2122-41ca-8634-5b09910fba8a</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2009/05/23/Project-Euler-Problem-1.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=092742da-2122-41ca-8634-5b09910fba8a</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2009/05/23/Project-Euler-Problem-1.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2008/12/11/ELMAH-10-Beta2-to-10-Beta3-upgrade-gotcha.aspx</id>
    <title>ELMAH 1.0 Beta2 to 1.0 Beta3 upgrade gotcha</title>
    <updated>2008-12-12T04:24:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=75a6b2c6-ccae-4e32-9920-3e0c15fa7d7c" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/cH_FLXM__dA/ELMAH-10-Beta2-to-10-Beta3-upgrade-gotcha.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;In one of my projects, I upgraded&amp;nbsp;&lt;a href="http://code.google.com/p/elmah/"&gt;ELMAH&lt;/a&gt;&amp;nbsp;from 1.0 Beta2 to 1.0 Beta3. &amp;nbsp;I have 404 filtering turned on so that my log doesn&amp;#39;t get flooded with 404 notifications (usually caused by legitimate, albeit a tad overzealous, monitoring applications). &amp;nbsp;Here is what the Web.config element looks like for Beta2:&lt;/p&gt;&lt;blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px"&gt;		&amp;lt;equal binding=&amp;quot;HttpStatusCode&amp;quot; value=&amp;quot;404&amp;quot; valueType=&amp;quot;Int32&amp;quot; /&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;p&gt;All of a sudden, when I fired up my site, I started getting a weird error message:&lt;/p&gt;&lt;blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px"&gt;		The Empty value type is invalid for a comparison.&lt;br /&gt;&lt;/blockquote&gt;&lt;p&gt;It turns out that the XML schema has changed ever so slightly in 1.0 Beta3. &amp;nbsp;To fix the aforementioned error, you must change the &amp;quot;valueType&amp;quot; attribute to &amp;quot;type&amp;quot;, like this:&lt;/p&gt;&lt;blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px"&gt;		&amp;lt;equal binding=&amp;quot;HttpStatusCode&amp;quot; value=&amp;quot;404&amp;quot; &lt;span class="Apple-style-span" style="font-weight: bold"&gt;type&lt;/span&gt;=&amp;quot;Int32&amp;quot; /&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;p&gt;Hopefully this will save someone some pain.&amp;nbsp;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/cH_FLXM__dA" height="1" width="1"/&gt;</summary>
    <published>2008-12-12T04:24:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2008/12/11/ELMAH-10-Beta2-to-10-Beta3-upgrade-gotcha.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=75a6b2c6-ccae-4e32-9920-3e0c15fa7d7c</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=75a6b2c6-ccae-4e32-9920-3e0c15fa7d7c</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2008/12/11/ELMAH-10-Beta2-to-10-Beta3-upgrade-gotcha.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=75a6b2c6-ccae-4e32-9920-3e0c15fa7d7c</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2008/12/11/ELMAH-10-Beta2-to-10-Beta3-upgrade-gotcha.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://www.sagara.net/post/2008/11/19/Ordered-a-new-computer.aspx</id>
    <title>Ordered a new computer</title>
    <updated>2008-11-19T06:24:00+00:00</updated>
    <link rel="self" href="http://www.sagara.net/post.aspx?id=8ca437ee-a0f4-4fcf-9940-1b569292fac1" />
    <link href="http://feedproxy.google.com/~r/SagaraNET/~3/D3PmeiH8wXQ/Ordered-a-new-computer.aspx" />
    <author>
      <name>Jon Sagara</name>
    </author>
    <summary type="html">&lt;p&gt;
But it can&amp;#39;t get here soon enough.
&lt;/p&gt;
&lt;p&gt;
I&amp;#39;m currently doing development on two machines, one with 512MB of RAM, and the other with 1GB.&amp;nbsp; It is PAINFUL.&amp;nbsp; Plus, on the latter, I&amp;#39;m running out of space on the OS drive, which makes it difficult to do anything at all.
&lt;/p&gt;
&lt;p&gt;
The new box sports 4GB RAM, 500GB of disk space (and I&amp;#39;m going to add second 500GB drive), and a Quad Core that will eventually run Windows Server 2008.
&lt;/p&gt;
&lt;p&gt;
I feel like a little kid again, waiting in agony for xmas day to come. 
&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/SagaraNET/~4/D3PmeiH8wXQ" height="1" width="1"/&gt;</summary>
    <published>2008-11-19T06:24:00+00:00</published>
    <link rel="related" href="http://www.sagara.net/post/2008/11/19/Ordered-a-new-computer.aspx#comment" />
    <category term="Blog" />
    <dc:publisher>Jon Sagara</dc:publisher>
    <pingback:server>http://www.sagara.net/pingback.axd</pingback:server>
    <pingback:target>http://www.sagara.net/post.aspx?id=8ca437ee-a0f4-4fcf-9940-1b569292fac1</pingback:target>
    <slash:comments>2</slash:comments>
    <trackback:ping>http://www.sagara.net/trackback.axd?id=8ca437ee-a0f4-4fcf-9940-1b569292fac1</trackback:ping>
    <wfw:comment>http://www.sagara.net/post/2008/11/19/Ordered-a-new-computer.aspx#comment</wfw:comment>
    <wfw:commentRss>http://www.sagara.net/syndication.axd?post=8ca437ee-a0f4-4fcf-9940-1b569292fac1</wfw:commentRss>
  <feedburner:origLink>http://www.sagara.net/post/2008/11/19/Ordered-a-new-computer.aspx</feedburner:origLink></entry>
</feed>
