align rnaseq with umi

Hello,
I am ultimately trying to detect gene fusion, but have got an error from alignment.
The UMI is added to fastq read name as UMI_XXXXXXXX where X is a base sequence.
To simplify the problem, I commented out everything except the alignment as follows:

algorithm:
aligner: star
mark_duplicates: true
umi_type: fastq_name
transcriptome_align: True
quality_format: standard

The error looks like with UMI, but I am not sure what exactly is happening.
[2019-04-18T20:50Z] Index BAM file: SeraseqDNARNA2.bam
Traceback (most recent call last):
File "/isilon/prod/apps/bcbio/bin/bcbio_nextgen.py", line 238, in
main(**kwargs)
File "/isilon/prod/apps/bcbio/bin/bcbio_nextgen.py", line 46, in main
run_main(**kwargs)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/pipeline/main.py", line 45, in run_main
fc_dir, run_info_yaml)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/pipeline/main.py", line 89, in _run_toplevel
for xs in pipeline(config, run_info_yaml, parallel, dirs, samples):
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/pipeline/main.py", line 245, in rnaseqpipeline
samples = run_parallel("process_alignment", samples)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/distributed/multi.py", line 28, in run_parallel
return run_multicore(fn, items, config, parallel=parallel)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/distributed/multi.py", line 86, in run_multicore
for data in joblib.Parallel(parallel["num_jobs"], batch_size=1, backend="multiprocessing")(joblib.delayed(fn)(*x) for x in items):
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/joblib/parallel.py", line 917, in call
if self.dispatch_one_batch(iterator):
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/joblib/parallel.py", line 759, in dispatch_one_batch
self._dispatch(tasks)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/joblib/parallel.py", line 716, in _dispatch
job = self._backend.apply_async(batch, callback=cb)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/joblib/_parallel_backends.py", line 182, in apply_async
result = ImmediateResult(func)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/joblib/_parallel_backends.py", line 549, in init
self.results = batch()
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/joblib/parallel.py", line 225, in call
for func, args, kwargs in self.items]
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/utils.py", line 54, in wrapper
return f(*args, **kwargs)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/distributed/multitasks.py", line 119, in process_alignment
return sample.process_alignment(*args)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/pipeline/sample.py", line 132, in process_alignment
f1, f2, avg_cov = postalign.umi_consensus(data)
File "/isilon/prod/apps/bcbio-data/anaconda/lib/python2.7/site-packages/bcbio/ngsalign/postalign.py", line 190, in umi_consensus
umi_method, umi_tag = _check_umi_type(align_bam)
TypeError: 'NoneType' object is not iterable

I looked a little more around the problem.
In postalign.py, it looks for tags --  "RX", "XC", but when I look at the bam I got from star aligner, I don't see any of these tags.
NDX550138:22:HHMY2AFXY:1:21208:18955:12784:UMI_GGTGGGATAG       163     1       137797  60      17S77M1I44M     =       138002  318     ACGAATATACTCATTTTTTGGGGAAGCTGTGGACCGACCAAGGCCGCCAGGAGATGGGTAGGCACTGAGTCCAAAAAGGTTGTTG
AGAGGCAGGAAATCGGGCCTGGAGACCCAACCAGGAAGAAGAGCTGGGCCCGGA  EEE/EA/E//6A/EEEEEEEEAEEEEEEEEE6/EEEEEE6AEEEEEEEEAE/EEEE/EE/EAEEEEE/EEEEE6EAEEEEAEEEE/E//<E////A/6E<EAEEEEE6EAEE<//E/AA/</E//<<EEEEEAAEEEEE     NH:i:1  HI:i:1  NM:i:
3       MD:Z:3A54G62    AS:i:222        RG:Z:SeraseqDNARNA2
Could you kindly let me know what I am missing here?
Thanks,
Segun

OK.  I figured I had to configure better in the yaml file and it seems working now.

Sorry, we don't support standard RNA-seq analyses with UMI-- we haven't seen any protocols at all where full-length transcripts are being used with UMI. 3' DGE data and single-cell RNA-seq both work with fragments of the full RNA, so all of the downstream quantification tools will fail since they are expecting full length transcripts.
See https://github.com/bcbio/bcbio-nextgen/issues/2070 for some more discussion as well. You might get data back from the standard RNA-seq pipeline, but it will not be taking the UMI into account so it will be incorrect.

We also don't support fusion calling with tag based data.--  you are probably not going to be able to find fusions since the tag data only hits a small part of the transcript. If you have tag-based data I think what you are asking to do is probably a waste of time, you'd need full length transcript data to detect fusions.

Thanks Rory.
That's very interesting.  My interest is with only fusion detection and my colleague has his own pipeline outside of bcbio and uses UMIs to collapse using fgbio (although I need to check how my colleague's pipeline works).  For now, I will need to do my homework.  Thanks anyway for the comments!

Heya, if the FASTQ files you are putting in already have the duplicate
reads for each UMI removed then bcbio will work fine running normally—
essentially the UMI is already taken into account so you can ignore it. So
if you can get your FASTQ files into that state then you are all set.
On Thu, Apr 18, 2019 at 8:34 PM Segun Christopher Jung <
<EMAIL_ADDRESS>wrote:

