问:
How to get route name from outside MaterialApp?
I have a widget that is always showing on screen (Navigation Side Bar) and a content section that has a navigation.

In the Navigation Side Bar, I need to find some way to detect what is the current root of the content section (To highlight a certain menu item if active) , I thought I could achieve that using a Global key for NavigationState but it always says that the current route is "/"

```<code>ModalRoute.of(_contentKey.currentContext!)!
                            .settings
                            .name;
</code>```

Can someone explain what's going on and help me achieve my goal ?

Here is the minimum reproducible example:

```<code>class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final GlobalKey<NavigatorState> _contentKey = GlobalKey<NavigatorState>();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.max,
            children: [
              Container(
                child: ElevatedButton(
                  onPressed: () {
                    final currentRoot =
                        ModalRoute.of(_contentKey.currentContext!)!
                            .settings
                            .name;
                    print("currentRoot: $currentRoot");
                  },
                  child:
                      Text("What is the currrent root of other materialApp ?"),
                ),
              ),
              Expanded(
                child: MaterialApp(
                  navigatorKey: _contentKey,
                  title: 'Flutter Demo',
                  theme: ThemeData(
                    primarySwatch: Colors.blue,
                  ),
                  initialRoute: 'A',
                  routes: {
                    "A": (context) => Scaffold(
                          body: Center(
                            child: InkWell(
                                child: Text("Go to B"),
                                onTap: () {
                                  Navigator.of(context).pushNamed("B");
                                }),
                          ),
                        ),
                    "B": (context) => Scaffold(
                          body: Center(
                            child: InkWell(
                                child: Text("Go to A"),
                                onTap: () {
                                  Navigator.of(context).pushNamed("A");
                                }),
                          ),
                        ),
                  },
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
</code>```

Body:
I have a widget that is always showing on screen (Navigation Side Bar) and a content section that has a navigation.

In the Navigation Side Bar, I need to find some way to detect what is the current root of the content section (To highlight a certain menu item if active) , I thought I could achieve that using a Global key for NavigationState but it always says that the current route is "/"

ModalRoute.of(_contentKey.currentContext!)!
                            .settings
                            .name;

Can someone explain what's going on and help me achieve my goal ?

