SwiftUI compatibility plan

I thought it prudent to start an issue which can describe the necessary steps forward for releasing a SwiftUI compatible version of ReSwift.
At this time, I have a port of ReSwift in mjarvis/swiftui which conforms StoreType to ObservableObject. This allows for one to use @ObservedObject or @EnvironmentObject property wrappers to access a store, allowing direct usage of store.state.xyz in view bodies.
There are a number of concerns that need to be taken care of before this branch can be released in a supported manner.
We can split off individual issues and a milestone for completing the work below after #1 is agreed upon.
1. Implementation
Is my choice of implementation ideal? Perhaps there are other options than making StoreType: ObservableObject.
Maybe something around calling subscribe to create a publisher from an injected store?
Do others have suggestions? Or just need to get approvals for existing implementation.
2. Backwards-compatibility
We need to determine how we will include this functionality in a general ReSwift release. It is important that we maintain backwards compatibility for UIKit, and allow for bug fixes / feature release to continue for both paths.
3. Performance
Some general performance testing needs to be done to validate that this is an okay solution for a production environment.
Questions arise such as: How many/often state changes can occur before we overwhelm the SwiftUI diffing? Do we need to do some sort of diffing ourselves before?
4. Documentation & Examples
Documentation and examples need to be split and updated to account for UIKit vs SwiftUI paths.

