问:
showing image in pdf puppeteer not working
I'm trying to generate a PDF using Puppeteer. But the images are not showing in the page .PDF file .

Both images from HTML and CSS are not showing. Am I missing something?

index.hbs

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <div class="container">

        <img src="logo_head.png" class="logo">

    </div>
</body>
</html>
</code>```

index.js

```<code>(async function() {
    try{
        const browser = await puppeteer.launch({executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'});

        const page = await browser.newPage()

        const content = await compile('index',data)

        await page.setContent(content,{ waitUntil: "networkidle0" });
        await page.emulateMediaType('print');

        await page.pdf({
            path:'output2.pdf',
            displayHeaderFooter: true,

        })

        console.log("done creating pdf")

        await browser.close()

        process.exit()

    }catch(e){
        console.log(e)
    }
})()
</code>```

Body:
I'm trying to generate a PDF using Puppeteer. But the images are not showing in the page .PDF file .

Both images from HTML and CSS are not showing. Am I missing something?

index.hbs

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

index.js

(async function() {
    try{
        const browser = await puppeteer.launch({executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'});

        const page = await browser.newPage()

        const content = await compile('index',data)

        await page.setContent(content,{ waitUntil: "networkidle0" });
        await page.emulateMediaType('print');

        await page.pdf({
            path:'output2.pdf',
            displayHeaderFooter: true,

        })

        console.log("done creating pdf")

        await browser.close()

        process.exit()

    }catch(e){
        console.log(e)
    }
})()


来源: stackexchange

问:
Which value should isControlling have in ice4j Agent?
In all the ice4j examples (for example) the agent is set to setControlling(true) for one site and setControlling(false) for the other site.

Which value must I set if the other site is a browser? I can modify it only on the Java site in this case. Or is there an equivalent in JavaScript? Can I derive this from a SDP offer or answer? Depends this on the attribute a=setup:active and a=setup:passive?

ContentLicense: CC BY-SA 4.0


问:
Write Fixed Width File
My question is can I create a fixed width file from a dataframe? all columns on my df are different position/width . I tried to do this in python and failed.</p>

Title: Write Fixed Width File


问:
Spring Graphql Client code executing a query to receive a flux
Anyone know who to use the Spring graphql Client to receive a Flux of objects ? https://docs.spring.io/spring-graphql/docs/current/reference/html/#client.httpgraphqlclient
What expression would you code for the client to execute a query to receive a flux of objects

Trying to solve a problem and expecting an answer


问:
how to work with aiogram photo without downloading it to disk
I want to get a photo of the qr code and decrypt it, but I don't want to save the qr code to disk,
await message.photo[-1].download(destination_file = "aaa.png")

can I somehow work with the resulting image without saving it?

```<code>import cv2
from pyzbar import pyzbar
@dp.message_handler(state=QrScanState.Qr_Scan_Data, content_types=types.ContentType.PHOTO)
async def send_qr_data(message: types.Message, state: FSMContext):
    await message.photo[-1].download(destination_file = "aaa.png")
    img = cv2.imread("aaa.png")
    barcodes = pyzbar.decode(img)
    await bot.send_message(chat_id = message.from_user.id, text = barcodes[0].data.decode())
    await state.finish()
</code>```

I tried to work without saving the photo, but, as I understand it, the file_id of the photo is in the list

```<code>img = cv2.imread(message.photo[-1])
</code>```

TypeError: Can't convert object to 'str' for 'filename'

Body:
I want to get a photo of the qr code and decrypt it, but I don't want to save the qr code to disk,
await message.photo[-1].download(destination_file = "aaa.png")

can I somehow work with the resulting image without saving it?

import cv2
from pyzbar import pyzbar
@dp.message_handler(state=QrScanState.Qr_Scan_Data, content_types=types.ContentType.PHOTO)
async def send_qr_data(message: types.Message, state: FSMContext):
    await message.photo[-1].download(destination_file = "aaa.png")
    img = cv2.imread("aaa.png")
    barcodes = pyzbar.decode(img)
    await bot.send_message(chat_id = message.from_user.id, text = barcodes[0].data.decode())
    await state.finish()

I tried to work without saving the photo, but, as I understand it, the file_id of the photo is in the list

img = cv2.imread(message.photo[-1])

TypeError: Can't convert object to 'str' for 'filename'


问:
Load text file in powershell and process data
I was delivered a text file with tens of millions of data.

CSV has limitations and could not be used. An example text file is shown below, all separated by tabs.

```<code>fileUrl   fileExtension   filePath   fileType   name   ownerName
https://????.[sharepoint.com/sites/aaa_bbb/Shared%20Documents/General/%EC.xlsx](sharepoint.com/sites/aaa_bbb/Shared%20Documents/General/%EC.xlsx)   xlsx   /sites/aaa_bbb/Shared Documents/General/filepath CheckSheet List.xlsx   \[2, 'SPREADSHEET'\]   2023 CheckSheet List.xlsx   UserPrincipalName
https://????.[sharepoint.com/sites/aaa_bbb/Shared%20Documents/General/%EF.xlsx](sharepoint.com/sites/aaa_bbb/Shared%20Documents/General/%EF.xlsx)   xlsx   /sites/aaa_bbb/Shared Documents/General/filepath CheckSheet List2.xlsx   \[2, 'SPREADSHEET'\]   2023 CheckSheet List.xlsx   UserPrincipalName
</code>```

What I want is below.

1. 1. Load the text file using PowerShell. Encoding is required.

$source= Get-Content D:\result.txt -Encoding utf8

2. Add each row.

"fileUrl","fileExtension","filePath","fileType","name","ownerName","PowerShell_rt"

3. Add the tab-separated values one after the other. Examples have been ~ processed, but all content must be included.

```<code>fileUrl   fileExtension   filePath   fileType   name   ownerName
\------   --------------   --------   ---------   ------   --------------
URL\~    xlsx      Path\~      2, 'SPREADSHEET'   name\~ UPN\~
</code>```

4. Execute the Get command by referring to the value of fileUrl, and save D among the results of A,B,C,D to PowerShell_rt.

Get-Spomodule -fileurl $_.fileurl

A id : aaa-bbb-ccc-ddd

B : path : file/path/www.xlsx

C : rabel : non

D : active : non

5. Save the results to a new text file.

```<code>fileUrl   fileExtension   filePath   fileType   name   ownerName   PowerShell_rt
\------   --------------   --------   ---------   ------   -------------- ----------------
URL\~    xlsx      Path\~      2, 'SPREADSHEET'   name\~ UPN\~ Result
</code>```

Getting the values from a text file into rows is also too difficult. The content may be long and complicated, but it is earnest.

If you help me, I will cooperate as much as I can with the part that I don't understand. please.

Body:
I was delivered a text file with tens of millions of data.

CSV has limitations and could not be used. An example text file is shown below, all separated by tabs.

fileUrl   fileExtension   filePath   fileType   name   ownerName
https://????.[sharepoint.com/sites/aaa_bbb/Shared%20Documents/General/%EC.xlsx](sharepoint.com/sites/aaa_bbb/Shared%20Documents/General/%EC.xlsx)   xlsx   /sites/aaa_bbb/Shared Documents/General/filepath CheckSheet List.xlsx   \[2, 'SPREADSHEET'\]   2023 CheckSheet List.xlsx   UserPrincipalName
https://????.[sharepoint.com/sites/aaa_bbb/Shared%20Documents/General/%EF.xlsx](sharepoint.com/sites/aaa_bbb/Shared%20Documents/General/%EF.xlsx)   xlsx   /sites/aaa_bbb/Shared Documents/General/filepath CheckSheet List2.xlsx   \[2, 'SPREADSHEET'\]   2023 CheckSheet List.xlsx   UserPrincipalName

What I want is below.

1. 1. Load the text file using PowerShell. Encoding is required.

$source= Get-Content D:\result.txt -Encoding utf8

2. Add each row.

"fileUrl","fileExtension","filePath","fileType","name","ownerName","PowerShell_rt"

3. Add the tab-separated values one after the other. Examples have been ~ processed, but all content must be included.

fileUrl   fileExtension   filePath   fileType   name   ownerName
\------   --------------   --------   ---------   ------   --------------
URL\~    xlsx      Path\~      2, 'SPREADSHEET'   name\~ UPN\~

4. Execute the Get command by referring to the value of fileUrl, and save D among the results of A,B,C,D to PowerShell_rt.

Get-Spomodule -fileurl $_.fileurl

A id : aaa-bbb-ccc-ddd

B : path : file/path/www.xlsx

C : rabel : non

D : active : non

5. Save the results to a new text file.

fileUrl   fileExtension   filePath   fileType   name   ownerName   PowerShell_rt
\------   --------------   --------   ---------   ------   -------------- ----------------
URL\~    xlsx      Path\~      2, 'SPREADSHEET'   name\~ UPN\~ Result

Getting the values from a text file into rows is also too difficult. The content may be long and complicated, but it is earnest.

If you help me, I will cooperate as much as I can with the part that I don't understand. please.


问:
In Google sheets, I have 3 cells with percentage. I want to make dynamic all 3 cells on each other
I have 3 cells.
If I changes one cell value then other 3 cells are change automatically.

Suppose I have 100 percentage for 3 cells.
If I enter 30% in 1st cell.
So,other 2 cells divide into remaining percentage.

How can I implement this?


问:
ScrollView prevents onPress event to work properly. How to solve this problem?
The whole content is wrapped inside the scrollview. Because of this The onPress event needs two click to be activated.</p>
```<code><ScrollView>
    <View style={styles.container}>
      <Popup
      />
      <ImgsContainer />
      <Inputs/>
     //here is the problem
     <TouchableWithoutFeedback onPress={()=>{
       submitData()
     }
     }>
    <View style={styles.postBtn}><Text style=
     {styles.btnText}>POST</Text></View>
</TouchableWithoutFeedback>
     //////////////
    </View>
    </ScrollView>
</code>```

Body:
The whole content is wrapped inside the scrollview. Because of this The onPress event needs two click to be activated.

<ScrollView>
    <View style={styles.container}>
      <Popup
      />
      <ImgsContainer />
      <Inputs/>
     //here is the problem
     <TouchableWithoutFeedback onPress={()=>{
       submitData()
     }
     }>
    <View style={styles.postBtn}><Text style=
     {styles.btnText}>POST</Text></View>
</TouchableWithoutFeedback>
     //////////////
    </View>
    </ScrollView>


问:
Pytorch DataParallel crashes runtime
Whenever I use DataParallel to use multiple GPUs, the whole process crashes.
According to nvidia-smi, the use of all GPUs rises to 100% after a few seconds of training. Also, torchsummary shows the whole model twice, i.e. all layers appear a second time (what makes the model contain 82.000.000 instead of 41.000.000 trainable parameters), no matter if I use 2 or more GPUs.

I use DataParallel as proposed in https://pytorch.org/tutorials/beginner/blitz/data_parallel_tutorial.html:

```<code>Inceptionv4_ = Inceptionv4()
if tc.cuda.device_count() > 1:
    print(tc.cuda.device_count())
    Inceptionv4_ = nn.DataParallel(Inceptionv4_)

Inceptionv4_.to(device)
optimizer = tc.optim.SGD(Inceptionv4_.parameters(), lr=0.005)
print(summary(Inceptionv4_, (3, 224, 224)))
</code>```

Title: Pytorch DataParallel crashes runtime

Body:
Whenever I use DataParallel to use multiple GPUs, the whole process crashes.
According to nvidia-smi, the use of all GPUs rises to 100% after a few seconds of training. Also, torchsummary shows the whole model twice, i.e. all layers appear a second time (what makes the model contain 82.000.000 instead of 41.000.000 trainable parameters), no matter if I use 2 or more GPUs.

I use DataParallel as proposed in https://pytorch.org/tutorials/beginner/blitz/data_parallel_tutorial.html:

Inceptionv4_ = Inceptionv4()
if tc.cuda.device_count() > 1:
    print(tc.cuda.device_count())
    Inceptionv4_ = nn.DataParallel(Inceptionv4_)

Inceptionv4_.to(device)
optimizer = tc.optim.SGD(Inceptionv4_.parameters(), lr=0.005)
print(summary(Inceptionv4_, (3, 224, 224)))


问:
Customize a class in a kivy.uix component, Kivy-Python
I want to import MDDataTable class from kivy.uix.datatables that have different classes which will be used in MDDatatable. So I think I should inherit MDDatatable in a custom class in my code. but there is a problem, I want to customize one of the class which is using by MDDatatable ( its name is CellRow ). Is there a way to do that in my code? or I have to make my custom datatables.py whole?

its part of my code, that i inherited the class I want:

```<code>    from kivy.uix.datatables import MDDataTable

    class CustomMDDataTable(MDDataTable):
        def __init__(self, **kwargs):
            super(CustomMDDataTable, self).__init__(**kwargs)
</code>```

in datatables.py is another class with name CellRow, i want to customize it: ( How can i access it? )

```<code>
class CellRow(
    ThemableBehavior,
    RecycleDataViewBehavior,
    HoverBehavior,
    ButtonBehavior,
    BoxLayout,
):
    text = StringProperty()  # row text
    table = ObjectProperty()  # <TableData object>
    index = None
    icon = StringProperty()
    icon_copy = icon
    icon_color = ColorProperty(None)
    selected = BooleanProperty(False)
    selectable = BooleanProperty(True)

    def __init__(self, **kwargs):
        super(CellRow, self).__init__(**kwargs)
        self.ids.check.bind(active=self.select_check)
        self.ids.check.bind(active=self.notify_checkbox_click)

class MDDataTable(ThemableBehavior, AnchorLayout):
 ...
</code>```

Body:
I want to import MDDataTable class from kivy.uix.datatables that have different classes which will be used in MDDatatable. So I think I should inherit MDDatatable in a custom class in my code. but there is a problem, I want to customize one of the class which is using by MDDatatable ( its name is CellRow ). Is there a way to do that in my code? or I have to make my custom datatables.py whole?

its part of my code, that i inherited the class I want:

    from kivy.uix.datatables import MDDataTable

    class CustomMDDataTable(MDDataTable):
        def __init__(self, **kwargs):
            super(CustomMDDataTable, self).__init__(**kwargs)

in datatables.py is another class with name CellRow, i want to customize it: ( How can i access it? )

class CellRow(
    ThemableBehavior,
    RecycleDataViewBehavior,
    HoverBehavior,
    ButtonBehavior,
    BoxLayout,
):
    text = StringProperty()  # row text
    table = ObjectProperty()  # <TableData object>
    index = None
    icon = StringProperty()
    icon_copy = icon
    icon_color = ColorProperty(None)
    selected = BooleanProperty(False)
    selectable = BooleanProperty(True)

    def __init__(self, **kwargs):
        super(CellRow, self).__init__(**kwargs)
        self.ids.check.bind(active=self.select_check)
        self.ids.check.bind(active=self.notify_checkbox_click)

class MDDataTable(ThemableBehavior, AnchorLayout):
 ...


问:
How can I block users from changing the src of an iframe?
I am limited by the platforms I am using.
I need to use an iframe to display personalized data. Due to the nature of the data, it uses a query in the iframe src. If that is changed (using devtools), there is a possibility that a user could see someone else's data, which is obviously not ideal for security purposes.
The query part is required because the end platform uses a variable to identify the user to the source platform.

I've tried setting up a CSP with the frame-src parameter, but that doesn't work because of the required query.


问:
Typescript property decorator weird behaviour
I have a simple class

class Component {
  @id() instanceId: string;

  @id() secondaryId: string;

  log() {
    console.log(this.instanceId, this.secondaryId);
  }
}
```
<p>And a decorator</p>
<pre class="lang-js prettyprint-override"><code>const id = (): PropertyDecorator => {
  return (target, name) => {
    const descriptor = {
      get(this: any) {
        const propertyName = `__${String(name)}`;

        if (!this[propertyName]) {
          this[propertyName] = 'MY ID';
        }

        return this[propertyName];
      },
      enumerable: true,
      configurable: true
    };

    Object.defineProperty(target, name, descriptor);
  };
};
</code>```

My tsconfig.json looks like this:

{
  "compilerOptions": {
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strictPropertyInitialization": false,
    "target": "ESNext",
    "module": "CommonJS",
    "moduleResolution": "node",
    "types": [
      "node"
    ]
  }
}

```
<p>When I do the following:</p>
<pre class="lang-js prettyprint-override"><code>const cmp = new Component();
cmp.log();
</code>```

I expect that "MY ID", "MY ID" will be printed in the console, but I get undefined, undefined instead.

This example works as expected in TS playground (link), but not locally and even on CodeSandbox (link).

What's wrong?

UPD

When I changed target to ES2021 everything became working as I expected. As far as I understand, changing target to ES2021 automatically sets useDefineForClassFields to false and the main issue was happened because of this option.

Body:
I have a simple class

class Component {
  @id() instanceId: string;

  @id() secondaryId: string;

  log() {
    console.log(this.instanceId, this.secondaryId);
  }
}

And a decorator

const id = (): PropertyDecorator => {
  return (target, name) => {
    const descriptor = {
      get(this: any) {
        const propertyName = `__${String(name)}`;

        if (!this[propertyName]) {
          this[propertyName] = 'MY ID';
        }

        return this[propertyName];
      },
      enumerable: true,
      configurable: true
    };

    Object.defineProperty(target, name, descriptor);
  };
};

My tsconfig.json looks like this:

{
  "compilerOptions": {
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strictPropertyInitialization": false,
    "target": "ESNext",
    "module": "CommonJS",
    "moduleResolution": "node",
    "types": [
      "node"
    ]
  }
}

When I do the following:

const cmp = new Component();
cmp.log();

I expect that "MY ID", "MY ID" will be printed in the console, but I get undefined, undefined instead.

This example works as expected in <a href="https://www.typescriptlang.org/play?strictPropertyInitialization=false&target=99&jsx=0&module=1#code/MYewdgzgLgBAlgExgXhgCgJQC4YAUBOIADgKb5QCeAIiaPgIZQj4oB8MA3gLABQMM+ElACu+MOij18AcyEAaGGHoBbEhjade-fqEiwEJCMHxwiTFqm59t-WVDRQAFnAg56YCuqs2bu6DCJCUnIKADkVEhQYAAMAfViAEg4AZSgTMGk0JVUMAF9ogG5eLR9+OAAzdABCJxcAbUDiMkpw1QBdLxLS-lqIBqDmsIi2qIByAFkATRgASSpRoutS3OKln0ERMRhe-qaQ1pI2xeW5Lu0SMGFVBgAjABsSHDThElO1nXByuGlRenvH7b4F5nXKLM4AeRuACtaFAAHQGL5gEgEPaUBxSOwKbKvGAGIwmMzMDDHGCg3jkni8YB3egQCAwADCIGURHAF1g3hgAAFEJh4Hp3MASDMEFUcNB0tIwdZeQh+RBaOAEFIKKLxTBJXAMjL+HcQJlOms-CAHnD9ZlenDtdAhSKEAorYrdCr8GqECSSiseN7qeB-MBWVFkQB3JkstnIsD2T08QNEc0GzAFIA" rel="nofollow noreferrer">TS playground (link), but not locally and even on CodeSandbox (link).

What's wrong?

UPD

When I changed target to ES2021 everything became working as I expected. As far as I understand, changing target to ES2021 automatically sets useDefineForClassFields to false and the main issue was happened because of this option.


问:
mystreamlistener is not streaming any data to the database
Here, tweepy is used to stream data and then store it in a mysql database.

But this block of code is taking forever to execute:

```<code>myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth = api.auth, listener = myStreamListener)
myStream.filter(languages=["en"], track = settings.TRACK_WORDS)
</code>```

I don't know what to try because I am not getting any errors either. I have cross checked my credentials for twitter account too.

edit: I tried adding is_async = true, and even when the code executes after adding this (I am not sure how), nothing happens?

```<code>myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth = api.auth, listener = myStreamListener, is_async = True)
myStream.filter(languages=["en"], track = settings.TRACK_WORDS)
</code>```

Can anyone explain what is it that I am supposed to do or look for?

Body:
Here, tweepy is used to stream data and then store it in a mysql database.

But this block of code is taking forever to execute:

myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth = api.auth, listener = myStreamListener)
myStream.filter(languages=["en"], track = settings.TRACK_WORDS)

I don't know what to try because I am not getting any errors either. I have cross checked my credentials for twitter account too.

edit: I tried adding is_async = true, and even when the code executes after adding this (I am not sure how), nothing happens?

myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth = api.auth, listener = myStreamListener, is_async = True)
myStream.filter(languages=["en"], track = settings.TRACK_WORDS)

Can anyone explain what is it that I am supposed to do or look for?


问:
VS Code Flutter/Dart - Shortcut for Inserting Named Arguments?
If I were to use the copyWith() function on a Widget, there are many named arguments such a Widget would have where I want to pass my own values.

Is there a shortcut or code snippet to automatically insert all the named arguments so I can tab through and add them quickly?

```<code>Theme.of(context).textTheme.copyWith(
  bodyLarge: CURSORHEREFIRST,
  bodyMedium: TABNEXT,
  bodySmall: TABNEXT,
  bodyText1: TABNEXT,
  ...etc...
)
</code>```

Example:

```<code>Theme.of(context).textTheme.copyWith()
</code>```

Upon shortcut becomes:

```<code>Theme.of(context).textTheme.copyWith(
  bodyLarge: ,
  bodyMedium: ,
  bodySmall: ,
  bodyText1: ,
  ...etc...
)
</code>```

Body:
If I were to use the copyWith() function on a Widget, there are many named arguments such a Widget would have where I want to pass my own values.

Is there a shortcut or code snippet to automatically insert all the named arguments so I can tab through and add them quickly?

Theme.of(context).textTheme.copyWith(
  bodyLarge: CURSORHEREFIRST,
  bodyMedium: TABNEXT,
  bodySmall: TABNEXT,
  bodyText1: TABNEXT,
  ...etc...
)

Example:

Theme.of(context).textTheme.copyWith()

Upon shortcut becomes:

Theme.of(context).textTheme.copyWith(
  bodyLarge: ,
  bodyMedium: ,
  bodySmall: ,
  bodyText1: ,
  ...etc...
)


问:
Module parse failed: Unexpected character '#' after updating react-pdf package version to 6.2.1
I am using the react-pdf node module package to display PDFs in a React application and running using storybook. Earlier, I was using react-pdf version 4.1.0, and it was working fine, but after updating the package to the latest version, i.e., 6.2.1, it started to give me the below error when I am trying to run the storybook.

```<code>ERROR in ./node_modules/pdfjs-dist/build/pdf.js 1413:9
Module parse failed: Unexpected character '#' (1413:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| class PDFDocumentLoadingTask {
>   static #docId = 0;
|
|   constructor() {
 @ ./node_modules/react-pdf/dist/esm/entry.webpack.js 1:0-46 9:0-25 10:0-42
</code>```

I am using the following versions of the below packages:

```<code>react: 16.12.0

react-dom: 16.12.0

react-pdf: 6.2.1

typescript: 3.7.2

@storybook/react: ^6.1.21
</code>```

Note: I have Node 14 on my system

Body:
I am using the react-pdf node module package to display PDFs in a React application and running using storybook. Earlier, I was using react-pdf version 4.1.0, and it was working fine, but after updating the package to the latest version, i.e., 6.2.1, it started to give me the below error when I am trying to run the storybook.

ERROR in ./node_modules/pdfjs-dist/build/pdf.js 1413:9
Module parse failed: Unexpected character '#' (1413:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| class PDFDocumentLoadingTask {
>   static #docId = 0;
|
|   constructor() {
 @ ./node_modules/react-pdf/dist/esm/entry.webpack.js 1:0-46 9:0-25 10:0-42

I am using the following versions of the below packages:

react: 16.12.0

react-dom: 16.12.0

react-pdf: 6.2.1

typescript: 3.7.2

@storybook/react: ^6.1.21

Note: I have Node 14 on my system


问:
Excessive number of pending callbacks in Timer After React/Expo Version Update
After updating my react native app (that uses expo) I am noticing that a timer is causing the app to crash when the user starts it. This timer used to work fine prior to the update. The error I'm getting references excessive callbacks:

Please report: Excessive number of pending callbacks: 501. Some
pending callbacks that might have leaked by never being called from
native code:
{"3041":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3053":{"module":"NativeAnimatedModule","method":"getValue"},"3138":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3140":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3148":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3150":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3234":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3237":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3240":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3243":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3245":{"module":"Networking","method":"sendRequest"},"3334":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3337":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3340":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3343":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3432":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3435":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3438":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3441":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},

Some people have mentioned the issue could have to do with TouchableOpacity because there was a change made there. But I don't think that's relevant here, because this particular block of code doesn't use TouchableOpacity. Is the issue that there are numerous promises executed, or perhaps that I'm using async/await in componentDidMount and componentDidUpdate? Again, to clarify, this was working prior to these updates. Any insight would be appreciated:

```<code>import React from 'react';
import { TextInput, View, Button } from 'react-native';

import moment from 'moment';
import componentStyles from './styles';

export class VisitTimer extends React.PureComponent {
  constructor(props) {
    super(props);

    this.timer = null;
    this.state = {
      duration: '00:00:00',
      editable: true,
      startDuration: null,
      startTime: null,
      stopDuration: null,
      stopTime: null,
      shortDuration: '00:00',
      stopTimeOffset: 0,
      maxDurationReached: false,
    };
  }

  async componentDidMount() {
    console.log('VisitTimer() firing...');
    await this.loadTimer(this.props);
  }

  async componentDidUpdate(prevProps) {
    if (
      this.props.started != prevProps.started ||
      this.props.stopped != prevProps.stopped ||
      this.props.durationOverride != prevProps.durationOverride ||
      this.props.editable != prevProps.editable
    ) {
      await this.loadTimer(this.props);
    }
    this.state.editable = !this.props.disabled;
  }

  componentDidCatch(error) {
    if (this.timer) clearInterval(this.timer);
    if (this.props.onError) {
      this.props.onError(error);
    }
  }

  componentWillUnmount() {
    if (this.timer) clearInterval(this.timer);
  }

  _getDuration() {
    let msDuration =
      (this.state.stopTime
        ? moment(this.state.stopTime).valueOf()
        : moment(Date.serverTime() - this.state.stopTimeOffset).valueOf()) -
      (this.state.startTime ? moment(this.state.startTime).valueOf() : moment(Date.serverTime()).valueOf());

    // detect maximum duration in millisecondsr
    if (this.props.maxDuration && this.state.stopTime === null && msDuration >= this.props.maxDuration) {
      msDuration = this.props.maxDuration;

      this.setState(
        {
          stopTimeOffset:
            moment(Date.serverTime()).valueOf() - (moment(this.state.startTime).valueOf() + this.props.maxDuration),
          maxDurationReached: true,
        },
        () => {
          this._stopTimer();
          if (this.props.onMaxDurationReached) this.props.onMaxDurationReached();
        }
      );
    }

    if (msDuration < 0) msDuration = 0;
    const diff = moment.utc(msDuration);

    let long = diff.format('HH:mm:ss');
    let short = diff.format('HH:mm');

    return {
      long: long,
      short: short,
      stopTime: moment(moment(this.state.startTime).valueOf() + msDuration),
    };
  }

  async _startTimer() {
    if (this.timer) clearInterval(this.timer);

    let stateUpdate = {
      stopTime: null,
    };

    const newStartTime = moment(Date.serverTime() || Date.now());
    if (!this.state.startTime) {
      stateUpdate.startTime = newStartTime.format('YYYY-MM-DD HH:mm:ss');
      stateUpdate.startDuration = newStartTime.format('HH:mm');
    }

    this.setState(stateUpdate, () => {
      this.timer = setInterval(() => {
        const duration = this._getDuration();
        this.setState({
          duration: duration.long,
          shortDuration: duration.short,
          stopDuration: duration.stopTime.format('HH:mm'),
        });
      }, 1000);

      if (this.props.onChange) this.props.onChange(this.state);
    });
  }

  _stopTimer() {
    return new Promise((resolve) => {
      if (this.timer) clearInterval(this.timer);
      if (this.state.stopTime) return resolve(this.state);

      const newStopTime = moment(Date.serverTime() - this.state.stopTimeOffset);

      this.setState(
        {
          stopTime: newStopTime.format('YYYY-MM-DD HH:mm:ss'),
        },
        () => {
          const duration = this._getDuration();

          const l = moment(duration.long, 'hh:mm:ss');
          const roundedUpDuration =
            l.second() >= 30
              ? l.add(1, 'minute').startOf('minute').format('HH:mm')
              : l.startOf('minute').format('HH:mm');

          this.setState(
            {
              duration: duration.long,
              shortDuration: roundedUpDuration,
              stopDuration: duration.stopTime.format('HH:mm'),
            },
            () => {
              if (this.props.onChange) await this.props.onChange(this.state);
              return resolve(this.state);
            }
          );
        }
      );
    });
  }

  async _continueTimer() {
    if (this.timer) clearInterval(this.timer);

    const stopTimeOffset = Date.serverTime() - moment(this.state.stopTime).valueOf();

    this.setState(
      {
        stopTimeOffset: stopTimeOffset,
        stopDuration: null,
        stopTime: null,
      },
      () => {
        this.timer = setInterval(() => {
          const duration = this._getDuration();
          this.setState({
            duration: duration.long,
            shortDuration: duration.short,
          });
        }, 1000);

        if (this.props.onChange) this.props.onChange(this.state);
      }
    );
  }

  _resetTimer() {
    this.setState({
      startDuration: null,
      startTime: null,
      stopDuration: null,
      stopTime: null,
      duration: '00:00:00',
      shortDuration: '00:00',
    });

    if (this.props.onChange) {
      this.props.onChange(this.state);
    }
  }

  async loadTimer(props) {
    await Promise.all([
      new Promise((resolve) => {
        if (props.editable !== undefined)
          this.setState(
            {
              editable: props.editable,
            },
            resolve
          );
      }),
      new Promise((resolve) => {
        if (props.stopped) {
          this.setState(
            {
              stopTime: moment(props.stopped).format('YYYY-MM-DD HH:mm:ss'),
              stopDuration: moment(props.stopped).format('HH:mm'),
            },
            resolve
          );
        } else {
          this.setState(
            {
              stopTime: null,
              stopDuration: null,
            },
            resolve
          );
        }
      }),
      new Promise((resolve) => {
        if (props.stopTimeOffset && props.stopTimeOffset != Number.NaN) {
          this.setState({ stopTimeOffset: props.stopTimeOffset }, resolve);
        } else {
          this.setState({ stopTimeOffset: 0 }, resolve);
        }
      }),
      new Promise((resolve) => {
        if (props.started) {
          this.setState(
            {
              startTime: moment(props.started).format('YYYY-MM-DD HH:mm:ss'),
              startDuration: moment(props.started).format('HH:mm'),
            },
            resolve
          );
        } else {
          this.setState(
            {
              startTime: null,
              startDuration: null,
            },
            resolve
          );
        }
      }),
    ]);

    if (!props.stopped && props.started && this.state.editable) {
      await this._startTimer();
    } else {
      if (props.durationOverride && !this.state.editable) {
        this.setState({
          duration: `${props.durationOverride}:00`,
          durationShort: props.durationOverride,
        });
      } else {
        const duration = this._getDuration();
        this.setState({
          duration: duration.long,
          shortDuration: duration.short,
        });
      }
    }
  }

  render() {
    return (
      <View
        style={{
          ...componentStyles.fieldContainer,
          flexDirection: 'row',
        }}
      >
        <TextInput
          style={[componentStyles.formField, componentStyles.durationTimer]}
          editable={false}
          value={this.state.duration}
        />
        {(() => {
          if (this.state.editable && !this.state.startTime)
            return (
              <Button
                onPress={this._startTimer.bind(this)}
                title='Start'
                color='#841584'
                accessibilityLabel='Start visit timer'
                style={componentStyles.durationTimerButton}
              />
            );
        })()}
        {(() => {
          if (this.state.editable && this.state.startTime && !this.state.stopTime)
            return (
              <Button
                onPress={this._stopTimer.bind(this)}
                title='Stop'
                color='#841584'
                accessibilityLabel='Stop visit timer'
                style={componentStyles.durationTimerButton}
              />
            );
        })()}
        {(() => {
          //  if(this.state.editable && this.state.startTime && this.state.stopTime) return (
          if (this.state.editable && this.state.startTime && this.state.stopTime && this.props.editable)
            return (
              <Button
                onPress={this._continueTimer.bind(this)}
                title='Resume'
                color='#841584'
                accessibilityLabel='Undo visit timer'
                style={componentStyles.durationTimerButton}
              />
            );
        })()}
      </View>
    );
  }
}
</code>```

Body:
After updating my react native app (that uses expo) I am noticing that a timer is causing the app to crash when the user starts it. This timer used to work fine prior to the update. The error I'm getting references excessive callbacks:

Please report: Excessive number of pending callbacks: 501. Some
pending callbacks that might have leaked by never being called from
native code:
{"3041":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3053":{"module":"NativeAnimatedModule","method":"getValue"},"3138":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3140":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3148":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3150":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3234":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3237":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3240":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3243":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3245":{"module":"Networking","method":"sendRequest"},"3334":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3337":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3340":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3343":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3432":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3435":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3438":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"3441":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},

Some people have mentioned the issue could have to do with TouchableOpacity because there was a change made there. But I don't think that's relevant here, because this particular block of code doesn't use TouchableOpacity. Is the issue that there are numerous promises executed, or perhaps that I'm using async/await in componentDidMount and componentDidUpdate? Again, to clarify, this was working prior to these updates. Any insight would be appreciated:

import React from 'react';
import { TextInput, View, Button } from 'react-native';

import moment from 'moment';
import componentStyles from './styles';

export class VisitTimer extends React.PureComponent {
  constructor(props) {
    super(props);

    this.timer = null;
    this.state = {
      duration: '00:00:00',
      editable: true,
      startDuration: null,
      startTime: null,
      stopDuration: null,
      stopTime: null,
      shortDuration: '00:00',
      stopTimeOffset: 0,
      maxDurationReached: false,
    };
  }

  async componentDidMount() {
    console.log('VisitTimer() firing...');
    await this.loadTimer(this.props);
  }

  async componentDidUpdate(prevProps) {
    if (
      this.props.started != prevProps.started ||
      this.props.stopped != prevProps.stopped ||
      this.props.durationOverride != prevProps.durationOverride ||
      this.props.editable != prevProps.editable
    ) {
      await this.loadTimer(this.props);
    }
    this.state.editable = !this.props.disabled;
  }

  componentDidCatch(error) {
    if (this.timer) clearInterval(this.timer);
    if (this.props.onError) {
      this.props.onError(error);
    }
  }

  componentWillUnmount() {
    if (this.timer) clearInterval(this.timer);
  }

  _getDuration() {
    let msDuration =
      (this.state.stopTime
        ? moment(this.state.stopTime).valueOf()
        : moment(Date.serverTime() - this.state.stopTimeOffset).valueOf()) -
      (this.state.startTime ? moment(this.state.startTime).valueOf() : moment(Date.serverTime()).valueOf());

    // detect maximum duration in millisecondsr
    if (this.props.maxDuration && this.state.stopTime === null && msDuration >= this.props.maxDuration) {
      msDuration = this.props.maxDuration;

      this.setState(
        {
          stopTimeOffset:
            moment(Date.serverTime()).valueOf() - (moment(this.state.startTime).valueOf() + this.props.maxDuration),
          maxDurationReached: true,
        },
        () => {
          this._stopTimer();
          if (this.props.onMaxDurationReached) this.props.onMaxDurationReached();
        }
      );
    }

    if (msDuration < 0) msDuration = 0;
    const diff = moment.utc(msDuration);

    let long = diff.format('HH:mm:ss');
    let short = diff.format('HH:mm');

    return {
      long: long,
      short: short,
      stopTime: moment(moment(this.state.startTime).valueOf() + msDuration),
    };
  }

  async _startTimer() {
    if (this.timer) clearInterval(this.timer);

    let stateUpdate = {
      stopTime: null,
    };

    const newStartTime = moment(Date.serverTime() || Date.now());
    if (!this.state.startTime) {
      stateUpdate.startTime = newStartTime.format('YYYY-MM-DD HH:mm:ss');
      stateUpdate.startDuration = newStartTime.format('HH:mm');
    }

    this.setState(stateUpdate, () => {
      this.timer = setInterval(() => {
        const duration = this._getDuration();
        this.setState({
          duration: duration.long,
          shortDuration: duration.short,
          stopDuration: duration.stopTime.format('HH:mm'),
        });
      }, 1000);

      if (this.props.onChange) this.props.onChange(this.state);
    });
  }

  _stopTimer() {
    return new Promise((resolve) => {
      if (this.timer) clearInterval(this.timer);
      if (this.state.stopTime) return resolve(this.state);

      const newStopTime = moment(Date.serverTime() - this.state.stopTimeOffset);

      this.setState(
        {
          stopTime: newStopTime.format('YYYY-MM-DD HH:mm:ss'),
        },
        () => {
          const duration = this._getDuration();

          const l = moment(duration.long, 'hh:mm:ss');
          const roundedUpDuration =
            l.second() >= 30
              ? l.add(1, 'minute').startOf('minute').format('HH:mm')
              : l.startOf('minute').format('HH:mm');

          this.setState(
            {
              duration: duration.long,
              shortDuration: roundedUpDuration,
              stopDuration: duration.stopTime.format('HH:mm'),
            },
            () => {
              if (this.props.onChange) await this.props.onChange(this.state);
              return resolve(this.state);
            }
          );
        }
      );
    });
  }

  async _continueTimer() {
    if (this.timer) clearInterval(this.timer);

    const stopTimeOffset = Date.serverTime() - moment(this.state.stopTime).valueOf();

    this.setState(
      {
        stopTimeOffset: stopTimeOffset,
        stopDuration: null,
        stopTime: null,
      },
      () => {
        this.timer = setInterval(() => {
          const duration = this._getDuration();
          this.setState({
            duration: duration.long,
            shortDuration: duration.short,
          });
        }, 1000);

        if (this.props.onChange) this.props.onChange(this.state);
      }
    );
  }

  _resetTimer() {
    this.setState({
      startDuration: null,
      startTime: null,
      stopDuration: null,
      stopTime: null,
      duration: '00:00:00',
      shortDuration: '00:00',
    });

    if (this.props.onChange) {
      this.props.onChange(this.state);
    }
  }

  async loadTimer(props) {
    await Promise.all([
      new Promise((resolve) => {
        if (props.editable !== undefined)
          this.setState(
            {
              editable: props.editable,
            },
            resolve
          );
      }),
      new Promise((resolve) => {
        if (props.stopped) {
          this.setState(
            {
              stopTime: moment(props.stopped).format('YYYY-MM-DD HH:mm:ss'),
              stopDuration: moment(props.stopped).format('HH:mm'),
            },
            resolve
          );
        } else {
          this.setState(
            {
              stopTime: null,
              stopDuration: null,
            },
            resolve
          );
        }
      }),
      new Promise((resolve) => {
        if (props.stopTimeOffset && props.stopTimeOffset != Number.NaN) {
          this.setState({ stopTimeOffset: props.stopTimeOffset }, resolve);
        } else {
          this.setState({ stopTimeOffset: 0 }, resolve);
        }
      }),
      new Promise((resolve) => {
        if (props.started) {
          this.setState(
            {
              startTime: moment(props.started).format('YYYY-MM-DD HH:mm:ss'),
              startDuration: moment(props.started).format('HH:mm'),
            },
            resolve
          );
        } else {
          this.setState(
            {
              startTime: null,
              startDuration: null,
            },
            resolve
          );
        }
      }),
    ]);

    if (!props.stopped && props.started && this.state.editable) {
      await this._startTimer();
    } else {
      if (props.durationOverride && !this.state.editable) {
        this.setState({
          duration: `${props.durationOverride}:00`,
          durationShort: props.durationOverride,
        });
      } else {
        const duration = this._getDuration();
        this.setState({
          duration: duration.long,
          shortDuration: duration.short,
        });
      }
    }
  }

  render() {
    return (
      <View
        style={{
          ...componentStyles.fieldContainer,
          flexDirection: 'row',
        }}
      >
        <TextInput
          style={[componentStyles.formField, componentStyles.durationTimer]}
          editable={false}
          value={this.state.duration}
        />
        {(() => {
          if (this.state.editable && !this.state.startTime)
            return (
              <Button
                onPress={this._startTimer.bind(this)}
                title='Start'
                color='#841584'
                accessibilityLabel='Start visit timer'
                style={componentStyles.durationTimerButton}
              />
            );
        })()}
        {(() => {
          if (this.state.editable && this.state.startTime && !this.state.stopTime)
            return (
              <Button
                onPress={this._stopTimer.bind(this)}
                title='Stop'
                color='#841584'
                accessibilityLabel='Stop visit timer'
                style={componentStyles.durationTimerButton}
              />
            );
        })()}
        {(() => {
          //  if(this.state.editable && this.state.startTime && this.state.stopTime) return (
          if (this.state.editable && this.state.startTime && this.state.stopTime && this.props.editable)
            return (
              <Button
                onPress={this._continueTimer.bind(this)}
                title='Resume'
                color='#841584'
                accessibilityLabel='Undo visit timer'
                style={componentStyles.durationTimerButton}
              />
            );
        })()}
      </View>
    );
  }
}


问:
Unable to run powershell command within Windows cmd prompt
I need to run below powershell command using Windows cmd.exe. The powershell command works fine, when run directly within powershell.exe.

```<code>Get-Process | Where-Object { $_.Name -like 'ABC.*' } | Stop-Process
</code>```

However, when I run it in cmd mode, I get below error.

```<code>powershell.exe -ExecutionPolicy unrestricted -Command "Get-Process | Where-Object { $_.Name -like 'ABC.*' } | Stop-Process"
</code>```

Error:

```<code>.Name : The term '.Name' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:30
+ Get-Process | Where-Object { .Name -like 'ABC.*' } | Stop-Process
+                              ~~~~~
    + CategoryInfo          : ObjectNotFound: (.Name:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
</code>```

Somehow, its not able to use the $_ in the script. I tried adding \ escape character just for $, just for _ and for both. But it resulted in same error. Also tried using old format $PSItem and that also did not work.

Unfortunately, I cannot use a script file for the ps script. Hence need to somehow get this working. Please suggest how can this powershell command be run under cmd.

I am using Windows 10 Enterprise.

Thanks!

Body:
I need to run below powershell command using Windows cmd.exe. The powershell command works fine, when run directly within powershell.exe.

Get-Process | Where-Object { $_.Name -like 'ABC.*' } | Stop-Process

However, when I run it in cmd mode, I get below error.

powershell.exe -ExecutionPolicy unrestricted -Command "Get-Process | Where-Object { $_.Name -like 'ABC.*' } | Stop-Process"

Error:

.Name : The term '.Name' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:30
+ Get-Process | Where-Object { .Name -like 'ABC.*' } | Stop-Process
+                              ~~~~~
    + CategoryInfo          : ObjectNotFound: (.Name:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Somehow, its not able to use the $_ in the script. I tried adding \ escape character just for $, just for _ and for both. But it resulted in same error. Also tried using old format $PSItem and that also did not work.

Unfortunately, I cannot use a script file for the ps script. Hence need to somehow get this working. Please suggest how can this powershell command be run under cmd.

I am using Windows 10 Enterprise.

Thanks!


问:
Django auto complete light not showing suggestions
I am currently trying to test the django auto complete light.

I am able to get it to display the auto complete results when I go directly to the url as it says in the read me.

Ie, when I go to localhost:8000/company-autocomplete/ or localhost:8000/company-autocomplete/?q=j

it shows the correct json

```<code>{"results": [{"id": "1", "text": "john", "selected_text": "john"}, {"id": "5", "text": "jjjj", "selected_text": "jjjj"}], "pagination": {"more": false}}
</code>```

The issue arrises when I am trying to have it in the form.  My code looks like the following

urls.py

```<code>    path('company-autocomplete/', CompanyAutocomplete.as_view(), name='company-autocomplete', ),
</code>```

views.py, forms.py, models.py

```<code>class Company(models.Model):
    name = models.CharField(max_length=250)
    def __str__(self):
        return self.name

class CompanyForm(forms.ModelForm):
    class Meta:
        model = Company
        fields = ('__all__')
        widgets = {
            'company': autocomplete.ModelSelect2(url='company-autocomplete')
        }

class CompanyAutocomplete(autocomplete.Select2QuerySetView):
    def get_queryset(self):
        qs = Company.objects.all()
        if self.q:
            qs = qs.filter(name__istartswith=self.q)
        return qs

class IndexPage(View):
    def get(self, request):

        response = render(
            request,
            'base.html',
            {
                'title': 'title',
                'description': 'description',
                'form': CompanyForm()
            }
        )
        return response
</code>```

And my base template like so

```<code>        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

        <form method="POST">
            {% csrf_token %}
            <fieldset class="form-group">
                {{ form.as_p }}
            </fieldset>
                {{ form.media }}
        </form>
</code>```

I would greatly appreciate any help

Body:
I am currently trying to test the django auto complete light.

I am able to get it to display the auto complete results when I go directly to the url as it says in the read me.

Ie, when I go to localhost:8000/company-autocomplete/ or localhost:8000/company-autocomplete/?q=j

it shows the correct json

{"results": [{"id": "1", "text": "john", "selected_text": "john"}, {"id": "5", "text": "jjjj", "selected_text": "jjjj"}], "pagination": {"more": false}}

The issue arrises when I am trying to have it in the form.  My code looks like the following

urls.py

    path('company-autocomplete/', CompanyAutocomplete.as_view(), name='company-autocomplete', ),

views.py, forms.py, models.py

class Company(models.Model):
    name = models.CharField(max_length=250)
    def __str__(self):
        return self.name

class CompanyForm(forms.ModelForm):
    class Meta:
        model = Company
        fields = ('__all__')
        widgets = {
            'company': autocomplete.ModelSelect2(url='company-autocomplete')
        }

class CompanyAutocomplete(autocomplete.Select2QuerySetView):
    def get_queryset(self):
        qs = Company.objects.all()
        if self.q:
            qs = qs.filter(name__istartswith=self.q)
        return qs

class IndexPage(View):
    def get(self, request):

        response = render(
            request,
            'base.html',
            {
                'title': 'title',
                'description': 'description',
                'form': CompanyForm()
            }
        )
        return response

And my base template like so

        <form method="POST">
            {% csrf_token %}
            <fieldset class="form-group">
                {{ form.as_p }}
            </fieldset>
                {{ form.media }}
        </form>

I would greatly appreciate any help


问:
Admob ads are not displayed as specified
I have an app that is currently live in the store. After clicking a button 3 times in the application, an advertisement is shown. There has been a serious decrease in advertising revenues in the last two days. The reason for this was that on some devices, it was necessary to press more than 3 times for the ad to appear. On my friend's phone, normally it was necessary to click 3 times for the ad to appear, but now after 13 clicks, the ad appeared. How can I solve this issue?

Splash screen

import { View } from 'react-native'
import React, { useEffect } from 'react'
import mobileAds from 'react-native-google-mobile-ads';

export default Splash = ({ navigation }) => {

    useEffect(() => {

        mobileAds().initialize()
            .then(e => {
                navigation.navigate("MainScreen")
            })
    }, [])

    return (
        <View />
    )
}```
</div>
</div>
</p>
<p>MainScreen:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import { Button } from 'react-native'
import React, { useState, useEffect } from 'react'
import { InterstitialAd, TestIds, AdEventType } from 'react-native-google-mobile-ads';

const adUnitId = __DEV__ ? TestIds.INTERSTITIAL : 'ca-app-pub-XXXX';
const interstitialAd = InterstitialAd.createForAdRequest(adUnitId);

export default MainScreen = ({ navigation }) => {

    const [request, setRequest] = useState(0)

    useEffect(() => {
        interstitialAd.addAdEventsListener(({ type }) => {
            if (type === AdEventType.LOADED) {
                interstitialAd.show();
            }
        });
    }, [])

    useEffect(() => {
        if (countOfRequests % 3 == 0) {
            interstitialAd.load();
        }
    }, [request])

    return (
        <Button
            title='press'
            onPress={() => setRequest(prev => prev + 1)}
        />
    )
}</code>```

Body:
I have an app that is currently live in the store. After clicking a button 3 times in the application, an advertisement is shown. There has been a serious decrease in advertising revenues in the last two days. The reason for this was that on some devices, it was necessary to press more than 3 times for the ad to appear. On my friend's phone, normally it was necessary to click 3 times for the ad to appear, but now after 13 clicks, the ad appeared. How can I solve this issue?

Splash screen

import { View } from 'react-native'
import React, { useEffect } from 'react'
import mobileAds from 'react-native-google-mobile-ads';

export default Splash = ({ navigation }) => {

    useEffect(() => {

        mobileAds().initialize()
            .then(e => {
                navigation.navigate("MainScreen")
            })
    }, [])

    return (
        <View />
    )
}

MainScreen:

import { Button } from 'react-native'
import React, { useState, useEffect } from 'react'
import { InterstitialAd, TestIds, AdEventType } from 'react-native-google-mobile-ads';

const adUnitId = __DEV__ ? TestIds.INTERSTITIAL : 'ca-app-pub-XXXX';
const interstitialAd = InterstitialAd.createForAdRequest(adUnitId);

export default MainScreen = ({ navigation }) => {

    const [request, setRequest] = useState(0)

    useEffect(() => {
        interstitialAd.addAdEventsListener(({ type }) => {
            if (type === AdEventType.LOADED) {
                interstitialAd.show();
            }
        });
    }, [])

    useEffect(() => {
        if (countOfRequests % 3 == 0) {
            interstitialAd.load();
        }
    }, [request])

    return (
        <Button
            title='press'
            onPress={() => setRequest(prev => prev + 1)}
        />
    )
}


问:
How can I get all REST API Methods from website without public documentation
There is a website https://api.somewebsite.com/
I need to get api methods (routes) and queries to get data from them

Lets pretend they dont have any docs.
Is there a way to do it?

I tried to find some website to do that for me.
I didn't come with a better idea than bruteforce uri and look at the responses


问:
react hook form: useFieldArray circular reference type error
I am trying to use the useFieldArray hook from react-hook-form with an object that has a recursive type definition. However, this causes a type error:

```<code>Type of property 'children' circularly references itself in mapped type '{ [K in keyof TOrganization]-?: ArrayPathImpl<K & string, TOrganization[K]>; }'.ts(2615)
</code>```

I found a solution to this problem in this issue, but I don't understand it. Can someone help me understand the solution or provide an alternative solution?

Thank for your help.

CodeSandbox

Body:
I am trying to use the useFieldArray hook from react-hook-form with an object that has a recursive type definition. However, this causes a type error:

Type of property 'children' circularly references itself in mapped type '{ [K in keyof TOrganization]-?: ArrayPathImpl<K & string, TOrganization[K]>; }'.ts(2615)

I found a solution to this problem in this issue, but I don't understand it. Can someone help me understand the solution or provide an alternative solution?

Thank for your help.

CodeSandbox


问:
How do I render the next page after login?
I can't pass the navigation response to the next page after the user correctly fills in the password and email.

I tried passing the navigate from the useNavigation library instead of the answer but when I go to fill in the password or email it doesn't check if the fields are right.

How could I put in place of the response a navigate but checking if the data is right in the database?

```<code>import "../App.css";
import * as yup from "yup";
import { ErrorMessage, Formik, Form, Field } from "formik";
import Axios from "axios";
import { useNavigate } from "react-router-dom";

const Login = () => {
  // const navigate = useNavigate();

  const handleLogin = (values) => {
    Axios.post("http://localhost:3001/login", {
      email: values.email,
      password: values.password,
    }).then((response) => {
      alert(response.data);
      // navigate("/Home")
      // console.log(response);
    });
  };

  const validationsLogin = yup.object().shape({
    email: yup
      .string()
      .email("email inválido")
      .required("O email é obrigatório"),
    password: yup
      .string()
      .min(8, "A senha deve ter pelo menos 8 caracteres")
      .required("A senha é obrigatória"),
  });

  return (
    <div className="container">
      <h1>Login</h1>
      <Formik
        initialValues={{}}
        onSubmit={handleLogin}
        validationSchema={validationsLogin}
      >
        <Form className="login-form">
          <div className="login-form-group">
            <Field name="email" className="form-field" placeholder="Email" />

            <ErrorMessage
              component="span"
              name="email"
              className="form-error"
            />
          </div>
          {/*Outro campo*/}
          <div className="form-group">
            <Field name="password" className="form-field" placeholder="Senha" />

            <ErrorMessage
              component="span"
              name="password"
              className="form-error"
            />
          </div>

          <button className="button" type="submit">
            Login
          </button>
        </Form>
      </Formik>
    </div>
  );
};

export default Login;
</code>```
```<code>const db = mysql.createPool({
  host: "localhost",
  user: "root",
  password: "",
  database: "bd_login_cadastro",
});

app.use(express.json());
app.use(cors());

app.post("/register", (req, res) => {
  const email = req.body.email;
  const password = req.body.password;

  db.query("SELECT * FROM usuarios WHERE email = ?", [email], (err, result) => {
    if (err) {
      res.send(err);
    }
    if (result.length == 0) {
      bcrypt.hash(password, saltRounds, (err, hash) => {
        db.query(
          "INSERT INTO usuarios (email, password) VALUE (?,?)",
          [email, hash],
          (error, response) => {
            if (err) {
              res.send(err);
            }

            res.send({ msg: "Usuário cadastrado com sucesso" });
          }
        );
      });
    } else {
      res.send({ msg: "Email já cadastrado" });
    }
  });
});

app.post("/login", (req, res) => {
  const email = req.body.email;
  const password = req.body.password;

  db.query("SELECT * FROM usuarios WHERE email = ?", [email], (err, result) => {
    if (err) {
      res.send(err);
    }
    if (result.length > 0) {
      bcrypt.compare(password, result[0].password, (error, response) => {
        if (error) {
          res.send(error);
        }
        if (response) {
          res.send({ msg: "Usuário logado" });
        } else {
          res.send({ msg: "Senha incorreta" });
        }
      });
    } else {
      res.send({ msg: "Usuário não registrado!" });
    }
  });
});
</code>```

Body:
I can't pass the navigation response to the next page after the user correctly fills in the password and email.

I tried passing the navigate from the useNavigation library instead of the answer but when I go to fill in the password or email it doesn't check if the fields are right.

How could I put in place of the response a navigate but checking if the data is right in the database?

import "../App.css";
import * as yup from "yup";
import { ErrorMessage, Formik, Form, Field } from "formik";
import Axios from "axios";
import { useNavigate } from "react-router-dom";

const Login = () => {
  // const navigate = useNavigate();

  const handleLogin = (values) => {
    Axios.post("http://localhost:3001/login", {
      email: values.email,
      password: values.password,
    }).then((response) => {
      alert(response.data);
      // navigate("/Home")
      // console.log(response);
    });
  };

  const validationsLogin = yup.object().shape({
    email: yup
      .string()
      .email("email inválido")
      .required("O email é obrigatório"),
    password: yup
      .string()
      .min(8, "A senha deve ter pelo menos 8 caracteres")
      .required("A senha é obrigatória"),
  });

  return (

Login

      <Formik
        initialValues={{}}
        onSubmit={handleLogin}
        validationSchema={validationsLogin}
      >
        <Form className="login-form">

            <Field name="email" className="form-field" placeholder="Email" />

            <ErrorMessage
              component="span"
              name="email"
              className="form-error"
            />

          {/*Outro campo*/}

            <Field name="password" className="form-field" placeholder="Senha" />

            <ErrorMessage
              component="span"
              name="password"
              className="form-error"
            />

          <button className="button" type="submit">
            Login
          </button>
        </Form>
      </Formik>

  );
};

export default Login;

const db = mysql.createPool({
  host: "localhost",
  user: "root",
  password: "",
  database: "bd_login_cadastro",
});

app.use(express.json());
app.use(cors());

app.post("/register", (req, res) => {
  const email = req.body.email;
  const password = req.body.password;

  db.query("SELECT * FROM usuarios WHERE email = ?", [email], (err, result) => {
    if (err) {
      res.send(err);
    }
    if (result.length == 0) {
      bcrypt.hash(password, saltRounds, (err, hash) => {
        db.query(
          "INSERT INTO usuarios (email, password) VALUE (?,?)",
          [email, hash],
          (error, response) => {
            if (err) {
              res.send(err);
            }

            res.send({ msg: "Usuário cadastrado com sucesso" });
          }
        );
      });
    } else {
      res.send({ msg: "Email já cadastrado" });
    }
  });
});

app.post("/login", (req, res) => {
  const email = req.body.email;
  const password = req.body.password;

  db.query("SELECT * FROM usuarios WHERE email = ?", [email], (err, result) => {
    if (err) {
      res.send(err);
    }
    if (result.length > 0) {
      bcrypt.compare(password, result[0].password, (error, response) => {
        if (error) {
          res.send(error);
        }
        if (response) {
          res.send({ msg: "Usuário logado" });
        } else {
          res.send({ msg: "Senha incorreta" });
        }
      });
    } else {
      res.send({ msg: "Usuário não registrado!" });
    }
  });
});


问:
Why keyboard disappears after entering one value (React Native Expo)?
I'm making a login form in React Native. I can login and register already but when I try to enter values in the TextInput fields in my register form, the keyboard disappears after I enter one value, so I have to re-click every time on the input field to re-open the keyboard. This does not happen on Android, just with iPhone.

The weird thing is that this behavior does not happen on the login screen even though it is built exactly the same. Does anyone have any idea why this is happening?

Register.js

return (
    <View>
      <TextInput
        style={styles.input}
        value={username}
        onChangeText={(text) => setUsername(text)}
        placeholder="username"
        returnKeyType="next"
      />
      <TextInput
        style={styles.input}
        value={fullname}
        onChangeText={(text) => setFullname(text)}
        placeholder="full name"
      />
      <TextInput
        style={styles.input}
        value={password}
        onChangeText={(text) => setPassword(text)}
        placeholder="password"
      />
      <PasswordStrengthMeterBar password={password} />
      <Button title="Register" onPress={handleSubmit} />
    </View>
  );
```
<h2>Login.js</h2>
<pre class="lang-js prettyprint-override"><code>    return (
      <View style={styles.container}>
        {this.state.showComponent ? (
          <View>
            <Text>
              <Register setShowComponent={this.setShowComponent} />
            </Text>
            <Pressable onPress={this.handlePress}>
              <Text>Login</Text>
            </Pressable>
          </View>
        ) : (
          <View>
            <TextInput
              style={styles.input}
              value={this.state.users_username}
              onChangeText={this.handleusers_usernameChange}
              placeholder="username"
            />
            <TextInput
              style={styles.input}
              value={this.state.users_password}
              onChangeText={this.handleusers_passwordChange}
              placeholder="password"
              secureTextEntry
            />
            <Button title="Login" onPress={this.handleLoginPress} />
            <Pressable onPress={this.handlePress}>
              <Text>Register</Text>
            </Pressable>
            <Text>{this.state.response}</Text>
          </View>
        )}
      </View>
    );
</code>```

I already updated my phone, but that has not solved anything.

Body:
I'm making a login form in React Native. I can login and register already but when I try to enter values in the TextInput fields in my register form, the keyboard disappears after I enter one value, so I have to re-click every time on the input field to re-open the keyboard. This does not happen on Android, just with iPhone.

The weird thing is that this behavior does not happen on the login screen even though it is built exactly the same. Does anyone have any idea why this is happening?

Register.js

return (
    <View>
      <TextInput
        style={styles.input}
        value={username}
        onChangeText={(text) => setUsername(text)}
        placeholder="username"
        returnKeyType="next"
      />
      <TextInput
        style={styles.input}
        value={fullname}
        onChangeText={(text) => setFullname(text)}
        placeholder="full name"
      />
      <TextInput
        style={styles.input}
        value={password}
        onChangeText={(text) => setPassword(text)}
        placeholder="password"
      />
      <PasswordStrengthMeterBar password={password} />
      <Button title="Register" onPress={handleSubmit} />
    </View>
  );

Login.js

    return (
      <View style={styles.container}>
        {this.state.showComponent ? (
          <View>
            <Text>
              <Register setShowComponent={this.setShowComponent} />
            </Text>
            <Pressable onPress={this.handlePress}>
              <Text>Login</Text>
            </Pressable>
          </View>
        ) : (
          <View>
            <TextInput
              style={styles.input}
              value={this.state.users_username}
              onChangeText={this.handleusers_usernameChange}
              placeholder="username"
            />
            <TextInput
              style={styles.input}
              value={this.state.users_password}
              onChangeText={this.handleusers_passwordChange}
              placeholder="password"
              secureTextEntry
            />
            <Button title="Login" onPress={this.handleLoginPress} />
            <Pressable onPress={this.handlePress}>
              <Text>Register</Text>
            </Pressable>
            <Text>{this.state.response}</Text>
          </View>
        )}
      </View>
    );

I already updated my phone, but that has not solved anything.


问:
Cant understand checkerlog's(image attached) comment
Cant seem to understand checkerlog's(image attached) comment.

The output of the following code matches test cases expected output in IDE but fails test case 2.

Link to problem

Link to submitted solution

```<code>import java.util.Arrays;
import java.util.Scanner;

public class Whiteboard {
public static long whiteboard(int[] a, int[] b) {
    Arrays.sort(a);
    Arrays.sort(b);
    int k = b.length - 1;
    for (int i = 0; i < a.length; i++) {
        if (k >= 0) a[i] = b[k--];
    }
    long sum = 0;
    for (long j : a) {
        sum += j;
    }
    return sum;
}

public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    while (n-- > 0) {
        int a = s.nextInt();
        int b = s.nextInt();
        int[] whiteboardA = new int[a];
        int[] whiteboardB = new int[b];
        int p = 0;
        int q = 0;
        while (a-- > 0) {
            whiteboardA[p++] = s.nextInt();
        }
        while (b-- > 0) {
            whiteboardB[q++] = s.nextInt();
        }
        System.out.println(whiteboard(whiteboardA, whiteboardB));
    }
}
</code>```

}

Body:
Cant seem to understand checkerlog's(image attached) comment.

The output of the following code matches test cases expected output in IDE but fails test case 2.

Link to problem

Link to submitted solution

import java.util.Arrays;
import java.util.Scanner;

public class Whiteboard {
public static long whiteboard(int[] a, int[] b) {
    Arrays.sort(a);
    Arrays.sort(b);
    int k = b.length - 1;
    for (int i = 0; i = 0) a[i] = b[k--];
    }
    long sum = 0;
    for (long j : a) {
        sum += j;
    }
    return sum;
}

public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    while (n-- > 0) {
        int a = s.nextInt();
        int b = s.nextInt();
        int[] whiteboardA = new int[a];
        int[] whiteboardB = new int[b];
        int p = 0;
        int q = 0;
        while (a-- > 0) {
            whiteboardA[p++] = s.nextInt();
        }
        while (b-- > 0) {
            whiteboardB[q++] = s.nextInt();
        }
        System.out.println(whiteboard(whiteboardA, whiteboardB));
    }
}

}


问:
I am unable to find few packages when I'm trying to run the AutoCkt file which is available on GitHub
These are the list of packages that I'm unable to find. I'm using windows and trying to run this github code in gitbash.

here is the link for the code

```<code>ResolvePackageNotFound:
  - libopus
  - ncurses
  - libvpx
  - dbus
  - libedit
  - readline
  - libuuid

</code>```

I have tried deleting the version of the packages that were missing but it worked in few cases and the one's in which I couldn't find anything are those which are listed above.

The original version of the packages are listed in the github in environment.yml file.

Body:
These are the list of packages that I'm unable to find. I'm using windows and trying to run this github code in gitbash.

here is the link for the code

ResolvePackageNotFound:
  - libopus
  - ncurses
  - libvpx
  - dbus
  - libedit
  - readline
  - libuuid

I have tried deleting the version of the packages that were missing but it worked in few cases and the one's in which I couldn't find anything are those which are listed above.

The original version of the packages are listed in the github in environment.yml file.


问:
Which Resharper Setting controls alignment of Lambdas
I have this code

```<code>ToggleAnalyzeCmd = new DelegateCommand(
       () =>
       {
           if (IsAnalyzing)
               CancelAnalysis();
           else
               Analyze(false);
       },
       () => IsAnalyzing)
   .ObservesProperty(() => IsAnalyzing);
</code>```

But when I type it or reformat it with Resharper (version 2022.3.1), it really wants those two lambdas to be lined up right under the DelegateCommand  No matter how far to the right that is.  Here is what I get if I select the block of code and use Resharper's "FormatCode" command

```<code>ToggleAnalyzeCmd = new DelegateCommand(
                       () =>
                       {
                           if (IsAnalyzing)
                               CancelAnalysis();
                           else
                               Analyze(false);
                       },
                       () => IsAnalyzing)
                   .ObservesProperty(() => IsAnalyzing);
</code>```

Looking at Options >> Code Editing >> C# >> Tabs, Indents, Alignment, I am trying to find what setting controls this

I tried checking/unchecking the most obvious candidate; This setting:

```<code>Align multiline constructs >> Anonymous Method Body
</code>```

It has no effect.  My code still gets indented regardless.    I don't see any other setting that looks like it could.

Anyone know what setting I am looking for?

EDIT: By request I am sharing my resharper settings file - just the code editing and code-style properties.  This is long though

```<code><wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <s:String x:Key="/Default/CodeEditing/GenerateMemberBody/MethodImplementationKind/@EntryValue">ReturnDefaultValue</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/GenerateMemberBody/WrapIntoRegions/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutoCompleteSmartCompletion/@EntryValue">False</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/EditorBrowsableProcessing/@EntryValue">Advanced</s:String>
    <s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ParenthesesInsertType/@EntryValue">Left</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ReplaceKeywordsWithTemplates/@EntryValue">False</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/NonCompletingCharacters/@EntryValue">.,;</s:String>
    <s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/NonCompletingCharacters/@EntryValue">.,;</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/Intellisense/LookupWindow/ShowAnnotations/@EntryValue">All</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/Intellisense/LookupWindow/UseCompletionFontForLookups/@EntryValue">False</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/TypingAssist/BraceInsertType/@EntryValue">DISABLED</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/InsertAsteriskInBlockComments/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/SkipClosingBracesOnTabInIndentPosition/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/SkipClosingBracesOnTabInStringLiterals/@EntryValue">True</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/TypingAssist/SmartBackspace/@EntryValue">OFF</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/SurroundTypingEnabled/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_LINQ_QUERY/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_BINARY_PATTERNS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_FOR_STMT/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_STATEMENT_CONDITIONS/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTIPLE_DECLARATION/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_LIST/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_TUPLE_COMPONENTS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALLOW_FAR_ALIGNMENT/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_BRACES_INSIDE_STATEMENT_CONDITIONS/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_CASE_FROM_SWITCH/@EntryValue">False</s:Boolean>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_INVOCATION_PARS/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_METHOD_DECL_PARS/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_PARS/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_STATEMENT_PARS/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_TYPEARG_ANGLES/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_TYPEPARAM_ANGLES/@EntryValue">OUTSIDE</s:String>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_ASSIGNMENTS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_BINARY_EXPRESSIONS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_COMMENTS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_FIELDS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_INVOCATIONS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_METHODS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_NESTED_TERNARY/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_PARAMETERS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_PROPERTIES/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_PROPERTY_PATTERNS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_SWITCH_SECTIONS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_VARIABLES/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_EXISTING_DECLARATION_BLOCK_ARRANGEMENT/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/OUTDENT_COMMAS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ABSTRACT_ACCESSORHOLDER_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/STICK_COMMENT/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/USE_INDENT_FROM_VS/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_DECLARATION_LPAR/@EntryValue">True</s:Boolean>
    <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">165</s:Int64>
    <s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
    <s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Mutable/@EntryIndexedValue">False</s:String>
    <s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNotificationDisabled/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
</code>```

Body:
I have this code

ToggleAnalyzeCmd = new DelegateCommand(
       () =>
       {
           if (IsAnalyzing)
               CancelAnalysis();
           else
               Analyze(false);
       },
       () => IsAnalyzing)
   .ObservesProperty(() => IsAnalyzing);

But when I type it or reformat it with Resharper (version 2022.3.1), it really wants those two lambdas to be lined up right under the DelegateCommand  No matter how far to the right that is.  Here is what I get if I select the block of code and use Resharper's "FormatCode" command

ToggleAnalyzeCmd = new DelegateCommand(
                       () =>
                       {
                           if (IsAnalyzing)
                               CancelAnalysis();
                           else
                               Analyze(false);
                       },
                       () => IsAnalyzing)
                   .ObservesProperty(() => IsAnalyzing);

Looking at Options >> Code Editing >> C# >> Tabs, Indents, Alignment, I am trying to find what setting controls this

I tried checking/unchecking the most obvious candidate; This setting:

Align multiline constructs >> Anonymous Method Body

It has no effect.  My code still gets indented regardless.    I don't see any other setting that looks like it could.

Anyone know what setting I am looking for?

EDIT: By request I am sharing my resharper settings file - just the code editing and code-style properties.  This is long though

<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <s:String x:Key="/Default/CodeEditing/GenerateMemberBody/MethodImplementationKind/@EntryValue">ReturnDefaultValue</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/GenerateMemberBody/WrapIntoRegions/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutoCompleteSmartCompletion/@EntryValue">False</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/EditorBrowsableProcessing/@EntryValue">Advanced</s:String>
    <s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ParenthesesInsertType/@EntryValue">Left</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ReplaceKeywordsWithTemplates/@EntryValue">False</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/NonCompletingCharacters/@EntryValue">.,;</s:String>
    <s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/NonCompletingCharacters/@EntryValue">.,;</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/Intellisense/LookupWindow/ShowAnnotations/@EntryValue">All</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/Intellisense/LookupWindow/UseCompletionFontForLookups/@EntryValue">False</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/TypingAssist/BraceInsertType/@EntryValue">DISABLED</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/InsertAsteriskInBlockComments/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/SkipClosingBracesOnTabInIndentPosition/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/SkipClosingBracesOnTabInStringLiterals/@EntryValue">True</s:Boolean>
    <s:String x:Key="/Default/CodeEditing/TypingAssist/SmartBackspace/@EntryValue">OFF</s:String>
    <s:Boolean x:Key="/Default/CodeEditing/TypingAssist/SurroundTypingEnabled/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_LINQ_QUERY/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_BINARY_PATTERNS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_FOR_STMT/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_STATEMENT_CONDITIONS/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTIPLE_DECLARATION/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_LIST/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_TUPLE_COMPONENTS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALLOW_FAR_ALIGNMENT/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_BRACES_INSIDE_STATEMENT_CONDITIONS/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_CASE_FROM_SWITCH/@EntryValue">False</s:Boolean>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_INVOCATION_PARS/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_METHOD_DECL_PARS/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_PARS/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_STATEMENT_PARS/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_TYPEARG_ANGLES/@EntryValue">OUTSIDE</s:String>
    <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_TYPEPARAM_ANGLES/@EntryValue">OUTSIDE</s:String>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_ASSIGNMENTS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_BINARY_EXPRESSIONS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_COMMENTS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_FIELDS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_INVOCATIONS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_METHODS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_NESTED_TERNARY/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_PARAMETERS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_PROPERTIES/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_PROPERTY_PATTERNS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_SWITCH_SECTIONS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INT_ALIGN_VARIABLES/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_EXISTING_DECLARATION_BLOCK_ARRANGEMENT/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/OUTDENT_COMMAS/@EntryValue">True</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ABSTRACT_ACCESSORHOLDER_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/STICK_COMMENT/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/USE_INDENT_FROM_VS/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_DECLARATION_LPAR/@EntryValue">True</s:Boolean>
    <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">165</s:Int64>
    <s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
    <s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Mutable/@EntryIndexedValue">False</s:String>
    <s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNotificationDisabled/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>


问:
Tableau 2nd, 3rd, etc. most items
UPDATE:
There is an awesome answer at the link now.

ORIGINAL POST:
I ran across a Tableau community thread describing a way to use a calculated field to find the 2nd highest value using MAX. Per the response, there seems to be a way to drill down to also get the 3rd highest item as well. I'm having an issue figuring that portion out. I'm hoping someone could help me out. In the end I really need to use a calculated field to find the 3rd highest value of an item. Rank and Index are not an option for what I'm doing.

The following calculated field finds the 2nd highest value.
{MAX(
{fixed [Customer Name: IF SUM([Sales]<MAX({MAX({fixed [Customer Name]: SUM([Sales])})}
THEN SUM([Sales]) END}
)}

How do I modify the above to find the 3rd highest value?

This link is to that conversation for situational awareness. Thought it might help with context.
https://community.tableau.com/s/question/0D54T00000I2PrVSAV/second-highest-sales-value-by-the-customer-using-lod?t=1672415425258

I've tried all sort of things that didn't work.

Title: Tableau 2nd, 3rd, etc. most items


问:
.NET 7, VS 2022 . Is it possible to define multiple deploy profiles each with different post build commands?
So for my work I handle a .NET 7 web application that changes in theme and behavior depending on what appsettings.json file group is present in app main folder.

These alterations changes do NOT depend on environment.

For now I just deploy all the files to the server and manually overwrite the appsettings.json group from the folder with the intended configuration.

I'm just wondering if it's possible to automate this process creating as many different deploy profiles, one that copies after build appsettings.json group  from 'folderA' and one that copies the json group from 'folderB', etc...

I am aware of the post-build events on application project properties, but this events would be applied for all builds, and I don't see any textbox to set post deploy commands on deploy  profile.

Am I missing something, or there is not way for script this behaviour with deploy tool?