Rx Challenge #10 (Solution): DistinctUntilChanged with expiration period

Friday, September 2, 2016

Rx Challenge #10 (Solution): DistinctUntilChanged with expiration period The solution for the DistinctUntilChanged challenge is: Code Snippet public static IObservable<TSource> DistinctUntilChanged<TSource, TKey, TPeriod>(     this IObservable<TSource> source,     Func<TSource, TKey> keySelector,     IEqualityComparer<TKey> comparer,     IObservable<TPeriod> distinctPeriod) {     var result = source.Publish(hot =>     {         var distinct = hot.TakeUntil(distinctPeriod)                           .DistinctUntilChanged(keySelector, comparer)                           .Repeat();         return distinct;     });     return result; }   The idea is to cancel the district stream after a period and resume the subscription (repeat).   You can use the following convenient overloads: Code Snippet public static IObservable<TSource> DistinctUntilChanged<TSource>(     this IObservable<TSource>...

Challenge Quick Access (Links)

Friday, July 17, 2015

this is a quick access page to the Challenges Challenge #1: Buffer On Time, Count and Custom Trigger  http://blogs.microsoft.co.il/bnaya/2015/01/27/rx-challenge/ #2: Avoid Overlaps http://blogs.microsoft.co.il/bnaya/2015/02/05/rx-challenge-2/ #3: Suspend on faults throttle http://blogs.microsoft.co.il/bnaya/2015/03/06/rx-challenge-3/ #4: Create message from spitted chunks http://blogs.microsoft.co.il/bnaya/2015/03/25/rx-challenge-4/ #5: Exception Safe-Point http://blogs.microsoft.co.il/bnaya/2015/04/03/rx-challenge-5/ #6: Weak subscription  http://blogs.microsoft.co.il/bnaya/2015/04/10/rx-challenge-6/ #7: Where Async http://blogs.microsoft.co.il/bnaya/2015/07/11/rx-challenge-7/ #8: Suspend Buffering and flush http://blogs.microsoft.co.il/bnaya/2015/07/24/rx-challenge-8/ #9: Execute Async Until http://blogs.microsoft.co.il/bnaya/2016/08/16/rx-challenge-9-execute-async-until/ #10: DistinctUntilChanged with expiration period http://blogs.microsoft.co.il/bnaya/2016/08/19/rx-challenge-10-distinctuntilchanged-with-expiration-period/ #11: Semaphore Wait Async Like http://blogs.microsoft.co.il/bnaya/2016/09/08/rx-challenge-11/   Solutions #1: Buffer On Time, Count and Custom Trigger http://blogs.microsoft.co.il/bnaya/2015/01/31/rx-challenge-solution/ #2: Avoid Overlaps  http://blogs.microsoft.co.il/bnaya/2015/02/09/rx-challenge-2-solution/ #3: Suspend...
3 comments

Observable.FromAsync is it the right choice?

Saturday, March 22, 2014

Observable.FromAsync is it the right choice? one of the most common RX's practice is to use Observable.FromAsync for executing asynchronous IO operations. typical code may look like: Code Snippet var webClient = new WebClient(); IObservable<string> uris = ...; var dataStream = from uri in uris                     from data in Observable.FromAsync(                         () => webClient.DownloadDataTaskAsync(uri))                     select data; behind the scenes RX set a Task continuation (ContinueWith) and propagate the result through AsyncSubject, actually it is a bit complex and messy implementation combination with TPL Dataflow (.NET 4.5) may offer better solution to asynchronous...

Rx – Open Source

Friday, November 9, 2012

Rx - Open Source Microsoft had announced the open sourcing of Rx. it is a great news for the Rx development community. Microsoft is still committed to the library's quality while accepting external contribution into the Rx code base. Open sourcing is the new Microsoft strategy and you can see other technology that is moving in that direction (for example ASP.NET). personally I will consider to move Visual Rx into an official Rx code base. central code base that is being managed by Microsoft is much better than...

Visual Rx – Part 6

Thursday, October 25, 2012

Visual Rx - Part 6 this post is part of the Visual Rx series and it will focus on Visual Rx Viewer Side Extensibility. this post is dealing with advance topic, you may want to read other post on this series before reading this one. this post refer to version 2.0.20.622.60 or higher (the extensibility model was simplify at this version). Visual Rx support extension via plug-ins bundle contract. a plug-ins bundle contains: General information about the package (like title and description), ...

Visual Rx Version 2.0.20622.60

Visual Rx Version 2.0.20622.60 I have release a new version of Visual Rx just before my fight to the Build conference. the version support .Net 4.5 and is having a new plug-in model. this post will be follow by a post about writing plug-ins for the Visual Rx. for the client side it is recommended to use the Nuget package (write visualrx into the Nuget search box). if you want to learn more about .Net 4.5 parallelism, Rx and Tpl Dataflow you can check out the Sela developer practice conference, my session are already sold...

Visual Rx – Backward Compatibility

Wednesday, August 22, 2012

Visual Rx - Backward Compatibility I have just publish a new release of Visual Rx SDK which is targeting Rx versions 1.0.10621 and 1.1.11111. this release is result of a community request which was added to the Issue Tracker. you can add other request or vote for existing one in here. this release is also available on the NuGet Gallery. the NuGet page for version 1.0.10621 is available for download in here and the page for version 1.1.11111 is available in here. the same Visual Rx viewer...

Visual Rx – Part 5

Sunday, August 19, 2012

Visual Rx - Part 5 this post is part of the Visual Rx series and it will focus on controlling the Visual Rx publication on the coding part. you can see this series TOC in here. I was talking about enabling / disabling the Visual Rx publication (through the predefine publication channel), using the VirtualRxSettings.Enable property, in part 1 of this series. Enable / Disable let look at a Enable / Disable snippet: Code Snippet Task<VisualRxInitResult> info = VisualRxSettings.Initialize(     VisualRxWcfDiscoveryProxy.Create());   VisualRxInitResult infos = info.Result; Trace.WriteLine(infos);   var xs...