I am quite new to Swift but I am not new to Redux. I used it in other languages.
Seen from other frameworks and seen from functional reactive programming pattern which combines a iterator and a subscribable it should be fine IMHO. You can always have a look at this: https://redux.js.org/recipes/usage-with-typescript
I have not used the new SwiftUI states... my question is if any other thing like ReactiveSwift RxSwift can be wrapped around the SwiftUI. (https://github.com/ReactiveX/RxSwift) Having it decoupled means creater flexibility and longevity.
Thanks to you guys I just wrote my first watchKitApp at industry strength.

Rx is a generic abstraction of computation expressed through Observable interface.
https://github.com/ReactiveX/RxSwift
https://github.com/RxSwiftCommunity/RxState

If we think about ReSwift as Redux, and as SwiftUI as React, it becomes clear that the code that glues both together should live in a different package, as we already did for ReSwift-Thunk. It would be the equivalent of https://react-redux.js.org/
I would only touch this main package to improve performance, fix bugs, improve the API, types, add more tests and maybe change its implementation using more modern Swift (in case it's necessary, of course).
In summary, I think the core package should contain the store, the reducers (I think a better way of composing reducers could be neat), and the middleware layer, and everything else on top must happen in opt-in, third party libs.

@dani-mp Your suggestion to make reducer composition nicer sounds interesting. You could create an issue with "help wanted" and "discussion needed" and propose something for others to pick up (including me eventually :))

@dani-mp Thats a good point. Creating a separate library, perhaps ReSwift-SwiftUI which contains this glue?
I'll look into how that would be possible, and if it would have the same kind of performance as the store refactor that I've done in my branch.

@DivineDominion done, sir: https://github.com/ReSwift/ReSwift/issues/457
@mjarvis I don't know much about SwiftUI because I mostly work with JavaScript and ClojureScript these days (although I still have a small tvOS project in production where I use ReSwift), but if for some reason, and to play nicely with SwiftUI, the API should expose any other kind of low-level primitives (thinking about Combine, for instance) instead of the current subscription, I think that'd be ok as long as people not using SwiftUI could use them as well from normal UIKit/AppKit code. AFAIK, react-redux uses a set of wrappers (HOCs and hooks) on top of the original Redux's listeners implementation, which I believe are similar to our subscription-based mechanism here.

Here is a minimal SwiftUI "glue" that I've managed to get working:
protocol ObservableStoreType: DispatchingStoreType, ObservableObject {

    associatedtype State: StateType

    /// The current state stored in the store.
    var state: State! { get }
}

class ObservableStore<State: StateType>: Store<State>, ObservableStoreType {

    override func _defaultDispatch(action: Action) {
        objectWillChange.send()
        super._defaultDispatch(action: action)
    }
}

Usage:
import SwiftUI
import ReSwift

protocol HasName {
    var name: String { get }
}

struct ChangeName: Action {
    let to: String
}

func nameReducer(action: Action, state: String?) -> String {
    switch action {
    case let action as ChangeName:
        return action.to
    default:
        return state ?? ""
    }
}

struct ContentView<S: ObservableStoreType>: View where S.State: HasName {
    @ObservedObject var store: S

    var body: some View {
        VStack {
            Text(store.state.name)
            TextField("Name", text: Binding(
                get: { self.store.state.name },
                set: { self.store.dispatch(ChangeName(to: $0)) }
            ))
        }
    }
}

struct ContentView_Previews : PreviewProvider {
    private struct MockState: StateType, HasName {
        var name: String = "mock"
    }

    private static func mockReducer(action: Action, state: MockState?) -> MockState {
        return MockState(
            name: nameReducer(action: action, state: state?.name)
        )
    }

    static var previews: some View {
        ContentView(store: ObservableStore(reducer: mockReducer, state: MockState()))
    }
}

This seems pretty nice. Simple minimal library, just need to replace Store(...) with ObservableStore(...) to get all the SwiftUI compatibility.
I'd like to figure out a way to use environment objects to pass the store around while maintaining the ability to keep views generic, but so far its feeling more awkward to go that route.

Alternative, which allows for environment object and some nicer generic forms:
(omitting Subscriber and AnyObservableStore implementation details, but I have this working)
struct ContentView: View {
    var body: some View {
        Subscriber { (state: HasName, dispatch: @escaping DispatchFunction) in
            VStack {
                Text(state.name)
                TextField("Name", text: Binding(
                    get: { state.name },
                    set: { dispatch(ChangeName(to: $0)) }
                ))
            }
        }
    }
}

Preview replaced with:
    static var previews: some View {
        ContentView()
            .environmentObject(
                AnyObservableStore(store: ObservableStore(reducer: mockReducer, state: MockState()))
        )
    }

Hi @mjarvis, thank you for your work!
I’m unfortunately unable to compile my project using your mjarvis/swiftui branch and the sample code from ReSwiftUI-StoreSubscriber.zip
I get the following build error:
Type 'ObservableStore<State>' does not conform to protocol 'ObservableStoreType'

Full code here: https://github.com/pianostringquartet/prototype/blob/add-reswift/prototype/ContentView.swift

Note: I can run the ReSwiftUI-StoreSubscriber project locally and, working off the main ReSwift branch, I can also locally run the approach described here: https://github.com/ReSwift/ReSwift/issues/424#issuecomment-532050246)

@pianostringquartet ReSwiftUI-StoreSubscriber.zip should work using the latest release of ReSwift, rather than my SwiftUI branch.

For reference: My plan this week is to try to implement a shim that mixes the ideas above, while also resolving the issue in #461
My rules are:

Views must be able to be generic over the store (only know about a subset of state)
Views must be able to apply state selectors and modifiers before SwiftUI diffing is triggered
It must be obvious and simple how to subscribe

Here are some possible interfaces that I'll explore (note: pseudocode, these do not compile)
1
struct MyView<S: PublishingStoreType>: View where S.State: HasTitle {
  let store: S

  var body: some View {
    Subscriber(store.statePublisher.map(\.title).removeDuplicates()) { title in
      Text(title)
    }
  }
}

2
struct MyView<S: PublishingStoreType>: View where S.State: HasTitle {
  let store: S

  var body: some View {
    store.subscribe {
      $0.map(\.title).removeDuplicates()
    } content: { title in
      Text(title)
    }
  }
}

3
struct MyView<S: PublishingStoreType>: View where S.State: HasTitle {
  let store: DispatchingStoreType
  @ObservableObject var state: String

  init(store: S) {
    self.store = store
    self._state = store.statePublisher.map(\.title).removeDuplicates()
  }

  var body: some View {
    Text(state)
  }
}

4
struct MyView<S, SubState>: SubscribingView<S, SubState> where S.State: HasTitle {

  let selector = { state in
    state.map(\.title).removeDuplicates()
  }

  @ViewBuilder func body(state: SubState) -> some View {
    Text(state)
  }
}

Option 1 seems needlessly complicated with the subscriber view type needing to be explicitly known.
Option 2 looks the closest to existing ReSwift code, which seems like a very good thing.
Options 3 and 4 are nice in that they make the actual body code very clear, but add a lot of complexity elsewhere.
At this time option 2 seems like the best choice for me to experiment with.
I can also see passing dispatch into content:  alongside state in order to avoid having to use self.store.dispatch(...)
All options may also allow for removal of explicit .removeDuplicates() by re-introducing automaticallySkipsRepeats functionality on Equatable substate selections.
All options I can see having an extremely nice way of isolating the view itself from subscription code, by having a raw, private view which takes the state directly: (Example here using option 2 above)
struct MyView<S: PublishingStoreType>: View where S.State: HasTitle {
  let store: S

  var body: some View {
    store.subscribe {
      $0.map(\.title).removeDuplicates()
    } content: { title in
      _MyView(title: title)
    }
  }
}

private struct _MyView: View {
  let title: String

  var body: some View {
    Text(title)
  }
}

This isolation has numerous benefits including testability, mocking, view/state replacement, etc. (And just raw clean readability)

Latest rendition: ReSwiftUI-PublishingStore.zip
Example View:
struct ContentView<S: PublishingStoreType>: View where S.State: HasName {
    let store: S

    var body: some View {
        store.subscribe(\.name) { name in
            VStack {
                Text(name)
                TextField("Name", text: Binding(
                    get: { name },
                    set: { self.store.dispatch(ChangeName(to: $0)) }
                ))
                Button(action: { self.store.dispatch(ChangeName(to: "Test")) }) {
                    Text("Update")
                }
            }
        }
    }
}

This includes functionality that supports automaticallySkipsRepeats on Equatable substate. (Update button included to tap to see in console that the onReceive is skipped)
Also available is an alternate func subscribe which takes a second transform: parameter, allowing one to manually transform the substate publisher. This alternative bypasses automaticallySkipsRepeats, allowing one to manually remove duplicates / filter updates, etc for more control over when updates come through.

Working on setting up https://github.com/ReSwift/ReSwift-SwiftUI which will start with the bindings from my last comment.
Once this is up and running all discussion + issues will move there.
We'll update this repo's README to include a link there once available.

After some riffing, heres another very minimal option:
class Subscriber<Value>: ObservableObject, StoreSubscriber {
    @Published private(set) var value: Value!

    init<S: StoreType>(_ store: S, transform: @escaping (ReSwift.Subscription<S.State>) -> ReSwift.Subscription<Value>) {
        store.subscribe(self, transform: transform)
    }

    init<S: StoreType>(_ store: S, transform: @escaping (ReSwift.Subscription<S.State>) -> ReSwift.Subscription<Value>) where Value: Equatable {
        store.subscribe(self, transform: transform)
    }

    func newState(state: Value) {
        value = state
    }
}

struct ContentView<S: StoreType>: View where S.State: HasName {
    private let store: S

    @ObservedObject private var name: Subscriber<String>

    init(store: S) {
        self.store = store
        name = Subscriber(store) { $0.select(\.name) }
    }

    var body: some View {
        VStack {
            Text(name.value)
            TextField("Name", text: Binding(
                get: { name.value },
                set: { store.dispatch(ChangeName(to: $0)) }
            ))
            Button(action: { store.dispatch(ChangeName(to: "Test")) }) {
                Text("Update")
            }
        }
    }
}

This seems more like idiomatic SwiftUI to me, more similar to the @FetchRequest type system for core data (A friend and I both tried to replicate something closer to that to integrate the subscribe into the property wrapper, but unfortunately apple does not publicly expose the capabilities for a property wrapper to indicate for the view to re-render)
This is also much cleaner glue -- Not even an extension on Store, just a simple observable object that deals with the subscription. The initializers are even not necessary -- I've included them only to force the user to subscribe immediately, rather than allow for a runtime error if one neglected to subscribe via the store.
The ideal situation here if the capabilities were added would be able to do something like @StoredState(\.name) var name: String and have the property wrapper subscribe + notify the view, but as mentioned above, we can't notify the view, and passing the store into this option would be quite awkward.
One downside to this option is it moves the subscriptions up to the root of the view, which means if we have multiple subscriptions, any one changing causes the entire view's tree to be diff'd by SwiftUI, whereas the other, inline subscribe functionality would reduce the diffing down to only the content within the subscription, but, as mentioned, this is how they intend for things to work with core data, etc. so maybe its an okay downside?

Hi @mjarvis!
This works pretty well! Works also great with substates. I added protocols for each substate and combined them into on isAppState protocol.
But I still ran into some issues with SwiftUI redrawing views too often. I solved it in my case by making Value equatable and adding a simple check in the newState method:
class Subscriber<Value: Equatable>: ObservableObject, StoreSubscriber {
	@Published private(set) var value: Value!

	init<S: StoreType>(_ store: S, state: StateType, transform: @escaping (ReSwift.Subscription<S.State>) -> ReSwift.Subscription<Value>) {
		store.subscribe(self, transform: transform)
	}

	init<S: StoreType>(_ store: S, transform: @escaping (ReSwift.Subscription<S.State>) -> ReSwift.Subscription<Value>) where Value: Equatable {
		store.subscribe(self, transform: transform)
	}

	func newState(state: Value) {
		if value != state {
			value = state
		}
	}
}

@mjarvis I've deleted my previous comment as I had an error in my code. Your code works pretty well, however, somehow even though my States are Equatable it does not skip repeats in my code and keeps redrawing my views, especially causing an issue with a SwiftUI SpriteView Not sure what I do wrong.
I had to add a check in the newState method in order to make it work. I'm subscribing to individual values of substates like \.substateA.frame or complete states \.substateB at times.
That's how I use your above modified code in my app:
class Subscriber<Value: Equatable>: ObservableObject, StoreSubscriber {

	@Published private(set) var value: Value!

	init<S: StoreType>(_ store: S, transform: @escaping (ReSwift.Subscription<S.State>) -> ReSwift.Subscription<Value>) {
		store.subscribe(self, transform: transform)
	}

	func newState(state: Value) {
		if value != state {
			value = state
		}
	}
}

@marcoboerner Interesting. In my testing the secondary initializer I provided handled that case by passing equatable state onto the automatic skip system built into ReSwift. It could be some swift version has changed the handling of Generics such that that is not working as intended. I'll do some more testing when I have some time, but your solution looks fine as well for your use case.

@mjarvis I might have time to experiment with SwiftUI in the summer on a small-scale project, and would of course consider ReSwift underpinnings :) Do you need anything in particular (Re: the 'help wanted' tag)? What is the current situation of backwards-compatibility, cf. the initial comment's

We need to determine how we will include this functionality in a general ReSwift release. It is important that we maintain backwards compatibility for UIKit, and allow for bug fixes / feature release to continue for both paths.

@DivineDominion current solutions are completely stand-alone, and do not modify ReSwift source code at all.
Basically what needs to happen to complete this would be to test + determine which solution we want to publicize / release in some fashion, and how we want to release it. (Include in ReSwift? Separate repo? Only document solutions?)

I'm dabbling with SwiftUI and (maybe due to lack of experience) tend towards making the store available as an @EnvironmentObject to avoid having to pass it around in view initialization.
Especially to have a means to dispatch actions in e.g. toolbar buttons that don't need to read any state. But for that, I found a little action dispatcher to be helpful.
class Dispatcher: ObservableObject {
    private let store: AppStore

    init(store: AppStore) {
        self.store = store
    }

    func dispatch(_ action: ReSwift.Action) {
        store.dispatch(action)
    }
}

@main
struct MyApp: App {
    private let store = AppStore()
    private let dispatcher: Dispatcher

   init() {
        self.dispatcher = Dispatcher(store: store)
    }

    var body: some Scene {
        WindowGroup {
            NavigationView { ... }
            .environmentObject(dispatcher)
        }
    }
}

