Sunday, July 13, 2008

Really Simple Syndication with Silverlight 2 Beta 2

I've been working with Silverlight 2 Beta 2 a bit lately on my personal side project and wanted to build a very simple RSS viewer. I've found it's pretty easy to do, but there are a few gotchas along the way. I've put up some sample code for doing this, please feel free to use it in anyway you see fit.

Sample code for Silverlight RSS viewer

Here is a non-exhaustive list of things to check out in the source:

1 Silverlight 2 Beta 2 still has some cross-domain access issues, so instead of spending time figuring out why my HttpWebRequests weren't working from Silverlight, I built a WCF service to fetch the RSS XML for me.

2 On the topic of WCF, review the web.config in the ASP.NET project; make sure the binding attribute for the WCF RSS feed service is set to "basicHttpBinding".

3 In ServiceReferences.ClientConfig file in the Silverlight project, make sure you change the endpoint address's port for the WCF service to whatever your local ASP.NET development server's port is, otherwise you won't be able to run the sample locally.

4 If you want to put this code up on a live server, you may run into WCF activation issues. If you do, take a look at this blog post from Joe's Blog about using a custom ServiceHostFactory workaround.

That's all the gotchas I can think about at the second, I'll update this post with more if I remember anything else later. WCF can get a bit tricky now and then... WCF has a nasty way of trapping you inside a cave. That has a bear inside. That you can't see.

Have fun with the source; you can do a lot of cool stuff in Silverlight 2 Beta 2. Throw a DataTemplate on the ListBox and make your data look spectacular (and give yourself extra points if you recognize the Mitch Hedberg reference I just made).

Good luck!

Friday, July 11, 2008

Free Linqpad Application

Linqpad is a nice little app that will replace your favorite SQL management studio for many tasks. This little app has no installer and is just a single exe that gets downloaded and run. It even has an updater built in to make sure that you have the latest version.

This powerful little tool can also run any SQL command, LINQ expression, or even a C#/VB.NET code snippet. This makes it a great little tool to have on your desktop. It was written by the authors of C# 3.0 in a Nutshell. It includes 200 samples from the book. This is a great addition to this little app.

http://www.linqpad.net/

Now all that glitters is not gold.... One of the things that Management Studio can do is to allow you to add new rows to tables using the datagrid that shows the data in the table. You can also delete rows using this. Linqpad does not allow this since it is only a web output.

Overall Linqpad is a great tool if you are using LINQ and/org .NET 3.5 and databases. Get it, play with it, see what it can do and you will like it too.