Is it possible to come up with a more convoluted HelloWorld example?

Answered Is it possible to come up with a more convoluted HelloWorld example?

  • Tuesday, August 21, 2012 7:04 PM
     
      Has Code

    Seriously?  Here is just part of the HelloWorld example....

            private static IObservable<SensorReading> SimulateLiveData()
            {
                return ToObservableInterval(HistoricData, TimeSpan.FromMilliseconds(1000), Scheduler.ThreadPool);
            }
    
            private static IObservable<T> ToObservableInterval<T>(IEnumerable<T> source, TimeSpan period, IScheduler scheduler)
            {
                return Observable.Using(
                    () => source.GetEnumerator(),
                    it => Observable.Generate(
                        default(object),
                        _ => it.MoveNext(),
                        _ => _,
                        _ =>
                        {
                            Console.WriteLine("Input {0}", it.Current);
                            return it.Current;
                        },
                        _ => period, scheduler));
            }
    
            static IQStreamable<SensorReading> CreateStream(Application application, bool isRealTime)
            {
                DateTime startTime = new DateTime(2011, 1, 1);
    
                if (isRealTime)
                {
                    // Live data uses IQbservable<>
                    return
                        application.DefineObservable(() => SimulateLiveData()).ToPointStreamable(
                            r => PointEvent<SensorReading>.CreateInsert(startTime.AddSeconds(r.Time), r),
                            AdvanceTimeSettings.StrictlyIncreasingStartTime);
                }
                // Historic data uses IQueryable<>
                return
                    application.DefineEnumerable(() => HistoricData).ToPointStreamable(
                        r => PointEvent<SensorReading>.CreateInsert(startTime.AddSeconds(r.Time), r),
                        AdvanceTimeSettings.StrictlyIncreasingStartTime);
            }
        }
    ....this is laughable.  Document what the code is doing for Pete's sake.....

All Replies

  • Tuesday, August 28, 2012 1:39 AM
     
     
    anyone can help?
  • Tuesday, August 28, 2012 1:16 PM
     
     Answered
    There wasn't a question. It seemed like a complaint about the product group samples. Is there something specific that you need help with?

    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.