Thanks Rory.
That's very interesting. My interest is with only fusion detection and my
colleague has his own pipeline outside of bcbio and uses UMIs to collapse
using fgbio (although I need to check how my colleague's pipeline works).
For now, I will need to do my homework. Thanks anyway for the comments!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/bcbio/bcbio-nextgen/issues/2794#issuecomment-484732076,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADFG6X5WBD5AESXCMFV7BDPREHR3ANCNFSM4HHAK7NA
.


proposal: channel buffer pools

When creating a large number of buffered channels for similar kinds of messages, instead of giving each channel a buffer size, it would be far more memory efficient to pool the buffers:
pool := make([]T1, 1e6) // alternatively make([]byte, n)
ch1 := make(chan T1, pool)
ch2 := make(chan T2, pool) // perhaps channels for diff types can share the pool?
// both block on write when the pool is exhausted

The above makes buffered objects editable, which may be undesirable. An alternative is to use a pointer as the name of an internal buffer:
var pool int = 1e6
ch1 := make(chan T, &pool) // does make([]T, *pool); labels slice with &pool
ch2 := make(chan T, &pool) // buffers to slice created above; *pool not checked

A channel buffer pool is particularly valuable where one can forecast the overall traffic for the set of channels (e.g. it's limited by network bandwidth), but not the load on any one channel. Any switchboard-style application where each incoming message is broadcast to multiple receivers fits that profile, for instance a chatroom server. This proposal might also solve the problem motivating #20352.
There is a workaround for the lack of buffer pools, but it's expensive: for each required channel, dedicate a goroutine-plus-two-channels to allow elastic channel buffers.

It seems like this would be a very productive source of bugs and deadlocks.
What is the problem you are trying to solve?
Why is the problem important to solve?
How does it arise in practice?
Why is this the right solution?

Hi Russ. The motivation for this proposal is an app with potentially millions of channels which are intermittently drained, where the average buffered queue is <10 items, but can spike to a few thousand. If every channel buffer were sized to 5,000 elements, it's >40GB of buffers for 1M chan int instances, but actual memory usage is <80MB. (The app is several weeks from its initial release; I will add real-world data points to this discussion as soon as I have some.)
So in today's Go we must either use the goroutine-plus-two-channels method to dynamically allocate channels (which is expensive but transparent to producer & consumer), or keep a pool of large-buffer channels which are switched in when the normal channels block on write. A dedicated channel buffer pool would be memory-efficient, inexpensive, and transparent.
Thinking more broadly, channels provide a nice interface (make, write, read, select, close) which app-defined services might like to implement so they can serve any channel client. So a scheme to define channel plug-ins is a more general solution to the problem I describe.
Regarding deadlocks, did you have a scenario in mind? You would lock+unlock the internal buffer pool before/after locking the channel to add/remove an element, so I'm not seeing where you have the lock+lock sequence necessary to create a deadlock.

@networkimprov

The motivation for this proposal is an app with potentially millions of channels which are intermittently drained, where the average buffered queue is <10 items, but can spike to a few thousand.

...

(The app is several weeks from its initial release; I will add real-world data points to this discussion as soon as I have some.)

Big number of goroutines have valid use cases. Millions of channels not so much IMO. Can you please share more details about the soon-to-be-released app? To be honest, I would like to try to evaluate if the design, using millions of channels, makes sense or not in this case.

Here "intermittently drained" means the goroutine for each channel isn't always up. The channel is for each user who's connected in the past ~24h.
Even given a smaller number of channels, or workarounds that approximate a channel buffer pool, I believe my point about the memory inefficiency of dedicated channel buffers remains valid.

@cznic, any more thoughts?

Here "intermittently drained" means the goroutine for each channel isn't always up. The channel is for each user who's connected in the past ~24h. Its producers are any of the active users. (Actives are 1-2% of the total, ~15K, at a given moment).
Even given a smaller number of channels, or workarounds that approximate a channel buffer pool, I believe my point about the memory inefficiency of dedicated channel buffers remains valid.

My impression is that the proposal's motivation is to fix a problem that was mistakenly inserted into the app's design.

That is a general statement of opinion, not an analysis by which the proposal can be evaluated!
Leaving buffered channels in place for intermittently active consumers means the queues in question do not have to be re-created from disk each time the consumer resumes.

You've asked for thoughts and I delivered. You dismissed that for not being analysis. If you'd have asked for analysis, I'd have to ask for the app source code in the first place. Let's forget it, okay?

Related to #20352, though this one does have a limit.  We're going to give this the same answer.  If you need to handle spikes in traffic, use mechanisms designed for that.  We don't want to complicate the language-provided channels by letting them share a pool of memory.  That seems likely to lead to deadlocks, and significant complicates the implementation in the normal case for an approach that will be used very rarely.
If we had generic types, unlimited channels could be implemented in a library with full type safety. A library would also make it possible to improve the implementation easily over time as we learn more. As various people said above, putting unlimited channels into the language seems like an attractive nuisance; most programs do need backpressure.
Closing on the assumption that we will get some type of generics. We can reopen if we decide that that is definitely not happening.

@gopherbot add LanguageChange


Use with TypeScript 2.0  (@types/redux-thunk)

Hi
I'm attempting to use redux-thunk with TypeScript 2.0. The definitions from npm install @types/redux-thunk is as follows:
import * as Redux from "redux";
import { Middleware } from "redux";

export as namespace ReduxThunk;

declare const thunk: Middleware & {
    withExtraArgument(extraArgument: any): Middleware;
};
export default thunk;

declare module 'redux' {
    export type ThunkAction<R, S, E> = (dispatch: Dispatch<S>, getState: () => S, extraArgument: E) => R;

    export interface Dispatch<S> {
        <R, E>(asyncAction: ThunkAction<R, S, E>): R;
    }
}

The above appears to be completely different the one in the repo ?
I'm creating my store like this:
    var middleware = [
        thunk
    ];

    var store = createStore(
        combineReducers({
            things1: Reducer1,
            things2: Reducer2
        }),
        initialState,
        compose(
            applyMiddleware(...middleware),
            devToolsAvailable() ? window.devToolsExtension() : f => f
        )
    );

Then trying to initiate a thunk like this (I've copied the body of the function into the dispatch call for simplicity, it is returned from an action creator in my real code):
store.dispatch((dispatch: Redux.Dispatch<State>, getState: () => State) => {
        if (!getState().things1.loading) {
            dispatch(loadStart());
            loadStaticData('things.json', {json: true})
                .then((data: Things[]) => {
                    dispatch(loadComplete(data));
                })
                .catch((err) => {
                    dispatch(loadFailed(err));
                });
        }
    })

Unfortunately the error I get back is:
[ts] Argument of type '(dispatch: Dispatch<State>, getState: () => State) => void' is not assignable to parameter of type 'Action'.
       Property 'type' is missing in type '(dispatch: Dispatch<State>, getState: () => State) => void'.

So it looks like the defs available through npm aren't working (or I am missing something!).
Please could someone confirm:

Are the typings available from npm current?
and if so, what am I missing in my example above?

Thanks guys!!

I have just realised that I could avoid this whole issue by just calling store.dispatch in my async function :P But it would be good to know what is wrong with the typings / my code. Thanks! :)

I'm running into the same issue.

I also don't get the redux-thunk typings to work or just don't get the point.
The Dispatch-Definition enforces you to dispatch a ThunkAction. But in Redux with Redux-Thunk Middleware you can either dispatch a classic action (object with ha type property) or a ThunkAction, so the Dispatch typing should support both cases, shouldn't it?

I have no problem with typescript 2 and @types/redux-thunk since the begining, but I had troubles with the typings definitions when I was using Typescript 1.8.
I m not sure to to it the right way, but it works for me (i dont use extra arguments):
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import {reducer} from './reducers/index';
import {ShoppingList} from './shoppingList';
import {createStore, applyMiddleware, ThunkAction } from 'redux';
import thunk from 'redux-thunk';
import {State} from './reducers/state';

const store = createStore(
    reducer,
    applyMiddleware(thunk)
);

type ThunkAction2<R> = ThunkAction<R, State, void>; // you can inline that
export type ThunkActionCreator<R> = (...args: any[]) => ThunkAction2<R>;

ReactDOM.render(
    <Provider store={store}>
        <ShoppingList title="liste de courses"/>
    </Provider>,
    document.getElementById("app")
);

You can see a simple example here
index.tsx
some actions
Please tell me if it helps or if i m doing wrong !

In your example you didn't type the dispatch parameter in your thunk action creator.
Anyway, I got it working. The problem was my IDE. IntelliJ IDEA doesn't recognize the multiple typings for Dispatch (1 from the redux npm module for classic actions and 1 from the redux-thunk typings for thunk actions). So the IDE showed errors even though the build succeeded.

Oh ok I understand what you mean, indeed I have the same error.

As a workaround I made an own type definition file that doesn't cause IDEA to show errors for wrong parameters at Dispatch:
declare module "redux-fixed" {
  export type ThunkAction<R, S, E> = (dispatch: Dispatch<S>, getState: () => S, extraArgument: E) => R;

  export interface Dispatch<S> {
    <R, E>(asyncAction: ThunkAction<R, S, E>): R;
  }
  export interface Dispatch<S> {
    (action:A &{type:any}): A &{type:any};
  }

//compiler compiles correctly, but IDEA shows error if original Dispatch from redux bundle is used:
/* Original:
 export interface Dispatch<S> {
     (action: A): A;
 }
 */
    }

In my application I'm importing Dispatch from "redux-fixed" now, that passes the IDEA error checks.

I have the same problem, and my build isn't succeeding unlike @Q-Man 's (i.e, it's not an editor problem - my editor, vscode, and build report the same issue).

Hi,
I'm working with<EMAIL_ADDRESS>and I've encountered the same error report mentioned by @dupski launching an async (redux-thunk) action. Here's the error:
Argument of type '(dispatch: Function, getState: Function) => void' is not assignable to parameter of type 'Action'.
  Property 'type' is missing in type '(dispatch: Function, getState: Function) => void'.

... and here's the action function code (typescript annotations are purposely very lousy):
export const loadList = ()  => {
  return (dispatch:Function, getState:Function) => {
    const state = getState(),
          xhrFilterParams = {
            xy: state.list.xy,
            uv: state.list.uv
          };

    Api.getList(xhrFilterParams).then((response:any) => {
      dispatch(setItems(response));
    }).catch((error:any) => {
      console.error(error);
    });
  }
}

It seems to me that the issue is related to Dispatch overloading as brilliantly exposed in #82. My dirty workaround is to add the :any annotation to the expected return of loadList function. Here's the full code:
export const loadList = ():any  => {
  return (dispatch:Function, getState:Function) => {
    const state = getState(),
          xhrFilterParams = {
            xy: state.list.xy,
            uv: state.list.uv
          };

    Api.getList(xhrFilterParams).then((response:any) => {
      dispatch(setItems(response));
    }).catch((error:any) => {
      console.error(error);
    });
  }
}

Any comments are welcomed and appreciated!

I think this is the same workaround as mine, but as @Q-Man said, it works because we cast dispatch as Function.
I prefere to return a promise from my asyncActionCreators, any is not cool :)

@jbcazaux thanks, I got your point! Following your insight and since I'm not returning anything a better code solution in my case would be a void annotation:
export const loadList = ()  => {
  return (dispatch:Function, getState:Function):void => {
    const state = getState(),
          xhrFilterParams = {
            xy: state.list.xy,
            uv: state.list.uv
          };

    Api.getList(xhrFilterParams).then((response:any) => {
      dispatch(setItems(response));
    }).catch((error:any) => {
      console.error(error);
    });
  }
}

I got it working with typed ThunkActions with my solution of adding an own type definition file for the Dispatch Definitions:
redux-fixed/index.d.ts:
//Fix for problem that TypeScript doesn't accept Dispatch from redux npm bundle
declare module "redux-fixed" {
  export type ThunkAction<R, S, E> = (dispatch: Dispatch<S>, getState: () => S, extraArgument: E) => R;

  export interface Dispatch<S> {
    <R, E>(asyncAction: ThunkAction<R, S, E>): R;
  }
  export interface Dispatch<S> {
    (action:A &{type:any}): A &{type:any};
  }
}

actions.ts:
/// <reference path="redux-fixed/index.d.ts" />
import {ThunkAction, Dispatch} from 'redux-fixed';
import {IMainState} from "./store-state";
import {Action} from "redux";

type ThunkInterface<R> = ThunkAction<R, IMainState, void>;
type ReduxDispatch = Dispatch<IMainState>;

interface IGetState {
	():IMainState;
}

interface ReduxAction extends Action {
    payload?: any;
    error?: boolean;
    meta?: any;
    errorMessage?: string;
}

function dummyThunkActionCreator():ThunkInterface<string> {
	return (dispatch:ReduxDispatch, getState:IGetState) => {
		dispatch(dummyActionCreator("dummy"));
		return "dummyReturnValue";
	}
}

function dummyActionCreator(anyParam:string):ReduxAction {
	return {
		type: "dummyActionType",
		payload: anyParam,
	}
}

I am still getting the same error:
Error:(13, 29) TS2345:Argument of type '(dispatch: any) => void' is not assignable to parameter of type 'Action'.
  Property 'type' is missing in type '(dispatch: any) => void'.

with latest redux-think
any ideas?
regards
Sean

@born2net could you please share the function code?

Until https://github.com/gaearon/redux-thunk/pull/77 is released, you can just copy the definition from the PR to your project and then tell TS how to find it using path mapping:
// typings.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "redux-thunk": ["path/to/definition"]
    }
  }
}

I removed redex-thunk from my typings, and added this to my typings.d.ts and still same issue :(
declare module 'redux-thunk' {
  import { Middleware } from 'redux';
  const thunkMiddleware : Middleware;
  export default thunkMiddleware;
  export type ThunkAction<R, S, E> = (dispatch: Dispatch<S>, getState: () => S, extraArgument: E) => R;
  export interface Dispatch<S> {
    <R, E>(asyncAction: ThunkAction<R, S, E>): R;
  }
  export interface Dispatch<S> {
    (action:A &{type:any}): A &{type:any};
  }
}

I know it's being applied since if I remove the entire snippet I get many errors on redux, so it is taking it, its just that it does not satisfy this issue of:
Error:(13, 29) TS2345:Argument of type '(dispatch: any) => void' is not assignable to parameter of type 'Action'.
  Property 'type' is missing in type '(dispatch: any) => void'.

regards
Sean

here is my latest and still same issue:
declare module 'redux-thunk' {
  import { Middleware } from 'redux';
  const thunkMiddleware : Middleware;
  export default thunkMiddleware;
  export type ThunkAction<R, S, E> = (dispatch: Dispatch<S>, getState: () => S, extraArgument: E) => R;
  export interface Dispatch<S> {
    <R, E>(asyncAction: ThunkAction<R, S, E>): R;
  }
  export interface Dispatch<S> {
    (action:A &{type:any}): A &{type:any};
  }
}

Released v2.1.1 with TypeScript definitions included.

@Q-Man Have you an example on how you use your typed thunk actions in a component with a mapDispatchToProps + bindActionCreators ?
I managed to type the thunk actions in my actions module like you but I can't bind them into a mapDispatchToProps correctly. Still have issues because the action is known as a ThunkAction that doesn't match when I'm writing this.props.myThunkAction().then((results) => {} );

Am I misunderstanding something, or is it a bit weird that both dispatch and getState use the same generic type? I don't want to dispatch my entire state, right? I want to dispatch an action, with a type parameter, but I don't want my state to have type parameter, right? Shouldn't it be
export type ThunkAction<R, S, A, E> = (dispatch: Dispatch, getState: () => S,
                                extraArgument: E) => R;

Having the same issue
app/_dashboard.store.ts(54,37): error TS2345: Argument of type '(dispatch: any) => void' is not assignable to parameter of type 'Action'.
the line:
` DashboardStore.dispatch((dispatch) => {
if (response.data) {
let notifications = response.data;
                delete notifications.ResultCode;

                dispatch({
                    type: 'STORE_NOTIFICATIONS',
                    notifications: notifications
                });
            }
        });`

Hey guys, I've now had way more experienced with TS and have worked out a good way to use the typings that ship with redux-thunk...
Basically the trick is to define your thunk function as a ThunkAction.
The ThunkAction<R, S, E> type is a generic type that takes 3 properties:

R - thunk function return type - it is a good idea to return a Promise from your thunk function so you can await the result if needed
S - State type - an interface that represents your redux store shape
E - extraArgument type - see https://twitter.com/dan_abramov/status/730053481919303685?lang=en

Heres an example:
import * as Redux from 'redux';
import { ThunkAction } from 'redux-thunk';
import { getStore, IState } from './my_store';

let store = getStore();

// Create myThunkAction function with a type of ThunkAction<R, S, E>
let myThunkAction: ThunkAction<Promise<string>, IState, null> =
    (dispatch: Redux.Dispatch<IState>, getState: () => IState) => {
        return new Promise<string>((resolve, reject) => {

            // do async stuff with getState() and dispatch(), then...
            resolve('done!');

        });
    }

store.dispatch(myThunkAction)
.then(() => {
    // do stuff after the thunk has finished...
});

Hope this helps folks. Closing this issue now :)