Places where I was just passing through the store to inner views now don't have to know about the store at all.

@DivineDominion How are you handling modularization / isolation with environment? The problem I had with doing that was that pulling an object from the environment requires knowing its entire type eg Store<AppState>, whereas I want to be able to isolate views to some sub-state, eg Store<S: HasSomeData>.

@mjarvis I initially started to go without beloved ReSwift from scratch and add state management piecemeal. I started with "Connectors" that map AppState to a per-view sub-state, and also map per-view actions to AppStore-compatible actions. Basically just two-way adapters to narrow down the focus. See: https://swiftwithmajid.com/2021/02/03/redux-like-state-container-in-swiftui-part4/
That looked very nice at first, but this breaks down with nested hierarchies. I attached a short comment from my own notes below with an example below the divider. E.g. an App that has a SidebarView (master pane) which has a ToolbarButton, you have 2 hops, and one "connector" per hop. The first hop looked great, but when I added the second hop to the inner view, the toolbar button, I noticed that I have to carry the toolbar-local state around in the sidebar just to make the connector. And what's worse, the toolbar button doesn't need state (so it's struct Empty: Equatable {}) but produces actions, so I had to have the button action bubble up to the sidebar and then bubble up to the app's store.
That sucked.
I'm not convinced that per-view action types are what I absolutely need, so an app-global action dispatcher is fine with me. That's what I proposed in my previous comment. It's state agnostic and just dispatches any ReSwift.Action to the store that was initially assigned, i.e. here the main AppStore.
Sub-state selection is another beast that this connector approach encapsulated really well. For now, since the transition to ReSwift and your code is not even a day old, I am rolling with your MyView<S: StateType>: View approach and inject the state and subscribe in there. But I do believe that I'd prefer to prepare the subscription object in advance, not inside the view's init.
I tried this out in this commit:   https://github.com/ChristianTietze/NowNowNowApp/commit/b1689881c7712b23c5e761fe193587ded631b199 -- you can have a look, and I'm open to suggestions :)

Connectors increase boilerplate as view hierarchy grows
Connectors to bridge sub-states and per-component-actions to the main app state become a bit weird when you have nested view hierarchies.
Then you need to either:

pass through the sub-component's state through intermediary views, and bubble-up sub-component's actions, or
declare Store<AppState, AppAction> as an @EnvironmentObject and access it from deep in the view hierarchy.

It's simple when you start at the App and then hand a mapped Connector down one level:
struct MyApp: App {
    @StateObject var store = AppStore()
    var body: some Scene {
        WindowGroup {
            MyView(viewModel: store.connect(using: MyViewConnector())
        }
    }
}

But once you're inside that level with its narrowed-down ViewModel, you cannot create a connector that bridges directly from AppState -> SubSubState anymore.
You have to make do with a mapping of SubState -> SubSubState because this component's store (Store<SubState,_>) doesn't know the AppState at all:
struct MyView: View {
    struct SubState { ... }
    enum SubAction { ... }
    typealias ViewModel: Store<SubState, SubAction>
    @ObservedObject var viewModel: ViewModel

    var body: some Scene {
        MySubView(viewModel: ???)
    }
}

This, in turn, means that you:

need to know both the sub-state and the sub-sub-state in the component so it can hand it down;
need to bridge actions from the sub-sub-component upwards, too.

struct MyInnerView: View {
    struct SubSubState { let subSubValue: Int }
    enum SubSubAction { case subsub }
    @ObservedObject var viewModel: Store<SubSubState, SubSubActions>
    // ...
}

struct MyView: View {
    struct SubState {
        let subValue: Double        // for this component
        let subSubValueBridge: Int  // for the inner component
    }
    enum SubAction {
        case subAction           // for this component
        case subSubActionBridge  // for the inner component
    }

    @ObservedObject var viewModel: Store<SubState, SubAction>

    var body: some Scene {
        MySubView(viewModel: viewModel.connect(MyInnerViewConnector()))
    }
}

/// Effectively bridges between MyView.ViewModel and MyInnerview.ViewModel
struct MyInnerViewConnector: Connector {
    func connect(state: MyView.SubState) -> MyInnerView.SubSubState {
        return .init(subSubValue: state.subSubValueBridge)
    }

    func connect(action: MyInnerView.SubSubAction) -> MyView.SubAction {
        switch action {
        case .subSubAction: return .subSubActionBridge
        }
    }
}

Originally posted by @sjmueller in https://github.com/ReSwift/ReSwift/issues/487#issuecomment-1063531570

Hi guys, here's the code -- it's fairly plug and play if you're using the latest ReSwift
One other useful part to mention:

support for animations when subscribed portion of state changes, the animation type can be passed in
it's compatible with onReceive too, so you're covered in more complex scenarios where adjacent state within the component needs to react:

ZStack {
}
.onReceive(entries.objectDidChange) { changeset in
    if let last = changeset.new {
        // do something with local @State
    }
}

We've used this code in production for awhile -- try it out below and lmk, happy to answer any questions!
// Sam Mueller, Blink Labs

import ReSwift
import SwiftUI
import ReSwiftRouter
import Combine

class ObservableState<T: Hashable>: ObservableObject, StoreSubscriber, ObservableSubscription {

    @Published fileprivate(set) var current: T
    let selector: (AppState) -> T
    fileprivate let animation: SwiftUI.Animation?
    fileprivate var isSubscribed: Bool = false
    fileprivate var cancellables = Set<AnyCancellable>()

    // MARK: Lifecycle

    public init(select selector: @escaping (AppState) -> (T), animation: SwiftUI.Animation? = nil) {
        self.current = selector(store.state)
        self.selector = selector
        self.animation = animation
        self.subscribe()
    }

    func subscribe() {
        guard !isSubscribed else { return }
        store.subscribe(self, transform: { [self] in $0.select(selector) })
        isSubscribed = true
    }

    func unsubscribe() {
        guard isSubscribed else { return }
        store.unsubscribe(self)
        isSubscribed = false
    }

    deinit {
        unsubscribe()
    }

    public func newState(state: T) {
        guard self.current != state else { return }
        DispatchQueue.main.async {
            let old = self.current
            if let animation = self.animation {
                withAnimation(animation) {
                    self.current = state
                }
            } else {
                self.current = state
            }
            self.objectDidChange.send(DidChangeSubject(old: old, new: self.current))
        }
    }

    public let objectDidChange = PassthroughSubject<DidChangeSubject<T>,Never>()

    struct DidChangeSubject<T> {
        let old: T
        let new: T
    }
}

class ObservableThrottledState<T: Hashable>: ObservableState<T> {

    // MARK: Lifecycle

    public init(select selector: @escaping (AppState) -> (T), animation: SwiftUI.Animation? = nil, throttleInMs: Int) {
        super.init(select: selector, animation: animation)

        objectThrottled
            .throttle(for: .milliseconds(throttleInMs), scheduler: DispatchQueue.main, latest: true)
            .sink { [weak self] in self?.current = $0 }
            .store(in: &cancellables)
    }

    override public func newState(state: T) {
        guard self.current != state else { return }
        DispatchQueue.main.async {
            let old = self.current
            if let animation = self.animation {
                withAnimation(animation) {
                    self.objectThrottled.send(state)
                }
            } else {
                self.objectThrottled.send(state)
            }
            self.objectDidChange.send(DidChangeSubject(old: old, new: self.current))
        }
    }

    private let objectThrottled = PassthroughSubject<T, Never>()
}

class ObservableDerivedState<Original: Hashable, Derived: Hashable>: ObservableObject, StoreSubscriber, ObservableSubscription {
    @Published public var current: Derived

    let selector: (AppState) -> Original
    let transform: (Original) -> Derived
    fileprivate let animation: SwiftUI.Animation?
    fileprivate var isSubscribed: Bool = false
    fileprivate var cancellables = Set<AnyCancellable>()

    // MARK: Lifecycle

    public init(select selector: @escaping (AppState) -> Original, transform: @escaping (Original) -> Derived, animation: SwiftUI.Animation? = nil) {
        self.current = transform(selector(store.state))
        self.selector = selector
        self.transform = transform
        self.animation = animation
        self.subscribe()
    }

    func subscribe() {
        guard !isSubscribed else { return }
        store.subscribe(self, transform: { [self] in $0.select(selector) })
        isSubscribed = true
    }

    func unsubscribe() {
        guard isSubscribed else { return }
        store.unsubscribe(self)
        isSubscribed = false
    }

    deinit {
        unsubscribe()
    }

    public func newState(state original: Original) {
        DispatchQueue.main.async {
            let old = self.current
            self.objectWillChange.send(ChangeSubject(old: old, new: self.current))

            if let animation = self.animation {
                withAnimation(animation) {
                    self.current = self.transform(original)
                }
            } else {
                self.current = self.transform(original)
            }
            self.objectDidChange.send(ChangeSubject(old: old, new: self.current))
        }
    }

    public let objectWillChange = PassthroughSubject<ChangeSubject<Derived>,Never>()
    public let objectDidChange = PassthroughSubject<ChangeSubject<Derived>,Never>()

    struct ChangeSubject<Derived> {
        let old: Derived
        let new: Derived
    }
}

class ObservableDerivedThrottledState<Original: Hashable, Derived: Hashable>: ObservableDerivedState<Original, Derived> {

    // MARK: Lifecycle

    public init(select selector: @escaping (AppState) -> Original, transform: @escaping (Original) -> Derived, animation: SwiftUI.Animation? = nil, throttleInMs: Int) {
        super.init(select: selector, transform: transform, animation: animation)

        objectThrottled
            .throttle(for: .milliseconds(throttleInMs), scheduler: DispatchQueue.main, latest: true)
            .sink { [weak self] in
                self?.current = transform($0)
            }
            .store(in: &cancellables)
    }

    override public func newState(state original: Original) {
        let old = current
        if let animation = animation {
            withAnimation(animation) {
                objectThrottled.send(original)
            }
        } else {
            objectThrottled.send(original)
        }

        DispatchQueue.main.async { self.objectDidChange.send(ChangeSubject(old: old, new: self.current)) }
    }

    private let objectThrottled = PassthroughSubject<Original, Never>()
}

extension Store where State == AppState {

    func subscribe<T>(select selector: @escaping (AppState) -> (T), animation: SwiftUI.Animation? = nil) -> ObservableState<T> {
        ObservableState(select: selector, animation: animation)
    }

    func subscribe<Original, Derived>(select selector: @escaping (AppState) -> (Original), transform: @escaping (Original) -> Derived, animation: SwiftUI.Animation? = nil) -> ObservableDerivedState<Original, Derived> {
        ObservableDerivedState(select: selector, transform: transform, animation: animation)
    }

    func subscribeThrottled<T>(select selector: @escaping (AppState) -> (T), throttleInMs: Int = 350, animation: SwiftUI.Animation? = nil) -> ObservableThrottledState<T> {
        ObservableThrottledState(select: selector, animation: animation, throttleInMs: throttleInMs)
    }

    func subscribeThrottled<Original, Derived>(select selector: @escaping (AppState) -> (Original), transform: @escaping (Original) -> Derived, throttleInMs: Int = 350, animation: SwiftUI.Animation? = nil) -> ObservableDerivedThrottledState<Original, Derived> {
        ObservableDerivedThrottledState(select: selector, transform: transform, animation: animation, throttleInMs: throttleInMs)
    }
}

protocol ObservableSubscription {
    func unsubscribe()
}

protocol Initializable {
    init()
}

It seems the  ObservableState<S> route that uses a subscription is superior to exposing the Store itself as an ObservableObject:

Q: I have a class Store<State, Action>: ObservableObject that holds the whole app state. It lives as @StateObject in the root of the App lifecycle and passed via environment to all views. View send actions to the store and update as soon as store’s state updated. It allows me to keep the app consistent. Could you please mention any downsides of this approach from your prospective?
A: That approach makes every view in your app dependent on a single Observable object. Any change to a Published property forces every view that references the environment object to be updated.

via https://onmyway133.com/posts/wwdc-swiftui-lounge/#downside-of-single-app-state


Update service-fabric-resource-balancer-proactive-metric-packing.md

Hi @GaugeField, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!

It looks like you're working at Microsoft (abhic). If you're full-time, we DON'T require a contribution license agreement.

If you are a vendor, or work for Microsoft Open Technologies, DO please sign the electronic contribution license agreement. It will take 2 minutes and there's no faxing! https://cla.azure.com.

TTYL, AZPRBOT;


modeling - change namings

This PR changes the naming of files / classes to make it more obvious for future readers / reviewers
cc @lewtun @lvwerra
addresses https://github.com/lvwerra/trl/pull/62#discussion_r1059175888 & https://github.com/lvwerra/trl/pull/62#discussion_r1059295130

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.


Animation flickers back and forth

See video on https://www.dropbox.com/s/lfyr7jv8n6dwzur/Screen Recording 2019-05-22 at 10.34.26.mov?dl=0
Running with chart v1.1.13   which is karma 0.34: https://github.com/helm/charts/blob/master/stable/karma/values.yaml#L9

There's an event listener on browser width changes that triggers grid size/count recalculation, looks like this is creating a loop. Does it happen always or with some specific window width?

I just noticed it this time (and then it was several alerts) - usually it is clear.
I mostly run in "full-screen" (e.g. not covering full desktop - but maximized).

Should be fixable with a tiny amount of refactoring so width is calculated consistently, will look into it next week

Raised #732, are you able to test it? If not let's keep this open until the next release

Not so easy to test for me without the same alerts firing

Let's merge it and see if it helps, should be a no-op for everyone not affected by this issue

Released v0.38, please re-open if you notice same issue with that version

https://github.com/helm/charts/pull/14343

This is still happening, just hit this on my production install

Any chance you will be looking at this issue. We are hitting this with 0.33 up to 0.44.

Didn't have the time and energy to look into this, especially that moving the slider for minimum group width stopped it for me. Will try to look into it this week

I would suggest as a starting point to have the minimum group width exposed in the karmal.yml configuration file. At least we could set a sane default width for our most common screen setups.

Added a test that simulates a resize loop in #970 and added code to adjust width calculations when that happens. It fixes the problem in tests but please re-open if you find this behaviour still happening in real world. Thanks

Great. I will test the next release and provide feedback.

When a loop happens it will kind refresh a couple times and stabilize. It is not pretty but it works.
The fix breaks expanding alerts. For example if an alert group has 20 elements, clicking the plus to see al elements will not work the first or send time due to some window shuffling. After a third time it usually works.
i would reiterate my suggestion of having the minimum group width exposed in the karmal.yml configuration file. At least we could set a sane default width for our most common screen setups. while this issue is being resolved.(I think it helps)

Adding a way to provide default for all the toggles in the UI settings modal is a reasonable request, so I'll work on that when I have a chance.
I'll also need to dig a little deeper into that resizing issue, I need to find a better way to avoid it, rather than add safety checks to mitigate it, maybe reserve some width for scrollbars when calculating the number of columns.

Merged #986 with (hopefully) a better fix for this issue.
Still need to add config options for UI defaults

UI defaults are now configurable


index.php not found

Hi there
We've noticed that the index.php (https://github.com/librenms-plugins/Weathermap/blob/master/index.php) references "../index.php". But looking at our plugins folder (and the one in upstream https://github.com/librenms/librenms/tree/master/html/plugins) There isn't any "index.php".
If we want to open a config (Overview -> Plugins -> Weathermap configname.conf) It then throws en error 404 trying to access said index.php.
What are we doing wrong?
libreNMS version: 	1.64.1-26-g300645388
Weathermap version: 0.97c

I am having the same issue.  I can use the editor just fine, but get a redirect when clicking the menu item for the map.
http://ubuntu01:8000/plugins/Weathermap/ gets a 302 redirect to http://ubuntu01:8000/plugins/index.php when gets a 404


Mobile: Error in Connector Details screen when charging a car and Session In Progress menu item is clicked in the side bar

@AlixH Could you please check

Test case :

[ ] Open the "sessions in progess" screen from the Home Screen for a user with exactly one session in progress. Then, open the drawer menu and select "Sessions in progress" => The sessions list is displayed.

Test case :

[ ] Open the "sessions in progess" screen from the Home Screen for a user with exactly one session in progress. Then, open the drawer menu and select "Sessions in progress" => The sessions list is displayed.

@AlixH Why did you close the issue?


Reformatting and migration to AndroidX

Deleted generated/redundant files
Target Android Pie
Updated Android Studio (3.1.4 to 3.3.2), Gradle (4.4 to 5.3), and Kotlin (1.2.60 to 1.3.21)
Kotlin jdk7 to jdk8
Set compilation of Java to 1.8 (just a config thing, because default is 1.7 but we should use 1.8)
Renamed thunder.ogg to storm.ogg to match code
Reformatted code in general (and xml files)
Renamed vals to lowercase so Kotlin doesn't flip shit
Migrated to AndroidX

Thanks for the pull request. I'll try to review and merge this week.

👍

Yeah, I wanna add the timer feature first tho.

Ok


Project preview added and contributors image service added to README

Updates in README.MD

Added Project Preview
Added images of contributors in README. The image list of contributors will be auto updated.
LICENSE link was broken. Fixed that

@fineanmol check once , how it looks.


C  [liblicensing.so+0x2a4d1]  boost::exception_ptr boost::exception_detail::get_static_exception_objectboost::exception_detail::bad_alloc_()+0x11

Please provide a brief summary of the bug
Hi
I'm running Centos7 in the virtual box. When I try to fire up a software application it crashes with this error message. I have attached the log file for your review.
Thanks
error1.log
Please provide steps to reproduce where possible
No response
Expected Results
The software application should fire up
Actual Results
Crashed with error message
What Java Version are you using?
JRE version: OpenJDK Runtime Environment (8.0_282-b08) (build 1.8.0_282-b08) Java VM: OpenJDK 64-Bit Server VM (25.282-b08 mixed mode linux-amd64 compressed oops)
What is your operating system and platform?
CentOS 7in Virtual box 7.0.12r159484 (Qt5.15.2)
How did you install Java?
No response
Did it work before?
No, this is the first attempt

Did you test with the latest update version?
No response
Did you test with other Java versions?
No response
Relevant log output
No response

Please upgrade to Java 1.8.0_392 and report back here if you still get crashes.

Thanks, Karianna. When I listed the available packages for Java, there is only <IP_ADDRESS>2.b05 and no 18.0.392! Is there any other way I can locate this version.
On a different note, I was also suggested to set the image configuration to a different virtualisation mode as the windows HyperV usage excludes anything better than SSE support. By doing this, I can have AVX/AVX2 become available in Centos 7 which can resolve this error. Please can you shed some light on this as well. Thanks

@jincentos Ah, you may not actually be using our Eclipse Temurin build in that case.  How do you get your OpenJDK today?


Minor additions

Minor changes to culture conversion:

Post-colonial cultures (e.g. Yankee, Amerikaner, ...) have been now split according to regions in the mapping code
Slaves have been added for cultures without African diaspora so as to avoid the "noculture Slaves of Uzbekistan"

These have the format of old versions of the files. You need to take off the culture_map = { and the closing curly brace. Same for the slave culture map. Otherwise they'll throw errors while parsing. Possibly fail entirely.


apply threshold on focus-out

Description
Apply thresholds when you click outside of threshold field.

yes, I think we should -- I'd expect to be able to submit the threshold both ways (enter / focus-out)


Wrong link to unicornn paper

Hi
Very impressive code repository!
I just saw that the link in the readme in src/models to the unicornn paper is wrong (it links to ckconv).
Feel free to change it when you have time
Best wishes

My apologies for the wrong link, it should be corrected now. Thanks for the catch!


frechet_l and frechet_r have been removed as of SciPy 1.6.0

In SciPy 1.6.0 frechet_l and frechet_r distributions were removed as they were deprecated since release 1.0..
From my tests (using the scipy==1.6.1) the inclusion of these distributions in the list of distributions crashes the program.
Possible solution:

Removal of frechet_l and frechet_r from the list of distributions used

References:

SciPy 1.6.0 Release Notes - deprecated features

Thank you for the feedback and sorry for the delayed fix. The issue has now been resolved.


Documentation fixes and improvements

This commit goes through the documentation for retworkx and fixes
various typos and mistakes. It also updates the generated api docs to be
put in an 'apiref' path instead of 'stubs' to clean up the urls a bit.
To maintain compatibility with existing links though a redirect is added
to redirect from stubs/* to apiref/*.
Fixes #507

To start I just went through the issues outlined in #507 that weren't already fixed. But before we merge this I want to do a quick scan through the documentation to see if I catch anything else obvious there.

Pull Request Test Coverage Report for Build<PHONE_NUMBER>

0 of 0   changed or added relevant lines in 0 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage remained the same at 98.511%

Totals

Change from base Build<PHONE_NUMBER>:
0.0%

Covered Lines:
11114

Relevant Lines:
11282

💛  - Coveralls

#507 mentions a few things that aren't solved here, like the inconsistency between indices versus indexes for nodes and edges. That change would require deprecation, I'd expect. Should we track that?

The start of that process was actually handled separately in: https://github.com/Qiskit/retworkx/pull/541


[NETBEANS-54] Module Review form.j2ee

Added license headers to xml files, changed one in a java template file. Also removed some trailing whitespaces as well.
Fixes #59

I don't think these forms are user-facing, but I'm not sure how to check.
Reverted whitespaces.


compilerOptions.lib on ionic

I have read this http://dev.apollodata.com/angular2/initialization.html#typescript-es2015

TypeScript 2.0 comes with a set of predefined type declarations.
If you’re using one of them that brings ES2015 (ES6) you should disable it, because @types/es6-shim will cause an issue with multiple types definitons.
It’s easy, just replace es6, es2015 or similar options from compilerOptions.lib for es5.

This only works if I have to do ionic build <platform> or ionic run <platform> . But will not work if I do ionic serve I will see the es6-shim issues and setting compilerOptions.lib back to es6, es2015 will fix it.
What is the reason? Is there a way around this? I have to modify tsconfig everytime.
Here is my ionic info
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.43
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.6.0
Xcode version: Not installed

Here is my tsconfig.json
{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es6"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

Here is my packages.json
{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/compiler-cli": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/platform-server": "2.1.1",
    "@ionic/storage": "1.1.6",
    "angular2-apollo": "^0.8.0",
    "apollo-client": "^0.5.2",
    "graphql-tag": "^0.1.16",
    "ionic-angular": "2.0.0-rc.2",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.21"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.43",
    "typescript": "2.0.9"
  },
  "description": "githubIonic: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

Solved here https://github.com/apollostack/apollo-client/issues/963#event-875503850


Eureka 0-downtime Blue/Green deployments issue

Describe the bug
We are leveraging eureka for the service discovery function and we have two different deployments for one app as blue-green deployments.
At beginning, deployment A is start up as eureka.instance.initialStatus=UP while deployment B as eureka.instance.initialStatus=OUT_OF_SERVICE. After running sometime, we switch them by PUT /eureka/v2/apps/appID/instanceID/status?value={OUT_OF_SERVICE or UP}. It works good usually.
However, sometimes, we find eureka server is blocked by network issue to this app, and the lease for the app expires. Then eureka server will ask client to re-register. In this case, the initialized status is not correct for the two deployments.
Is there a way that we can override “eureka.instance.initial-status” without restarting these instances? Such as config hot reload? Will it work since app is up and running for a long time.

I find that the initial status can be refreshed when EurekaInstanceConfigBean is reloaded.
So one possible solution is to use Config Server to store eureka.instance.initialStatus and when want to swap the two deployments,

update the value in Config Server
curl -XPOST http://{eureka-client}/actuator/refresh together with overriding the status to the eureka server-side so that they can both update to the new status.

This is a bit complicated, not sure if any other methods can achieve it.

You can use the ServiceRegistry.setStatus() method. https://github.com/spring-cloud/spring-cloud-netflix/blob/main/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistry.java#L75

@spencergibb Thanks for the response. May I double confirm that the operation ServiceRegistry.setStatus() happens in client app side? If that case, when should the client app set the value? Does it mean the client app should be aware of the time the swap of blue-green happens?

ServiceRegistry.setStatus() can happen anywhere. It's just calling the eureka server API. I'd say that something has to be aware of the blue/green swap, but not necessarily a client.

@spencergibb I think the problem we found is caused by the obsolete client status. Even the server-side is aware of the blue/green swap, when the client lost connection due to a network issue or so, the client will re-registry with a wrong status.

Something has to change the status of that client, there's no other way around it.

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Do we have a plan to improve this behavior that the client can be notified about the change? I believe this is a common issue for Eureka users.

We are running into this problem as a user of a PaaS with a provided Eureka server.
The PaaS does blue/green deployments by setting the status as described by @leonard520 above...
The application being deployed has no knowledge of how it is deployed or of any change it needs to make in the status.
What should be the intended behaviour in situations like this? Do we have to customise the client side Eureka client code to change the initial status? Are there any plans to fix blue/green deployments with Eureka?

Closing due to age of the question. If you would like us to look at this issue, please comment and we will look at re-opening the issue.

We are still struggling with this issue.
It happens whenever the app loses connection to Eureka for a time, regardless of the cause.
@spencergibb Could you please answer my question above?
How is it supposed to work?
Or is it the case that the initial status was not intended for use like this? (Although I have trouble seeing where else it would be used)
In any case, the problem is that the Eureka client is liable to re-register itself with the initial status every time it loses connection. And there is no mechanism to change the initial status that I am aware of.

@spencergibb @OlgaMaciaszek Apologies for bumping an old issue, but it is still a problem for us and we'd greatly appreciate some pointers on how it's supposed to work and/or how we should work around the problem.
Right now we have to just accept occasional outages caused by an incorrect Eureka status and restart everything, which seems sub optimal to say the least.

Closing due to age of the question. If you would like us to look at this issue, please comment and we will look at re-opening the issue.

@spring-cloud-issues @OlgaMaciaszek Yes please, we would still like to have our questions around this issue answered...

Closing due to age of the question. If you would like us to look at this issue, please comment and we will look at re-opening the issue.

Closing due to age of the question. If you would like us to look at this issue, please comment and we will look at re-opening the issue.


read_the_csv_output

Dear author,

i am using 1.0-dev, and get csv output, with default parameters;

and what is the meaning of each column stand for;

i guess the fifth column is the score, but how much the score will be good enough for a really tandem repeats;

how can i filter the csv output to locate the centromere or telomere sequences;

best,
atongsa

thank you very much :owl:  :monkey_face:    @DanielOlson


v9.0.0: update project

What does this PR do?

I updated all the project dependencies to their latest versions.
I changed the minimum required Node version to 10.13, as 8 ends LTS next week (this is the reason the PR is breaking).

How should it be tested manually?
npm test
# or
yarn test

Pull Request Test Coverage Report for Build 164

0 of 0   changed or added relevant lines in 0 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage remained the same at 100.0%

Totals

Change from base Build 161:
0.0%

Covered Lines:
355

Relevant Lines:
355

💛  - Coveralls


Unspecified props are swallowed

I'm using react-tags alongside react-bootstrap. One of the components I use from there is OverlayTrigger, which throws on various handlers and events on the child component: onMouseOut and onMouseOver to name a few. But because the props that are passed to ReactTags are selectively extracted, these handlers are lost.
So in the following example, the intended behavior would be to display a popover (tooltip) onMouseOver -- onMouseOver is not transferred to any DOM element, so we get nothing.
render: function() {
        let tooltip = (
            <Popover title="Title" id="popover">
                Tee-hee
            </Popover>
        );
        return (
            <OverlayTrigger placement="top" key="tooltip" overlay={tooltip}>
                <ReactTags/>
            </OverlayTrigger>
        );
}

Would you open to spreading the rest of the props on one of the components? I'll open a PR with my proposed changes and we can discuss further if it would be a viable solution.

#145

@mrdannael thanks for adding the ref, I can rebase if the PR is good-as-is.

Yes, please. Rebase with master :)

One way or another, something like it would be necessary to avoid the "unknown prop" warnings. Without it, props such as handleDelete, handleAddition, etc. would be passed to the top-level div leading to those warnings.


get rid of std::function

No need for std::function here. A free function with an unspecified callback will do nicely.
This was first proposed in #422

Thanks! Merged!


Building microlite fails due to missing include fixedpoint.h

@tensorflow/micro
System information

Host OS Platform and Distribution: Ubuntu 18.04
TensorFlow installed from (source or binary): source
Tensorflow version (commit SHA if source): aaa88b7db6cf359d7ceea219a180c6f83775a368
Target platform (e.g. Arm Mbed OS, Arduino Nano 33 etc.): x86

Describe the problem
Running
$ make -f tensorflow/lite/micro/tools/make/Makefile microlite
results in the error:
In file included from tensorflow/lite/micro/kernels/activations.cc:18:0:
./tensorflow/lite/kernels/internal/common.h:26:10: fatal error: fixedpoint/fixedpoint.h: No such file or directory
 #include "fixedpoint/fixedpoint.h"

The issue seems to be that gemmlowp, which contains fixedpoint.h, isn't being downloaded:
$ ls tensorflow/lite/micro/tools/make/downloads/
flatbuffers/
person_model_int8/
pigweed/

A workaround to this issue is to run this command before trying to build microlite:
$ make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads
$ ls tensorflow/lite/micro/tools/make/downloads/
flatbuffers/
gemmlowp/
kissfft/
person_model_grayscale/
person_model_int8/
pigweed/
ruy/

Please provide the exact sequence of commands/steps when you ran into the problem
$ git clone https://github.com/tensorflow/tflite-micro.git
$ cd tflite-micro/
$ make -f tensorflow/lite/micro/tools/make/Makefile microlite

Right, this is a known issue that we haven't gotten around to fixing.
The workaround is exactly what we have in our CI scripts as well:
https://github.com/tensorflow/tflite-micro/blob/56e785e78810291625697dcdaffc66c4dbe32a44/tensorflow/lite/micro/tools/ci_build/test_x86.sh#L29-L30
The fix is to change the gemmlowp download to use a bash script instead of the Makefile macros, similar to https://github.com/tensorflow/tflite-micro/blob/56e785e78810291625697dcdaffc66c4dbe32a44/tensorflow/lite/micro/tools/make/Makefile#L522-L526

Internal bug: http://b/194418406

Hi, I am still getting the same error and unable to find the above files to execute cmd.
How to fix it?
I have downloaded the tfite-micro_main from GIT.
any help would be appreciated.

Is this issue resovled? I'm still having issues


Namespace Controller creates namespace again, when the project is deleted

Cluster Setup

Kubernetes version: v1.20.15
Rancher 2.6.9
Type of Cluster (RKE1, RKE2, k3s, EKS, GKE, AKS, OKE, etc): RKE1
Installation option (Helm Chart / Custom Installation): Helm prometheus-federator 0.1.1

Describe the bug
A project is created on downstream cluster and prometheus-federator created the namespace
cattle-project-p-jmqqq.
If the project is deleted in Rancher, the controller creates the namespace again and again, out of scope of the user because the project doesn't exists
To Reproduce
Create Pproject
Create namespace in project
cattle-project-p-jmqqq appears
Delete project
Result
cattle-project-p-jmqqq exists without corresponding project
Expected Result
cattle-project-p-jmqqq should deleted as well.
Screenshots

Additional context
@aiyengar2 : I think this was the behavior in this function

Hello @aiyengar2
the left namespace has the following label
  labels:
    field.cattle.io/projectId: p-xxxx
    helm.cattle.io/helm-project-operated: 'true'
    helm.cattle.io/helm-project-operator-orphaned: 'true'
    helm.cattle.io/projectId: p-xxxxxx
    kubernetes.io/metadata.name: cattle-project-p-xxxxxx
    objectset.rio.cattle.io/hash: 244ac0a875e2b8deec08969b192e174205a719def

I think we have meanwhile hundreds of them. The problem is: the user had the role project owner at the cluster and the project is removed. At the end the user has no access anymore to the cluster and also not to this namespace.
Or I understand the Rancher Project Concept wrong

Cc: @bashofmann

@eumel8 Thanks for highlighting this. If I understand correctly, if a project was deleted and if you delete the orphaned cattle-project-p-xxxx namespace, the namespace is automatically re-created.
Is this correct?
As Arvind said, can you check if there are other namespaces left-over in the cluster that have the same field.cattle.io/projectId: p-xxxx label (kubectl get namespace -l field.cattle.io/projectId=p-xxxx)? Maybe there is still a namespace stuck in termination and because of that the operator recreates the cattle-project-p-xxxx namespace.

no fix no fun


Remove supplier A–Z feature flag

Per https://www.pivotaltracker.com/story/show/102080450

Some feature flags we will want to switch off again in future (e.g. G7 Submissions open), but others will never be turned off again and so should be removed from the codebase.

:+1:


Enforce TypeConditions on Fragments

Prior to this, multiple Fragments of the same name could be defined, with the last one being run instead of the one associated with the correct type. I broke out the collect_fragment to keep the collect_fields function from bloating more, as I'm also planning on trying to add support for Directives in the Executor soon if this gets merged.

Looks good, think it's worth adding another test for the multiple fragment scenario?

Do you mean multiple fragments with the same name? If so, that's more of a Validation issue, according to http://facebook.github.io/graphql/#sec-Fragment-Name-Uniqueness. Re-reading the description I wrote, I misrepresented what this PR does, mostly to not thinking things through (or reading the spec well enough :fearful:), so I'm going to edit that to be more accurate.. Just the same, I added another test with 2 named fragments to ensure that only the matching one was run.

Looks good. You are right about the fragment name uniqueness being a validation concern.


Structure the code base (the project) as a lvlib of lvclasses

Currently the project contains one main lvlib named "Error Manager.lvlib". This lvlib in turn contains a few other lvlibs.
It might be better for the sub-lvlibs to be converted to lvclasses. Such that the "Error Manager.lvlib" would contain lvclasses instead.

Refactored several lvlibs (such as MHL Queue.lvlib's) into lvclasses


Add a pipe for multiline truncate. (fixes #868)

fix: #868

Can one of the admins verify this patch?

Can one of the admins verify this patch?

We already have multiline truncation in css. Do we need pipe?

@SMahil But that not work as expected.

@vikram-raj Can we check that tomorrow?

@SMahil Yes sure.

Can we not use CSS for this?
If we really need the pipe, can you please change the prefix to fab instead of alm?

This issue is resolved in PR #925 using CSS.


meter are wrong

librealsense
2.33.1 RELEASE

OS
Windows

Name
Intel RealSense D435

Serial Number
943222071442

Firmware Version
<IP_ADDRESS>

Advanced Mode
YES

Camera Locked
YES

Usb Type Descriptor
3.2

Product Line
D400

Asic Serial Number
943623022438

Firmware Update Id
943623022438

I have the mouse cursor on the middle of the my hand, and I get this strange number for meters,
I also run the "hello realsense" from examples and I do not get the correct distances.

@ZiSo89 , this may occur if you accidentally (or intentionally) switch to and then remain in Disparity domain:

Please check the post-processing options and ensure that the Depth->Disparity and Disparity -> Depth filters are used simultaneously
.
if this is not the case then pls check the advanced mode parameters , or just load "Default" preset to revert all the developer's options back to defaults.

Thanks :)


Connect Authentication API (Login, Registration) with Frontend

Features

Added Login, Registration API request to backend using fetch.
Added cors in the backend.
Added dev in package.json for both front-end and back-end. They use different '.env' files, that's the only difference.

These commits tie the front end with the back end. Front-end API functionalities need to be checked. I couldn't figure out how to use '.env' support on Webpack. Base API URLs can be put in the '.env' file.
TODO @vilbedawg

Add Error handling message for login and registration API calls.
API calls can be turned into a utility function. A suggestion.
Add .env support on the front end.

The base branch is an old feature branch and there are quite a lot of conflicts with the current development branch.

I will add the changes from this branch on top of the new branch on a new PR.

I will close this since these changes have been made in a separate PR.


Do not support jupyter lab 2.1

Hi Author,
Great thanks for your creation of this extension. Any plan on support jupyter lab 2.1?

I just tested with jupyterlab==2.1.2 and it seems to work?
What issue are you seeing?

Thanks, I re-installed jupyter lab and it seems working.


Add CloudTrail logging and Redshift logging accounts to S3CrossAccountFilter

It would be useful to have the CloudTrail logging and Redshift logging region accounts as part of S3CrossAccountFilter.  These can be found at http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-regions.html and http://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html, respectively.

thanks, probably should parameterize (services: [cloudtrail, elb]) on the filter with a default of all.


Multiple views with live camera feed

First of, thank you for making this project open source!
I'm making an application with multiple features that would build on top of the live camera view. In my project I have 2 views, connected with a segue, and I wish to show the live camera in both of them. The initial view works fine, and shows the camera as expected. However, when I segue to my second view, I only get presented with a grey screen without any camera.
Both views implement SwiftyCamViewController and SwiftyCamViewControllerDelegate, and include setting cameraDelegate = self. Is there something I'm missing to be able to also use the camera feed in the second view? Any help is very much appreciated!

This issue seemed to be fixed by selection the same Module for both views in the storyboard editor, however Im not 100% certain.


numba f.reduce : 'function' object has no attribute 'reduce'

Hi:
Good Morning!
I encounter a very strange error in my codes.
I cut the piece of code to test and it is OK. In my larger program, however, it reports " 'function' object has no attribute 'reduce'"
test codes:
import numpy as np
from numba import vectorize, float64,float32

@vectorize([float32(float32, float32),float64(float64, float64)],nopython=True)
def add_vec(A,B):
	return A+B

def sum_avg(seq,seq_pre):

	print (seq_pre.shape)
	print (seq.shape)
	print (add_vec.reduce(seq,axis=0))

a=[float(i) for i in range(300)]
seq=[]
seq.append(a)
seq.append(a)
seq.append(a)
seq=np.array(seq)
sum_avg(seq,seq)

(3, 300)
(3, 300)
[   0.    3.    6.    9. ...

larger program:
@measure_time
@vectorize([float32(float32, float32),float64(float64, float64)],nopython=True)
def add_vec(A,B):
	return A+B

@measure_time
#@jit(nopython=True)
def sum_avg(seq,seq_pre):
	#for debuging
	#--------------------------------
	a=[float(i) for i in range(300)]
	seq=[]
	seq.append(a)
	seq.append(a)
	seq.append(a)
	seq=np.array(seq)
	#--------------------------------

	print (seq_pre.shape)
	print (seq.shape)
	print (add_vec.reduce(seq,axis=0))

	if len(seq_pre)<=1:
		print ('liwei mark1')
		window_vector=add_vec.reduce(seq,axis=0)-seq_pre
	else:
		window_vector=add_vec.reduce(seq,axis=0)-add_vec.reduce(seq_pre,axis=0)
	window_vector=window_vector/(len(seq)-len(seq_pre))
	return window_vector

Can anybody tell me why it is like this?

Using gpu device 5: Tesla M60 (CNMeM is enabled with initial size: 70.0% of memory, cuDNN 5103)
Build model...
zero3d padding ouput shape = (None, 402, 300, 12, 1)
conv3d ouput shape = (None, 400, 1, 10, 120)
/home/wliax/Anaconda/Or/envs/myenv1/lib/python2.7/site-packages/keras/backend/theano_backend.py:1550: UserWarning: DEPRECATION: the 'ds' parameter is not going to exist anymore as it is going to be replaced by the parameter 'ws'.
mode='max')
/home/wliax/Anaconda/Or/envs/myenv1/lib/python2.7/site-packages/keras/backend/theano_backend.py:1550: UserWarning: DEPRECATION: the 'st' parameter is not going to exist anymore as it is going to be replaced by the parameter 'stride'.
mode='max')
/home/wliax/Anaconda/Or/envs/myenv1/lib/python2.7/site-packages/keras/backend/theano_backend.py:1550: UserWarning: DEPRECATION: the 'padding' parameter is not going to exist anymore as it is going to be replaced by the parameter 'pad'.
mode='max')
maxpooling3d 122 shape = (None, 200, 1, 5, 120)
reshape shape = (None, 200, 600)
LSTM shape = (None, 120)
/home/wliax/Anaconda/Or/envs/myenv1/lib/python2.7/site-packages/theano/tensor/basic.py:2146: UserWarning: theano.tensor.round() changed its default from half_away_from_zero to half_to_even to have the same default as NumPy. Use the Theano flag warn.round=False to disable this warning.
"theano.tensor.round() changed its default from"
Train...
Build generator...
save train dataset
Epoch 1/1
(1, 300)
(3, 300)
liwei mark1
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/wliax/Anaconda/Or/envs/myenv1/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/home/wliax/Anaconda/Or/envs/myenv1/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/wliax/Anaconda/Or/envs/myenv1/lib/python2.7/site-packages/keras/engine/training.py", line 433, in data_generator_task
generator_output = next(generator)
File "2_liwei_efc_spec_CNN_LSTM.py", line 338, in batch_generator
(Y_batch,X_batch)=preprocessing_pipline_efc(h5py_data,fileids_ls)
File "2_liwei_efc_spec_CNN_LSTM.py", line 61, in timed
result = f(*args, **kw)
File "2_liwei_efc_spec_CNN_LSTM.py", line 283, in preprocessing_pipline_efc
X_spec_train=process_data(X_train)
File "2_liwei_efc_spec_CNN_LSTM.py", line 61, in timed
result = f(*args, **kw)
File "2_liwei_efc_spec_CNN_LSTM.py", line 165, in process_data
spectrum_matrix=format_spectrum(X_sample)
File "2_liwei_efc_spec_CNN_LSTM.py", line 61, in timed
result = f(*args, **kw)
File "2_liwei_efc_spec_CNN_LSTM.py", line 152, in format_spectrum
X_sample_win=map_seq(X_sample,window_size,pre_window_size)
File "2_liwei_efc_spec_CNN_LSTM.py", line 61, in timed
result = f(*args, **kw)
File "2_liwei_efc_spec_CNN_LSTM.py", line 141, in map_seq
window_vector=build_window_vector(X_sample,window_size,pre_window_size,i)
File "2_liwei_efc_spec_CNN_LSTM.py", line 61, in timed
result = f(*args, **kw)
File "2_liwei_efc_spec_CNN_LSTM.py", line 128, in build_window_vector
window_vector=sum_avg(seq,seq_pre)
File "2_liwei_efc_spec_CNN_LSTM.py", line 61, in timed
result = f(*args, **kw)
File "2_liwei_efc_spec_CNN_LSTM.py", line 116, in sum_avg
window_vector=add_vec.reduce(seq,axis=0)-seq_pre
AttributeError: 'function' object has no attribute 'reduce'

What is the @measure_time decorator?  The @vectorize decorator returns a function-like object with methods.  The @measure_time decorator may not work on it.

@sklam
Thanks!  After I remove the measure_time and solve some issue on list append and list comprehension.  It is OK now.
It seems that "list append" is not supported in nopython mode, while "list comprehension" is not supported in all modes.
Now I initialize a full sized all 0 matrix outside of the function which is to be @jit. I wonder if it is the proper way of doing it, since there are no way to alter the shape of the array in numba.

It seems that "list append" is not supported in nopython mode, while "list comprehension" is not supported in all modes.

List-append works in limited cases.  It only works on simple types (e.g. numerics but not arrays) currently.   List comprehension doesn't work at all due to lack of closure/inner-function support.

Now I initialize a full sized all 0 matrix outside of the function which is to be @jit. I wonder if it is the proper way of doing it, since there are no way to alter the shape of the array in numba.

Numba has some support for array stacking functions (e.g. numpy.stack, numpy.vstack, etc.) and numpy.concatenate.  You can grow an array.
Tips: you can use the listing to find supported numpy features.  But note that the actual name of the numpy function could be longer (numpy.stack is alias to numpy.core.shape_base.stack) .

@sklam
Thank you very much!
I tried to modify the codes according to some of your advice last week, and it is faster now.
I think this issue is solved now. Thank you.


works on logo

Issues Identification #912
Closes: #(issue number)
Description
Summary
A brief description of what this pull request does and why it is needed.
Details
Include any detailed information about the changes in this pull request.
Types of Changes
Please check the boxes that apply

[ ] Bugfix (non-breaking change that fixes an issue)
[ ] New feature (non-breaking change that adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Documentation update (Documentation content changed)
[ ] Other (please describe):

Checklist
Please check the boxes that apply

[x] My code follows the style guidelines of this project
[ ] I have performed a self-review of my own code
[ ] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[ ] My changes generate no new warnings
[ ] My changes do not break the current system and pass all existing test cases
[ ] I have added tests that prove my fix is effective or that my feature works
[ ] New and existing unit tests pass locally with my changes

Screenshots
If applicable, please attach screenshots of the changes made to the user interface.
Additional Information
Please provide any other information that is relevant to this pull request.

Successfully merging this pull request may close these issues.

@ambrishgoswami why did you make on other contributors issue this is not good practice
This is your first and last warning


Fixed MatchError exception in stage 103

Fixed match clause in LabelSpreadingClassifier to properly filter all items before mapping them with a match guard pattern. This bug ended execution during the execution stage 103 for some data. Tested on both Metacentrum and Betelgeuse+Antares Hadoop clusters.

lgtm, except the old-code comments. Thanks for the PR!


Add to form field after successful ajax call

For instance, I make a ajax call to get a couple names, I now want to populate an array form field with those names. I tried using the plugin but when I declare the field in the form, it seems to clear the recipients. Any suggestions? Thanks
plugin code:
    case constants.GET_RECIPIENTS:{
      return{
        ...state, recipients:action.recipients
      }
    };

Hi, thanks for coming by.
This is a usage question, and we encourage you to ask it on StackOverflow instead. We try to use the issue tracker for bug reports and feature requests, as well as some discussions, but this appears to be a very localized question.
I’m closing for these reasons.


Fixed returning arrays with none to mopidy in rare cases causing crash

Exceptions from pafy when video's are not available sometimes results in an array with a nonetype being returned to mopdiy, in turn crashing the entire actor thread. This should clean up all the output send to mopidy.

Merged. Thanks!


Module 2 exercises [Edith Kwablah]

Module2_exercise1.pdf
Module2_exercise2.pdf
Module2_exercise3.pdf
Module2_exercise4.pdf

Well done, Edith. You clearly grasped the material outlined in Module 2 and successfully applied it to these exercises. Thank you for your participation!


Include corresponding values in d.ts for C-style enums

Motivation
wasm_bindgen macro supports C-style enums. It supports specifying literal values for each enum variant, but it seems that those values are not included in the generated d.ts file. For example,

#[wasm_bindgen]
pub enum ErrorCode {
    FooError = 0,
    BarError = 2,
}

is converted to the following code:
export enum ErrorCode {
  FooError,
  BarError,
}

Specifying the actual values of enum lets us use more features in typescript, so it would be nice if the corresponding literal values are included in d.ts.
Proposed Solution
The ideal solution would give us the following typescript code:
export enum ErrorCode {
  FooError = 0,
  BarError = 2,
}

👍  This is really important as otherwise it can lead to subtle bugs when using the literal value of the enum.


[elfutils] Update to 0.186

Describe the pull request

What does your PR fix?
Updates elfutils to version 0.186

Which triplets are supported/not supported? Have you updated the CI baseline?
No changes

Does your PR follow the maintainer guide?

Yes

Thanks for the update!