Showing posts with label ReactiveExtensions. Show all posts
Showing posts with label ReactiveExtensions. Show all posts

Wednesday, August 06, 2014

Reactive Extensions for mere mortals (and using them to merge Window Closing KeyEvents and MouseClicks events)

Loek van den Ouweland - Use Reactive Extensions to merge KeyEvents and MouseClicks to close a window

After reading this post, you’ve learned how to convert MouseClick  and KeyDown events into observable collections. You’ll see how you can even make these collections more convenient by merging them into one stream that tells your window to close with or without saving data.

Before we begin

How would you do this with events? Easy. Create a KeyDown event and ButtonClick events.

  • VirtualKey.Enter -> Close(true)
  • VirtualKey.Escape -> Close(false)
  • ButtonOK.Click -> Close(true)
  • ButtonCancel.Click -> Close(false)

...

image..."

I thought this a cool example of how Reactive Extensions is shown to be useful and usable by mere mortals. As they say in RX land, "Life is but a stream [of data]"

Wednesday, April 16, 2014

Droning on with Tasks, Rx and some TPL

The Brain Dump - Tasks and awaits and Rx! (And Drones!) Oh My!

A few people I work with are tinkering with an off-the-shelf drone in our spare time and so we are writing a C# library to control it.

The way it works is you send UDP commands to the drone and you receive a stream of status & navigation UDP packets from it. So everything is asynchronous by default. You don’t send a command and get back an “I got it!” response. You have to send a command and then monitor the status for a change reflecting your desired state,

For example, to start flying, you must repeatedly send the “take off” packet every few milliseconds until you see the “is flying” flag set in the status packets. Lets see what that would look like.

We want the SendCommand method to be asynchronous and totally decoupled from the UI. So the send process looks like this.

image

...

Broken down, each function is simple enough to understand and debug. This simplicity only comes from the power of Rx, the TPL and the async/await functionality. Imagine what the code would look like before when all the timers and .NET events and state would have to be managed directly.

Mostly I just liked his title... :P

Well that and there are some tips in this post that will come in handy, right about, well, now...

Thursday, August 16, 2012

It's RX v2 Baby! Reactive Extensions v2.0 RTW, with details, download and the SDK too!

Reactive Extensions Team Blog - Reactive Extensions v2.0 has arrived!

"Today, we’re extremely pleased to announce the availability of Reactive Extensions for .NET (Rx) v2.0 RTM, aligned with the availability of Visual Studio 2012 RTM and Windows 8 RTM for MSDN subscribers. This is a major milestone for the Rx project and we hope you’ll love what you see!

In this post, we’ll focus on how to download and install the bits for use in various application frameworks. Unlike previous posts about the v2.0 pre-releases, we’ll defer further technical details to a series of follow-up posts. Nonetheless, we’ll give a brief introduction into the use of Portable Library with Rx v2.0 RTM.

Note: We’ve written this post in the typical font used for big announcements nowadays – Comic Sans – in honor of the Higgs boson discovery. In case you don’t want to partake in this celebration for the remainder of the post, click here to switch fonts.

Before we get started, make a note of the supported platforms for this release:

  • .NET Framework 4
  • .NET Framework 4.5
  • .NET Framework 4.5 for Windows Store apps
  • Silverlight 5
  • Windows Phone 7.5

Although this post was authored on Windows 8 using Visual Studio 2012 for screenshots, Rx can be used with Visual Studio 2010, and/or on older versions of the operating system as well. (For example, at the time of writing this post, Windows Phone development wasn’t yet publicly available in Visual Studio 2012, so that’d be a case where you have to use Visual Studio 2010 for the time being.)

Reactive Extensions for JavaScript (RxJS) users can expect the v2.0 release – including support for WinJS used in Windows Store apps – to hit the web very soon. Watch this blog for the announcement

...

image..."

Reactive Extensions SDK

Reactive Extensions v2.0 SDK

Reactive Extensions (Rx) is a library to compose asynchronous and event-based programs using observable reactive data sequences and LINQ-style query operators.

Asynchronous, event-driven "reactive" programming is way too hard in today's world of development tools and frameworks. The huge amount of manual and error-prone plumbing leads to incomprehensible and hard to maintain code. As we reach out to services in the cloud, asynchronous programming is the way of life, requiring a fresh look on the problems imposed by reactive programming.

Centered around the concept of observable data sequences, Reactive Extensions (Rx) provides a framework that takes care of the hard parts of reactive event stream programming. Instead of getting lost in the jungle of asynchrony, you now can start dreaming about the endless possibilities of composing queries over event streams using familiar LINQ syntax with lots of complex event processing extensions.

For more information about these technologies, visit the Reactive Extensions (Rx) Homepage.

Microsoft Downloads - Reactive Extensions (Rx) v2.0

Reactive Extensions (Rx) is a library to compose asynchronous and event-based programs using observable reactive data sequences and LINQ-style query operators.

Quick details

Version: 2.0.20814
Date published: 8/15/2012

Language:English

Rx v2.0 SDK.msi, 2.8 MB

