Monthly archives: November, 2009

LocalMessageSender with strongly typed objects

If you need to have two Silverlight apps talking to each other, you would be using the LocalMessageSender and LocalMessageReceiver classes from the System.Windows.Messaging namespace. The LocalMessageSender class will only allow you to send string messages. So if you are looking to send strongly typed objects using the LocalMessageSender you will have to serialize the …

LocalMessageSender with retry capability

If you need to have two Silverlight apps talking to each other, you would be using the LocalMessageSender and LocalMessageReceiver classes from the System.Windows.Messaging namespace. The problem with the LocalMessageSender is that it might not be able to send message at the very first try. So you will have to write code which retries to …

Duck Typing using C# 4.0

using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { QuackTheQuacker(new Toy()); QuackTheQuacker(new Duck()); } static void QuackTheQuacker(dynamic quacker) { quacker.Quack(); } } class Toy { public void Quack() { Console.WriteLine("A toy that quacks"); } } class Duck { public void Quack() { Console.WriteLine("A duck that quacks"); } } }

Blogging from iphone

I bought a new iPhone a few days ago and I am totally loving it. The only complaint that I have is the short battery time. If it could hold battery charge for a couple of days under heavy use, this would be the most perfect gadget I ever used. I am pretty sure Steve …

How to post source code on your blog

For a long time I have been looking for a tool to help me post source code on my blog. Obviously many people had solved this because we have all seen well formatted source code on many blogs. I did try several solutions including Syntax Highlighter, Copy Source as Html, C# code format from Manoli …

Getting Access Denied Errors in your WCF service or ASP.NET application ?

We are using impersonation in our WCF Service so that credentials of the user can flow to the backend layer (where authorization is done). Strangely we were getting Access Denied errors when the client tries to connect to the service. The error message was like: Could not load file or assembly ‘MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ …

Adding a desktop shortcut using Wix

Creating installers is a pain in the ass. We had to move from ClickOnce to MSI (for reasons bizarre) and we chose Wix (it was easy considering the fact that there was only one option to chose from). While Wix doesn’t help much in easing the pain (and in some ways it makes things worse), …