Here is the minimum reproducible example:

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final GlobalKey<NavigatorState> _contentKey = GlobalKey<NavigatorState>();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.max,
            children: [
              Container(
                child: ElevatedButton(
                  onPressed: () {
                    final currentRoot =
                        ModalRoute.of(_contentKey.currentContext!)!
                            .settings
                            .name;
                    print("currentRoot: $currentRoot");
                  },
                  child:
                      Text("What is the currrent root of other materialApp ?"),
                ),
              ),
              Expanded(
                child: MaterialApp(
                  navigatorKey: _contentKey,
                  title: 'Flutter Demo',
                  theme: ThemeData(
                    primarySwatch: Colors.blue,
                  ),
                  initialRoute: 'A',
                  routes: {
                    "A": (context) => Scaffold(
                          body: Center(
                            child: InkWell(
                                child: Text("Go to B"),
                                onTap: () {
                                  Navigator.of(context).pushNamed("B");
                                }),
                          ),
                        ),
                    "B": (context) => Scaffold(
                          body: Center(
                            child: InkWell(
                                child: Text("Go to A"),
                                onTap: () {
                                  Navigator.of(context).pushNamed("A");
                                }),
                          ),
                        ),
                  },
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}


来源: stackexchange

问:
Error 400 - Bad Request to Service Now API using win_uri module
I'm working on an automation whose last step is to update a ticket in service now. To do this, I am attempting to use the ansible.builtin.win_uri module to send a PATCH request to the incident indicated in the URL. The problem is, no matter how I format my body, I always get a 400 bad request error and I'm not sure how to go about troubleshooting this as I am learning ansible on the fly.

I can see I'm logged in from the headers in the failure message:
"x_is_logged_in": "true",

My task currently:

```<code>    - name: Update Ticket
      register: RESULT_update_ticket
      ansible.builtin.win_uri:
        url: "https://<ORG>.service-now.com/api/<HEADER>_<ORG>_rest/<ORG>_incident/{{ incident_number }}"
        url_method: PATCH
        return_content: true
        content_type: application/json
        force_basic_auth: true
        headers:
          Accept: application/json
        validate_certs: false
        url_username: <Account Username>
        url_password: <Account Password>
        body: |
          {
            "comments" : "Test comment from ansible"
          }
    - debug:
        var: result
</code>```

I suspect my problem is somewhere is in how I'm doing the body but I'm not sure what I need to do or change. but essentially I'm trying to send JSON a REST API

ContentLicense: CC BY-SA 4.0

Body:
I'm working on an automation whose last step is to update a ticket in service now. To do this, I am attempting to use the ansible.builtin.win_uri module to send a PATCH request to the incident indicated in the URL. The problem is, no matter how I format my body, I always get a 400 bad request error and I'm not sure how to go about troubleshooting this as I am learning ansible on the fly.

I can see I'm logged in from the headers in the failure message:
"x_is_logged_in": "true",

My task currently:

    - name: Update Ticket
      register: RESULT_update_ticket
      ansible.builtin.win_uri:
        url: "https://<ORG>.service-now.com/api/_<ORG>_rest/<ORG>_incident/{{ incident_number }}"
        url_method: PATCH
        return_content: true
        content_type: application/json
        force_basic_auth: true
        headers:
          Accept: application/json
        validate_certs: false
        url_username: <Account Username>
        url_password: <Account Password>
        body: |
          {
            "comments" : "Test comment from ansible"
          }
    - debug:
        var: result

I suspect my problem is somewhere is in how I'm doing the body but I'm not sure what I need to do or change. but essentially I'm trying to send JSON a REST API


问:
import react-banner in version 18 of react
In installed react-banner using npm install react-banner --legacy-peer-deps but when I try to import react banner into my Javascript using import Banner from 'react-banner'; I get the following error:

```<code>info  - Linting and checking validity of types
info  - Creating an optimized production build
info  - Compiled successfully
info  - Collecting page data .ReferenceError: window is not defined
    at Object.<anonymous> (~/heroku-website/node_modules/react-banner/dist/react-banner.min.js:1:240)
    at Module._compile (node:internal/modules/cjs/loader:1119:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
    at Module.load (node:internal/modules/cjs/loader:997:32)
    at Module._load (node:internal/modules/cjs/loader:838:12)
    at Module.require (node:internal/modules/cjs/loader:1021:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at 34 (~/heroku-website/.next/server/pages/index.js:39:47)
    at __webpack_require__ (~/heroku-website/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (~/heroku-website/.next/server/pages/index.js:174:39)
</code>```

Does anyone know what I have done wrong? Note that if I comment out the import statement, then the website compiles correctly.

Also, if I do not include --legacy-peer-deps then I cannot install react-banner (it expects version 16). Is there a newer version of react-banner?

I tried --force instead of --legacy-peer-deps (same result)

Body:
In installed react-banner using npm install react-banner --legacy-peer-deps but when I try to import react banner into my Javascript using import Banner from 'react-banner'; I get the following error:

info  - Linting and checking validity of types
info  - Creating an optimized production build
info  - Compiled successfully
info  - Collecting page data .ReferenceError: window is not defined
    at Object.<anonymous> (~/heroku-website/node_modules/react-banner/dist/react-banner.min.js:1:240)
    at Module._compile (node:internal/modules/cjs/loader:1119:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
    at Module.load (node:internal/modules/cjs/loader:997:32)
    at Module._load (node:internal/modules/cjs/loader:838:12)
    at Module.require (node:internal/modules/cjs/loader:1021:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at 34 (~/heroku-website/.next/server/pages/index.js:39:47)
    at __webpack_require__ (~/heroku-website/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (~/heroku-website/.next/server/pages/index.js:174:39)

Does anyone know what I have done wrong? Note that if I comment out the import statement, then the website compiles correctly.

Also, if I do not include --legacy-peer-deps then I cannot install react-banner (it expects version 16). Is there a newer version of react-banner?

I tried --force instead of --legacy-peer-deps (same result)


问:
Error installing mariadb-server mariadb-client on Chromebook
I'm trying install wordpress locally on my chromebook following these instructions.

I successfully ran:
`

```<code>sudo apt update
sudo apt upgrade
sudo apt install nano
</code>```

`

But then get an error when I try to run
`

```<code>sudo apt install mariadb-server mariadb-client -y
</code>```

`

Here's the error from my terminal:
`

```<code>Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libdbi-perl : Depends: perlapi-5.32.0
E: Unable to correct problems, you have held broken packages.
</code>```

`

I'm a complete newb at Linux and spend hours googling / trying solutions to no avail. Any help is appreciated.

Body:
I'm trying install wordpress locally on my chromebook following these instructions.

I successfully ran:
`

sudo apt update
sudo apt upgrade
sudo apt install nano

`

But then get an error when I try to run
`

sudo apt install mariadb-server mariadb-client -y

`

Here's the error from my terminal:
`

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libdbi-perl : Depends: perlapi-5.32.0
E: Unable to correct problems, you have held broken packages.

`

I'm a complete newb at Linux and spend hours googling / trying solutions to no avail. Any help is appreciated.


问:
Blazor webassembly app hosted ASP.NET Core 7 test with WebApplicationFactory
I have a Blazor webassembly app hosted in ASP.NET Core 7 that I want to run some tests on.

I'm trying to swap out the authentication setup (azure b2c) with a in memory version of IdentityServer while testing.

I'm able to start the host using WebApplicationFactory and modify the services.

But I need to apply some changes to the Blazor Webassembly client before I start the server.

I can't figure out how to access the builder object in the Webassembly Program.cs.

You can find my code at github

My WebApplicationFactory is in the directory test -> XunitPlaywright -> Auth -> IndividualAuthWebApplicationFactory.cs

Any help would be very much appreciated.

I've tried modifying ConfigureWebHost and ConfigureClient


问:
Mudblazor Bar Chart Margin
Is it possible to get a margin on the MudBlazor Bar Chart?
If you don't know what I mean:

Image Explanation with Arrows

I think that the bars at the edges are too close to the edges, so...

Thanks for you help!

Tried searching the internet after a solution and manipulating the BarChart with CSS by myself.
Expected result: Some kinda Attribute of the MudBlazor Bar Chart which sets the margin...

Title: Mudblazor Bar Chart Margin


问:
Discord slash commands via CLI
I'm trying to pass slash option on CLI via POST request like:

curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{"content": "/command test"}" webhook_url

But "/" character acting like a character in the Discord channel instead of command prompt. Is there any possibility to do that or it's just possible for your own bot? Just I want to pass any command for a specific bot (not mine) on the CLI.

It should be prompt as in the Discord on browser or client instead of text.

Title: Discord slash commands via CLI


问:
How do i display colored terminal output in readable form in reactjs
This code tells electron to run a command and prints the output to the console and render the same output in DOM using react-js

import Titlebar from "./components/Titlebar/Titlebar"
import { useState } from "react"

let shellOutput = []
const [currentShellOutput, setCurrentShellOutput] = useState(shellOutput)
ElectronAPI.execShellCommands(["spicetify apply"])
ElectronAPI.receive("sendToRenderer/shell-output", (outputString) => {
    console.log(outputString)
    setCurrentShellOutput((value) => {
        return value.concat([outputString])
    })
})

export default function App() {
    return (
        <>
            <Titlebar></Titlebar>
            {currentShellOutput.map((output) => (

{output}

            ))}
        </>
    )
}
```
<p>Code that actually runs the command using nodejs</p>
<pre class="lang-js prettyprint-override"><code>export function execShellCommands(commands) {
    let shellProcess = spawn("powershell.exe", [commands[0]])

    shellProcess.stdout.on("data", (data) => {
        mainWindow.webContents.send("sendToRenderer/shell-output", data.toString())
    })
    shellProcess.stderr.on("data", (data) => {
        mainWindow.webContents.send("sendToRenderer/shell-output", "stderr: " + data.toString())
    })
    shellProcess.on("exit", () => {
        mainWindow.webContents.send("sendToRenderer/shell-output", "shell-exited")
        commands.shift()
        if (0 < commands.length) {
            execShellCommands(commands)
        }
    })
}
</code>```

The output is printed perfectly in devtools console but in the DOM its weird:

Body:
This code tells electron to run a command and prints the output to the console and render the same output in DOM using react-js

import Titlebar from "./components/Titlebar/Titlebar"
import { useState } from "react"

let shellOutput = []
const [currentShellOutput, setCurrentShellOutput] = useState(shellOutput)
ElectronAPI.execShellCommands(["spicetify apply"])
ElectronAPI.receive("sendToRenderer/shell-output", (outputString) => {
    console.log(outputString)
    setCurrentShellOutput((value) => {
        return value.concat([outputString])
    })
})

export default function App() {
    return (
        <>
            <Titlebar></Titlebar>
            {currentShellOutput.map((output) => (

{output}

            ))}
        </>
    )
}

Code that actually runs the command using nodejs

export function execShellCommands(commands) {
    let shellProcess = spawn("powershell.exe", [commands[0]])

    shellProcess.stdout.on("data", (data) => {
        mainWindow.webContents.send("sendToRenderer/shell-output", data.toString())
    })
    shellProcess.stderr.on("data", (data) => {
        mainWindow.webContents.send("sendToRenderer/shell-output", "stderr: " + data.toString())
    })
    shellProcess.on("exit", () => {
        mainWindow.webContents.send("sendToRenderer/shell-output", "shell-exited")
        commands.shift()
        if (0 < commands.length) {
            execShellCommands(commands)
        }
    })
}

The output is printed perfectly in devtools console but in the DOM its weird:


问:
I am getting an error when trying to install requirements.txt in a conda. The error is CondaValueError: could not parse ' ' in: requirements.txt
Here is what I tried

conda create --name py39 --file requirements.txt

Here is the error I am getting.
CondaValueError: could not parse ' ' in: requirements.txt

Here is the requirements.txt file. for some reason I could not format it correctly here.
https://pastebin.com/RVmd26Us

I tried googling this and can't find anything. Can someone please help.

Thanks


问:
Sympy plotting backends library unable to save plot
I use sympy plotting backends library to create plots directly from sympy expressions. As backends i use matplotlib library. Actually, i don't need to show a plot. I create plot and then i return it as svg string in order to insert it in a web page later. Everything worked fine, but when i started to use new virtual environment (i installed all necessary packages) i got an error. I use the following code:

```<code># create two plot: one from init_expr (sympy tree expression) and second from
# fourier_expr (sympy tree expression):
p1 = plot(
        (init_expr, (var, left_bound, right_bound), label_1, line_color_1),
        (fourier_expr, (var, left_bound, right_bound), label_2, line_color_2),
         show = False)

# add axes decorations and legend:
p1.xlabel = var_name
p1.ylabel = "f(" + data.var_name + ")"
p1.legend = True

# buffer to write svg data:
f = io.StringIO()

# save plot in svg formate in buffer:
p1.save(f, format = "svg")

# return svg string:
return f.getvalue()
</code>```

when execution begins, at line:

```<code>p1.save(f, format="svg")
</code>```

i get an error:

```<code>AttributeError("'NoneType' object has no attribute 'runner'")
</code>```

Any ideas what am i doing wrong?

Body:
I use sympy plotting backends library to create plots directly from sympy expressions. As backends i use matplotlib library. Actually, i don't need to show a plot. I create plot and then i return it as svg string in order to insert it in a web page later. Everything worked fine, but when i started to use new virtual environment (i installed all necessary packages) i got an error. I use the following code:

# create two plot: one from init_expr (sympy tree expression) and second from
# fourier_expr (sympy tree expression):
p1 = plot(
        (init_expr, (var, left_bound, right_bound), label_1, line_color_1),
        (fourier_expr, (var, left_bound, right_bound), label_2, line_color_2),
         show = False)

# add axes decorations and legend:
p1.xlabel = var_name
p1.ylabel = "f(" + data.var_name + ")"
p1.legend = True

# buffer to write svg data:
f = io.StringIO()

# save plot in svg formate in buffer:
p1.save(f, format = "svg")

# return svg string:
return f.getvalue()

when execution begins, at line:

p1.save(f, format="svg")

i get an error:

AttributeError("'NoneType' object has no attribute 'runner'")

Any ideas what am i doing wrong?


问:
Color guesser using :nth-child selector does not work
I’m making a color guesser. It gives an RGB and multiple choices and you have to guess which one is correct. I made a
 with grid and put six
s there that will be the choices, but when I wrote the following code, the rgb did not work but it did not give any errors.

const colorMap = new Map;
var colorSelector = Math.round(Math.random() * 5);

RandomCreator = () => Math.round(Math.random() * 254);
ColorCreator = (x) => {
  colorMap.set("red" + x, RandomCreator());
  colorMap.set("green" + x, RandomCreator());
  colorMap.set("blue" + x, RandomCreator());
}

for (let count = 0; count < 6; count++) {
  ColorCreator(count);
  document.querySelector('#colors :nth-child(' + (count + 1) + ')').style.backgroundColor = "rgb(" + colorMap.get("+red+" + count) + "," + colorMap.get("+green+" + count) + "," + colorMap.get("blue" + count) + ")";
}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#colors div{
  width: 100px;
  height: 100px;
}</code>```

```

Body:
I’m making a color guesser. It gives an RGB and multiple choices and you have to guess which one is correct. I made a
 with grid and put six
s there that will be the choices, but when I wrote the following code, the rgb did not work but it did not give any errors.

const colorMap = new Map;
var colorSelector = Math.round(Math.random() * 5);

RandomCreator = () => Math.round(Math.random() * 254);
ColorCreator = (x) => {
  colorMap.set("red" + x, RandomCreator());
  colorMap.set("green" + x, RandomCreator());
  colorMap.set("blue" + x, RandomCreator());
}

for (let count = 0; count < 6; count++) {
  ColorCreator(count);
  document.querySelector('#colors :nth-child(' + (count + 1) + ')').style.backgroundColor = "rgb(" + colorMap.get("+red+" + count) + "," + colorMap.get("+green+" + count) + "," + colorMap.get("blue" + count) + ")";
}

#colors div{
  width: 100px;
  height: 100px;
}


问:
Is there a way to assign result from rendering template echo framework
How I can assign result from rendering template to send this value as json, for ajax call

my example:

```<code>func Load(c echo.Context) error {
    params := map[string]any{
        "btn_style":  "btn-light btn-sm",
    }

    if err := c.Render(http.StatusOK, "test.tmpl", params); err != nil {
        return err
    }

    payload := []byte(fmt.Sprintf(`{"payload":"%s"}`, c.Get("tmpl").(string)))

    fmt.Println(string(payload))

    return c.JSONBlob(http.StatusOK, (payload))
}
</code>```

Render function

```<code>func (t *TemplateRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
    var buf bytes.Buffer

    err := t.templates.ExecuteTemplate(&buf, name, data)
    if err != nil {
        return err
    }

    c.Set("tmpl", buf.String())

    return t.templates.ExecuteTemplate(w, name, data)
}
</code>```

Body:
How I can assign result from rendering template to send this value as json, for ajax call

my example:

func Load(c echo.Context) error {
    params := map[string]any{
        "btn_style":  "btn-light btn-sm",
    }

    if err := c.Render(http.StatusOK, "test.tmpl", params); err != nil {
        return err
    }

    payload := []byte(fmt.Sprintf(`{"payload":"%s"}`, c.Get("tmpl").(string)))

    fmt.Println(string(payload))

    return c.JSONBlob(http.StatusOK, (payload))
}

Render function

func (t *TemplateRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
    var buf bytes.Buffer

    err := t.templates.ExecuteTemplate(&buf, name, data)
    if err != nil {
        return err
    }

    c.Set("tmpl", buf.String())

    return t.templates.ExecuteTemplate(w, name, data)
}


问:
Sql Using Rounding and Averages together
I am new to SQL and trying to complete my first project. I want to round the average deaths for each month to a whole number Right now, if the average death for March 2021 is 1345. 66666, I want to round it to 1345. How do I do that.

Here is my code for now:

SELECT FORMAT_DATE('%Y %b' , date) AS Month,
ROUND(AVG(death/1,0)), AVG(hospitalizedCurrently) AS Hospitalized_Currently, AVG(onVentilatorCurrently) AS ON_Ventilator

FROM `cogent-splicer-372320.covid_datat.missouri_data`

GROUP BY Month

ORDER BY PARSE_DATE('%Y %b', MONTH) DESC

Limit 12;
```

Everytime I run it, it tells me

"No matching signature for aggregate function AVG for argument types: FLOAT64, INT64. Supported signatures: AVG(INT64); AVG(FLOAT64); AVG(NUMERIC); AVG(BIGNUMERIC); AVG(INTERVAL) at [2:7]".

I want the rounded number of the average death rate for the month to be saved AS Death.

Body:
I am new to SQL and trying to complete my first project. I want to round the average deaths for each month to a whole number Right now, if the average death for March 2021 is 1345. 66666, I want to round it to 1345. How do I do that.

Here is my code for now:

SELECT FORMAT_DATE('%Y %b' , date) AS Month,
ROUND(AVG(death/1,0)), AVG(hospitalizedCurrently) AS Hospitalized_Currently, AVG(onVentilatorCurrently) AS ON_Ventilator

FROM `cogent-splicer-372320.covid_datat.missouri_data`

GROUP BY Month

ORDER BY PARSE_DATE('%Y %b', MONTH) DESC

Limit 12;

Everytime I run it, it tells me

"No matching signature for aggregate function AVG for argument types: FLOAT64, INT64. Supported signatures: AVG(INT64); AVG(FLOAT64); AVG(NUMERIC); AVG(BIGNUMERIC); AVG(INTERVAL) at [2:7]".

I want the rounded number of the average death rate for the month to be saved AS Death.


问:
SQL Server is not printing the whole text
I have this SQL Server script and this is working fine. The only issue I have is the "Source" value is not printing the whole thing in my txt file for some reason.

I would be really appreciated if I can get any help or suggestion on how to fix it and show the whole source text in my txt ouput file instead of having ... after a few character.

```<code>        -- Printing Adding Records which are exists in Temp_Hold_Inv Table and Not exists in Hold_Inv Table

        SELECT 'Adding: '+XX.Source+' '+XX.Type AS Result
        FROM (
            Select  * from (
                SELECT Source, Type
                FROM Temp_Hold_Inv Thi
                WHERE NOT EXISTS (SELECT 1 FROM Hold_Inv Hi WHERE  Thi.Source = Hi.Source)
                AND Thi.Source <> 'NOT FOUND'
                AND LEN(TRIM(ISNULL(Thi.Source, ''))) > 0
                UNION ALL
                SELECT  Source, Type
                FROM Temp_Hold_Inv Thi
                WHERE NOT EXISTS (SELECT 1 FROM Hold_Inv Hi WHERE  Thi.Source = Hi.Source)
                AND Thi.Source = 'NOT FOUND'
                UNION ALL
                SELECT  Source, Type
                FROM Temp_Hold_Inv Thi
                WHERE NOT EXISTS (SELECT 1 FROM Hold_Inv Hi WHERE  Thi.Source = Hi.Source)
                AND LEN(TRIM(ISNULL(Thi.Source, ''))) = 0) T1
            except select * from (SELECT Source, [Type] FROM Daily_Proc) T2
        ) XX
        GO"

        Invoke-Sqlcmd -Query $query2 -ServerInstance $Global:Server -Database $Global:Database -username $SQLusername -password $SQLpass -ErrorAction Stop | Out-File -filePath $Global:QueryLogPath

</code>```

Body:
I have this SQL Server script and this is working fine. The only issue I have is the "Source" value is not printing the whole thing in my txt file for some reason.

I would be really appreciated if I can get any help or suggestion on how to fix it and show the whole source text in my txt ouput file instead of having ... after a few character.

        -- Printing Adding Records which are exists in Temp_Hold_Inv Table and Not exists in Hold_Inv Table

        SELECT 'Adding: '+XX.Source+' '+XX.Type AS Result
        FROM (
            Select  * from (
                SELECT Source, Type
                FROM Temp_Hold_Inv Thi
                WHERE NOT EXISTS (SELECT 1 FROM Hold_Inv Hi WHERE  Thi.Source = Hi.Source)
                AND Thi.Source <> 'NOT FOUND'
                AND LEN(TRIM(ISNULL(Thi.Source, ''))) > 0
                UNION ALL
                SELECT  Source, Type
                FROM Temp_Hold_Inv Thi
                WHERE NOT EXISTS (SELECT 1 FROM Hold_Inv Hi WHERE  Thi.Source = Hi.Source)
                AND Thi.Source = 'NOT FOUND'
                UNION ALL
                SELECT  Source, Type
                FROM Temp_Hold_Inv Thi
                WHERE NOT EXISTS (SELECT 1 FROM Hold_Inv Hi WHERE  Thi.Source = Hi.Source)
                AND LEN(TRIM(ISNULL(Thi.Source, ''))) = 0) T1
            except select * from (SELECT Source, [Type] FROM Daily_Proc) T2
        ) XX
        GO"

        Invoke-Sqlcmd -Query $query2 -ServerInstance $Global:Server -Database $Global:Database -username $SQLusername -password $SQLpass -ErrorAction Stop | Out-File -filePath $Global:QueryLogPath


问:
How do I make this owner authentication work?
I have a problem with this code. I would appreciate it very much if someone could help me with this. If you have any missing information feel free to ask. Note: Iam using mysql2.

```<code>router.get('/restaurants/:name/:location/dashboard', userContoller.isLoggedInAdmin, async (req, res) => {
  const restaurantName = req.params.name;
  const restaurantLocation = req.params.location;

  console.log(`restaurantName: ${restaurantName}`);
  console.log(`restaurantLocation: ${restaurantLocation}`);

  try {
    // Query the database to retrieve the owner's information and the information for the specific restaurant
    const [ownerRows] = await db.promise().query(
      'SELECT * FROM owner WHERE id = (SELECT owner_id FROM restaurant WHERE name = ? AND location = ?)',
      [restaurantName, restaurantLocation]
    );
    const [restaurantRows] = await db.promise().query(
      'SELECT * FROM restaurant WHERE name = ? AND location = ?',
      [restaurantName, restaurantLocation]
    );

    console.log(`ownerRows: ${JSON.stringify(ownerRows)}`);
    console.log(`restaurantRows: ${JSON.stringify(restaurantRows)}`);

    const owner = ownerRows[0];
    const restaurant = restaurantRows[0];

    console.log(`owner: ${JSON.stringify(owner)}`);
    console.log(`restaurant: ${JSON.stringify(restaurant)}`);

    // Check if the owner is logged in and has permission to access the dashboard
    if (req.owner && req.owner.id === restaurant.owner_id) {
      // Render the dashboard template and pass the owner's information and information for the specific restaurant to it
      res.render('role/admin/index', { owner: owner, restaurant: restaurant });
    } else {
      console.log('Owner not granted access to dashboard');
      // Redirect the owner to the login page
      res.render('errors/no permission');
    }
  } catch (error) {
    console.error(error);
    res.sendStatus(500);
  }
});
</code>```

So I have this route and I want it to work. I have a user, owner and a restaurant table. In the owner table is the owner id and the user id as a foreign key referencing to the primary key in the user table. In the restaurant table there is a column called owner_id which is a foreign key referencing to the primary key in the owner table. What this basically means is that the user is the owner/admin of one or more restaurants. The problem is that somehow the owner does not have access to the restaurant even though he is connected with it.

Here is the middleware:

```<code>exports.isLoggedInAdmin = async (req, res, next) => {
    console.log('isLoggedInAdmin middleware called');

    if (req.cookies.one) {
      try {
        const decode = await jwt.verify(req.cookies.one, process.env.JWT_SECRET);

        const [user] = await db.promise().query("SELECT * FROM user WHERE id = ?", [decode.id]);
        if (!user) {
          return res.status(401).json({ message: "Unauthorized" });
        }

        const [owner] = await db.promise().query("SELECT * FROM owner WHERE user_id = ?", [decode.id]);
        if (!owner) {
          return res.status(401).json({ message: "Unauthorized" });
        }

        if (user.id !== owner.user_id) {
          return res.status(401).json({ message: "Unauthorized" });
        }

        console.log('Owner found:', owner);
        req.owner = {
          id: owner.id,
          user_id: owner.user_id,
        };
        next();
      } catch (error) {
        console.error(error);
        return res.status(401).json({ message: "Unauthorized" });
      }
    } else {
      console.log('No owner found');
      next();
    }
  };
</code>```

Here is the login system (focus on the cookie for the owner):

```<code>exports.login = async (req, res) => {
  try {
    const { email, password } = req.body;
    if (!email || !password) {
      return res.status(400).render("login", {
        msg: "Please Enter Your Email and Password",
        msg_type: "error",
      });
    }

    db.query(
      "select * from user where email=?",
      [email],
      async (error, result) => {
        console.log(result);
        if (result.length <= 0) {
          return res.status(401).render("login", {
            msg: "Please Enter Your Email and Password",
            msg_type: "error",
          });
        } else {
          if (!(await bcrypt.compare(password, result[0].password))) {
            return res.status(401).render("login", {
              msg: "Please Enter Your Email and Password",
              msg_type: "error",
            });
          } else {
            const id = result[0].id;
            const token = jwt.sign({ id: id }, process.env.JWT_SECRET, {
              expiresIn: process.env.JWT_EXPIRES_IN,
            });
            console.log("The Token is " + token);
            const cookieOptions = {
              expires: new Date(
                Date.now() +
                process.env.JWT_COOKIE_EXPIRES * 24 * 60 * 60 * 1000
              ),
              httpOnly: true,
            };

            // Check if the user is in the owner table
            db.query("SELECT * FROM owner WHERE user_id=?", [id], (error, result) => {
              if (result.length > 0) {
                // Set the cookie for owner
                res.cookie("one", token, cookieOptions);
                res.status(200).redirect("/restaurants/:name/:location/dashboard");
              } else {
                // Check if the user is in the manager table
                db.query("SELECT * FROM manager WHERE user_id=?", [id], (error, result) => {
                  if (result.length > 0) {
                    // Set the cookie for manager
                    res.cookie("two", token, cookieOptions);
                    res.status(200).redirect("/manager/dashboard");
                  } else {
                    // Check if the user is in the cook table
                    db.query("SELECT * FROM cook WHERE user_id=?", [id], (error, result) => {
                      if (result.length > 0) {
                        // Set the cookie for cook
                        res.cookie("three", token, cookieOptions);
                        res.status(200).redirect("/cook/dashboard");
                      } else {
                        // Check if the user is in the waiter table
                        db.query("SELECT * FROM waiter WHERE user_id=?", [id], (error, result) => {
                          if (result.length > 0) {
                            // Set the cookie for waiter
                            res.cookie("four", token, cookieOptions);
                            res.status(200).redirect("/waiter/dashboard");
                          }
                        });
                      }
                    });
                  }
                });
              }
            });
          }
        }
      }
      );
    } catch (error) {
      console.log(error);
    }
  };
</code>```

Here is the log:

isLoggedInAdmin middleware called
Owner found: [ { id: 7, user_id: 42 } ]
restaurantName: BLOCKHOUSE
restaurantLocation: Pakistan
ownerRows: [{"id":7,"user_id":42}]
restaurantRows: [{"id":40,"name":"BLOCKHOUSE","location":"Pakistan","email":"2021erik.mettner@gmail.com","phonenumber":"012386763618","owner_id":7}]
owner: {"id":7,"user_id":42}
restaurant: {"id":40,"name":"BLOCKHOUSE","location":"Pakistan","email":"2021erik.mettner@gmail.com","phonenumber":"012386763618","owner_id":7}
Owner not granted access to dashboard

I know where the problem is. It is here:

```<code>// Check if the owner is logged in and has permission to access the dashboard
    if (req.owner && req.owner.id === restaurant.owner_id)
</code>```

My Problem is that I dont know how to fix it. I want that the owner can access his restaurants. Only he, not any other owner.

Body:
I have a problem with this code. I would appreciate it very much if someone could help me with this. If you have any missing information feel free to ask. Note: Iam using mysql2.

router.get('/restaurants/:name/:location/dashboard', userContoller.isLoggedInAdmin, async (req, res) => {
  const restaurantName = req.params.name;
  const restaurantLocation = req.params.location;

  console.log(`restaurantName: ${restaurantName}`);
  console.log(`restaurantLocation: ${restaurantLocation}`);

  try {
    // Query the database to retrieve the owner's information and the information for the specific restaurant
    const [ownerRows] = await db.promise().query(
      'SELECT * FROM owner WHERE id = (SELECT owner_id FROM restaurant WHERE name = ? AND location = ?)',
      [restaurantName, restaurantLocation]
    );
    const [restaurantRows] = await db.promise().query(
      'SELECT * FROM restaurant WHERE name = ? AND location = ?',
      [restaurantName, restaurantLocation]
    );

    console.log(`ownerRows: ${JSON.stringify(ownerRows)}`);
    console.log(`restaurantRows: ${JSON.stringify(restaurantRows)}`);

    const owner = ownerRows[0];
    const restaurant = restaurantRows[0];

    console.log(`owner: ${JSON.stringify(owner)}`);
    console.log(`restaurant: ${JSON.stringify(restaurant)}`);

    // Check if the owner is logged in and has permission to access the dashboard
    if (req.owner && req.owner.id === restaurant.owner_id) {
      // Render the dashboard template and pass the owner's information and information for the specific restaurant to it
      res.render('role/admin/index', { owner: owner, restaurant: restaurant });
    } else {
      console.log('Owner not granted access to dashboard');
      // Redirect the owner to the login page
      res.render('errors/no permission');
    }
  } catch (error) {
    console.error(error);
    res.sendStatus(500);
  }
});

So I have this route and I want it to work. I have a user, owner and a restaurant table. In the owner table is the owner id and the user id as a foreign key referencing to the primary key in the user table. In the restaurant table there is a column called owner_id which is a foreign key referencing to the primary key in the owner table. What this basically means is that the user is the owner/admin of one or more restaurants. The problem is that somehow the owner does not have access to the restaurant even though he is connected with it.

Here is the middleware:

exports.isLoggedInAdmin = async (req, res, next) => {
    console.log('isLoggedInAdmin middleware called');

    if (req.cookies.one) {
      try {
        const decode = await jwt.verify(req.cookies.one, process.env.JWT_SECRET);

        const [user] = await db.promise().query("SELECT * FROM user WHERE id = ?", [decode.id]);
        if (!user) {
          return res.status(401).json({ message: "Unauthorized" });
        }

        const [owner] = await db.promise().query("SELECT * FROM owner WHERE user_id = ?", [decode.id]);
        if (!owner) {
          return res.status(401).json({ message: "Unauthorized" });
        }

        if (user.id !== owner.user_id) {
          return res.status(401).json({ message: "Unauthorized" });
        }

        console.log('Owner found:', owner);
        req.owner = {
          id: owner.id,
          user_id: owner.user_id,
        };
        next();
      } catch (error) {
        console.error(error);
        return res.status(401).json({ message: "Unauthorized" });
      }
    } else {
      console.log('No owner found');
      next();
    }
  };

Here is the login system (focus on the cookie for the owner):

exports.login = async (req, res) => {
  try {
    const { email, password } = req.body;
    if (!email || !password) {
      return res.status(400).render("login", {
        msg: "Please Enter Your Email and Password",
        msg_type: "error",
      });
    }

    db.query(
      "select * from user where email=?",
      [email],
      async (error, result) => {
        console.log(result);
        if (result.length <= 0) {
          return res.status(401).render("login", {
            msg: "Please Enter Your Email and Password",
            msg_type: "error",
          });
        } else {
          if (!(await bcrypt.compare(password, result[0].password))) {
            return res.status(401).render("login", {
              msg: "Please Enter Your Email and Password",
              msg_type: "error",
            });
          } else {
            const id = result[0].id;
            const token = jwt.sign({ id: id }, process.env.JWT_SECRET, {
              expiresIn: process.env.JWT_EXPIRES_IN,
            });
            console.log("The Token is " + token);
            const cookieOptions = {
              expires: new Date(
                Date.now() +
                process.env.JWT_COOKIE_EXPIRES * 24 * 60 * 60 * 1000
              ),
              httpOnly: true,
            };

            // Check if the user is in the owner table
            db.query("SELECT * FROM owner WHERE user_id=?", [id], (error, result) => {
              if (result.length > 0) {
                // Set the cookie for owner
                res.cookie("one", token, cookieOptions);
                res.status(200).redirect("/restaurants/:name/:location/dashboard");
              } else {
                // Check if the user is in the manager table
                db.query("SELECT * FROM manager WHERE user_id=?", [id], (error, result) => {
                  if (result.length > 0) {
                    // Set the cookie for manager
                    res.cookie("two", token, cookieOptions);
                    res.status(200).redirect("/manager/dashboard");
                  } else {
                    // Check if the user is in the cook table
                    db.query("SELECT * FROM cook WHERE user_id=?", [id], (error, result) => {
                      if (result.length > 0) {
                        // Set the cookie for cook
                        res.cookie("three", token, cookieOptions);
                        res.status(200).redirect("/cook/dashboard");
                      } else {
                        // Check if the user is in the waiter table
                        db.query("SELECT * FROM waiter WHERE user_id=?", [id], (error, result) => {
                          if (result.length > 0) {
                            // Set the cookie for waiter
                            res.cookie("four", token, cookieOptions);
                            res.status(200).redirect("/waiter/dashboard");
                          }
                        });
                      }
                    });
                  }
                });
              }
            });
          }
        }
      }
      );
    } catch (error) {
      console.log(error);
    }
  };

Here is the log:

isLoggedInAdmin middleware called
Owner found: [ { id: 7, user_id: 42 } ]
restaurantName: BLOCKHOUSE
restaurantLocation: Pakistan
ownerRows: [{"id":7,"user_id":42}]
restaurantRows: [{"id":40,"name":"BLOCKHOUSE","location":"Pakistan","email":"2021erik.mettner@gmail.com","phonenumber":"012386763618","owner_id":7}]
owner: {"id":7,"user_id":42}
restaurant: {"id":40,"name":"BLOCKHOUSE","location":"Pakistan","email":"2021erik.mettner@gmail.com","phonenumber":"012386763618","owner_id":7}
Owner not granted access to dashboard

I know where the problem is. It is here:

// Check if the owner is logged in and has permission to access the dashboard
    if (req.owner && req.owner.id === restaurant.owner_id)

My Problem is that I dont know how to fix it. I want that the owner can access his restaurants. Only he, not any other owner.


问:
Leaflet and plot date data
I have some data to plot with leaflet package :

```<code>library(leaflet)
states <- geojsonio::geojson_read("https://rstudio.github.io/leaflet/json/us-states.geojson", what = "sp")
x=seq.Date(as.Date("2019-01-01"),as.Date("2019-08-01"),by="day")
states@data$vdate=x[1:nrow(states@data)]
</code>```

I want to plot date format (vdate column) data as a chloropleth map with leaflet with

```<code>bins <- as.Date(c("2019-01-01","2019-03-01","2019-05-01","2019-08-01"))
pal <- colorBin("YlOrRd", domain = states$vdate, bins = bins)
labels <- sprintf(
  "<strong>%s</strong><br/>%g people / mi<sup>2</sup>",
  states$name, states$vdate
) %>% lapply(htmltools::HTML)

  m %>% addPolygons(
  fillColor = ~pal(vdate),
  weight = 2,
  opacity = 1,
  color = "white",
  dashArray = "3",
  fillOpacity = 0.7,
highlightOptions = highlightOptions(
    weight = 5,
    color = "#666",
    dashArray = "",
    fillOpacity = 0.7,
    bringToFront = TRUE),
  label = labels,
  labelOptions = labelOptions(
    style = list("font-weight" = "normal", padding = "3px 8px"),
    textsize = "15px",
    direction = "auto"))
</code>```

The map plotted is not correct, the rendering of breaks and dates data in popup is not correct. How should I do it?

Title: Leaflet and plot date data

Body:
I have some data to plot with leaflet package :

library(leaflet)
states <- geojsonio::geojson_read("https://rstudio.github.io/leaflet/json/us-states.geojson", what = "sp")
x=seq.Date(as.Date("2019-01-01"),as.Date("2019-08-01"),by="day")
states@data$vdate=x[1:nrow(states@data)]

I want to plot date format (vdate column) data as a chloropleth map with leaflet with

bins <- as.Date(c("2019-01-01","2019-03-01","2019-05-01","2019-08-01"))
pal <- colorBin("YlOrRd", domain = states$vdate, bins = bins)
labels <- sprintf(
  "%s
%g people / mi2",
  states$name, states$vdate
) %>% lapply(htmltools::HTML)

  m %>% addPolygons(
  fillColor = ~pal(vdate),
  weight = 2,
  opacity = 1,
  color = "white",
  dashArray = "3",
  fillOpacity = 0.7,
highlightOptions = highlightOptions(
    weight = 5,
    color = "#666",
    dashArray = "",
    fillOpacity = 0.7,
    bringToFront = TRUE),
  label = labels,
  labelOptions = labelOptions(
    style = list("font-weight" = "normal", padding = "3px 8px"),
    textsize = "15px",
    direction = "auto"))

The map plotted is not correct, the rendering of breaks and dates data in popup is not correct. How should I do it?


问:
OpenAI "We could not parse the JSON body of your request."
I'm trying to write a Chrome extension that takes the webpage text and send it to ChatGPT. Here's my JS code:

```<code>document.addEventListener('DOMContentLoaded', function () {
var getBattleCardButton = document.getElementById('get-battle-card-button');
getBattleCardButton.addEventListener('click', function () {
    // Get all the content on the page as a string
    var pageContent = document.body.innerText;

    // Truncate the content to a maximum length of 4096 tokens
    var truncatedContent = pageContent.substring(0, 4096);

    // Construct the prompt by concatenating the specific words with the page content
    var prompt = "Summarize this content into 3 sections, What? Why? and How?. Each section with 3 concise points. " + truncatedContent;

    // Send the page content to Chat GPT as a prompt
    fetch('https://api.openai.com/v1/completions', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer MY_API_KEY'
        },
        body: JSON.stringify({
            'prompt': prompt,
            'model': 'text-davinci-003',
            'max_tokens': 512
        })
    })
        .then(response => response.json())
        .then(data => {
            // Open a new tab and insert the Chat GPT output into it
            var newTab = window.open();
            newTab.document.body.innerHTML = data.response;
        })
        .catch(error => {
            console.error('Error:', error);
        });
});
</code>```

});

I'm getting the error "We could not parse the JSON body of your request." and the output is 'undefined'. What am I doing wrong?

PS: the HTML and CSS on the extension works just fine.

Body:
I'm trying to write a Chrome extension that takes the webpage text and send it to ChatGPT. Here's my JS code:

document.addEventListener('DOMContentLoaded', function () {
var getBattleCardButton = document.getElementById('get-battle-card-button');
getBattleCardButton.addEventListener('click', function () {
    // Get all the content on the page as a string
    var pageContent = document.body.innerText;

    // Truncate the content to a maximum length of 4096 tokens
    var truncatedContent = pageContent.substring(0, 4096);

    // Construct the prompt by concatenating the specific words with the page content
    var prompt = "Summarize this content into 3 sections, What? Why? and How?. Each section with 3 concise points. " + truncatedContent;

    // Send the page content to Chat GPT as a prompt
    fetch('https://api.openai.com/v1/completions', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer MY_API_KEY'
        },
        body: JSON.stringify({
            'prompt': prompt,
            'model': 'text-davinci-003',
            'max_tokens': 512
        })
    })
        .then(response => response.json())
        .then(data => {
            // Open a new tab and insert the Chat GPT output into it
            var newTab = window.open();
            newTab.document.body.innerHTML = data.response;
        })
        .catch(error => {
            console.error('Error:', error);
        });
});

});

I'm getting the error "We could not parse the JSON body of your request." and the output is 'undefined'. What am I doing wrong?

PS: the HTML and CSS on the extension works just fine.


问:
Rapidoid custom config file is ignored
I'm very new to Rapidoid and I'm experiencing problem with initial configuration of the application. I'm using Rapidoid 5.5.5 with following Rapidoid modules defined in pom:

rapidoid-commons

rapidoid-http-server

rapidoid-web

Java 11 is used to run the application.

I've prepared a custom config-develop.yml file where I've changed value for port to use from default 8080 to 18888 and added some menu items in gui: section however when I start application none of my changes were used: generated log does not have any data about accepting/use of parameters from my file and configuration files are the files that are included into rapidoid-commons Maven artefact.

Also, the log shows that classpath used is limited to /target/classes folder (I'm using Maven as build tool). So, these are my questions:

What are the rules for merging configuration information when multiple config-*.yml files are present in search path?

How I can tell Rapidoid to ignore some configuration files?

Is it possible to specify explicit name for configuration file as part of initialisation process?

I'm happy to provide additional information if this will help to find an answer to the questions above.

With best regards,
Nick

Title: Rapidoid custom config file is ignored


问:
Firebase Google sign in stopped working on iOS 16
I'm working in a React web app project that's using Firebase Google sign in. The sign in apparently stopped working on iOS mobile devices after an update to iOS 16 or higher. The issue is the same in both Safari and Chrome browsers. It still works fine on other devices though. It seems that the page gets reloaded after I have selected my Google account from the list. I've tried inspecting the network tab but I'm not getting any errors.

We're using Firebase version 7.6.2 and I tried updating to the latest, which is 9.15.0 but the problem persists. We also have email + password login and that works just fine on all devices.

Here's the Firebase part of our current code if that helps:

```<code>import * as firebase from 'firebase/app'
import 'firebase/auth'
import * as firebaseui from 'firebaseui'
import { apiGET, api } from './api'

const initFirebase = apiGET('/firebase-config-url')
  .then((config) => firebase.initializeApp(config))
  .then(() => firebase.auth())

export const firebaseAuth = initFirebase

export const signInOptions = {
  signInSuccessUrl: '/',
  signInOptions: [
    {
      provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
      customParameters: {
        prompt: 'select_account',
      },
    },
    firebase.auth.EmailAuthProvider.PROVIDER_ID,
  ],
}

export const bindUI = (el, options = signInOptions) => {
  firebaseAuth.then((auth) => {
    const ui = new firebaseui.auth.AuthUI(auth)
    ui.start(el, { ...signInOptions, ...options })
  })
}
</code>```

Has anyone else experienced similar issues on newer iOS versions and is there a solution for fixing this?

Body:
I'm working in a React web app project that's using Firebase Google sign in. The sign in apparently stopped working on iOS mobile devices after an update to iOS 16 or higher. The issue is the same in both Safari and Chrome browsers. It still works fine on other devices though. It seems that the page gets reloaded after I have selected my Google account from the list. I've tried inspecting the network tab but I'm not getting any errors.

We're using Firebase version 7.6.2 and I tried updating to the latest, which is 9.15.0 but the problem persists. We also have email + password login and that works just fine on all devices.

Here's the Firebase part of our current code if that helps:

import * as firebase from 'firebase/app'
import 'firebase/auth'
import * as firebaseui from 'firebaseui'
import { apiGET, api } from './api'

const initFirebase = apiGET('/firebase-config-url')
  .then((config) => firebase.initializeApp(config))
  .then(() => firebase.auth())

export const firebaseAuth = initFirebase

export const signInOptions = {
  signInSuccessUrl: '/',
  signInOptions: [
    {
      provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
      customParameters: {
        prompt: 'select_account',
      },
    },
    firebase.auth.EmailAuthProvider.PROVIDER_ID,
  ],
}

export const bindUI = (el, options = signInOptions) => {
  firebaseAuth.then((auth) => {
    const ui = new firebaseui.auth.AuthUI(auth)
    ui.start(el, { ...signInOptions, ...options })
  })
}

Has anyone else experienced similar issues on newer iOS versions and is there a solution for fixing this?


问:
EhCache 3 : Too many items getting evicted from off heap store even though there is enough space off heap
I have the ehcache configuration that stores items offheap for 4G size. I do see a lot of items start to evict at around 100000 items in the cache even though cache occupied size is around 2.9G (out of 4G allocated). The constant stream of evictions at > 200 items per sec drops my hit rate to 65%.

Any idea what could be the cause of these evictions ?  Is the off-heap store also limited by size or percentage of the allocated direct memory on the JVM. These are not expired items but evicted items for some reason.

```<code>  CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
                .using(statisticsService)
                .withCache("cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(String.class, String.class, ResourcePoolsBuilder.newResourcePoolsBuilder()
                        .offheap(4, MemoryUnit.GB).build())
                        .withExpiry(ExpiryPolicyBuilder.timeToIdleExpiration(Duration.ofMinutes(10)))
                        .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofMinutes(10)))

                        .withService(WriteBehindConfigurationBuilder.newUnBatchedWriteBehindConfiguration().queueSize(10).concurrencyLevel(10).build())
                )
                .build()
</code>```

Body:
I have the ehcache configuration that stores items offheap for 4G size. I do see a lot of items start to evict at around 100000 items in the cache even though cache occupied size is around 2.9G (out of 4G allocated). The constant stream of evictions at > 200 items per sec drops my hit rate to 65%.

Any idea what could be the cause of these evictions ?  Is the off-heap store also limited by size or percentage of the allocated direct memory on the JVM. These are not expired items but evicted items for some reason.

  CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
                .using(statisticsService)
                .withCache("cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(String.class, String.class, ResourcePoolsBuilder.newResourcePoolsBuilder()
                        .offheap(4, MemoryUnit.GB).build())
                        .withExpiry(ExpiryPolicyBuilder.timeToIdleExpiration(Duration.ofMinutes(10)))
                        .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofMinutes(10)))

                        .withService(WriteBehindConfigurationBuilder.newUnBatchedWriteBehindConfiguration().queueSize(10).concurrencyLevel(10).build())
                )
                .build()