SingingEels : Development Community & Resource

Login

Articles

  • ADO.NET (2)
  • ASP.NET (36)
  • LINQ (4)
  • Security (2)
  • Silverlight (3)
  • SQL (7)
  • Standards (5)
  • WCF (2)

Syndication

  • Articles RSS
  • Blogs RSS

Contribute

  • Our Authors List
  • Member Sign-Up
  • Suggestions Box
ASP.NET Hosting with MS SQL 2008 – Click Here!
Sunday, April 20, 2008 : 8:07 PM - (0 comments)

Site Updates, Bug Fixes and Syndication in .NET 3.5

Minor Bug Fixes

There have been a few bugs and glitches that I've noticed since the recent rewrite. For starters, the Blogs RSS page wasn't linking to the blog posts. They were correctly displaying most recent blog entries, but the link was broken and would simply take you back to the front page of the site.

There was also a strange bug with the categories selector when writing an article. If you would edit your aritcle, and not change your selection of categories, then the next time you saved, the categories were blank... like I said, weird bug, but it's fixed now.

Minor Updates

Also, since I've recently learned about the System.ServiceModel.Syndication namespace, I've changed the RSS code to use these new classes for sending out the RSS feeds. Because of it, there is a new feature (well, not new, but I wasn't doing it before). Now the article's (or blog post's) categories are being sent too in the feed. This lets you sort or filter by a the category in your favorite RSS viewer!

Here's a snippet of the code that I'm using now. It's offers some easy RSS abilities in .NET:

System.ServiceModel.Syndication

// This is in the System.ServiceModel.Web dll. So you'll
// have to add a reference to it in your .NET 3.5 web project.

using System.ServiceModel.Syndication;

public partial class MyRssPage : ContentPage
{
   protected override void OnInit(EventArgs e)
   {
       // This isn't required, but I do it anyway.

       this.Response.AppendHeader("content-type", "application/xml");

       // Make a list of the items that will be in the feed.

       List<SyndicationItem> feedItems = new List<SyndicationItem>();

       // Add items to my RSS feed. This will probably be selected

       // from a database in real life.

       feedItems.Add(new SyndicationItem("Item One Title",
           "Item one content here. <b>HTML Tags</b> are ok!",
           new Uri("http://www.singingeels.com/ItemOne.aspx")));

       // Create the feed object with some simple parameters.

       SyndicationFeed feed = new SyndicationFeed("My RSS Feed!",
           "My site description!!!",
           new Uri("http://www.singingeels.com/RSS.aspx"),
           feedItems);

       // Now to send it out to the browser!

       XmlWriterSettings feedWriterSettings = new XmlWriterSettings();

       feedWriterSettings.Indent = true;

       feedWriterSettings.IndentChars = "\t";

       XmlWriter feedWriter = XmlWriter.Create(this.Response.OutputStream, feedWriterSettings);

       feed.SaveAsRss20(feedWriter);

       feedWriter.Close();

       this.Response.End();
   }
}

Of course, you don't have to indent the XML either, but I like my source to look good :) The more I look into .NET 3.5, the more I love it!

Saturday, April 5, 2008 : 9:45 PM - (0 comments)

Silverlight 2 Beta 1 - Online Game and the Pain it Caused

The Good News

First off, I have to say that I have successfully made an "online video game", with Silverlight as the game client. I can't stress enough how overly difficult this was, and how many "the right way" paths I went down that completely failed.

Silverlight 2 Beta 1 WCF Issues

As of right now (April 5th 2008 at 11:31 PM) as I am writing this blog post, the Silverlight 2 Beta 1 that is out doesn't support "connected" WCF functionality. What I mean by this is that, while you *can* consume WCF web services, you must use basicHttp binding, which means that you lose all ability to have required sessions.

Hopefully this will be addressed when the full version is out. But as it stands right now, no duplex WCF support and no sessioned WCF support.

Silverlight 2 Beta 1 Threading Issues

Now, I will eventually tell you how I got this to work, but first you have to understand that there was a lot of pain that needs to be resolved. When I finally got connecting to my server and receiving useful data to my Silverlight app, I was ready to add "players" to my screen... then CRASH!

Silverlight 2 Beta 1 doesn't have a way for you to update the UI at all from another thread. So, that means that using any thread other than the main thread (which includes WCF or TCP sockets) to create or update your UI, it will absolutely fail. Also, there is no "Page.Invoke" method to call your needed code back on the main UI thread as there is in Windows Forms programming.

Ultimately, Good Results = Good Results

While I am disappointed in the methods I had to employ to get here, I have to show you my awesome results:

Silverlight 2 Beta 1 - Online Game

Now, this may not look like much, but these are four browser windows running Silverlight applications that ACTUALLY CONNECTED to my C# Windows Console application via TCP sockets, and was displaying my "game" objects on the screen.

As you clicked on the Silverlight page, it sent a command across the wire to the server and the little red circles were moving around!

I'll be going to bed now, but soon I'll be writing a "make your own MMORPG video game in Silverlight" article.

Developer / Architect / Author

Blog Archives

  • November 2008 - (1)
  • October 2008 - (2)
  • September 2008 - (2)
  • August 2008 - (3)
  • July 2008 - (1)
  • June 2008 - (3)
  • May 2008 - (2)
  • April 2008 - (2)
  • March 2008 - (4)
  • February 2008 - (2)
  • December 2007 - (2)
  • November 2007 - (1)
  • October 2007 - (4)
  • September 2007 - (9)
  • August 2007 - (7)

Related Ads

SingingEels.com as of Jan 06 2009 - 01:46:45 AM - (0.0468738)