Heres an example thunk that takes some arguments:
// Return a thunk with a type of ThunkAction<R, S, E>
function doAsyncStuff(someArg: string): ThunkAction<Promise<string>, IState, null> {
    return (dispatch: Dispatch<IState>, getState: () => IState) => {
        return new Promise<string>((resolve, reject) => {

            // do async stuff with getState() and dispatch(), then...
            resolve('done...');

        });
    };
}

store.dispatch(doAsyncStuff('www.google.com'))
.then(() => {
    // do stuff after the thunk has finished...
});

@dupski You don't need to type Dispatch and getState, it's already done par ThunkAction.
See:

https://github.com/gaearon/redux-thunk/blob/master/index.d.ts#L4
https://github.com/gaearon/redux-thunk/blob/master/test/typescript.ts

It improves readability :)

It took me hours to solve it.
In my case, the problem was that Dispath<S> exists in both redux and react-redux. The type definitions from redux-thunk create an overload for the Dispatch<S> that exists in redux, not react-redux.

@cr0cK Were you ever able to get this to work with mapDispatchToProps? What did you do?

@sarink Yes, you can't use the same props ILoadItem in your component because the return value is not the same. To handle this, you can declare a type/interface for your actions by using a generic type in order to "configure" the type of the returned value, according to the usage context. See this example:
/** action.js **/

import { ThunkAction } from 'redux-thunk';

export interface IItem {
  id: string;
}

// use a generic to define the type of the return according to the context (binded action or not)
export type LoadItem<R> = (id: string) => R;

// thunk action with the correct return type
export const loadItem: LoadItem<ThunkAction<<Promise<IItem>, IState, IExtraArgument> = (id) => {
  return (dispatch, getState) => {
    // ...
  }
};

/** MyComponent.tsx */

// split your props in order to reuse them
// in mapStateToProps and mapDispatchToProps
export interface IStateProps {
  // ...
}

export interface IDispatchProps {
  loadItem: LoadItem<Promise<IItem>>;
}

class MyComponent extends React.Component<IProps, {}> {
  componentDidMount() {
    // the action argument should be checked as a string and item should be an `IItem` object
    this.props.loadItem('1').then((item) => {
      // ...
    });
  }

  render() {
    return

;
  }
}

/** types.d.ts */

// Mapped type (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html#mapped-types)
// Use this to check that all functions have been declared in your mapDispatchToProps according
// to the *DispatchProps of your components
declare type ActionCreatorsMapObject<T> = {
  [K in keyof T]: any;
}

/** index.js **/

import { IDispatchProps } from './MyComponent';

const mapDispatchToProps = bindActionCreators<ActionCreatorsMapObject<IDispatchProps>>({
  loadItem,
  // will raise an error if some binds are missing
}, dispatch);

Your workaround hopefully doesn't work with --strictFunctionTypes 😄
I haven't yet used this in practice, as almost all thunk actions I am dispatching are void, but I wonder if a helper like this would work well:
/**
 * Wrapper used when calling thunk actions that were bound by react-redux's connect.
 *
 * Usage:
 *
 * ```ts
 * const result = thunkResult(this.props.thunkAction(args))
 * ```
 *
 * TypeScript doesn't support transforming the signature of functions,
 * so it's not possible to make a generic type that would correctly
 * accept the thunk functions while changing their return type. This has
 * to be done with a roundtrip through any.
 *
 * This is only correct if the action actually was dispatched. By default,
 * this will check whether the result is or is not a function to ensure it
 * is being used correctly, but if the result really must be a function, the
 * second argument can be set to true to disable the check.
 */
export function thunkResult<R> (
  thunkAction: ThunkAction<R, any>,
  resultIsFunction?: true
): R {
  const result = thunkAction as any as R
  if (typeof result === 'function' && !resultIsFunction) {
    throw new Error('thunkResult mistakenly used on undispatched thunk')
  }
  return result
}

If anyone is coming here because they just wanted to make a simple import to the store, and import is not working... Here's the solution:
import { applyMiddleware, createStore } from 'redux';
import * as thunk from 'redux-thunk';
import * as promise from 'redux-promise-middleware';
import { rootReducer } from './root-reducer';
const middleware = applyMiddleware(promise.default(), thunk.default);
export default createStore(rootReducer, middleware);

We had to call "default" after each import.
Here's the post in Medium

@superjose - You may want to look into allowSyntheticDefaultImports instead of this as what you're doing is a bit of a workaround.

@atrauzzi Thank you very much for pointing that out. I honestly don't know if it's a problem with my tsconfig or create-react-app typescript. But it is certainly not picking that up:

The very first line has allowSyntheticDefaultImports

In my case upgrading redux-thunk was enough:
redux-thunk": "^2.3.0"

For the love of god, I've been battling with this error for hours:

Argument of type 'ThunkAction<Promise<any>, RootState, null, AnyAction>' is not assignable to parameter of type 'Action'.   Property 'type' is missing in type 'ThunkAction<Promise<any>, RootState, null, AnyAction>'.
And here's the thunk:

const verifyUserEmail = (token: string): ThunkAction<Promise<any>, RootState, ApiClient, AnyAction> => {
  return async (dispatch, getState, api) => {
    dispatch(Actions.verifyUserEmailRequest());

    try {
      await api.users.verifyUserEmail(token);
      return dispatch(Actions.verifyUserEmailSuccess());
    } catch (e) {
      captureException(e);
      if (e.code === 404) {
        dispatch(Actions.verifyUserEmailFailure('wrong_token'));
      } else if (e.code === 400) {
        dispatch(Actions.verifyUserEmailFailure('already_verified'));
      }
      return dispatch(Actions.verifyUserEmailFailure('some_other_error')); // TODO: types for errors?
    }
  };
};

I've tried all sorts of combinations.. already on the 4th page of google. So you know.
@redux 4.0
@redux-thunk 2.3.0
Any ideas, guys?
@dupski

@rpmonteiro
export function verifyUserEmailThunk(token: string) {
  return (dispatch: Dispatch<RootState>, getState: () => RootState, api) => {
    return new Promise<string>(async (resolve, reject) => {
      // I don't know where Actions is coming from
      dispatch(Actions.verifyUserEmailRequest());

      try {
        await api.users.verifyUserEmail(token);
        return dispatch(Actions.verifyUserEmailSuccess());
      } catch (e) {
        // I don't know where captureException is coming from.
        captureException(e);
        if (e.code === 404) {
          dispatch(Actions.verifyUserEmailFailure('wrong_token'));
        } else if (e.code === 400) {
          dispatch(Actions.verifyUserEmailFailure('already_verified'));
        }
        return dispatch(Actions.verifyUserEmailFailure('some_other_error')); // TODO: types for errors?
      }
      const result = await firebase.signIn(email, password);

      // We have to query the server to see if the user has admin rights, or not.
      if (result.succeeded) { return; }
      dispatch(loginActions.loginFailed(result.error!.message));

    });
  };
}

// Then you consume it like this:
import { verifyUserEmailThunk} from '@common/redux/actions/emailThunk';
import store from '@src/root-redux/store';
export class MyComponent extends React.Component<MyProps, MyState> {
  handleVerifyEmail() {
     store.dispatch(verifyUserEmailThunk(this.state.token));
  }
}

That's how I got it working! (I honestly didn't know how to quickly rewrite it to the const verifyUserEmail form.) I'm using TypeScript as well!

Ah, I see. So we're not using any types from redux-thunk?
On Fri, 8 Jun 2018, 03:47 Jose<EMAIL_ADDRESS>wrote:

@rpmonteiro https://github.com/rpmonteiro
export function verifyUserEmailThunk(token: string) {
return (dispatch: Dispatch, getState: () => RootState, api) => {
return new Promise(async (resolve, reject) => {
// I don't know where Actions is coming from
dispatch(Actions.verifyUserEmailRequest());
  try {
    await api.users.verifyUserEmail(token);
    return dispatch(Actions.verifyUserEmailSuccess());
  } catch (e) {
    // I don't know where captureException is coming from.
    captureException(e);
    if (e.code === 404) {
      dispatch(Actions.verifyUserEmailFailure('wrong_token'));
    } else if (e.code === 400) {
      dispatch(Actions.verifyUserEmailFailure('already_verified'));
    }
    return dispatch(Actions.verifyUserEmailFailure('some_other_error')); // TODO: types for errors?
  }
  const result = await firebase.signIn(email, password);

  // We have to query the server to see if the user has admin rights, or not.
  if (result.succeeded) { return; }
  dispatch(loginActions.loginFailed(result.error!.message));

});

};
}
// Then you consume it like this:
import { verifyUserEmailThunk} from '@common/redux/actions/emailThunk';
import store from '@src/root-redux/store';
export class MyComponent extends React.Component<MyProps, MyState> {
handleVerifyEmail() {
store.dispatch(verifyUserEmailThunk(this.state.token));
}
}
That's how I got it working! (I honestly didn't know how to quickly
rewrite it to the const verifyUserEmail form.) I'm using TypeScript as
well!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/reduxjs/redux-thunk/issues/103#issuecomment-395619696,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHdk505DhVi7KyrNBpCpw6y2dzv7Ny13ks5t6devgaJpZM4KTSVi
.

@rpmonteiro: exactly!! Now I don't remember where I got the info from. I think it was from a create-react-app-typescript project that was lying around. It was also very painful to get it right. Let me know if that solves the issue!

I spent most of yesterday battling with this issue, and managed to solve it like so:
/*
    AppAction - extends Redux::Action
    AppState - my app's state shape
*/
export type Thunk = ThunkAction<void, AppState, null, AppAction>;
export type Dispatch<S> = ThunkDispatch<S, null, AppAction>;

In my connected components, instead of using Dispatch from redux, I use the above definition.
const mapDispatchToProps = (
	dispatch: Dispatch<AppState>
): ContentOverlayDispatchProps => ({
	dismissOverlay: () => dispatch(hideContentOverlay()),
	loadContent: (key: string) => dispatch(loadDocument(key))
});

In this case, hideContentOverlay returns an AppAction object, and loadDocument is a Thunk.
Hope this helps! :)

Thank you for taking the time to share this. I actually used the exact same
approach, with the slight tweak of actually overloading redux's dispatch to
take my thunk type.
Was a huge headache.
On Sat, 9 Jun 2018, 11:34 Shishir Srivastava<EMAIL_ADDRESS>wrote:

