Rx Workshop: Event Processing

Download this episode

Download Video

Description

Learn how to use LINQ operators to filter, aggregate, and group data in observable sequences to produce desired results. 

Download the Challenge

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      javelinBCD

      This should be a great series.  Finally a reason I can push more people at work to learn Linq.

      I attended SoCal Code Camp in San Diego last weekend.  There was a session on real world Rx and Rx Koans.  This gave me a great start on Rx.  The Koans looks like a great way to help learn Rx.  just wanted everyone to know about this codeplex project.  The idea of using koans come from the Ruby community and are an effective way to learn.

      "Koans - Zen Buddhist riddle: a Zen Buddhist riddle used to focus the mind during meditation and to develop intuitive thinking"

    • User profile image
      AbdouMoumen

      Hey,

      This is the second video (after the introduction video) of the series, right? but I get the feeling that you're talking about things that I haven't seen in the first video (like when you said "if you did the last challenge you'll know where did that 'stock ticks' come from".) Maybe there's a problem with the ordering of the episodes.

      Thanks for the great series anyway Smiley

    • User profile image
      Charles

      @AbdouMoumen: This is actually the 3rd part. Smiley

    • User profile image
      AbdouMoumen

      @Charles:OK, thanks. The ordering of the videos in the series' page is a little confusing Smiley what's even more confusing is that near the end of the video, when opening the solution for  the challenge, the folder says "Challenge 5: Complex Event Processing" Tongue Out

       

    • User profile image
      Charles

      @AbdouMoumen: Yeah, we messed this up Smiley It's the right challenge, though. I'll circle back with Wes and Bart to ensure we have this all right...

      C

    • User profile image
      Moumen

      @Charles:OK, I've already downloaded the whole series though, so, I'll try to figure it out Wink

    • User profile image
      cbae

      ,Charles wrote

      @AbdouMoumen: This is actually the 3rd part.Smiley

      I went through all the videos, and it this one appears to be the last one. So skip to the 3rd one in the list of videos, and come back to this one at the end.

    • User profile image
      Moumen

      I just noticed that the Challenge files have the correct numbers (so this is actually the 5th episode) stick to them and you'll be fine Wink

      By the way, aren't there two more episodes? ( "Reactive Coincidence" and "Programming the Cloud")

    • User profile image
      mdcsoft

      I think I got it!

      Code Snippet
      1. var result = quotes
      2.     .Where(q=>q.Symbol=="MSFT")
      3.     .Select(q=> new {q.Close, q.Date, q.High, q.Low})
      4.     .Buffer(5)
      5.     .Select(list => new
      6.     {
      7.         AvgHigh=list.Average(q=>q.High),
      8.         AvgLow=list.Average(q=>q.Low),
      9.         Last=list.Last().Close,
      10.         Date=list.Last().Date
      11.     });
    • User profile image
      Yazid

      Great video, where can I download the code (Chanlleng)
      TIA
      Yaz

    • User profile image
      Reonekot

      All links to the challenges are giving 404 error. Could someone fix it please?

    • User profile image
      Eugene Strizhok

      This, I believe, the answer for same task, but taking non-stocking days into account.

      return from window in
      (from quote in quotes
      group quote by quote.Symbol
      into company
      from window in company.Buffer(2, 1)
      from stock in this.WithNonStockingDays(window)
      where stock.Symbol == "MSFT"
      select stock).Buffer(5, 4)
      select new {
      window.Last().Date,
      window.Last().Close,
      AverageHigh = window.Average(q => q.High),
      AverageLow = window.Average(q => q.Low)
      };

      private IEnumerable<StockQuote> WithNonStockingDays(IList<StockQuote> window) {
      var left = window.First();
      var right = window.Last();

      yield return left;
      while (right.Date - left.Date > TimeSpan.FromDays(1)) {
      left = new StockQuote {
      Close = left.Close,
      Date = left.Date.AddDays(1),
      High = left.High,
      Low = left.Low,
      Open = left.Open,
      Symbol = left.Symbol,
      Volume = left.Volume
      };
      yield return left;
      }
      yield return right;
      }

    • User profile image
      Eugene Strizhok

      But how do I insert code snippets?

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.