现在微软已经在devlabs上发布了适当版本的Rx框架,这个问题已经不再适用了
原始问题
我已经下载了Silverlight 3工具包并重新定义了System.Reactive.dll,以便在.NET 3.5 CLR上工作,我真的很享受使用它.
我想知道的是,我可以发货吗?
我想我可以在MS-PL许可下发货,但同时感觉我不应该,因为我不得不重新设置dll,因为我还没有看到任何微软关于发布反应框架的官方消息.
另一种选择是要么IObservable直到.NET 4.0,或者编写我自己的系统ripoff版本.我可能最终会编写一个ripoff版本,即使这会浪费一些时间.
有没有其他人想过这个问题,是否有其他人使用/运送该DLL?
我使用System.IO.Pipes(控制台应用程序和GUI应用程序)在同一台计算机上建立了两个独立进程之间的通信.控制台应用程序NamedPipeServerStream在GUI应用程序NamedPipeClientStream连接到现有管道时创建管道.我经常更新GUI.我的问题是,命名管道技术是处理这种情况最有效的方法.第二个问题是Reactive Extensions RX是否适合这种情况以及如何?先感谢您.
服务器
using System;
using System.IO;
using System.IO.Pipes;
using System.Threading;
namespace PipeApplicationSender
{
class ProgramPipeTest
{
static void Main(string[] args)
{
ProgramPipeTest Server = new ProgramPipeTest();
Thread ServerThread = new Thread( Server.ThreadStartServer );
ServerThread.Start();
}
public void ThreadStartServer()
{
// Create a name pipe
using (NamedPipeServerStream pipeStream = new NamedPipeServerStream("mytestpipe"))
{
// Wait for a connection
pipeStream.WaitForConnection();
Console.WriteLine("[Server] Pipe connection established");
using (StreamReader sr = new StreamReader(pipeStream))
{
string temp;
// We read a line from the pipe …Run Code Online (Sandbox Code Playgroud) 可以说我有两个可观察的流
Observable<Book> books;
Observable<Movie> movies;
Run Code Online (Sandbox Code Playgroud)
如果它们具有匹配的属性,我如何加入这些?像下面的psudo代码:
Observable<BookMoviePair> pairs = books.join(movies)
.where((book, movie) -> book.getId() == movie.getId()))
.return((book, movie) -> new BookMoviePair(book, movie));
Run Code Online (Sandbox Code Playgroud) 我正在研究Angular 1.5应用程序与RxJS之间的集成.我正在考虑直接使用RxJs,但后来发现了以下内容,虽然它已经过几个月没有更新了.
https://github.com/Reactive-Extensions/rx.angular.js
推荐哪种方式?订阅时还应该在哪里进行?在控制器?还是在服务方面?
有没有人有更多的信息?我真的想将我的Angular应用程序与RxJs集成,但我发现很难找到具体的文档或指南.
我是Observable样式编程的新手.我有一个问题:我希望在组件之间跨应用程序共享用户信息 - 我使用BehaviorSubject来共享此信息.这是通过将BehaviorSubject共享为AuthInfo来启发的.如果我可以在我的应用程序组件中共享包含uid的AuthInfo,为什么我可以使用它来共享我的用户对象数据?
问题是,用户对象,我是从Firebase获得的.所以它是一个Observable,我不知道如何将它分配给一个行为主题.所以这是我尝试的代码:
@Injectable()
export class AuthService {
static UNKNOWN_USER = new AuthInfo(null);
static EMPTY_USER = new User(null, null, null, null);
authInfo$: BehaviorSubject<AuthInfo> = new BehaviorSubject<AuthInfo>(AuthService.UNKNOWN_USER);
userInfo$: BehaviorSubject<User> = new BehaviorSubject<User>(AuthService.EMPTY_USER);
constructor(private auth: FirebaseAuth, private db:AngularFireDatabase, @Inject(FirebaseRef) fb) {
//firebase way to see if user is login or not
this.auth.subscribe(user => {
if (user) {
const authInfo = new AuthInfo(user.uid);
this.authInfo$.next(authInfo);
//This is the part I do not know how to do
[OPTION 1]: this.userInfo$.next(findUserByuid(user.uid)) ?? - error
[OPTION …Run Code Online (Sandbox Code Playgroud) 首先,我必须说我对反应式编程没有多少经验.
由于JDK 9(Flow及其嵌套接口)中只有少数接口,因此JDK 9显然不包含像RxJava这样的反应库.
在Javadoc,有对的implentations一些例子Publisher,Subscription和Subscriber.但这些似乎相当低级,没有任何反应操作员或处理背压.
那么将这些接口包含在JDK中有什么意义呢?
反应库的供应商是否应该使用它们,以便那些Java实现(如RxJava)使用一组通用的接口?(类似于JPA和Hibernate?)
我正在常见的场景中工作,我希望访问存储库的子集,而不用担心必须保持更新,例如“获取价格大于 10 的所有订单”。我已经实现了一个解决方案,但有两个问题(列在最后)。
存储库的子集可以通过相当于的东西来实现
var expensiveOrders = Repository.GetOrders().Where(o => o.Price > 10);
但这是一个IEnumerable,不会在原始集合更新时更新。我可以添加 的处理程序CollectionChanged,但如果我们想访问更多子集怎么办?
var expensiveOrdersFromBob = expensiveOrders.Where(o => o.Name == Bob);
Run Code Online (Sandbox Code Playgroud)
我们还必须连接一个集合 - 也为这个集合进行了更改。实时更新的概念让我想到了 Rx,因此我开始构建一个ObservableCache,其中包含ObservableCollection自动更新的项目和用于通知的 RX 流。(该流也是在底层更新缓存的内容。)
class ObservableCache<T> : IObservableCache<T>
{
private readonly ObservableCollection<T> _cache;
private readonly IObservable<Tuple<T, CRUDOperationType>> _updates;
public ObservableCache(IEnumerable<T> initialCache
, IObservable<Tuple<T, CRUDOperationType>> currentStream, Func<T, bool> filter)
{
_cache = new ObservableCollection<T>(initialCache.Where(filter));
_updates = currentStream.Where(tuple => filter(tuple.Item1));
_updates.Subscribe(ProcessUpdate);
}
private void ProcessUpdate(Tuple<T, CRUDOperationType> update)
{
var item …Run Code Online (Sandbox Code Playgroud) c# repository observablecollection reactive-programming system.reactive
我有一个 Rx.Observable.webSocket 主题。我的服务器端点无法处理同时接收的消息(<25 毫秒)。现在我需要一种方法来扩展我的 websocket 主题的 next() 调用。
我创建了另一个主题requestSubject并订阅了这个。然后调用订阅中的下一个 websocket。
requestSubject.delay(1000).subscribe((request) => {
console.log(`SENDING: ${JSON.stringify(request)}`);
socketServer.next(JSON.stringify(request));
});
Run Code Online (Sandbox Code Playgroud)
使用延迟将每个下一个调用转移到相同的延迟时间,然后所有下一个调用在同一时间之后发出......这不是我想要的。
我试过delay,throttle,debounce但它并不适合。
以下应该说明我的问题
Stream 1 | ---1-------2-3-4-5---------6----
after some operation ...
Stream 2 | ---1-------2----3----4----5----6-
Run Code Online (Sandbox Code Playgroud) 说我有一个类型T:
class T {
public int identifier; //Arbitrary but unique for each character (Guids in real-life)
public char character; //In real life not a char, but I chose char here for easy demo purposes
}
Run Code Online (Sandbox Code Playgroud)
我有一个预定义的有序标识符序列:
int[] identifierSequence = new int[]{
9, 3, 4, 4, 7
};
Run Code Online (Sandbox Code Playgroud)
我现在需要订购IObservable<T>产生以下对象序列的an :
{identifier: 3, character 'e'},
{identifier: 9, character 'h'},
{identifier: 4, character 'l'},
{identifier: 4, character 'l'},
{identifier: 7, character 'o'}
Run Code Online (Sandbox Code Playgroud)
使生成的 IObservable 产生hello. 我不想使用 ToArray,因为我想在对象到达时立即接收它们,而不是等到所有内容都被观察到。更具体地说,我希望像这样接收它们: …
我有两个Observables,我们称它们为PeanutButter和Jelly。我想将它们组合到一个Sandwich Observable. 我可以使用:
Observable<PeanutButter> peanutButterObservable = ...;
Observable<Jelly> jellyObservable = ...;
Observable<Sandwich> sandwichObservable = Observable.combineLatest(
peanutButterObservable,
jellyObservable,
(pb, j) -> makeSandwich(pb, j))
Run Code Online (Sandbox Code Playgroud)
问题是 RX在发射第一个组合之前等待第一个PeanutButter和第一个Jelly发射,Sandwich但Jelly可能永远不会发射,这意味着我永远不会得到第一个Sandwich。
我想组合这两个提要,以便在发出任一提要的第一个项目时立即发出组合项目,无论另一个提要是否尚未发出任何内容,我该如何在 RxJava 中执行此操作?
c# ×4
java ×3
rx-java ×3
rxjs ×3
angular ×1
angularjs ×1
java-9 ×1
javascript ×1
licensing ×1
observable ×1
reactive ×1
repository ×1
rx-java2 ×1
silverlight ×1
sorting ×1
wpf ×1