Rx Challenge #10: DistinctUntilChanged with expiration period

2016/08/19

Rx Challenge #10: DistinctUntilChanged with expiration period This challenge is DistinctUntilChanged  cancellation after a period. When having event stream which may produce items in a row and then be idle for a period. You may want to get item after a period even those it identical the the previous one.   On challenge you need to construct it using composition of existing Rx’s operators. It can be formulate into the following pattern: Code Snippet public static IObservable<T> DistinctUntilChanged<T>(     this IObservable<T> source,     TimeSpan distinctPeriod) {     // TODO: your code }  
no comments

Rx Challenge #9: Execute Async Until

2016/08/16

Rx Challenge #9: Execute Async Until This time the challenge is for implementing a pattern where you have to keep sending async message until you will get notification which approve that the message is handled by the other side. The idea is to verify that the message was handled by other side without keeping open connection and waiting for response (which already implement by the TCP protocol). This pattern can be useful on many scenarios, For example, any queue mechanism like Service Bus, Rabbit MQ, etc. Using this pattern you can keep sending the message using predefine interval...

Semaphore Slim and Async

Semaphore Slim and Async On this post I will focus on async waiting on Semaphore (using SemaphoreSlim). In general .NET is having 2 Semaphore implementations: - Semaphore which is the legacy implementation (but support cross process operations) - SemaphoreSlim which is lightweight version. It bring some performance improvements but it don’t support cross process operation. this post will focus on SemaphoreSlim WaitAsync API. Let start analyzing the following code snippet, think what’s wrong with it: Code Snippet private static SemaphoreSlim _gate = new SemaphoreSlim(4); static void Main(string args) {     for (int i = 0;...
no comments

Visual Rx is having new Home and future plans

2016/08/02

.Visual Rx is having new Home and future plans Visual Rx is having new Home under GitHub. It had moved from CodePlex to GitHub and will be maintain on GitHub. The plans for Visual Rx future is to start new version from scratch. This version will have the following characteristic: - Support .NET Core. - Better organized. - API improvements. - Support more communication client out of the box. - Have Angular 2 viewer. After setting the foundation for this version I will post call for the community to join the effort. The final target of Visual Rx (if...

RX Issue: scheduler within Merge over GroupBy

2016/05/04

Be aware of RX issue when you use scheduler within Merge over GroupBy The following code snippets work well when no scheduler is used: Code Snippet var source = Observable.Return(1)                         .Concat(Observable.Never<int>());   var xs = from item in source             group item by item % 3 == 0 into g             from x in Observable.Merge(                 g.FirstOrDefaultAsync(),                 g.LastOrDefaultAsync())             select x;   xs.Subscribe(Console.WriteLine); The code snippet will produce output of 1   When altering the code for better testability and adding scheduler to the Return and Merge operation, it will produce no output. ...
no comments

VS 15 Intellisense improvements

2016/04/02

Years ago I was publishing Visual studio extension (for VS 2010) which improve Intellisense in away that you can filter specific aspects like Method, Property, Events, etc. I didn’t find the time to upgrade this extension to newer versions of Visual Studio. Finally this functionality become part of the default Intellisense on Visual Studio 15 (not 2015). This is great feature which improve can productivity. This feature is not on the current public bits yet but it’s coming soon. I was waiting for this feature to be in the default intellisense for long time, and...
no comments

Demystify Async and Await (Part 2 of 2)

2016/03/29

Demystify Async and Await (Part 2 of 2) This post is the second post on this series. I’m strongly recommend to read the first post before this one.   On this post I will demystify async and await. So many developers are having wrong understanding of the feature all over the industry. This lead to bad practice and confusion. On this post I will try to clarify the true nature of async and await.   Misconception of async and await before I’ll explain what async and await really are, I’ll start with what it doesn’t.   I will start...
no comments

Demystify Async and Await (Part 1 of 2)

Demystify Async and Await (Part 1 of 2) After seeing so many confusion speed abroad the industry, I had came to conclusion to write this post and demystify the behavior of async and await.   To many people is having to many wrong conceptions and theories about the functionality of async and await. It lead to great confusion and bad practices. In order to explain async and await I must go back to the basic and demystify Task.   Part 1 of this 2 part series will explain what really is Task and the confusion almost everybody...
no comments