I spent most of yesterday battling with this issue, and managed to solve
it like so:
/*
AppAction - extends Redux::Action
AppState - my app's state shape
*/
export type Thunk = ThunkAction<void, AppState, null, AppAction>;
export type Dispatch = ThunkDispatch<S, null, AppAction>;
In my connected components, instead of using Dispatch from redux, I use
the above definition.
const mapDispatchToProps = (
dispatch: Dispatch
): ContentOverlayDispatchProps => ({
dismissOverlay: () => dispatch(hideContentOverlay()),
loadContent: (key: string) => dispatch(loadDocument(key))
});
In this case, hideContentOverlay returns an AppAction object, and
loadDocument is a Thunk.
Hope this helps! :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/reduxjs/redux-thunk/issues/103#issuecomment-395955111,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHdk51Da-2RkaLfjDgvys58jKlc-WRgaks5t65afgaJpZM4KTSVi
.

@shishir-srivastava What you suggest works with an async function with no parameters but it doesn't if I pass any parameters to an async func. How did you manage?
I'm wondering what I'm missing..
export type RTAction = ThunkAction<void, RootState, null, RootAction>;
export type RTDispatch = ThunkDispatch<RootState, null, RootAction>;
export type GetState = () => RootState;

This works:
export const someActionAsync: RTAction = () => async (
  dispatch: RTDispatch,
  getState: GetState
) => {
  try {
    const url = getUrl();
    const res = await axios.get(url);
    dispatch(someAction(res.data));
  } catch (error) {
    // console.log("actionAsync.error", error);
  }
};

This doesn't:
export const anotherActionWithParamAsync: RTAction = (param: string) => async (
  dispatch: RTDispatch,
  getState: GetState
) => {
  try {
    const url = getUrl(param);
    const res = await axios.get(url);
    dispatch(anotherActionWithParam(res.data));
  } catch (error) {
    // console.log("anotherActionWithParamAsync.error", error);
  }
};

redux: 4.0.0
redux-thunk: 2.3.0
react-redux: 5.0.7
react: 16.3.1
typescript: 2.9.2
types/react-redux: 6.0.2

This seems to work for me:
// file: actions/users.ts
import { ActionCreator } from 'redux';
import { ThunkAction } from 'redux-thunk';

export const updateEmail: ActionCreator<
  ThunkAction<Promise<UpdateEmailAction>, State, null, UpdateEmailAction>
> = (req: IUpdateEmailRequest) => {
    return (dispatch, getState) => {
      let action: UpdateEmailAction = {
        type: CHANGE_EMAIL,
        state: States.INFLIGHT
      };
      dispatch(action);

      return ajax('/api/change-email', {
        method: 'POST',
        body: JSON.stringify(req)
      })
      .then(async (resp) => {
        if (resp.ok) {
          let action: UpdateEmailAction = {
            type: CHANGE_EMAIL,
            state: States.SYNCED
          };
          dispatch(action);
          return action;
        }

        let action: UpdateEmailAction = {
          type: CHANGE_EMAIL,
          state: States.ERRORED
        };
        dispatch(action);
        return action;
      })
      .catch(() => {
        let action: UpdateEmailAction = {
          type: CHANGE_EMAIL,
          state: States.ERRORED
        };
        dispatch(action);
        return action;
      });
    };
}

I omitted some specifics of my implementation, but this captures the gist of it. I generally return a promise from my async actions, and that promise always resolves to the action that I dispatched. This generally helps me remove some boilerplate state from components. You could of course use async for your ThunkAction like some of the other examples show here, or not return anything at all (e.g. ThunkAction<void, State, null, UpdateEmailAction>

This approach worked for me:
`
/* Imports from react, redux, and redux-thunk */
import { ThunkDispatch } from "redux-thunk";
import { connect } from 'react-redux';
import { Dispatch } from "react";
interface State {
something: string;
}
/* Thunk action */
export const myThunkAction= (arg: number) => {
return (dispatch: Dispatch, getState: () => State) => {
console.log('calling myThunkAction!');
}
}
/* Connecting a component, plugging everything together */
export default connect(
(state: State) => state,
(dispatch: ThunkDispatch<State, undefined, RootAction>) => ({
myThunkAction: (argument : number) => dispatch(myThunkAction(argument))
}))( MyComponent )
`
Dependencies:
"react": "^16.7.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"react-redux": "^6.0.0",
"@types/react-redux": "^7.0.1",
"@types/react": "^16.7.21",

If anyone still here because you can't configure the dispatch to accept thunks:
You can configure the generic params of applyMiddleware:
import { logger } from 'redux-logger'
import { applyMiddleware, createStore, combineReducers } from 'redux'
import thunk, { ThunkDispatch } from 'redux-thunk'

const middleware = applyMiddleware<ThunkDispatch<YourState, ThunkThirdParam, Actions>, YourState>(thunk, logger,...)

No use of as here... @zefj

I was struggling with this too and passing types to createStore solved the problem for me:
const store = createStore<StoreState, Actions, any, any>(appReducer, initialState, enhancers)
note: I just tried and we can also pass types to thunk as ThunkMiddleware<IState, Actions>

I have it working as:
import {ThunkDispatch} from 'redux-thunk';
import {Action} from '@reduxjs/toolkit';
import {useDispatch} from 'react-redux';

import {store} from './configureStore';

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = ThunkDispatch<RootState, undefined, Action<string>>;

export const useAppDispatch = () => useDispatch<AppDispatch>();

I dont know if this is still relevant but i solved:
Argument of type 'ThunkAction<Promise<void>, IState, undefined, Actions>' is not assignable to parameter of type 'Actions'.
aka  "i cannot dispatch thunkActions from the store"
store.dispatch(INSERT_YOUR_THUNK_ACTION_HERE()) // error

by typing the createStore return value:
export type appStore = Store<usersState, usersActions>
 & { dispatch: ThunkDispatch<usersState, undefined, usersActions>;} // this the good stuff
;
export const configureStore = (usersInitialState: usersState): appStore => {
  const appstore = createStore(
    usersReducer,
    usersInitialState,
    applyMiddleware(thunk)
  );
  return appstore;
};

then you can even drop the type assertion in createStore:
const store = createStore(
    rootReducer,
    applyMiddleware(
        thunk as ThunkMiddleware<IState, Actions>, // this is not needed anymore
    ),
);

For anyone else having this issue while using redux-toolkit, it could be due to using the spread operator for the middleware. Eg. I started with:
export const createStore = () => {
    return configureStore({
        reducer: appSlice.reducer,
        middleware: [...getDefaultMiddleware(), loggerMiddleware],
        preloadedState: appState
    })
}

and updated to
export const createStore = () => {
    return configureStore({
        reducer: appSlice.reducer,
        middleware: getDefaultMiddleware => getDefaultMiddleware().concat(loggerMiddleware),
        preloadedState: appState
    })
}

https://redux-toolkit.js.org/api/configureStore

Alternately, you may pass a callback function that will receive getDefaultMiddleware as its argument, and should return a middleware array. This lets you skip importing getDefaultMiddleware separately. If using TypeScript, prefer using this syntax, as we provide a more strongly-typed version of getDefaultMiddleware that will correctly retain the types of the provided middleware when constructing the store.

https://redux-toolkit.js.org/api/getDefaultMiddleware

It is preferrable to use the chainable .concat(...) and .prepend(...) methods of the returned MiddlewareArray instead of the array spread operator, as the latter can lose valuable type information under some circumstances.


Dashboard builder from policy components

Is your feature request related to a problem? Please describe.
Instead of preparing a dashboard for each policy we should have a library of panels for each policy component and generate it using scripts.
Describe the solution you'd like
Prepare a libsonnet script that puts together a dashboard based on policy components.

[ ] #2175

Dashboard builder is finished. PR for its usage is waiting on CI problem.


error: pts: /dev/pts/1 if create terminal after event loop

I want dynamically initialize and deinitialize terminal (vaxis.widgets.Terminal), but I get error: pts: /dev/pts/1 if I initialize after loop.TryEvent or loop.NextEvent basically after first frame. Is that a bug or I am supposed to initialize terminal in different way?

On Wed Sep 4, 2024 at 7:14 PM CDT, LightSrc wrote:

I want dynamically initialize and deinitialize terminal
(vaxis.widgets.Terminal), but I get error: pts: /dev/pts/1 if I initialize
after loop.TryEvent or loop.NextEvent basically after first frame. Is that
a bug or I am supposed to initialize terminal in different way?

It looks like that log happens no matter what. I'll change it to a debug log
since no actual error is occurring. Was the widget working, other than that?


Application layer checks (optional) in the network checker

Added ability to check if the server replies with a particular message, to ensure it is really alive.

That looks great @ralienpp. I’ll get down to review it further ASAP.
I can already see it’s missing migrations, but I can add that :)

I'd be glad to add them myself, but my knowledge of Django is superficial and rusty. If you can write a step-by-step guide, I will be able to follow it; otherwise I am not confident I won't mess up the existing ORM-related logic.
Otherwise, I'm happy to write the purely network-related part.


Add readoptions

merged the PR adding readOptions
flag consistency works for consul and etcd

Coverage decreased (-0.2%) to 83.649% when pulling 67c42baba47374d0207b0a4bfb696cde65b942c2 on znx:add_readoptions into eb7018589df3fbda09c48c4976840824e0cb793f on abronan:master.

Coverage decreased (-0.2%) to 83.649% when pulling 778ef57ca9e375763a1a7b15cfe01b119dc3ff1d on znx:add_readoptions into eb7018589df3fbda09c48c4976840824e0cb793f on abronan:master.

@zyclonite Sorry for the very long latency to get back to this PR. Would you mind rebasing your changes on top of the master branch?
Only thing is that it now includes etcd v3 which uses the etcd.WithSerializable() flag to set consistency on Get and List calls. Simple solution would be to call either the normal Get or the consistent Get with the etcd.WithSerializable() option depending on whether the libkv Consistent option is set to true or false. Knowing that the consistent Get is the one we call by default.
Let me know if you have time to do this otherwise I will kindly carry to another PR (while keeping your contribution intact).
Thanks!

should merge again :)
but i had only time to implement the api for v3 ...

@zyclonite Woops, I think there was some issue with the rebase. You could either try to fix and force push to your branch, or if this is more convenient for you, feel free to close and open a new PR.

i'll try a new one, maybe that's easier


⚠ Spryr has degraded performance

