Standing on the shoulders of giants. RSS 2.0
# Monday, September 15, 2008
public class Foo : IComparable<Foo>
{
    public Foo() { }

    public int Value { get; set; }

    public int CompareTo(Foo other)
    {
        if (other == null) { return 1; }

        return this.Value.CompareTo(other.Value);
    }
}

The trick is the line, which checks for the null comparison. Since null is always less than this, the method must return a value greater than zero (0).

Also see the remarks in the documentation:

Greater than zero: This object is greater than other.
...
By definition, any object compares greater than null (Nothing in Visual Basic), and two null references compare equal to each other.

Monday, September 15, 2008 8:55:47 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Codesnippet
# Monday, September 08, 2008

55 more sessions have been added to an all ready full schedule making the current total 139 sessions and still more "secret" session will be announced at the PDC.

Highlights of the (new) sessions:

  • Parallel Symposium:
    • Addressing the Hard Problems with Concurrency
    • Application Opportunities and Architectures
    • Future of Parallel Computing
  • Services Symposium:
    • Enterprise Grade Cloud Applications
    • Expanding Applications to the Cloud
    • Projecting On Premises Applications to The Cloud
  • Service Bus Building Blocks: Connectivity, Messaging, Events, and Discovery
  • "Zermatt"
    • Deep Dive
    • Enabling Next Generation Identity
  • Windows CardSpace "2": Under the Hood

With the focus on "The Cloud", Parallel Computing and "Oslo" this looks like it will be a very interesting PDC. For more information about what "Oslo" is see both Don's and Doug's definitions.

[Current PDC08 Session List]

Monday, September 08, 2008 8:49:05 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Conference | PDC2008
# Sunday, September 07, 2008

In the Managed Extensibility Framework source code on CodePlex is this 'preview' of the new Tuple class in the .NET Framework 4.0

// NOTE : this is a TEMPORARY and a very minimalistic implementation of Tuple'2,
// as defined in http://devdiv/sites/docs/NetFX4/CLR/Specs/Base Class Libraries/Tuple Spec.docx
// We will remove this after we move to v4 and Tuple is actually in there

[Via: Don Box's Spoutlet]

Sunday, September 07, 2008 10:55:08 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
BCL
# Saturday, September 06, 2008

A simple example to show how to use the SyndicationFeed class to load a feed and how to handle the items.

using System;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Xml;

class Program
{
    static void Main(string[] args)
    {
        string feedUrl = "http://feeds.delicious.com/v2/rss/tags/paul.van.brenk";

        SyndicationFeed feed;

        using (XmlTextReader xReader = new XmlTextReader(feedUrl))
        {
            feed = SyndicationFeed.Load(xReader);
        }

        // max is more appropriate
        //var sum = feed.Items.Aggregate(0m, (x, y) => x += Decimal.Parse(y.Summary.Text));

        var max = feed.Items.Max(x => Decimal.Parse(x.Summary.Text));

        // select item title and relative weight for items with a relative weight > 0.1 
        var normItems = from i in feed.Items
                        where (Decimal.Parse(i.Summary.Text) / max) > 0.1m
                        select new { Title = i.Title.Text, Weight = Decimal.Parse(i.Summary.Text) / max };

        foreach (var item in normItems)
        {
            // 15 = highest possible value for consolecoler (Magic Number)
            Console.ForegroundColor = (ConsoleColor)(15 * item.Weight);
            Console.Write("{0} ", item.Title);
        }

        Console.ReadLine();
    }
}

Download code: ConsoleTagCloud.txt (1.22 KB)

Saturday, September 06, 2008 4:15:16 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Codesnippet | Services
# Saturday, August 30, 2008

Joe Duffy is building a custom threadpool on his blog, exploring the different trade-offs:

The first threadpool he designs in part 1 is a very simple one, using a naive algorithme. The second one in part 2 is more interesting, since this allows threads to 'steal' work from each other and tries to take advantage of work still being in the memory cache by using a LIFO (Last In First Out) algorithm.

Update:

Part 3 was posted some time ago, which integrates the queue from part 2 in the pool from part 1.

Saturday, August 30, 2008 12:34:45 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
C#
# Friday, August 22, 2008

On Wednesday Lutz Roeder announced he has reached an agreement with Red Gate Software to continue the development of Reflector. It looks like this will prove to a good move for the product: Red Gate is able to make resources available for the future development of the product and has already opened a forum to get suggestions.

So thanks Lutz for this great tool and good luck to the team at Red Gate Software with the future development!

More info in this interview on Simple Talk.

Friday, August 22, 2008 1:10:12 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Development
# Monday, August 11, 2008

Earlier today .NET Framework 3.5 and Visual Studio 2008 SP 1 were released. I wrote about the new features earlier and this still looks like an amazing service pack. Some of the highlights:

  1. The improved performance of the installation of the service pack compared to the vs2005 sp. And the fact that the final sp will install over the beta, no need to uninstall. Update: The final version won't install over the Beta SP, you have to run the "Service Pack Preparation Tool" first.
  2. Inclusion of the Entity Framework, this is no longer a separate download. Some of the fixes in this version of the Entity Framework include support for SQL Server 2008 and improved support for iterative development (the "Update model from database" wizard).
  3. Inclusion of ADO.NET Data Service Framework (Astoria)
  4. Improvements to DataContracts in WCF. The serializer now supports types that aren't annotated with any serialization attributes and better support for object references (and circular references) in DataContracts.

Update: the MSDN Library for Visual Studio 2008 SP1 is also available for download.

Monday, August 11, 2008 10:47:42 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Development | Visual Studio 2008
Ads
About
© Copyright 2014
Paul van Brenk
Sign In
newtelligence dasBlog 2.3.12105.0
All Content © 2014, Paul van Brenk
DasBlog theme 'Business' created by Christoph De Baene (delarou)