Standing on the shoulders of giants. RSS 2.0
# 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
# Thursday, August 07, 2008

Justin Etheredge from CodeThinked is writing a series about learning IronRuby. After showing how to set up IronRuby on your environment and how to run an application, he shows how to create classes, with properties and methods and how to interact with basic collections (arrays and hashes).

While it does not (yet) have the depth of Why's (poignant) guide to ruby, it certainly is a good starting point for any C# developer interested in learning Ruby.

Thursday, August 07, 2008 8:44:20 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
IronRuby
# Tuesday, August 05, 2008

Last Friday another batch of session for PDC2008 was posted, increasing the count to 84. Still missing are sessions about the next version of Office and MOSS (v14), but there are plenty of other interesting sessions; it will be hard to choose from all the sessions. The highlights of the new sessions (also see this and this earlier post):

Concurrency Runtime Deep Dive: How to Harvest Multicore Computing Resources
Parallel Programming for Managed Developers with the Next Version of Microsoft Visual Studio
With multi-core processors and cloud-computing becoming mainstream, concurrency and parallel computing will become a requirement for more performant software.

Developing Applications Using Data Services

Modeling Data for Efficient Access at Scale
Scalable, Available Storage in the Cloud
SQL Server Data Services: Futures
Storing data in the cloud has a number of unique challenges in availability, security and efficient access.

A Lap around "Oslo"
"Oslo": The Language
There has been a lot of buzz around "Oslo"; it will be interesting to see how the vision translates into a product.

Windows Workflow Foundation: Futures
Extending Windows Workflow Foundation v.Next with Custom Activities
Workflow Services
The future of Windows Workflow Foundation and the ability to run processes in the cloud should be very interesting.

Tuesday, August 05, 2008 3:25:09 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Conference | PDC2008
# Monday, July 28, 2008

Tom Hollander has a series on how to get MSMQ, WCF and IIS to work in a mulit-server scenario; this is an extension to an earlier post about a pub/sub message bus using WCF and MSMQ.

  1. Part 1: basic setup: no security, no transactions, single server
  2. Part 2: advanced setup: transport security, no transactions, multi-server
  3. Part 3: final setup: transport security, transactional, multi-server

Notice how little you have to change in code, to switch from having your service listen on http to having it listen to a remote MSMQ and supporting transactions. This really shows how robust and powerful WCF is.

Monday, July 28, 2008 7:18:27 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Services
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)