Overview

Asynchronous, event-driven "reactive" programming is way too hard in today's world of development tools and frameworks. The huge amount of manual and error-prone plumbing leads to incomprehensible and hard to maintain code. As we reach out to services in the cloud, asynchronous programming is the way of life, requiring a fresh look on the problems imposed by reactive programming. Centered around the concept of observable data sequences, Reactive Extensions (Rx) provides a framework that takes care of the hard parts of reactive event stream programming. Instead of getting lost in the jungle of asynchrony complexity, you now can start dreaming about the endless possibilities of composing queries over asynchronous data sources.

..."

 

Related Past Post XRef;
RX? Reactive Extensions? If only there was a site dedicated to introducing the world to it...

Wednesday, August 15, 2012

RX? Reactive Extensions? If only there was a site dedicated to introducing the world to it...

IntroToRX

"IntroToRx.com is the online resource for getting started with the Reactive Extensions to .Net. Originally starting life as a blog series, it has now flourished into an online book. You can read it online here via the website, or get a copy of the Kindle edition for reading offline.

While the content is complete, save some changes from my editor, the site is still under construction. Feel free however to start reading what is ready now. The targeted version is 1.0.10621.0 (NuGet: Rx-Main v1.0.11226). Note that Rx has a v2.0 Beta, which has some new cool features. Those features are largely an addition to the v1 functionality, so you are still best off learning v1 before getting too carried away with the v2 features.

While the site is getting its finishing touches, you can be assured that we are busily working away on getting content for the soon to be released version 2.0 of Rx.

image..."

What's also awesome is that not only is this a great intro to Reactive Extensions, that the content is easily viewable on the web, but it's also freely available in Kindle/Mobi form too!

image

Thursday, August 02, 2012

Think Rx (Reactive Extensions) is just for Stocks and stuff like that? Here's a cool use with the FileSystemWatcher

Matthieu MEZIL - FileSystemWatcher, Rx and Throttle

"Imagine that we want to be notified if a directory files changed.

In general, when we use files, we don’t need to have a real time application.

Moreover, if we change many files in same time, we perhaps don’t need to have many notification and one notification at the end could be enough.

For this case, Rx and particularly Throttle method is very useful.

...

Now we can use the observable like this:

var fileWatcher = new FileWatcher(".", "*.*", TimeSpan.FromSeconds(5));
var fileObserver = fileWatcher.GetObservable().Subscribe(fce => { /*TODO*/ });

Imagine that if we have n changes on the directory in less than 5 seconds between two consecutive changes.
With this code, we have one only notification, 5 seconds after the last one.

image..."

Most of the time I hear Rx being mentioned for use in high volume cases like stocks, high event loads, stuff that the normal dev might not see very often. And so the normal dev might think they can ignore Rx.

This is a great example that the normal dev should be able to easily grok and easily see the value that Rx can provide them...

Thursday, February 09, 2012

Free "Introduction to Reactive Extensions" on-demand video training available, with 8 sessions and growing

Mr. Bool - Introduction to Reactive Extensions for .net (not finished yet)

"As MSDN defines it “The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers.” We will look at every piece in details in the upcoming videos.

image

..."

Mr. Bool (aka Ayad Boudiab) is doing it again, providing a cool set of free on-demand training videos. All he asks is that you, optionally, +1 it the first time you hit the site...

(via .Net reddit - Introduction to Reactive Extensions for .net - online course with a lot of free videos)

Thursday, September 22, 2011

"Building Windows Phone Apps: A Developer’s Guide" free PDF from those in the field (Think "Been there, done that, wrote the book...")

Building Windows Phone Apps: A Developer’s Guide

"This book combines useful, technical information about the platform, written by those who’ve been there and done it, with some stories about the people and the apps they’d written. The book will act as a handy reference that gives you a “puddy up” into developing on the platform and, importantly, helps you to avoid making the same mistakes others have made.

...

image"

Here's a snap of the PDF:

SNAGHTMLad65088

And the TOC;

Table of contents
Table of contents .................................................................................................................................... 2
Foreword ................................................................................................................................................. 3
Contributors ............................................................................................................................................ 4
Introduction ............................................................................................................................................ 9
Interlude: Football Crazy ....................................................................................................................... 11
The Windows Phone Developer Tools .................................................................................................. 14
Interlude: Going underground .............................................................................................................. 23
The Application Lifecycle ...................................................................................................................... 25
Interlude: Snow+Rock ........................................................................................................................... 29
Accessing Phone Features (launchers, choosers and input features) .................................................. 31
Interlude: Interactive sci-fi movies ....................................................................................................... 57
Location Aware Applications and Mapping .......................................................................................... 59
Interlude: How much is that taxi journey? ........................................................................................... 83
Reactive Extensions for .NET ................................................................................................................ 85
Interlude: Dude, where’s my car? ......................................................................................................... 92
Marketplace – Designing for First Time Approval................................................................................. 94
Interlude: Jobsite.co.uk goes mobile .................................................................................................... 98
A tour of libraries and samples ........................................................................................................... 100