In 8680266, Spryr (https://spryr.com) experienced degraded performance:

HTTP code: 200
Response time: 3481 ms

Resolved: Spryr performance has improved in e8fc4bf after 3 minutes.


pkgsStatic.dash: fix build

Followup to #205958 to actually fix the build, not entirely sure why this worked previously.
Description of changes

Things done

Built on platform(s)

[x] x86_64-linux
[ ] aarch64-linux
[ ] x86_64-darwin
[ ] aarch64-darwin

[ ] For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
[ ] Tested, as applicable:

NixOS test(s) (look inside nixos/tests)
and/or package tests
or, for functions and "core" functionality, tests in lib/tests or pkgs/test
made sure NixOS tests are linked to the relevant packages

[x] Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
[ ] Tested basic functionality of all binary files (usually in ./result/bin/)
23.05 Release Notes (or backporting 22.11 Release notes)

[ ] (Package updates) Added a release notes entry if the change is major or breaking
[ ] (Module updates) Added a release notes entry if the change is significant
[ ] (Module addition) Added a release notes entry if adding a new NixOS module
[ ] (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes

[x] Fits CONTRIBUTING.md.

Used this command to confirm it builds successfully: nix build github:Kiskae/nixpkgs/dash-static#pkgsStatic.dash --no-link -L


Init should generate a gitignore

Version control is good
https://github.com/github/gitignore/blob/main/Python.gitignore or a subset of it should suffice

Disagree - workflows are not git repositories by default and it will be up to the developer who turns it into one to create a .gitignore with statements that make sense for their development environment


Service is active, but no zrams are mounted

Fresh install of debian 10 with pihole.
Previously installed log2ram and after that decided to move to zram-config.
Uninstalled log2ram with apt and installed the zram-config. Used the default /etc/ztab-file. Service is active, but zramctl shows empty output. DF, FREE -H and SWAPON commands shows no signs of any zram drives mounted.
Stop command finished with error (see - below).
root@wyse:/opt/zram# sudo zram-config "stop"
zram-config stop 2021-08-06-23:24:51
tac: failed to open '/tmp/zram-device-list' for reading: No such file or directory
I would be gratefull for any suggestions how to make it working.
Linux wyse 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux

Checked the status of service (see below) and noticed that the error at the last line "failed to set alg".
Checked the /proc/crypto file and found no lzo-rle.
I guess zlo was't installed. I install zram-tools and after that everything started to work.
I assume you should add certain dependencies or something like that to zram-config's install script.
root@wyse:~/zram-config# sudo systemctl status zram-config.service
● zram-config.service - zram-config
   Loaded: loaded (/etc/systemd/system/zram-config.service; enabled; vendor p
   Active: active (exited) since Sat 2021-08-07 19:28:13 MSK; 15s ago
     Docs: https://github.com/ecdye/zram-config/blob/main/README.md
  Process: 710 ExecStart=/usr/local/sbin/zram-config start (code=exited, stat
 Main PID: 710 (code=exited, status=0/SUCCESS)

Aug 07 19:28:13 wyse systemd[1]: Started zram-config.
Aug 07 19:28:13 wyse zram-config[710]: zram-config start 2021-08-07-19:28:13
Aug 07 19:28:14 wyse zram-config[710]: zramctl: /dev/zram0: failed to set alg

I was too fast to close this issue.
So far after installing zram-tools, stop and start zram-config.service I got zswap, but not log and dir zrams mounted.
I rebooted the system but now luck.
Here is my /etc/ztab
# swap  alg             mem_limit       disk_size       swap_priority   page$
swap    lzo-rle         250M            750M            75              0   $

# dir   alg             mem_limit       disk_size       target_dir          $
dir     lzo-rle         150M            450M            /var/cache          $

# log   alg             mem_limit       disk_size       target_dir          $
log     lzo-rle         250M            750M            /var/log            $

and some command's output:
root@wyse:~# sudo zramctl
NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram3 lzo            64M   4K   78B   12K       4 [SWAP]
/dev/zram2 lzo            64M   4K   78B   12K       4 [SWAP]
/dev/zram0 lzo            64M   4K   78B   12K       4 [SWAP]

after reboot I found zram2 and zram3 in addition to zram0 which was there before reboot
root@wyse:~# df
Filesystem     1K-blocks    Used Available Use% Mounted on
udev              961192       0    961192   0% /dev
tmpfs             195216    3164    192052   2% /run
/dev/mmcblk0p2   5947704 1639748   3986116  30% /
tmpfs             976072    2320    973752   1% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
tmpfs             976072       0    976072   0% /sys/fs/cgroup
/dev/mmcblk0p1    523248    6704    516544   2% /boot/efi
tmpfs             195212       0    195212   0% /run/user/998
tmpfs             195212       0    195212   0% /run/user/1000
root@wyse:~# free -h
              total        used        free      shared  buff/cache   available
Mem:          1.9Gi       123Mi       1.3Gi       8.0Mi       438Mi       1.6Gi
Swap:         1.1Gi          0B       1.1Gi
root@wyse:~# sudo swapon
NAME           TYPE      SIZE USED PRIO
/dev/mmcblk0p3 partition 976M   0B   -2
/dev/zram0     partition  64M   0B  100
/dev/zram2     partition  64M   0B  100
/dev/zram3     partition  64M   0B  100

still need help

root@wyse:/opt/zram# journalctl -xe | grep zram
Aug 07 20:16:01 wyse systemd[1]: Starting Linux zramswap setup...
-- Subject: A start job for unit zramswap.service has begun execution
-- A start job for unit zramswap.service has begun execution.
Aug 07 20:16:01 wyse systemd[1]: Started zram-config.
-- Subject: A start job for unit zram-config.service has finished successfully
-- A start job for unit zram-config.service has finished successfully.
Aug 07 20:16:01 wyse zram-config[377]: zram-config start 2021-08-07-20:16:01
Aug 07 20:16:01 wyse kernel: zram: Added device: zram0
Aug 07 20:16:01 wyse kernel: zram: Added device: zram1
Aug 07 20:16:01 wyse kernel: zram: Added device: zram2
Aug 07 20:16:01 wyse kernel: zram: Added device: zram3
Aug 07 20:16:01 wyse kernel: zram0: detected capacity change from 0 to 67108864
Aug 07 20:16:01 wyse zramswap[376]: Setting up swapspace version 1, size = 64 MiB (67104768 bytes)
Aug 07 20:16:01 wyse zramswap[376]: no label, UUID=7e70647a-3777-48f7-9790-1fa449ed9539
Aug 07 20:16:01 wyse kernel: Adding 65532k swap on /dev/zram0.  Priority:100 extents:1 across:65532k SSFS
Aug 07 20:16:01 wyse kernel: zram1: detected capacity change from 0 to 67108864
Aug 07 20:16:01 wyse kernel: zram1: detected capacity change from 67108864 to 0
Aug 07 20:16:01 wyse zramswap[376]: mkswap: error: swap area needs to be at least 40 KiB
Aug 07 20:16:01 wyse zram-config[377]: zramctl: /dev/zram1: failed to set algorithm: Invalid argument
Aug 07 20:16:01 wyse zramswap[376]: swapon: /dev/zram1: read swap header failed
Aug 07 20:16:01 wyse kernel: zram2: detected capacity change from 0 to 67108864
Aug 07 20:16:01 wyse zramswap[376]: Setting up swapspace version 1, size = 64 MiB (67104768 bytes)
Aug 07 20:16:01 wyse zramswap[376]: no label, UUID=9089f825-94b9-4e89-a24c-1c21cc912c62
Aug 07 20:16:01 wyse kernel: Adding 65532k swap on /dev/zram2.  Priority:100 extents:1 across:65532k SSFS
Aug 07 20:16:01 wyse kernel: zram3: detected capacity change from 0 to 67108864
Aug 07 20:16:01 wyse zramswap[376]: Setting up swapspace version 1, size = 64 MiB (67104768 bytes)
Aug 07 20:16:01 wyse zramswap[376]: no label, UUID=a02f38ec-1095-4a5c-beba-8a9f645f8d9e
Aug 07 20:16:01 wyse kernel: Adding 65532k swap on /dev/zram3.  Priority:100 extents:1 across:65532k SSFS
Aug 07 20:16:01 wyse systemd[1]: Started Linux zramswap setup.
-- Subject: A start job for unit zramswap.service has finished successfully
-- A start job for unit zramswap.service has finished successfully.
Aug 07 20:16:47 wyse sudo[624]:     root : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/sbin/zramctl
Aug 07 20:24:29 wyse sudo[4249]:     root : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/local/sbin/zram-config stop
Aug 07 20:24:29 wyse systemd[1]: Stopping zram-config...
-- Subject: A stop job for unit zram-config.service has begun execution
-- A stop job for unit zram-config.service has begun execution.
Aug 07 20:24:29 wyse zram-config[4257]: zram-config stop 2021-08-07-20:24:29
Aug 07 20:24:29 wyse zram-config[4257]: tac: failed to open '/tmp/zram-device-list' for reading: No such file or directory
Aug 07 20:24:29 wyse systemd[1]: zram-config.service: Succeeded.
-- The unit zram-config.service has successfully entered the 'dead' state.
Aug 07 20:24:29 wyse systemd[1]: Stopped zram-config.
-- Subject: A stop job for unit zram-config.service has finished
-- A stop job for unit zram-config.service has finished.
Aug 07 20:24:42 wyse sudo[4267]:     root : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/systemctl status zram-config.service
Aug 07 20:24:54 wyse sudo[4270]:     root : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/systemctl start zram-config.service
Aug 07 20:24:54 wyse systemd[1]: Started zram-config.
-- Subject: A start job for unit zram-config.service has finished successfully
-- A start job for unit zram-config.service has finished successfully.
Aug 07 20:24:54 wyse zram-config[4273]: zram-config start 2021-08-07-20:24:54
Aug 07 20:24:54 wyse zram-config[4273]: zramctl: /dev/zram1: failed to set algorithm: Invalid argument
Aug 07 20:24:58 wyse sudo[4333]:     root : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/systemctl status zram-config.service
Aug 07 20:26:15 wyse sudo[4353]:     root : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/sbin/zramctl
Aug 07 20:45:22 wyse sudo[4980]:     root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/usr/sbin/zramctl
Aug 07 21:03:33 wyse sudo[6467]:     root : TTY=pts/1 ; PWD=/opt/zram ; USER=root ; COMMAND=/usr/local/sbin/zram-config stop
Aug 07 21:03:34 wyse systemd[1]: Stopping zram-config...
-- Subject: A stop job for unit zram-config.service has begun execution
-- A stop job for unit zram-config.service has begun execution.
Aug 07 21:03:34 wyse zram-config[6475]: zram-config stop 2021-08-07-21:03:34
Aug 07 21:03:34 wyse zram-config[6475]: tac: failed to open '/tmp/zram-device-list' for reading: No such file or directory
Aug 07 21:03:34 wyse systemd[1]: zram-config.service: Succeeded.
-- The unit zram-config.service has successfully entered the 'dead' state.
Aug 07 21:03:34 wyse systemd[1]: Stopped zram-config.
-- Subject: A stop job for unit zram-config.service has finished
-- A stop job for unit zram-config.service has finished.
Aug 07 21:04:50 wyse systemd[1]: Started zram-config.
-- Subject: A start job for unit zram-config.service has finished successfully
-- A start job for unit zram-config.service has finished successfully.
Aug 07 21:04:50 wyse zram-config[6605]: zram-config start 2021-08-07-21:04:50
Aug 07 21:04:50 wyse zram-config[6605]: zramctl: /dev/zram1: failed to set algorithm: Invalid argument
Aug 07 21:06:04 wyse sudo[6675]:     root : TTY=pts/1 ; PWD=/opt/zram ; USER=root ; COMMAND=/usr/bin/systemctl status zram-config.service
Aug 07 21:06:26 wyse sudo[6683]:     root : TTY=pts/3 ; PWD=/root/zram-config ; USER=root ; COMMAND=/usr/bin/apt overlayfs-tools
Aug 07 21:06:31 wyse sudo[6685]:     root : TTY=pts/3 ; PWD=/root/zram-config ; USER=root ; COMMAND=/usr/bin/apt install overlayfs-tools
Aug 07 21:08:11 wyse sudo[6805]:     root : TTY=pts/3 ; PWD=/root/zram-config ; USER=root ; COMMAND=/usr/local/sbin/zram-config stop
Aug 07 21:08:11 wyse systemd[1]: Stopping zram-config...
-- Subject: A stop job for unit zram-config.service has begun execution
-- A stop job for unit zram-config.service has begun execution.
Aug 07 21:08:11 wyse zram-config[6810]: zram-config stop 2021-08-07-21:08:11
Aug 07 21:08:11 wyse zram-config[6810]: tac: failed to open '/tmp/zram-device-list' for reading: No such file or directory
Aug 07 21:08:11 wyse systemd[1]: zram-config.service: Succeeded.
-- The unit zram-config.service has successfully entered the 'dead' state.
Aug 07 21:08:11 wyse systemd[1]: Stopped zram-config.
-- Subject: A stop job for unit zram-config.service has finished
-- A stop job for unit zram-config.service has finished.
Aug 07 21:08:12 wyse systemd[1]: Started zram-config.
-- Subject: A start job for unit zram-config.service has finished successfully
-- A start job for unit zram-config.service has finished successfully.
Aug 07 21:08:12 wyse zram-config[6845]: zram-config start 2021-08-07-21:08:12
Aug 07 21:08:12 wyse zram-config[6845]: zramctl: /dev/zram1: failed to set algorithm: Invalid argument

zram-config_log.txt

Simple solution, your linux kernel is too old and does not support lzo-rle. Try changing your algorithm in /etc/ztab to lz4 and see if it works.

The change of algorithm did the job.
Thanks a lot.


Any breaking changes from 4 to 5?

what are the breaking changes from v4 to v5?  the changelog seem to not mention any breaking changes?!
https://github.com/aFarkas/lazysizes/blob/gh-pages/CHANGELOG.md

Do not leak global lazySizesConfig anymore fixes #647

Can break things. In case you changed lazySizesConfig dynamically without creating it initially yourself.

thx


Wrap lines to 80 chars and remove trailing whitespace

Overview
Wrap lines to 80 chars and remove trailing whitespace

Testing recommendations

Related Issues or Pull Requests

Checklist

[ ] Code is written and works correctly
[ ] Changes are covered by tests
[ ] Any new configurable parameters are documented in rel/overlay/etc/default.ini
[ ] A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation

@wohali thanks for the reminder, but as an old FORTRAN hax0r, I will always be an 80 column guy ;)


Do you know any javascript formatter?

I'd like to format a MoneyPHP object using Javascript (in React): do you know any javascript library that can help?

How do you want to format a PHP object in javascript? I mean: you somehow need to return the object to javascript in a string representation, so why not format the value there? Unfortunately I don't use too much JavaScript, so I can't help with that.

I worked around this with a Doctrine embeddable, saving also the converted amount other than the base amount... Anyway, thank you for your reply!


[Bug]: kubectl-cnpg status --> Physical backups progress

Is there an existing issue already for this bug?

[X] I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

[X] I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

[X] I have read the troubleshooting guide and I think this is a new bug.

Contact Details
<EMAIL_ADDRESS>Version
1.22.2
What version of Kubernetes are you using?
1.26
What is your Kubernetes environment?
Other
How did you install the operator?
YAML manifest
What happened?
The progress in the Physical backups section of kubectl-cnpg status is not correctly calculated
Physical backups
Name             Phase                     Started at                   Total  Transferred  Progress  Tablespaces
----             -----                     ----------                   -----  -----------  --------  -----------
keycloak-2-join  streaming database files  2024-04-17T12:59:48.939639Z  46 GB  38 GB        0.84%     0/1

according to https://github.com/cloudnative-pg/cloudnative-pg/commit/2d1c4db3909d62cab4861e627deacd0c564cafb2 the progress is calculated BackupStreamed/BackupTotal
		progress := ""
		if bb.BackupTotal != 0 {
			progress = fmt.Sprintf("%.2f%%", float64(bb.BackupStreamed)/float64(bb.BackupTotal))
		}

imho it should be 100/BackupTotal*BackupStreamed
Cluster resource
No response
Relevant log output
No response
Code of Conduct

[X] I agree to follow this project's Code of Conduct

This was already fixed on #4131


Support for Local account/Sign in names was missing in  MS graph api.

i was unable to create local account via new microsoft graph api, as i am using that for all communications,
But userprincipal name was asking domain name, which will be not used for communication,
When will be support provided for local account and sign in names to create a local account in b2c via ms graph api?
or
any other way to create local account via ms graph api in asp.net core 2.2

I'm also interested in the answer, I've been waiting for almost 2 years for this functionality to be added and want to move away from Azure AD Graph. You can see from this article in 2016 that it was promised "soon" and 3 years has to be classed as soon, surely!

Sorry for delay in responding, didn't have repo alerts set up previously.
@markdstafford or @dkershaw10 any comment?


Provide documentation on how to create identifiers using gem

As requested by @opoudjis https://github.com/metanorma/metanorma-iso/issues/657#issuecomment-1146028990

Ping @mico


CCIP-SDK addition to mega menu - TO BE MERGED ON MONDAY THE 28th

Add SDK on megamenu

NOTE: To be merged on Monday the 28th

The SDK is not going live. The PR will be reopened when the time comes for this change to take place


Web interface password

First: THANKS for all the work!
I'v got a issue with the web interface. After i'v set the username and password an rebooted the device the username and password for the rtsp stream are set. But the interface on :8080 does not accept the username and password. The rtsp stream does.
I'v checked cat /tmp/httpd.conf and the username and password are correct.
Any ideas?

Yes #

The parser is very ugly, the # char is not supported.

Np. It was a rtfm since it was explained right under the input.


[MM-32401][MM-32450] Some style fixes for the sidebar

Summary
3 fixes are included in this PR:

On mobile view, the width of the channels was not set on mobile view correctly. Have now been set to 290px
On desktop mobile view, the height of the channel menu element was too high. I've removed the specific height of the menu button element which should no longer be required now that we've switched the parent over to flexbox
When dragging multiple channels, the count of channels was cutoff due to adding overflow: hidden. I've added overflow: visible to the dragging state of the channel so that it will show correctly.

Ticket Link
https://mattermost.atlassian.net/browse/MM-32401
https://mattermost.atlassian.net/browse/MM-32450

Thanks @devinbinnie
Looks good, I'll approve after dev reviews.

Verified 3-dot icons lineup and vertical alignment(on desktop) in mobile view (and non-mobile, just in case).
Verified channel count is not cutoff when dragging multiple channels.

@jgilliam17 Dev reviews are complete.

/cherry-pick release-5.32

Cherry pick is scheduled.

/cherry-pick cloud

Cherry pick is scheduled.


I have added utf-8 char encoding

I had a little bit of trouble from time to time and it was complaining about characters,so I added utf-8.I also added model loading sound so when it is loaded we know it is functional.You may want to add language support instead of auto detection if you want.So that we can force the model to translation etc. Anyway Just wanted to thank you for the tool.
whisper-typer-tool.zip

Thanks.I'm glad to hear that you like the tool. I have taken over your solution, but changed the model again to "tiny", as this was best working on a standard device like a mac book pro with no powerful GPU.


Add plots for main p38 figure

ExtDataFig3a.zip
Fig2.zip
These are zip files contain the figures generated in this notebook

FYI @AnneCarpenter


Search paths is not woking if use-legacy-processing sets to true in config repo

Describe the bug
If our config repo has spring.config.use-legacy-processing=true in application.yml and use search paths in config server,
Then returns empty environments becase of ; delimiter at NativeEnvironmentRepository which updated from #1904.
If this is within the provided specification, please close the issue :) thx!
Sample

Config Repo

tree ./
./
├── app
│   └── application.yml
└── data
    └── db.yml

app/application.yml
...
spring:
  config:
    use-legacy-processing: true
...

Config Server

application.yml
spring:
  cloud:
    config:
      server:
        git:
          uri: file://${user.home}/myrepo
          search-paths:
            - app
            - data

What version of Spring Boot and Spring Cloud are you using?  Can you provide a sample that reproduces the issue?

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.


Update clap to v3.1.6: clap version used in dex has unstable API

Currently used version of clap is 3.0.0-beta.1, see
https://github.com/project-serum/serum-dex/blob/a3b4cf71193611fd96af9b277db93a505d581648/dex/crank/Cargo.toml#L14
This leads to compilation error when building downstream projects in solana: build log
Why it happens: because we trying to update clap to version 3.1.5 and version resolution works such a ways that it picks the latest version from Cargo.lock with the same major release. It is assumed that all the crates with the same major have compatible API which is not the case for clap's beta. (please, correct me if I'm wrong)

resolved


Docs: use consistent HTML elements in Utilities > Background page

Description
This PR brings more consistency to our Utilities > Background page by using the same HTML element everywhere for the same rendering.
@patrickhlauke I've used
s because the entire page was already using mostly
s. However, I'm wondering, in terms of documentation accessibility, if it wouldn't be better to use
s instead everywhere. What do you think?
Motivation & Context
Consistency.
Type of changes

[x] Docs refactoring (non-breaking change)

Checklist

[x] I have read the contributing guidelines
[x] My code follows the code style of the project (using npm run lint)
[x] My change introduces changes to the documentation
[x] I have updated the documentation accordingly
(N/A) I have added tests to cover my changes
[x] All new and existing tests passed

Live previews

https://deploy-preview-39519--twbs-bootstrap.netlify.app/docs/5.3/utilities/background/

However, I'm wondering, in terms of documentation accessibility, if it wouldn't be better to use
s instead everywhere. What do you think?

won't make any practical difference, so this is good to go


Sending new widget to the second screen

I modified the example and added a button new screen to update the value of current widget. I created a provider service which I wanted to use to pass the widget between the two screen but for some reason whenever I get the value of current widget from the service in the second screen it's always null. I think the second screen is a different process
here is the code:
import 'package:flutter/material.dart';
import 'package:presentation_displays/displays_manager.dart';
import 'package:presentation_displays/display.dart';
import 'package:presentation_displays/secondary_display.dart';
import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';

class PresenterService {
  Widget current;
}

Route<dynamic> generateRoute(RouteSettings settings) {
  switch (settings.name) {
    case '/':
      return MaterialPageRoute(builder: (_) => DisplayManagerScreen());
    case 'presentation':
      return MaterialPageRoute(builder: (_) => SecondaryScreen());
    default:
      return MaterialPageRoute(
          builder: (_) => Scaffold(
                body: Center(
                    child: Text('No route defined for ${settings.name}')),
              ));
  }
}

class ProviderInjector {
  static List<SingleChildWidget> providers = [
    Provider.value(value: PresenterService()),
  ];
}

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: ProviderInjector.providers,
      child: MaterialApp(
        onGenerateRoute: generateRoute,
        initialRoute: '/',
      ),
    );
  }
}

