Post Race! - Page 1574-VBForums
Page 1574 of 1574 FirstFirst ... 57410741474152415641571157215731574
Results 62,921 to 62,926 of 62926

Thread: Post Race!

  1. #62921
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    622

    Re: Post Race!

    (gravel driveway - about to get it paved...).
    That didn't take long.
    I like the brick-work edging too.
    Last edited by Spooman; Sep 19th, 2017 at 10:17 AM. Reason: typo

  2. #62922
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    30,626

    Re: Post Race!

    Instead of paving, you should use yellow paver stones.
    My usual boring signature: Nothing

  3. #62923
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    3,666

    Re: Post Race!

    Ever spent weeks on something that turns out to be a remarkably stupid oversight on your part?

    I've been using the Reactive Extensions for .NET (Rx) a lot lately. It's a framework that works sort of like "What if instead of events, we had IEnumerables that added an item every time the event was raised?" I'm using it because I'm doing a lot of tasks that involve gathering data coming in at different rates, merging it, and processing it on a myriad of threads.

    So I have this guy right here I wanted to test:
    Code:
    _dataSource.Buffer(TimeSpan.FromSeconds(10))
        .ObserveOn(DefaultScheduler.Instance)
        .Subscribe(ProcessBatch)
    Items come in at a high rate, Buffer() collects all of them into a List for 10 seconds, then pushes that batch to my ProcessBatch method, and DefaultScheduler means ProcessBatch() is getting called on a worker thread. Whew.

    I don't want my tests to take 10 seconds per test, so I was going to cheat. Things that work with time can take an IScheduler. There is a TestScheduler that lets you control the clock. So with a slight change, "10 seconds" passes when I say it does:
    Code:
    dataSource.Buffer(TimeSpan.FromSeconds(10), scheduler)
        ...
    The way to test it looks something like:
    Code:
    Dim scheduler = New TestScheduler()
    _dataSource = scheduler.CreateHotObservable(
        OnNext(10, <data>),
        OnNext(20, <data>),
        ...)
    
    ' ...set up code so it uses that data source and the scheduler.
    
    ' Advance by 10 seconds
    scheduler.AdvanceBy(10000)
    
    ' Test side effects of ProcessBatch()
    I've revisited this test in my free time for a few weeks. Every time I tried it, the test failed with no data. I was stumped.

    It was only this week I got the bright idea to comment out the Buffer() call to see if I got data at all. And I replaced the "test" observable with Observable.Interval, which behaves like a timer. So I set it to have a 1s period and expected 10 data points.

    I got 0 data points. What?

    I hacked at it for 10 minutes until, out of anger, I changed AdvanceBy() to use "999999999" instead of 10000. I got some results. What?

    Then it hit me. The name of the parameter that takes a time offset is 'ticks'. Ticks are NOT milliseconds. Whoops.
    Nothing I post is production-ready. It is provided as-is, use it at your own risk.

  4. #62924
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    30,626

    Re: Post Race!

    So....you were ticked off?
    My usual boring signature: Nothing

  5. #62925
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    30,626

    Re: Post Race!

    Or are you just clocking a tick talk?
    My usual boring signature: Nothing

  6. #62926
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    622

    Re: Post Race!

    He is stubbing his tick tack.

Page 1574 of 1574 FirstFirst ... 57410741474152415641571157215731574

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.