Some light and inexpensive reading for the weekend... :)

(via ScottLogicBuilding Windows Phone Apps – a free WP7 eBook)

Wednesday, June 29, 2011

Rx Released - Reactive Extensions v1.0 (stable) now available (and v1.1 experimental available for you to play with too)

Channel 9 - Charles - Announcing the Official Release of Rx!

You've learned a lot about Rx (Reactive Extensions) on C9 over the years. You've seen Rx go from incubation stage to DevLabs project to having a happy home on the MSDN Data Developer Center.

Today, we're very pleased to announce that Rx is now officially official with the final V1 release!

Rx V1 will ship as a stable release with professionally-written technical documentation, developer samples and...ready? Product support!! :)

..."

Reactive Extensions Team Blog - Reactive Extensions v1.0 Stable and v1.1 Experimental available now!

"We're happy to announce the first official releases of Reactive Extensions v1.0 Stable and v1.1 Experimental:

More information will be available on Channel 9 and the Rx forums. Also check out the Rx homepage on MSDN Data Developer Center.

..."

What is Rx, you ask?

Channel 9 - Rx Workshop - Rx Workshop: Introduction

What is Reactive Extensions? What is reactive programming? How is it used in the real world?

Welcome to the Rx Workshop! Rx developers (they design and implement Rx) Wes Dyer and Bart De Smet will guide you through a series of sessions that will get you up to speed with Rx fundamentals rather quickly. Tune in!

See the rest of the Rx Workshop tutorials.

http://channel9.msdn.com/Series/Rx-Workshop/Rx-Workshop-Event-Processing
http://channel9.msdn.com/Series/Rx-Workshop/Rx-Workshop-Observables-versus-Events
http://channel9.msdn.com/Series/Rx-Workshop/Rx-Workshop-Unified-Programming-Model
http://channel9.msdn.com/Series/Rx-Workshop/Rx-Workshop-Writing-Queries
http://channel9.msdn.com/Series/Rx-Workshop/Rx-Workshop-Schedulers 

[GD: Post Leached in full]

 

Related Past Post XRef:
Reactive Extensions graduates from MSDN Dev Labs to MSDN Data Developer Center
“Exploring Reactive Extensions”

Rx:SSSsssss... (That's the sound of Reactive Extensions, Windows Phone 7 and a Snake...)

Tuesday, March 01, 2011

Reactive Extensions graduates from MSDN Dev Labs to MSDN Data Developer Center

Matthew Podwysocki - The Reactive Extensions Extensions Now Live on MSDN Data Developer Center

"As you may have noticed, the Reactive Extensions for .NET and JavaScript have a new home, moving from MSDN Dev Labs to the MSDN Data Developer Center. The new home will provide you with not only how to get them, but also a beginner’s guide and other additional resources including hands on labs, videos, tutorials, forums and much more.

First Off, How Do I Get Them?

There are several ways to get your hands on the Reactive Extensions (Rx) either by installing them via the Reactive Extensions for .NET Home or via NuGet which we’ll cover below. The Reactive Extensions is available on multiple platforms such as:

  • .NET 3.5 SP1
  • .NET 4
  • Silverlight 3
  • Silverlight 4
  • Windows Phone 7
  • XBox and Zune via XNA
  • JavaScript

The great news about getting the Windows Phone 7 is that you get the Reactive Extensions out of the box as it shipped on the ROM itself. Since it shipped with the phone, there have been updates and you can get the latest always by visiting the site or via NuGet.

Now About NuGet…

Besides a direct download on the Rx Home Page, you can also get them via NuGet.

...

Next, in the search window, type Rx and hit enter to search. You’ll see that we ship quite a few packages already and have since NuGet was first introduced.

image1

..."

Good to see this move forward in its growth... I've been hearing more about the Reactive Extensions recently and really need to try to take a peek at it...

Monday, November 22, 2010

“Exploring Reactive Extensions”

LessThanDot - Exploring Reactive Extensions - IObservable and IObserver

“A while ago, a coworker (Jon) showed us a presentation over lunch that he had given at the local alt.net user group on the Reactive Extensions for .NET. I was pretty unfamiliar with the subject, but once I got the lowdown from this presentation it was quite clear that this was something I'd need to explore. At the most basic level, the reactive extensions are about setting up your objects to react to something they are subscribed to. In the presentation, he used an analogy of a reversed, or push-based IEnumerable, and I like that a lot. There is a ton of cool stuff in this library that I hope to get into later, but it all hinges on that idea.

I've only recently been getting back into windows desktop development (coming from a more web-centric environment) so it is possible that I'm overreacting to the pain of dealing with events in windows forms, but this paradigm really appeals to me. It gives you a way to call methods on your observers from the object they are observing, through a standard set of interfaces. The simpler parts are possible using the normal event mechanisms found in .net, but keeping the interaction limited to a standard set of interfaces (and explicitly calling the code from a central location) feels much simpler to me.

pagesnap…”

The Reactive Extensions is something I’d like to learn more about. From what I’ve seen, it looks interesting…