Skip to main content

Posts

Showing posts from November, 2009

Microsoft, isn't it a good idea to have a Silverlight OS against Google Chrome OS?

Before we begin - these are few random thoughts and speculations on the possibilities of having a Silverlight Operating System.If Google can think about an Operating System on top of Linux + Chrome, why Microsoft can’t think about a Silverlight OS, probably on top of MinWin? Especially for Atom PCs, Handheld devices, IP TVs etc. This might be already there in the cards – I don’t know. Just want to take a step back and see what all revelations are happening around the Silverlight + Cloud technology stack, and where that may lead us (the Microsoft developers).From Net Books To Mobiles To IP TVsSilverlight has emerged a lot in the last couple of years. As I see it, the investment going towards improving Silverlight in an astonishing speed has various reasons.RIA is growing, RIA is big. Silverlight provides a great RIA platform for Microsoft developers, and this will help Microsoft to combat the efforts from Google and Adobe. Silverlight is Microsoft’s Trojan horse to get into the Mac wor…

Rx Framework Part III - LINQ To Events - Generating GetEventName() Wrapper Methods using T4 Text Templates

Before you being, you may Read Part I and Part IISoon after writing my last post on LINQ to Events, I thought about creating a quick text template to automatically generate those GetEventName wrapper methods – so that we don’t end up in hand coding those GetMouseDown(), GetMouseMove() and all again. You may use it to quickly generate extension methods to create event to observable wrappers for a specific type. Here we go. Click 'view plain' to grab the source code Add a new text file to your project, and name it EventWrapperGen.ttinclude<#+ //Generate the Event wrappers to create an observable from //an event //Generate a GetEventName wrapper method for events in this type void GenerateEventGetters(Type type) { var events = type.GetEvents(); foreach (var e in events) { Type tDelegate = e.EventHandlerType; var parameters=GetDelegateParameterTypes(tDelegate); if (parameters.Length==2 …

Rx Framework Part II - Observables From Events and ‘LINQ to Events’ – With a WPF Drawing demo

In my last post, I gave a high level overview about .NET Reactive Extensions (Rx), Push and Pull data sequences, and creating Observables from .NET events. In this post, we’ll explore more Observables from Events, and the ‘LINQ to Event’ aspect. We’ll create a small drawing application in WPF in declarative style. You may want to download the related source code to play withDownload related source to play withA note on the source code. I’m using the System.Reactive.dll, that I rebased to .NET CLR using Reflexil. It is just for demo purposes, and is not expected to include in your production deployments.Event To ObservablesTo recap, as described in my last post, you may use the Observable.FromEvent method to create Observables from events and subscribe to them, like,var allKeyDowns = Observable.FromEvent<KeyEventHandler, KeyEventArgs> ( h => new KeyEventHandler(h), h => el.KeyDown += h, h=> el.KeyDown -= h …

Rx Framework Part I - System.Reactive or the .NET Reactive Extensions (Rx) – Concepts and First Look

Recently, a lot of interest is bubbling up in the .NET community about reactive programming. This weekend I played around with this, and created a couple of POCs to get a feel. And I'm loving everything. Reactive extensions (Rx) is really cool, as it introduces lot of new possibilities. The .NET Rx or .NET Reactive extensions (System.Reactive.dll) recently appeared in the latest Silverlight tool kit drop.  .NET Rx introduces two interfaces, IObservable and IObserver that "provides an alternative to using input and output adapters as the producer and consumer of event sources and sinks" and this will soon become the de-facto for writing asynchronous code in a declarative manner. Also, .NET Rx gives greater freedom to compose new events – you can create specific events out of general events. Let us see these aspects in a bit more detail. Push and Pull SequencesHere is a quick recap on Reactive programming - Consider a small example, result = var1 + var2. In a normal scen…

MEF or Managed Extensibility Framework – Creating a Zoo and Animals

MEF or Managed Extensibility Framework is cool. Firstly, it allows you to decouple your components pretty easily. Secondly, it supports various component discovery scenarios, and enables you to write better frameworks. In this post, I’ll cover few basic aspects of MEF. MEF classes reside in the assembly System.ComponentModel.Composition.dll – Creating plug-in frameworks is quite easy with MEF. The main application can Import plug-ins, marked with an Export attribute. MEF terminology is pretty simple. To start with, you can Export and Import your Parts. A Part is anything you export or import - be it a class, method, or property. Any such composable Part should be attributed with either the Export or Import attributes (You can find those attributes in System.ComponentModel.Composition namespace). For simple scenarios, you may use the Export attribute along with a Contract to mark your part as exportable. Also, you may use the Import attribute to specify where you want to import the ava…

Silverdraw: A collaboration board using SIlverlight + WCF - Source Code & Intro Article

In my previous post, I introduced Silverdraw, something that came out of my weekend hacks. Today I managed to push the source code of the same to Codeplex, and finished writing an article about the same in Codeproject




Silverdraw is realtime white board that can sync information between various participants, using Silverlight + WCF Polling Duplex. Presently this is a just a POC implementation. Users can draw together in the white board, and may chat each other. Here is a quick screen shot of the client running in two different browsers. These are the steps to start.The application has two parts:Server - A WCF service with a polling duplex end point for clients to register, to publish information, and to receive notifications. Client - A Silverlight client that consumes the end point to register the user, to publish the user's drawing, and to receive and plot the drawing data from other users. The server side web service interface (IDuplexDrawService) has these important methods:R…

Silverlight + WCF Polling Duplex Services = Awesomeness

Silver light + WCF Polling Duplex services enables you to write Silver light apps that can share information almost real time between users, over HTTP. Last weekend I started experimenting with Tomasz's pubsub sample - And again, this weekend, I ended up coding for the past 12-16 hours, and packaged together a not so bad Real time White board - Silver Draw -  where users can chat and even draw some primitive drawing.

If you are interested, here is the same. If my wife permits me to spend a couple of hours in front of my box this sunday, I'll do some quick refactoring to clean up the code a bit more- and may publish the source with another detailed article. In this Video, you may see I'm logging in from two different browsers, to do some dirty drawing that gets pumped to the other user.






I think recently there is lot of excitement about Google Wave, mainly because of it's ability to share information between various users real time, over HTTP. Real time information shari…