Rx Challenge #4 (solution)

2015/03/30

the last challenge was about composing multiple message into single messageby reading the message header. you can read more about it in here.   you can check the solutions for this challenge on the Rx forum or on the following code snippet: Enjoy public void SwitchPlusTests_Test(){ // device provides stream of byte that represent message header + body // for each byte the first byte represent the header // the first byte represent Message Type Enum of (None, MessageA, MessageB, C) // while the real message...
no comments

Rx Challenge #4

2015/03/25

this challenge was taken from real life problem. It was one of my colleague who ask about reacting to Bluetooth device's output the device provides stream of byte that represent message header + bodyfor each byte.the first chunk of bytes represent the header (kind, chunk count)- the first byte represent message kind (Enum of None = 0, MessageA = 1, MessageB = 2)- the second byte represent number of chunk (the message split to)on each following message's chunk- the first byte is equals to zero (this is how you know that the message is not a starting point)  when...
no comments

Rx Challenge #3 (solution)

the last challenge was to apply suspend / resume behavior. for example we might want to suspend the input stream when itbecome to intense. you can read more on the challenge post the solution for this post is not so easy, and it's using the Scan operator. at the heart of this solution I was creating threshold class (latter will be wrap by accumulation which in turn will be used by the Scan) /// <summary>/// Encapsulate time stamping threshold/// where stamps are checked against staleness duration (limit duration) /// and non-staled stamp count evaluate against the count limit///...
no comments

Rx Challenge #3

2015/03/06

this Rx's Challenge is actually real-life problem.I had to solve for one of my customers.it's actually a piece of infrastructure which may fit on many scenarios.the scenario I was encounter is fault tolerant for remote logging  service. we used to send our logs to central log viewer in order toinspect the heart bit of our client's apps and keeping it healthy. the problem starts when for some reason the client's apps cannot sent the information (offline, wrong  URL, etc.), in those cases wewand to suspend sending for awhile and resume later. so we react to send's failures and if...
no comments

Rx Challenge #2 (Solution)

2015/02/09

the solution of the challenge is, using the Switch operator (line 46): 1: 2: public void AvoidOverlappingStreams_Test() 3: { 4: /****************************************************** 5: * 6: * you start with Stream that create sub stream of string, 7: * each sub stream is built of single char representation. 8: * 9: ...
no comments

Async Transaction Scope on .NET 4.5.1

2015/02/05

even though C# async syntax let can dispose type on different thread with the using statementprivate static async Task RunAsync() { using (var conn = new SqlConnection(/* ... */)) { await conn.OpenAsync(); // ... } } unfortunately Transaction Scope (on .NET 4.5) didn't support completion on different thread. this issue fixed up on .NET 4.51 but instead of fixing it for the default scenario, you have to define it explicitly.using (var scope = new TransactionScope( ...
no comments

Rx Challenge #2

in the next RX Challenge you need to ovoid overlaps of charin the output stream. you start with Stream that create sub stream of string,each sub stream is built of single char representation. --#----------------@----------------*------------------    |                                                       #--##--###--####--#####--######--#######                             |                                                     @--@@--@@@--@@@@--                                                    |                                                    *---**---***--- you should find a way to get output stream wherelisten to the latest sub stream. the output stream should be look like: --#--##--###--@--@@--@@@-*---**---***--- in other words you have to avoid overlapping char. public void AvoidOverlappingStreams_Test() { /****************************************************** * * you start with...
no comments

Rx Challenge – Solution

2015/01/31

last week I was publishing the first RX Challenge. today I post solution for the first challenge.   the last week challenge was to set RX's Buffer that triggered by count, time or manual flushing. the following code present the solution public void Buffer_ShouldBulkOn_CountTimeoutOrFlush_Test() { // produce a buffer that should produce its bulk // as result of one of the following trigger // timeout, count threshold or manual flush request // arrange ISubject<int> source = new Subject<int>(); TimeSpan timeout...
no comments

Rx Challenge

2015/01/27

if you consider yourself RX pro, this challenge is for you. I decided to initiate weekly RX challenge and I let you  one week to solve it before I will publish solution. I will post it in a form of MS Test  method. and I will also post it on http://stackoverflow.com/questions/28176932/rx-challenge-1-by-bnaya-eshet on this challenge you have to make the following test pass by making buffer that triggered on timeout, count or flush request public void Buffer_ShouldBulkOn_CountTimeoutOrFlush_Test() { // produce a buffer that should produce its bulk // as result of one of...
no comments