class Button extends StatelessWidget {
  Button(this.title, this.function);

  final String title;
  final VoidCallback function;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.all(4.0),
      child: RaisedButton(
        onPressed: function,
        child: Text(
          title,
          style: TextStyle(fontSize: 40),
        ),
      ),
    );
  }
}

/// Main Screen
class DisplayManagerScreen extends StatefulWidget {
  @override
  _DisplayManagerScreenState createState() => _DisplayManagerScreenState();
}

class _DisplayManagerScreenState extends State<DisplayManagerScreen> {
  DisplayManager displayManager = DisplayManager();
  List<Display> displays = [];
  int num = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Wrap(
              alignment: WrapAlignment.center,
              children: <Widget>[
                Button("Get Displays", () async {
                  final values = await displayManager.getDisplays();
                  print(values);
                  displays.clear();
                  displays.addAll(values);
                  print(displays);
                }),
                Button("Show presentation", () async {
                  displayManager.showSecondaryDisplay(
                      displayId: displays[1]?.displayId ?? -1,
                      routerName: "presentation");
                }),
                Button("New Secreen", () async {
                  PresenterService service =
                      Provider.of(context, listen: false);
                  service.current = Text("Current " + (num++).toString());
                  await displayManager.transferDataToPresentation("NEW_SCREEN");
                }),
                Button("NameByDisplayId", () async {
                  final value = await displayManager
                      .getNameByDisplayId(displays[1]?.displayId ?? -1);
                  print(value);
                }),
                Button("NameByIndex", () async {
                  final value = await displayManager.getNameByIndex(1);
                  print(value);
                }),
                Button("TransferData", () async {
                  final value = await displayManager
                      .transferDataToPresentation("test transfer data");
                  print(value);
                })
              ],
            ),
          ],
        ),
      ),
    );
  }
}

/// UI of Presentation display
class SecondaryScreen extends StatefulWidget {
  @override
  _SecondaryScreenState createState() => _SecondaryScreenState();
}

class _SecondaryScreenState extends State<SecondaryScreen> {
  Widget _current;
  @override
  Widget build(BuildContext context) {
    PresenterService service = Provider.of(context, listen: false);
    return SecondaryDisplay(
      callback: (message) {
        switch (message) {
          case "NEW_SCREEN":
            setState(() {
              _current = service.current;
            });
            break;
          default:
        }
      },
      child: _current ??
          Container(
              color: Theme.of(context).scaffoldBackgroundColor,
              child: Center(
                child: Text("Loading .."),
              )),
    );
  }
}

when u use the SecondaryDisplay then the class SecondaryScreen  is a new application, so Provider not working,
If you want to receive data at the SecondaryScreen then you must use
displayManager.transferDataToPresentation("value");
"value" -> can u change value to json.
corresponding to data transfer
and
 SecondaryDisplay(
      callback: (message) {
      //TODO something
});

to listening for data

@VNAPNIC @EbramTawfik @harrynguyen-vmo
I tried Three Packages presentation_displays: ^0.1.9, presentation_displays: ^0.2.0 and presentation_displays: ^0.2.1 in rk3288 POS
with these two packages I have same two issues :

Once I press Show Presentation, in secondary screen I get "Init" message **but after that my whole screen FREEZES **, means to say none of the other buttons including the screen buttons are not able to Press (FROZEN)
TransferData is not working for me. Nothing happens once i press the button. my both screens looks same.

I am getting these print messages, but nothing in the secondary screen

Get Displays works well

NameByDisplayId works well

NameByIndex works well

TransferData NOT WORKING
Show Presentation, as i described above It FREEZES the screen

Please see the code below
import 'package:flutter/material.dart';
import 'package:presentation_displays/displays_manager.dart';
import 'package:presentation_displays/display.dart';
import 'package:presentation_displays/secondary_display.dart';
import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';
class PresenterService {
late Widget current;
}
Route generateRoute(RouteSettings settings) {
switch (settings.name) {
case '/':
return MaterialPageRoute(builder: () => DisplayManagerScreen());
case 'presentation':
return MaterialPageRoute(builder: () => SecondaryScreen());
default:
return MaterialPageRoute(
builder: (_) => Scaffold(
body: Center(
child: Text('No route defined for ${settings.name}')),
));
}
}
class ProviderInjector {
static List providers = [
Provider.value(value: PresenterService()),
];
}
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: ProviderInjector.providers,
child: MaterialApp(
onGenerateRoute: generateRoute,
initialRoute: '/',
),
);
}
}
class Button extends StatelessWidget {
Button(this.title, this.function);
final String title;
final VoidCallback function;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(4.0),
child: ElevatedButton(
onPressed: function,
child: Text(
title,
style: TextStyle(fontSize: 40),
),
),
);
}
}
/// Main Screen
class DisplayManagerScreen extends StatefulWidget {
@override
_DisplayManagerScreenState createState() => _DisplayManagerScreenState();
}
class _DisplayManagerScreenState extends State {
DisplayManager displayManager = DisplayManager();
List displays = [];
int num = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Wrap(
alignment: WrapAlignment.center,
children: [
Button("Get Displays", () async {
final values = await displayManager.getDisplays();
print(values);
displays.clear();
displays.addAll(values!);
print(
'Display Id0: ${displays[0].displayId} : ${displays[0].name}');
print(
'Display Id1: ${displays[1].displayId} : ${displays[1].name}');
}),
Button("Show presentation", () async {
print(
'Show presentation Display Id1: ${displays[1].displayId} : ${displays[1].name}');
displayManager.showSecondaryDisplay(
displayId: displays[1].displayId,
routerName: "presentation");
}),
            Button("NameByDisplayId", () async {
              final value = await displayManager
                  .getNameByDisplayId(displays[1].displayId);
              print(value);
            }),
            Button("NameByIndex", () async {
              final value = await displayManager.getNameByIndex(1);
              print("NameByIndex alue : $value");
            }),
            Button("TransferData", () async {
              final value = await displayManager
                  .transferDataToPresentation("test transfer data");
              print("TransferData Value : $value");
            })
          ],
        ),
      ],
    ),
  ),
);

}
}
/// UI of Presentation display
class SecondaryScreen extends StatefulWidget {
@override
_SecondaryScreenState createState() => _SecondaryScreenState();
}
class _SecondaryScreenState extends State {
String value = "init";
@override
Widget build(BuildContext context) {
print('message $value');
return SecondaryDisplay(
callback: (message) {
setState(() {
value = message;
print("message : $message");
});
},
child: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Center(
child: Text(value),
)),
);
}
}

when u use the SecondaryDisplay then the class SecondaryScreen is a new application, so Provider not working, If you want to receive data at the SecondaryScreen then you must use
displayManager.transferDataToPresentation("value");
"value" -> can u change value to json.
corresponding to data transfer
and
 SecondaryDisplay(
      callback: (message) {
      //TODO something
});

to listening for data

if some one have issue to get it work, please use this way displayManager.transferDataToPresentation(json.encode(json));

#The issue was with Android image, I had to flush the android image and re flash with other build. Now its working
for this case who can help to provide more information ? how to flush android image and re flash other build ?

The issue was with Android image, I had to flush the android image and re flash with other build. Now its working

hello , i am new to this, can help provide more information about this ? how can i solve this issue, i cant get it what its mean by flush the android image? anyone can help on this?

The issue was with Android image, I had to flush the android image and re flash with other build. Now its working

hello , i am new to this, can help provide more information about this ? how can i solve this issue, i cant get it what its mean by flush the android image? anyone can help on this?

Its better if you contact your device vendor, they will do it for you.

The issue was with Android image, I had to flush the android image and re flash with other build. Now its working

hello , i am new to this, can help provide more information about this ? how can i solve this issue, i cant get it what its mean by flush the android image? anyone can help on this?

Its better if you contact your device vendor, they will do it for you.

this is related to hardware device? i will contact my device vendor, thanks


Security: Enable CIDR for allow/deny play/publish

Previously you could only specify static IPs to the security config, this PR enables specifying ranges of IPs in a network.
Tests added and passing.
Fixes #1190
Thanks

This would be very useful for us, any chance this could be merged?

Thanks for your PR. 👍
I think it's very good to support CIDR for security, and the utest is in this PR which is very nice.
However, I need more time to think about it.
Please keep this PR here and others could pick it to their repository and test it.

Really appreciate this patch, thanks a lot.
I notice there is some codes copied from blog, but the LICENSE is not clear, so please rewrite these functions. Please check the code from Go or Nginx, both LICENSE are ok. 😄
// Convert an IPv4 from string to uint32_t. Extracted from https://www.stev.org/post/ccheckanipaddressisinaipmask
extern uint32_t srs_ipv4_to_num(std::string ip);

// Whether the IPv4 is in an IP mask. Extracted from https://www.stev.org/post/ccheckanipaddressisinaipmask
extern bool srs_ipv4_within_mask(std::string ip, std::string network, std::string mask);

@macabu @matclayton I have reviewed this PR and some codes are delivered under unspecified license, copied from the blog website, so @duiniuluantanqin fixed this and file a new PR #2914 which is based on this one (the commits are kept and new commits are added).
Appreciated for all you 👍

Moved to #2914


Humanize Count

It seems like there isn't any functionality to humanize a count.  Some examples:
0 => "0"
14 => "14"
71004 => "71k"
51000492 => "5m" (lower precision)
51000492 => "5.1m" (higher precision)

It seems very similar to ByteSize (maybe Count?) except you'd have Count.Ones, Count.Hundreds, Count.Thousands, Count.Millions, etc.  Count.Humanize(precision) would return the count string at that precision.
Example:
51000492.ToCount().Humanize(1) => "51000492"
51000492.ToCount().Humanize(0.999) => "5.1m"

Does this functionality exist in the library?  If not, was it excluded by design?  Or has it just not been thought of or implemented?
A good example of this kind of humanization of a count is on StackOverflow: http://stackoverflow.com/questions?sort=votes  Note how the views ("673k views", "2.4m views", etc.) look.

Thanks for the suggestion @timothy-shields. This feature does not exist because it was never requested.
It would make for a good addition. Did you want to submit a PR? :)

Just saw this post. I create exactly the same issue ( #457 ) two days ago. I used the searchbox without success. I should just read the issue list.
Well, I wrote the code to handle this. I will rewrite it and submit a PR.

Code rewrote. Test added. PR coming soon. (tomorrow? :)

This was implemented in https://github.com/MehdiK/Humanizer/pull/459 and is now in dev


fix(lib): duplicated metareducer

PR Checklist
Please check if your PR fulfills the following requirements:

[x] The commit message follows our guidelines: CONTRIBUTING.md#commit
[ ] Tests for the changes have been added (for bug fixes / features)
[ ] Docs have been added / updated (for bug fixes / features)

PR Type
What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?
duplicated metareducer
Issue Number: #2
What is the new behavior?
fix(lib): duplicated metareducer
Does this PR introduce a breaking change?
[ ] Yes
[x] No

Other information

:tada: This PR is included in version 1.1.0-next.2 :tada:
The release is available on:

npm package (@next dist-tag)
GitHub release

Your semantic-release bot :package::rocket:

:tada: This PR is included in version 1.2.0-next.1 :tada:
The release is available on:

npm package (@next dist-tag)
GitHub release

Your semantic-release bot :package::rocket:

:tada: This PR is included in version 1.2.0 :tada:
The release is available on:

npm package (@latest dist-tag)
GitHub release

Your semantic-release bot :package::rocket:


Would it be possible to add the foreign key ClientId into Client* Entities

Hello,
I have tried to create some BaseRepository for entities in this library and if I have tried to update for example entity ClientScope - I have to load whole object of Client before updating the ClientScope.
I have tried this:
public void UpdateClientScope(ClientScope scope){

_dbContext.ClientScope.Update(scope);
_dbContext.SaveChanges();
}

var scope = new ClientScope() { Client = new Client{Id = 1}, Id = 1, Scope = "Test Scope" }
UpdateClientScope(scope);

I want to specify only ClientId - not loading whole Client object - but in this case is not probable possible because ChangeTracker doesn't know if I want to update only ClientScope.
I would like to use something like this:
public class ClientScope
{
    public int Id { get; set; }

    public string Scope { get; set; }

    public Client Client { get; set; }

    public int ClientId { get; set; }
}

modelBuilder.Entity<ClientScope>()
	            .HasOne(p => p.Client)
	            .WithMany(b => b.AllowedScopes)
	            .HasForeignKey(p => p.ClientId)

I think in this case I am able do it following:
public void UpdateClientScope(ClientScope scope){

_dbContext.ClientScope.Update(scope);
_dbContext.SaveChanges();
}

var scope = new ClientScope() { ClientId = 1, Id = 1, Scope = "Test Scope" }
UpdateClientScope(scope);

What do you think about it?
Thank you.

Our design is for the two DB contexts to be separate since you might not use both. If you want this, then you'd need your own set of contexts and entities that model those FKs.

But I think you can add this foreign key although if you have separate dbcontexts?

I am wondering about inherit your set of entities and add some extra requirements for specific scenario, but I think the ClientId foreign key would be fine. :)

But I think you can add this foreign key although if you have separate dbcontexts?

But we have customers where they're using the operational data, but not the configuration data.

As for wanting to provide additional data, then I'd suggest creating separate tables, or use the new Properties collection we've added in 2.0.

OK, it is only for EF update, I don't want to load whole Client entity before Updating relation tables like ClientScopes. I have posted this use case on StackOverflow and I got this recommendation around EF which I mentioned in original question.

My idea is something like this:
public class ClientScope : ClientScope {... add FK }
Install Ids4.EF package for the original model.
What do you think about it?

No idea. If you can make it work the way you want, that's great. I have a feeling it will be a lot of work and I don't see the gain... but you might have your reasons.

Please, take a look: https://stackoverflow.com/questions/46337780/how-update-object-with-relation-data-in-entityframework-core


How can I read response body, and How can I modify it?

Hello. I need read response to check for dangerous content and modify response if it contains dangerous content. How can I do it?

Check the OnResponse on the start page:
https://github.com/justcoding121/Titanium-Web-Proxy

@honfika
string body = await e.GetResponseBodyAsString();
Is it body of response?

Yes


When I use the render function in the vue2.7+ version setup, I can't get the $refs of the dom correctly

Version
2.7.6
Reproduction link
codesandbox.io
Steps to reproduce
Use setup to return a render function, you can't get a reference to the ref dom after mounting; but it can be obtained in version 3.0+, I hope it can be consistent with 3.0
What is expected?
dom re can be obtained
What is actually happening?
The value of ref is still null

https://codesandbox.io/s/weathered-architecture-qeo8md
check @vue/composition-api's readme
https://github.com/vuejs/composition-api#template-refs
currently you can't use template ref in renderFn in setup.

Your reproduction doesn't work in Vue 3 either...
When using manual render functions in setup(), you need to pass the actual ref to the ref property:
      return h(
        "div",
        {
          class: "vue-charts",
-           ref: "chartRef"
+          ref: chartRef,
        },
        "helloWord"
      );

Yes, this method does not work with vue3, but placing the render outside the setup can work, and vue2.7 will not work.

@yyx990803  thanks for your suggestion


Double gift event issue

TikTok gifts are handled twice.

hi, please take a look at the documentation: https://github.com/zerodytrash/TikTok-Live-Connector#gift
You need to check giftType and repeatEnd and etc. Let me know if this fixes your issue.

Thanks! Solved!


Update container upload handling

Fixes #70
This PR addresses two "problems":

As of today every PR (and merge) results in a new image at https://github.com/eclipse-velocitas/devcontainer-base-images/pkgs/container/devcontainer-base-images%2Fbase (and cpp/python) that will stay there practically forever, as we do not have any easy mechanism to clean them out
PRs from other forks will not pass CI as they cannot upload images to eclipse-velocitas ghcr (see #70)

This PR uses reuses some ideas from eclipse-kuksa and https://github.com/eclipse-kuksa/kuksa-actions/blob/main/.github/workflows/check_ghcr_push.yml and https://github.com/eclipse-kuksa/kuksa-databroker, to use ttl.sh for temporary images and never publish sha-tagged versions at ghcr.io

To see who it would work for push, look at https://github.com/erikbosch/devcontainer-base-images
To see how it would work for PRs, look at build actions for this PR.

ttl.sh images are short lived and address can be found in build results

It also incorporates the improved license check printout from https://github.com/eclipse-velocitas/devenv-github-workflows/blob/35b40c5503b08db0722bfa5fcf83d0a6a20c8bb1/src/common/workflows/check-licenses.yml, but adapted to check if there is a token and otherwise just use a check
Differences compared to Kuksa
Lets say they use different philosophy:

Kuksa workflows/actions only push to ghcr if using the "vanilla kuksa repositories", forks will only push to ttl.sh, also on merge/push
Kuksa use the tag "latest" for the latest released version. Velocitas for the latest merged version. (Kuksa use "main" for latest merged)

In general I like the idea, but not sure if ttl.sh is the right solution. The max ttl is 24h which might be to short if you really want to test something. Although I don't know if that ever happened in the past.
@doosuu @dennismeister93 @BjoernAtBosch what do you think about having the PR images just available for 24h?

In general I like the idea, but not sure if ttl.sh is the right solution. The max ttl is 24h which might be to short if you really want to test something. Although I don't know if that ever happened in the past.
@doosuu @dennismeister93 @BjoernAtBosch what do you think about having the PR images just available for 24h?

At least for PRs originating from forks we cannot use ghcr.io ( as they do not have rights).
If we would use ttl.sh as default for PRs, and you need a longer lived container an option could be to manually trigger a build for the branch in the repo/fork where you have your changes. Then that would be updated to ghcr.io and live practically forever. But if we want to work like that we should maybe use branch name as label rather than latest, as we currently get a latest-tag even if triggering for an old branch

I actually also like the idea. One "different" question i would have. Would it be possible to try to also reuse this ttl image for "building" / "releasing" a new version from our main to avoid the double wait time of building after a PR is merged?

I guess it would be possible to look for an image in ttl.sh when a PR is merged and resend it to ghcr.io, similar to how we today do in the release workflow. But we have the risk that the image in ttl.sh has expired and there is also possibly a risk that someone uploads a malicious image to ttl.sh with same name/label and we do not want to push that to ghcr.io

Discussion
Do not push for Pull Request
No need for sha tags

I changed this one to draft. I noticed that our release workflow currently depends on that SHA pointed out by the tag exists as a ghcr container. So we cannot just suppress publishing SHA-tagged versions on ghcr, as the release workflow then will fail. There are off course options like rebuilding image from scratch or uploading image as a github build artifact and reuse it, but putting this one on hold for now and just fixing CI for PRs from forks in another PR.


No longer maintained?

Is this library no longer maintained? If so, does anyone have a recommendation for a similar library that's still maintained?

It looks like maybe not :crying_cat_face:. I'm also looking for a modern alternative...

https://whs.io/

I will give up it. whsjs is better


Release Google.Cloud.BigQuery.DataTransfer.V1 version 4.7.0

Changes in this release:
New features

Change netstandard2.1 target to netstandard2.0 (commit 82bea85)

Created release for Google.Cloud.BigQuery.DataTransfer.V1-4.7.0


Unable to configure --no-cntlibs or --libs or ...

I could be missing something, but it seems like there's no way to configure several options because they're hidden behind the main configure / info / list parsers.
In particular, I am trying to switch the library mount dir from the hardcoded /usr/lib64 to something more conducive in our environment -- or disable it entirely with OPT_NO_CNTLIBS -- and coming up short.
Can we add an the --no-cntlibs option to the configure.c parser to skip all the ldconfig magic (since we have forward compatibility in CUDA)? I would like our containers to bake in the things they need on their own.

If it's just a matter of spinning a patch, let me know and I'll move forward on that.

Similarly, I would like to disable passing the persistenced socket (if possible and IIUC) so container users cannot interfere with the GPU readiness.

Hi @anthonyrisinger
Similar to my comment here: https://github.com/NVIDIA/nvidia-container-runtime/issues/129#issuecomment-751715072
We are planning on doing a major overhaul libnidia-container in the very near future. Step 1 of this is going to be rewriting the CLI components in Go instead of C. When this happens (likely by end of January), I will make sure that all options have corresponding flags in ´configure,info, and list`.

Perfect thank you!

@klueska any progress?
I ran into a strange problem.
with libnvidia-container v1.10.0, nvidia-container-cli behave as follows:

while libnvidia-container v1.0.7, nvidia-container-cli did not select the cuda library files in base image.

I want to change --no-cntlibs value, but I can't find a way.


Support Managed Identity for AzureOpenAI and AI Search

Hi Team,
Our AI service is using Semantic Kernel (SK) for retrieval part with Azure Cognitive Search (AI Search) memory and for generation part with AzureOpenAI. We are going to move from authentication using access key to managed identity as soon as possible.
Have SK support Managed Identity Authentication for AI Search and AzureOpenAI yet? If yes, can we get more details on how to set it up, please? If not, can we get some ETA plan on when this feature can be delivered, please?
Thank you,
Nhan Dang

@nhandangms Both AzureOpenAIChatCompletionService and AzureAISearchMemoryStore accept TokenCredential as constructor parameter. All auth information is passed to underlying Azure .NET SDK:
https://github.com/Azure/azure-sdk-for-net/tree/49b0ace48d35cb4b2ace93b517036b660fc12ca4/sdk/openai/Azure.AI.OpenAI#create-openaiclient-with-an-azure-active-directory-credential
With TokenCredential parameter, you can use different authentication methods, including ManagedIdentityCredential.
Here is a full list of them:
https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication/?tabs=command-line#exploring-the-sequence-of-defaultazurecredential-authentication-methods
Let me know if that helps. Thank you!

Great, thank you so much for your prompt reply.

@nhandangms the AI Search connector supports Managed Identities too, using the same approach. Here's the ctor signature, where you can pass in a new DefaultAzureCredential():
public AzureAISearchMemoryStore(string endpoint, TokenCredential credentials)
        : this(new SearchIndexClient(new Uri(endpoint), credentials, GetClientOptions()))
    {
    }