问:
why does my react native app does not open or run properly
i am new to react native
my app is running sometimes but sometimes  it gives weird errors like this one  when i try to start my app

```<code>Starting: Intent { cmp=com.savam/.MainActivity }
Error type 3
Error: Activity class {com.savam/com.savam.MainActivity} does not exist.
</code>```

some times after reloading app does not show consolelogs or network requests what is wrong with my app

i try to run app using npx react-native run-android

sometimes my app does not start when i do this command and some times it does sometime relading the app make the app freaze and not reload

note it is not a perfomace issue of my pc my pc is capable to 4-5 emulators simultainuly

Body:
i am new to react native
my app is running sometimes but sometimes  it gives weird errors like this one  when i try to start my app

Starting: Intent { cmp=com.savam/.MainActivity }
Error type 3
Error: Activity class {com.savam/com.savam.MainActivity} does not exist.

some times after reloading app does not show consolelogs or network requests what is wrong with my app

i try to run app using npx react-native run-android

sometimes my app does not start when i do this command and some times it does sometime relading the app make the app freaze and not reload

note it is not a perfomace issue of my pc my pc is capable to 4-5 emulators simultainuly


来源: stackexchange

问:
File Synchronization
I am trying to build a software which link 2 files in different folders and will sync it.

Like if I have folder

```<code>c:\hi\foo.txt
d:\yep\poo.txt
</code>```

Whenever I change the contents of foo.txt and save, it should automatically update the contents in poo.txt. Same should work the other way round too.

I know there are tools to achieve synchronization between files. But I can't figure out how they work.

Any insights on how this can be achieved or how other tools work or any links to study on this topic would be wonderful.

ContentLicense: CC BY-SA 4.0

Title: File Synchronization

Body:
I am trying to build a software which link 2 files in different folders and will sync it.

Like if I have folder

c:\hi\foo.txt
d:\yep\poo.txt

Whenever I change the contents of foo.txt and save, it should automatically update the contents in poo.txt. Same should work the other way round too.

I know there are tools to achieve synchronization between files. But I can't figure out how they work.

Any insights on how this can be achieved or how other tools work or any links to study on this topic would be wonderful.


问:
Is (,$arrr) the best way to pass a single array as an argument list to a powershell invoke-command cmdlet?
I want to pass an array to a PowerShell script block. This is the accepted method:

```<code>$arr = 1..4;
invoke-command -ScriptBlock { Param($li); $li | %{$_}} -ArgumentList (,$arr)
</code>```

From my investigations, these alternatives work too:

```<code>invoke-command -ScriptBlock { Param($li); $li | %{$_}} -ArgumentList $arr,$arr
invoke-command -ScriptBlock { Param($li); $li | %{$_}} -ArgumentList $arr,$null
</code>```

And the same issue applies when used list this

```<code>$arr = 1..4;
$sb = { Param($li); $li | %{$_}}
$sb.Invoke((,$arr))
</code>```

I understand the reason for the (,$arr) syntax is that the -ArgumentList parameter is expecting an array of parameters to pass to the script block, and if it gets a single array as its value, it will unpack the array and pass the contents to the script block as multiple parameters. I credit these answers how and why for helping me through this.

The accepted solution looks very ugly to me and I wonder it there is a cleaner way that might be closer to what the designers of PowerShell intended. Please comment.

Perhaps the answer is

```<code>& $sb $arr.
</code>```

Please comment.

Body:
I want to pass an array to a PowerShell script block. This is the accepted method:

$arr = 1..4;
invoke-command -ScriptBlock { Param($li); $li | %{$_}} -ArgumentList (,$arr)

From my investigations, these alternatives work too:

invoke-command -ScriptBlock { Param($li); $li | %{$_}} -ArgumentList $arr,$arr
invoke-command -ScriptBlock { Param($li); $li | %{$_}} -ArgumentList $arr,$null

And the same issue applies when used list this

$arr = 1..4;
$sb = { Param($li); $li | %{$_}}
$sb.Invoke((,$arr))

I understand the reason for the (,$arr) syntax is that the -ArgumentList parameter is expecting an array of parameters to pass to the script block, and if it gets a single array as its value, it will unpack the array and pass the contents to the script block as multiple parameters. I credit these answers how and why for helping me through this.

The accepted solution looks very ugly to me and I wonder it there is a cleaner way that might be closer to what the designers of PowerShell intended. Please comment.

Perhaps the answer is

& $sb $arr.

Please comment.


问:
Cannot create connection to websocket server, however server works in Javascript
I am using System.Net.WebSockets to create a websocket client to a websocket server I am running. The following code is used to create the websocket

Debug.Log("Setting up websocket");
client = new ClientWebSocket();
await client.ConnectAsync(new Uri("ws://192.168.68.93:8001/ws"), System.Threading.CancellationToken.None);
Debug.Log($"Socket status: {client.State}");
```
<p>The following error is produced:
<code>System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.</code></p>
<p>The confusing part to me, the following code in javascript works perfectly fine</p>
```const ws = new WebSocket("ws://192.168.68.93:8001/ws")
```

And if I log the messages I receive, they are what I expect/work perfectly fine.

What would cause a JS websocket to work, but not a C# one?

My current suspicion is the issue is actually related to the wsserver, I am running it on an esp32, using a library called ESPAsyncWebServer. But I need to know why C# would fail on it when JS works fine

Body:
I am using System.Net.WebSockets to create a websocket client to a websocket server I am running. The following code is used to create the websocket

Debug.Log("Setting up websocket");
client = new ClientWebSocket();
await client.ConnectAsync(new Uri("ws://192.168.68.93:8001/ws"), System.Threading.CancellationToken.None);
Debug.Log($"Socket status: {client.State}");

The following error is produced:
System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

The confusing part to me, the following code in javascript works perfectly fine

const ws = new WebSocket("ws://192.168.68.93:8001/ws")

And if I log the messages I receive, they are what I expect/work perfectly fine.

What would cause a JS websocket to work, but not a C# one?

My current suspicion is the issue is actually related to the wsserver, I am running it on an esp32, using a library called ESPAsyncWebServer. But I need to know why C# would fail on it when JS works fine


问:
Unable to install apk to android emulator via adb，Error: ADB exited with exit code 1 in Android studio Performing Streamed Install
Appears when I run in Android Studio
enter image description here

When I use cmd to install a random apk that I downloaded, it takes a long time to 'Performing Streamed Install'
enter image description here

My adb version is
enter image description here
I can be sure that my Android emulator has enough memory
enter image description here

When I tried to change an Android emulator, I got other errors
enter image description here
I tried restarting my computer many times and it didn't work
When I try to install it on my real phone, it still can't be installed, but the running window shows my activity on the phone
enter image description here

Can you help me? I will thank you very much!


问:
How to import the data from /public/config.ini file to App.js and other *.ts files?
I am trying to import the data from the /public/config.ini file into other files throughout my React app.

I am able to fetch the data using Axios however since it is an async function upon loading the files the data is initially undefined.

I am unable to just import the file since it's saying that "Module not found: You attempted to import ../../public/config.ini which falls outside of the project src/ directory. Relative imports outside of src/ are not supported."

I tried using Axios and storing the data as a global variable.

```<code>let CONFIG_DATA;
const getConfigData = async () => {
  await Axios.get("/config.ini").then((data) => {
    const response = ini.parse(data.data);
    CONFIG_DATA = response;
    console.log(response, "CONFIG DATA");
  });
};
getConfigData()
console.log(CONFIG_DATA)
</code>```

However I get the value as undefined when I am logging it to the console.

Body:
I am trying to import the data from the /public/config.ini file into other files throughout my React app.

I am able to fetch the data using Axios however since it is an async function upon loading the files the data is initially undefined.

I am unable to just import the file since it's saying that "Module not found: You attempted to import ../../public/config.ini which falls outside of the project src/ directory. Relative imports outside of src/ are not supported."

I tried using Axios and storing the data as a global variable.

let CONFIG_DATA;
const getConfigData = async () => {
  await Axios.get("/config.ini").then((data) => {
    const response = ini.parse(data.data);
    CONFIG_DATA = response;
    console.log(response, "CONFIG DATA");
  });
};
getConfigData()
console.log(CONFIG_DATA)

However I get the value as undefined when I am logging it to the console.


问:
About the versions of Google Colaboratory
What is the version of the following libraries in Google Colaboratory on 2022/11/2?

Python
Pytorch
Numpy

I don't see it listed and I'm confused.


问:
Is it correct to make a database query every single time a user requests an authenticated resource?
Let's say you're using postgres for session management. Then, a user goes to access some content that requires a membership.

Do you really need to hit the database and check whether the session is in the database (and the user has the required membership level) on every single request to an authenticated resource? For example, they can be navigating around and try viewing 15 pieces of content in a couple minutes. Are you really hitting the database 15 times?

Am I right, but this is all negligible, and you're meant to hit the database this frequently?

Is it not an issue because postgresQL is smart enough to cache the query?

Is it insane to use postgresQL or MySQL for storing sessions, and one should always use something like Reddis?

Something else?

Thanks.


问:
Dart Json deserialization
Using flutter docs am trying to learn json deserialization. But I am getting the following error "The argument type 'Map<String, String>' can't be assigned to the parameter type 'String'"

heres the code

```<code>import 'dart:convert';

User userFromJson(String str) => User.fromJson(json.decode(str));

void main() {

  var jsonString = {
  "name": "Martin Perumala",
  "email": "martinarxxxxx@gmail.com"
};

User user = User.fromJson(jsonDecode(jsonString) as Map<String,dynamic>);
</code>```

}

```<code>class User {
    User({
        required this.name,
        required this.email,
    });

    String name;
    String email;

    factory User.fromJson(Map<String, dynamic> json) => User(
        name: json["name"],
        email: json["email"],
    );

}
</code>```

Title: Dart Json deserialization

Body:
Using flutter docs am trying to learn json deserialization. But I am getting the following error "The argument type 'Map<String, String>' can't be assigned to the parameter type 'String'"

heres the code

import 'dart:convert';

User userFromJson(String str) => User.fromJson(json.decode(str));

void main() {

  var jsonString = {
  "name": "Martin Perumala",
  "email": "martinarxxxxx@gmail.com"
};

User user = User.fromJson(jsonDecode(jsonString) as Map<String,dynamic>);

}

class User {
    User({
        required this.name,
        required this.email,
    });

    String name;
    String email;

    factory User.fromJson(Map<String, dynamic> json) => User(
        name: json["name"],
        email: json["email"],
    );

}


问:
Absolutely positioned div not taking the full height while applying translate X or left on other elements
I have fallen into a weird CSS, I am working with TailwindCSS, and here is the sandbox link for someone to see what am i exactly facing sandbox link, currently the mobile Nav which is an absolutely positioned div height seems to get affected whenever I try to put translate X or left positioning values on any other element. An explanation of where I went wrong would help me a lot because I have been struggling a lot with these.</p>

Body: I have fallen into a weird CSS, I am working with TailwindCSS, and here is the sandbox link for someone to see what am i exactly facing <a href="https://codesandbox.io/p/github/Biki-das/Test-App/draft/interesting-bogdan?workspace=%257B%2522activeFileId%2522%253Anull%252C%2522openFiles%2522%253A%255B%255D%252C%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522gitSidebarPanel%2522%253A%2522COMMIT%2522%252C%2522spaces%2522%253A%257B%2522clc5taxeo00772a68c7l1nuzb%2522%253A%257B%2522key%2522%253A%2522clc5taxeo00772a68c7l1nuzb%2522%252C%2522name%2522%253A%2522Default%2522%252C%2522devtools%2522%253A%255B%257B%2522key%2522%253A%2522clc5teils000d2a68352v2uq1%2522%252C%2522type%2522%253A%2522PROJECT_SETUP%2522%252C%2522isMinimized%2522%253Afalse%257D%252C%257B%2522type%2522%253A%2522PREVIEW%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A5173%252C%2522key%2522%253A%2522clc5taztl00bi2a68q66n3m66%2522%252C%2522isMinimized%2522%253Afalse%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522key%2522%253A%2522clc5taymx009q2a6837ur5jbi%2522%252C%2522isMinimized%2522%253Afalse%257D%255D%257D%257D%252C%2522currentSpace%2522%253A%2522clc5taxeo00772a68c7l1nuzb%2522%252C%2522spacesOrder%2522%253A%255B%2522clc5taxeo00772a68c7l1nuzb%2522%255D%257D" rel="nofollow noreferrer">sandbox link, currently the mobile Nav which is an absolutely positioned div height seems to get affected whenever I try to put translate X or left positioning values on any other element. An explanation of where I went wrong would help me a lot because I have been struggling a lot with these.


问:
How to add ellipses on function based django paginator
I have a model on database . I am pushing data to the database and making query as well. As the data  is growing large its time to use pagination to get better user experience . now pagination is added with the page number along with next and previous button.

But the problem is while data become larger the page number increases as well which doesn't cool to me . I wanna add ellipses with the pagination navbar so that only few number will be shown on the navbar and rest will be hidden with ellipses

```<code>views.py
</code>```
```<code>def VideoList(request):
    vid_mi=Video.objects.all()
    filter=VidFilter(request.GET,queryset=vid_mi)
    paginator=Paginator(filter.qs,10)
    page_num=request.GET.get('page')
    page_obj=paginator.get_page(page_num)
    num= "a" * page_obj.paginator.num_pages
    context={
        "filter":filter,
        "page_obj":page_obj,
        "nums":num
    }
    return render(request,'adminlte/videoList.html',context)
</code>```
```<code>html
</code>```
```<code>                         {%if page_obj.has_next or page_obj.has_previous%}
                            <nav aria-label="..." style="float:right;">
                                <ul class="pagination">
                                    {%if page_obj.has_previous%}
                                  <li class="page-item ">
                                    <a class="page-link" href="?page={{page_obj.previous_page_number}}" >Previous</a>
                                  </li>
                                  {% else%}
                                  <li class="page-item disabled">
                                    <a class="page-link" href="#" tabindex="-1">Previous</a>
                                  </li>
                                  {% endif%}
                                  {% for i in nums%}
                                  <li  class="{% if forloop.counter == page_obj.number%}page-item active{%endif%}"><a class="page-link" href="?page={{forloop.counter}}">
                                    {{forloop.counter}}

                                     </a></li>
                                  {% endfor%}
                                  {%if page_obj.has_next %}
                                  <li class="page-item">
                                    <a class="page-link" href="?page={{page_obj.next_page_number}}">Next</a>
                                  </li>
                                  {%else%}

                                  <li class="page-item disabled">
                                    <a class="page-link" href="#">Next</a>
                                  </li>
                                  {% endif%}
                                </ul>
                              </nav>
                              {% endif%}
</code>```

Body:
I have a model on database . I am pushing data to the database and making query as well. As the data  is growing large its time to use pagination to get better user experience . now pagination is added with the page number along with next and previous button.

But the problem is while data become larger the page number increases as well which doesn't cool to me . I wanna add ellipses with the pagination navbar so that only few number will be shown on the navbar and rest will be hidden with ellipses

views.py

def VideoList(request):
    vid_mi=Video.objects.all()
    filter=VidFilter(request.GET,queryset=vid_mi)
    paginator=Paginator(filter.qs,10)
    page_num=request.GET.get('page')
    page_obj=paginator.get_page(page_num)
    num= "a" * page_obj.paginator.num_pages
    context={
        "filter":filter,
        "page_obj":page_obj,
        "nums":num
    }
    return render(request,'adminlte/videoList.html',context)

html

                         {%if page_obj.has_next or page_obj.has_previous%}

                                    {%if page_obj.has_previous%}

                                    Previous

                                  {% else%}

                                    Previous

                                  {% endif%}
                                  {% for i in nums%}

                                    {{forloop.counter}}

                                  {% endfor%}
                                  {%if page_obj.has_next %}

                                    Next

                                  {%else%}

                                    Next

                                  {% endif%}

                              {% endif%}


问:
Flutter SSO (Single Sign On) using **windows ADFS**
I want to add authentication with SSO (Single Sign On) using windows ADFS in flutter app.

But I didn't find any helpful doc or package for integration with flutter.

So any suggestion will be of great help.


问:
github terraform auth with google cloud self hosted runner
I am using the github actions to run the terrafrom code to create resource in google cloud.
The github action run on self-hosted runner which is VM in my google cloud account only.
While running the terraform plan, I am getting the error as:

```<code>Error: Error acquiring the state lock Error message: 2 errors occurred:     * writing "gs://<BUCKET_NAME>/poc/auto-image/default.tflock" failed: googleapi: Error 403: Access denied., forbidden    * storage: object doesn't exist
</code>```

the github action file is:

```<code>name: Create Compute Image
on:
  push:
    branches: ["main"]

jobs:
  terraform:
    name: "Terraform"
    runs-on: self-hosted

    defaults:
      run:
        shell: bash

    steps:
      # Checkout the repository to the GitHub Actions runner
      - name: Checkout
        uses: actions/checkout@v2

      - uses: hashicorp/setup-terraform@v1
        with:
          terraform_wrapper: false

      - name: Terraform init
        run: |
          cd terraform/create-image-automatically
          terraform init

      - name: Terraform plan
        run: |
          cd terraform/create-image-automatically
          terraform plan -input=false
        env:
          TF_LOG: DEBUG

      - name: Terraform apply
        run: |
          cd terraform/create-image-automatically
          terraform apply --auto-approve
</code>```

Please help me how to fix this issue.
Thanks.

Body:
I am using the github actions to run the terrafrom code to create resource in google cloud.
The github action run on self-hosted runner which is VM in my google cloud account only.
While running the terraform plan, I am getting the error as:

Error: Error acquiring the state lock Error message: 2 errors occurred:     * writing "gs://<BUCKET_NAME>/poc/auto-image/default.tflock" failed: googleapi: Error 403: Access denied., forbidden    * storage: object doesn't exist

the github action file is:

name: Create Compute Image
on:
  push:
    branches: ["main"]

jobs:
  terraform:
    name: "Terraform"
    runs-on: self-hosted

    defaults:
      run:
        shell: bash

    steps:
      # Checkout the repository to the GitHub Actions runner
      - name: Checkout
        uses: actions/checkout@v2

      - uses: hashicorp/setup-terraform@v1
        with:
          terraform_wrapper: false

      - name: Terraform init
        run: |
          cd terraform/create-image-automatically
          terraform init

      - name: Terraform plan
        run: |
          cd terraform/create-image-automatically
          terraform plan -input=false
        env:
          TF_LOG: DEBUG

      - name: Terraform apply
        run: |
          cd terraform/create-image-automatically
          terraform apply --auto-approve

Please help me how to fix this issue.
Thanks.


问:
Datatable sorting and searching not working for dynamic data with input field in vuejs
I have a table with 2 column,

First one has default data without any input field.

Second column has a numeric type input filed.

So i need sort and search applicable for second column, and also i have tried using "orderDataType: "dom-text", type: 'numeric'", but it doesn't work as need only sort first and last row,

$(document).ready(function () {
  $.fn.dataTable.ext.order['dom-text-numeric'] = function (settings, col) {
      return this.api()
          .column(col, { order: 'index' })
          .nodes()
          .map(function (td, i) {
              return $('input', td).val() * 1;
          });
  };

  let testTable = $("#example_table").DataTable({
    scrollX: true,
    order: [],
    columns: [
        null,
        {orderDataType: 'dom-text-numeric'},
    ]
  });

});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://code.jquery.com/jquery-3.6.3.js" integrity="sha256-nQLuAZGRRcILA+6dMBOvcRh5Pe310sBpanc6+QBmyVM=" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.css">

<table id="example_table">
   <thead>
      <tr>
        <th class="text-center priceListData">Item</th>
        <th class="text-center">Discount %</th>
      </tr>
   </thead>

   <tbody>
      <tr>
         <td>Test 1</td>
         <td>
           <input placeholder="Enter %">
         </td>
      </tr>
      <tr>
         <td>Test 2</td>
         <td>
           <input placeholder="Enter %">
         </td>
      </tr>
      <tr>
         <td>Test 3</td>
         <td>
           <input placeholder="Enter %">
         </td>
      </tr>
      <tr>
         <td>Test 4</td>
         <td>
           <input placeholder="Enter %">
         </td>
      </tr>
   </tbody>
</table></code>```

Body:
I have a table with 2 column,

First one has default data without any input field.

Second column has a numeric type input filed.

So i need sort and search applicable for second column, and also i have tried using "orderDataType: "dom-text", type: 'numeric'", but it doesn't work as need only sort first and last row,

$(document).ready(function () {
  $.fn.dataTable.ext.order['dom-text-numeric'] = function (settings, col) {
      return this.api()
          .column(col, { order: 'index' })
          .nodes()
          .map(function (td, i) {
              return $('input', td).val() * 1;
          });
  };

  let testTable = $("#example_table").DataTable({
    scrollX: true,
    order: [],
    columns: [
        null,
        {orderDataType: 'dom-text-numeric'},
    ]
  });

});

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.css">

        Item
        Discount %

         Test 1

           <input placeholder="Enter %">

         Test 2

           <input placeholder="Enter %">

         Test 3

           <input placeholder="Enter %">

         Test 4

           <input placeholder="Enter %">


问:
Height state value not updating immediately and state value always one step behind
I have a small project using justified-layout and react-virtualized,

I set the width and height of the preview images with the useCallback of previewImageContainerRef Ref. ( In the <PreviewImage> component [(<Results> / <PreviewImgRow> / <PreviewImage>) components > albums > results > preview_image.js], ref={previewImageContainerRef} is in preview_image.js as well, located on
 with className="c-flex-center picture-frame-wrapper")

```<code>    // useCallback > Ref : previewImageContainerRef
    const previewImageContainerRef = useCallback(node => {

        if (node !== null) {

            // Set > Preview Image Width
            props.setPreviewImageWidth(node.getBoundingClientRect().width);

            // Calculate > Preview Image Height
            let new_height = (node.getBoundingClientRect().width / defaultImageWidthRef.current ) * defaultImageHeightRef.current;

            // Set > Preview Image Height
            props.setPreviewImageHeight(new_height);

        }

    }, []);
</code>```

The useState for setPreviewImageWidth and setPreviewImageHeight, are defined in the parent component (<Results> [components > albums > results > Results.js]):

```<code>  // Preview Image > Width & Height
  const [previewImageWidth, setPreviewImageWidth] = useState(0);
  const [previewImageHeight, setPreviewImageHeight] = useState(0);
</code>```

justifiedRowDetailsRef is defined in <Results> component, it uses useCallback as well and it is one of the parent
 wrapping around the preview image (ref={justifiedRowDetailsRef} is in  component [(<Results> / <PreviewImgRow>) components > albums > results > PreviewImgRow.js]):

```<code>  // useCallback > Ref : justifiedRowDetailsRef
  const justifiedRowDetailsRef = useCallback((node) => {
    if (node !== null) {

      setJustifiedRowDetailsWidth(node.getBoundingClientRect().width);
      setJustifiedRowDetailsHeight(node.getBoundingClientRect().height);

    }
  }, []);
</code>```

The useState for justifiedRowDetailsWidth and justifiedRowDetailsHeight are defined in <Result> component:

```<code>  const [justifiedRowDetailsWidth, setJustifiedRowDetailsWidth] = useState(0);
  const [justifiedRowDetailsHeight, setJustifiedRowDetailsHeight] = useState(0);
</code>```

justifiedRowDetailsHeight is used in the height calculations for multiple parent
 wrapping the preview image

The problem I am facing is that the justifiedRowDetailsHeight value is only updated correctly when the image in the <JustifiedBox> component is clicked to expand the second time and after

Preview of the problem:

and here is my codesandbox link:
https://codesandbox.io/s/gifted-ride-qvquwv?file=/components/albums/results/Results.js

any asistance on this is greatly appreciated

Edit: I have commented out:

```<code>  // useCallback > Ref : justifiedRowDetailsRef
  const justifiedRowDetailsRef = useCallback((node) => {
    if (node !== null) {

      setJustifiedRowDetailsWidth(node.getBoundingClientRect().width);
      setJustifiedRowDetailsHeight(node.getBoundingClientRect().height);

    }
  }, []);
</code>```

and replaced it with:

```<code>const justifiedRowDetailsRef = useRef(null);
</code>```

and passed setJustifiedRowDetailsWidth and setJustifiedRowDetailsHeight to <PreviewImgRow> component, and added this useEffect() into it:

```<code>  useEffect(() => {
    if (justifiedRowDetailsRef.current) {
      console.log("justifiedRowDetailsRef.current > NOT EMPTY");

      setJustifiedRowDetailsWidth(justifiedRowDetailsRef.current.offsetWidth);
      setJustifiedRowDetailsHeight(justifiedRowDetailsRef.current.offsetHeight);
    }
  }, [previewImageHeight, isPreviewShown]);
</code>```

Now on first click of the image, the height is correct, but if I clicked on images with different dimension ( for example, the square image keep calm and eat food), the height of the preview image is still using the previous preview image height ( the rectangle height ) and one step behind

Steps to reproduce the bug:

Step1:

Step2:

Step3:

Step4:

Body:
I have a small project using justified-layout and react-virtualized,

I set the width and height of the preview images with the useCallback of previewImageContainerRef Ref. ( In the <PreviewImage> component [(<Results> / <PreviewImgRow> / <PreviewImage>) components > albums > results > preview_image.js], ref={previewImageContainerRef} is in preview_image.js as well, located on
 with className="c-flex-center picture-frame-wrapper")

    // useCallback > Ref : previewImageContainerRef
    const previewImageContainerRef = useCallback(node => {

        if (node !== null) {

            // Set > Preview Image Width
            props.setPreviewImageWidth(node.getBoundingClientRect().width);

            // Calculate > Preview Image Height
            let new_height = (node.getBoundingClientRect().width / defaultImageWidthRef.current ) * defaultImageHeightRef.current;

            // Set > Preview Image Height
            props.setPreviewImageHeight(new_height);

        }

    }, []);

The useState for setPreviewImageWidth and setPreviewImageHeight, are defined in the parent component (<Results> [components > albums > results > Results.js]):

  // Preview Image > Width & Height
  const [previewImageWidth, setPreviewImageWidth] = useState(0);
  const [previewImageHeight, setPreviewImageHeight] = useState(0);

justifiedRowDetailsRef is defined in <Results> component, it uses useCallback as well and it is one of the parent
 wrapping around the preview image (ref={justifiedRowDetailsRef} is in  component [(<Results> / <PreviewImgRow>) components > albums > results > PreviewImgRow.js]):

  // useCallback > Ref : justifiedRowDetailsRef
  const justifiedRowDetailsRef = useCallback((node) => {
    if (node !== null) {

      setJustifiedRowDetailsWidth(node.getBoundingClientRect().width);
      setJustifiedRowDetailsHeight(node.getBoundingClientRect().height);

    }
  }, []);

The useState for justifiedRowDetailsWidth and justifiedRowDetailsHeight are defined in <Result> component:

  const [justifiedRowDetailsWidth, setJustifiedRowDetailsWidth] = useState(0);
  const [justifiedRowDetailsHeight, setJustifiedRowDetailsHeight] = useState(0);

justifiedRowDetailsHeight is used in the height calculations for multiple parent
 wrapping the preview image

The problem I am facing is that the justifiedRowDetailsHeight value is only updated correctly when the image in the <JustifiedBox> component is clicked to expand the second time and after

Preview of the problem:

and here is my codesandbox link:
https://codesandbox.io/s/gifted-ride-qvquwv?file=/components/albums/results/Results.js

any asistance on this is greatly appreciated

Edit: I have commented out:

  // useCallback > Ref : justifiedRowDetailsRef
  const justifiedRowDetailsRef = useCallback((node) => {
    if (node !== null) {

      setJustifiedRowDetailsWidth(node.getBoundingClientRect().width);
      setJustifiedRowDetailsHeight(node.getBoundingClientRect().height);

    }
  }, []);

and replaced it with:

const justifiedRowDetailsRef = useRef(null);

and passed setJustifiedRowDetailsWidth and setJustifiedRowDetailsHeight to <PreviewImgRow> component, and added this useEffect() into it:

  useEffect(() => {
    if (justifiedRowDetailsRef.current) {
      console.log("justifiedRowDetailsRef.current > NOT EMPTY");

      setJustifiedRowDetailsWidth(justifiedRowDetailsRef.current.offsetWidth);
      setJustifiedRowDetailsHeight(justifiedRowDetailsRef.current.offsetHeight);
    }
  }, [previewImageHeight, isPreviewShown]);

Now on first click of the image, the height is correct, but if I clicked on images with different dimension ( for example, the square image keep calm and eat food), the height of the preview image is still using the previous preview image height ( the rectangle height ) and one step behind

Steps to reproduce the bug:

Step1:

Step2:

Step3:

Step4:


问:
Rocket chat server, how can I config messages to be aligned that right for my messages, left for other people messages?
I installed rocket.chat server in Ubuntu.

Like the famouse chat applications - my messages are algined to right, other messages are aligned to left - also I want it would be in rocket.chat.

Is it possible to rocket chat server config?


问:
Parameter 0 of constructor in google.OAuth2UserService required a bean of type 'DataSource' that could not be found
Pls help me this issue

this is my issue

```<code>Parameter 0 of constructor in google.OAuth2UserService required a bean of type 'DataSource' that could not be found.

Action:

Consider defining a bean of type 'DataSource' in your configuration.
</code>```

here my code

my component

```<code>
@Component
public class DataSource {

    private Map<String, User> userRepo = new HashMap<>();

    public User findUserByEmail(String email) {
        return userRepo.get(email);
    }

    public User saveUserByEmail(String email, User user) {
        userRepo.put(email, user);
        return user;
    }
</code>```

my service

@Service
public class OAuth2UserService extends DefaultOAuth2UserService {

    private final DataSource dataSource;

    public OAuth2UserService(final DataSource dataSource) {
        this.dataSource = dataSource;
    }

.
.
.

}
```

i hope anyone can show the issue =.= , i try so many time , many way ,  but can't fixed

Can anyone show me where the error is, if there is an example, it is  better , thank you all

Body:
Pls help me this issue

this is my issue

Parameter 0 of constructor in google.OAuth2UserService required a bean of type 'DataSource' that could not be found.

Action:

Consider defining a bean of type 'DataSource' in your configuration.

here my code

my component

@Component
public class DataSource {

    private Map<String, User> userRepo = new HashMap<>();

    public User findUserByEmail(String email) {
        return userRepo.get(email);
    }

    public User saveUserByEmail(String email, User user) {
        userRepo.put(email, user);
        return user;
    }

my service

@Service
public class OAuth2UserService extends DefaultOAuth2UserService {

    private final DataSource dataSource;

    public OAuth2UserService(final DataSource dataSource) {
        this.dataSource = dataSource;
    }

.
.
.

}

i hope anyone can show the issue =.= , i try so many time , many way ,  but can't fixed

Can anyone show me where the error is, if there is an example, it is  better , thank you all


问:
Can't check checkboxes after passing parameter - grails / javascript / facebox
I'm doing some ajax requests in Grails 1.3.7. The front end uses jQuery and the 'facebox' plugin.

After a successful request and response, I redirect back to the page with a 'confirm' param which is picked up by javascript.

The facebox plugin works fine on its own, but when I pass the 'confirm' parameter, the facebox popup works, but the checkboxes on the popup are unclickable (they aren't disabled, the arrow just doesn't show up when you click them). This was tested in Chrome and FF. I thought it might be a duplicate ID issue, but I made sure the checkbox and IDs were unique.

Any ideas? Or is there a better way to do this?

Grails action:

```<code>def deleteEmailRecipient = {
        def recipientId = params.id
        accountService.deleteEmailRecipient(recipientId)
        redirect(action:'settings', params:[confirm:1])
    }
</code>```

JS:

```<code>$(document).ready(function() {
    //get params to display save confirm if confirm detected
    var url = window.location.toString();
    url.match(/\?(.+)$/);
    var params = RegExp.$1;
    var splitParams = params.split("&");

    for (var i=0;i<splitParams.length;i++) {
        var tmp = splitParams[i].split("=");

        if (tmp[0] == 'confirm') {
            $.facebox({div: '#addWord'});
        }
    }
});
</code>```

GSP (that shows up in facebox):

```<code><div class="checkboxes" style="border: 1px solid #FFFFFF;">
    <g:each in="${wordGroups}" var="wg" status="i">
       <label class="category">
          <g:checkBox name="${wg.id}"/>
          <span style="font-weight:bold;margin-right:5px;white-space: nowrap;">
              <img class="dropdownFlag" src="${resource(dir:'images',file:icon)}" alt="" />${wg.name}
          </span>${(i+1)%4 == 0 ? '<br />' : ''}
       </label>
    </g:each>
</div>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I'm doing some ajax requests in Grails 1.3.7. The front end uses jQuery and the 'facebox' plugin.

After a successful request and response, I redirect back to the page with a 'confirm' param which is picked up by javascript.

The facebox plugin works fine on its own, but when I pass the 'confirm' parameter, the facebox popup works, but the checkboxes on the popup are unclickable (they aren't disabled, the arrow just doesn't show up when you click them). This was tested in Chrome and FF. I thought it might be a duplicate ID issue, but I made sure the checkbox and IDs were unique.

Any ideas? Or is there a better way to do this?

Grails action:

def deleteEmailRecipient = {
        def recipientId = params.id
        accountService.deleteEmailRecipient(recipientId)
        redirect(action:'settings', params:[confirm:1])
    }

JS:

$(document).ready(function() {
    //get params to display save confirm if confirm detected
    var url = window.location.toString();
    url.match(/\?(.+)$/);
    var params = RegExp.$1;
    var splitParams = params.split("&");

    for (var i=0;i<splitParams.length;i++) {
        var tmp = splitParams[i].split("=");

        if (tmp[0] == 'confirm') {
            $.facebox({div: '#addWord'});
        }
    }
});

GSP (that shows up in facebox):

    <g:each in="${wordGroups}" var="wg" status="i">

          <g:checkBox name="${wg.id}"/>

              ${wg.name}
          ${(i+1)%4 == 0 ? '
' : ''}

    </g:each>


问:
Flutter Provider is not showing data
iam learning flutter state management with providers my senior told, so I am creating a commentpageui almost similar like Instagram, inside that I need to show some data from api, actually I am getting the data and printed inside console, but I am trying show in app by wrapping with consumer widget but data is not showing, I will attach the entry point where changenotifier is provided,

the data is getting called during init() method, printing value insider provider class, also I created a button calling the method insider provider class also, but not showing ,please help me

Entrypoint of coomentpage

```<code>class CommentPage extends StatelessWidget {
  CommentPage({super.key});

  //List widgets = [Topsection()]; // list of widgtes in page

  @override
  Widget build(BuildContext context) {
  return
     Scaffold(
        body: ChangeNotifierProvider<CommentPageProvider>(create: (context) =>CommentPageProvider() ,
          child: Padding(
            padding: EdgeInsets.all(10),
            child: ListView(children: [
              Topsection(),

MiddleSection(likeCount: 11, commentCount: 90),

              BottomSection(
                likeCount: 12,
                hourCount: 1,
              )
            ]),
          ),
        ),
      )
    ;
  }
}
</code>```

provider class

```<code>class CommentPageProvider extends ChangeNotifier {
  //CommentDataState commentDataState = CommentDataState.isNotLoaded;
  static CommentPageProvider instance = CommentPageProvider();

  // bool ispreesed = false;

  List<LikeModelData> data = [];

  bool isLoading = false;

  getLikesData() async {
    isLoading = true;
    //commentDataState = CommentDataState.isLoading;
    notifyListeners();

    data = (await LikeServiceCall().getdata());

    print("PROVIDER $data");

    print(data[1].postId);
    //commentDataState = CommentDataState.isLoaded;

  //  isLoading = false;
    notifyListeners();
  }
}
</code>```

Ui section

```<code>class MiddleSection extends StatefulWidget {
  MiddleSection(
      {super.key, required this.likeCount, required this.commentCount});

  final int likeCount;
  final int commentCount;

  @override
  State<MiddleSection> createState() => _MiddleSectionState();
}

class _MiddleSectionState extends State<MiddleSection> {
  @override
  void initState() {
    super.initState();

    CommentPageProvider.instance.getLikesData();
    //  getdata();
  }

  getdata() async {
    likesdata = await CommentPageProvider.instance.getLikesData();

    print(likesdata[0].userId);

    // likesdata = await LikeServiceCall().getdata();
  }

  bool isLikebuttonPressed = false;
  List<LikeModelData> likesdata = [];

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    //final likedData = Provider.of<CommentPageProvider>(context);

    return ChangeNotifierProvider<CommentPageProvider>(
      create: (context) => CommentPageProvider(),
      child: Padding(
        padding: const EdgeInsets.all(15.0),
        child: SizedBox(
            child: Column(children: [
          Row(
            children: [
              IconButton(
                icon: Icon(Icons.add),
                onPressed: () {
                  Provider.of<CommentPageProvider>(context, listen: false)
                      .getLikesData();
                },
              ),

              Consumer<CommentPageProvider>(
                builder: (context, value, child) {
                  return SizedBox(
                    width: 60,
                    height: 80,
                    child: ListView.builder(
                      itemCount: value.data.length,
                      shrinkWrap: true,
                      scrollDirection: Axis.horizontal,
                      itemBuilder: (context, index) {
                        LikeModelData likeModelData = value.data[index];

                        print("mydata${likeModelData.favStatus}");
                        return Text(
                          likeModelData.postId.toString(),
                          style: TextStyle(color: Colors.black),
                        );
                      },
                    ),
                  );
                },

</code>```

Title: Flutter Provider is not showing data

Body:
iam learning flutter state management with providers my senior told, so I am creating a commentpageui almost similar like Instagram, inside that I need to show some data from api, actually I am getting the data and printed inside console, but I am trying show in app by wrapping with consumer widget but data is not showing, I will attach the entry point where changenotifier is provided,

the data is getting called during init() method, printing value insider provider class, also I created a button calling the method insider provider class also, but not showing ,please help me

Entrypoint of coomentpage

class CommentPage extends StatelessWidget {
  CommentPage({super.key});

  //List widgets = [Topsection()]; // list of widgtes in page

  @override
  Widget build(BuildContext context) {
  return
     Scaffold(
        body: ChangeNotifierProvider<CommentPageProvider>(create: (context) =>CommentPageProvider() ,
          child: Padding(
            padding: EdgeInsets.all(10),
            child: ListView(children: [
              Topsection(),

MiddleSection(likeCount: 11, commentCount: 90),

              BottomSection(
                likeCount: 12,
                hourCount: 1,
              )
            ]),
          ),
        ),
      )
    ;
  }
}

provider class

class CommentPageProvider extends ChangeNotifier {
  //CommentDataState commentDataState = CommentDataState.isNotLoaded;
  static CommentPageProvider instance = CommentPageProvider();

  // bool ispreesed = false;

  List<LikeModelData> data = [];

  bool isLoading = false;

  getLikesData() async {
    isLoading = true;
    //commentDataState = CommentDataState.isLoading;
    notifyListeners();

    data = (await LikeServiceCall().getdata());

    print("PROVIDER $data");

    print(data[1].postId);
    //commentDataState = CommentDataState.isLoaded;

  //  isLoading = false;
    notifyListeners();
  }
}

Ui section

class MiddleSection extends StatefulWidget {
  MiddleSection(
      {super.key, required this.likeCount, required this.commentCount});

  final int likeCount;
  final int commentCount;

  @override
  State<MiddleSection> createState() => _MiddleSectionState();
}

class _MiddleSectionState extends State<MiddleSection> {
  @override
  void initState() {
    super.initState();

    CommentPageProvider.instance.getLikesData();
    //  getdata();
  }

  getdata() async {
    likesdata = await CommentPageProvider.instance.getLikesData();

    print(likesdata[0].userId);

    // likesdata = await LikeServiceCall().getdata();
  }

  bool isLikebuttonPressed = false;
  List<LikeModelData> likesdata = [];

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    //final likedData = Provider.of<CommentPageProvider>(context);

    return ChangeNotifierProvider<CommentPageProvider>(
      create: (context) => CommentPageProvider(),
      child: Padding(
        padding: const EdgeInsets.all(15.0),
        child: SizedBox(
            child: Column(children: [
          Row(
            children: [
              IconButton(
                icon: Icon(Icons.add),
                onPressed: () {
                  Provider.of<CommentPageProvider>(context, listen: false)
                      .getLikesData();
                },
              ),

              Consumer<CommentPageProvider>(
                builder: (context, value, child) {
                  return SizedBox(
                    width: 60,
                    height: 80,
                    child: ListView.builder(
                      itemCount: value.data.length,
                      shrinkWrap: true,
                      scrollDirection: Axis.horizontal,
                      itemBuilder: (context, index) {
                        LikeModelData likeModelData = value.data[index];

                        print("mydata${likeModelData.favStatus}");
                        return Text(
                          likeModelData.postId.toString(),
                          style: TextStyle(color: Colors.black),
                        );
                      },
                    ),
                  );
                },


问:
How to add Google Calendar API's credentials.json to a .env file in django
I am currently developing a react-django web application that will serve as an appointment scheduler.  I opted to use Google's Calendar API. I followed this guide for setting it up: https://developers.google.com/calendar/api/quickstart/python.

The credentials.json file is passed as a parameter to a method as shown below:

```<code>flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES)
</code>```

How can I store that file in a .env file so that nobody can access it?

I followed this tutorial https://djangocentral.com/environment-variables-in-django/ to setup my .env and shown below is what changed in the settings.py file:

```<code>env = environ.Env()
environ.Env.read_env()

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": BASE_DIR / "db.sqlite3",
        "GOOGLE_CRED": env('CRED'),
        "GOOGLE_SCOPE" : env('SCOPE'),
    }
}
</code>```

I used this code to access them from my views.py file:

```<code>os.environ['GOOGLE_CRED']
</code>```

where GOOGLE_CRED contains the content of the credentials.json file as indicated in this question: How to expose Gmail API credentials.json to env

Shown below is the method that calls the API and creates an event based on what the user entered on the frontend side:

```<code># Function that creates an event in the calendar
def createEvent(summary, start_time):

    creds = None

    if os.path.exists("token.json"):
        creds = Credentials.from_authorized_user_file('token.json', os.environ['GOOGLE_SCOPE'])

    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())

        else:
            flow = InstalledAppFlow.from_client_secrets_file(os.environ['GOOGLE_CRED'],
                   os.environ['GOOGLE_SCOPE'])
            creds = flow.run_local_server(port = 8080)

            with open('token.json', 'w') as token:
                json.dumps(creds, token)

    try:
        service = build('calendar', 'v3', credentials = creds)

        end_time = start_time + timedelta(min = 30)

        event = {
            'summary' : summary,
            'location' : "random location",
            'description' : summary,
            'start': {
                'dateTime': start_time.strftime("%Y-%m-%dT%H:%M:%S"),
                'timeZone': 'Canada/Eastern',
            },
            'end': {
                'dateTime': end_time.strftime("%Y-%m-%dT%H:%M:%S"),
                'timeZone': 'Canada/Eastern',
            }
        }

        service.events().insert(calendarId='primary', body=event).execute()

    except HttpError as error:
        print('An error occurred: %s' % error)
</code>```

When i run the method, this is the error that I get:

```<code>raise KeyError(key) from None
KeyError: 'GOOGLE_CRED'
</code>```

I am not sure how the GOOGLE_CRED environment variable is null. When I printed the os.environ, I noticed that the CRED entry in the .env file was missing in the output, but not the SCOPE one. Was I not supposed to copy the whole credentials.json file in that entry? Also, I don't know if this is relevant but each entry of my .env file does not contain quotation marks.

I appreciate the help!

Body:
I am currently developing a react-django web application that will serve as an appointment scheduler.  I opted to use Google's Calendar API. I followed this guide for setting it up: https://developers.google.com/calendar/api/quickstart/python.

The credentials.json file is passed as a parameter to a method as shown below:

flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES)

How can I store that file in a .env file so that nobody can access it?

I followed this tutorial https://djangocentral.com/environment-variables-in-django/ to setup my .env and shown below is what changed in the settings.py file:

env = environ.Env()
environ.Env.read_env()

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": BASE_DIR / "db.sqlite3",
        "GOOGLE_CRED": env('CRED'),
        "GOOGLE_SCOPE" : env('SCOPE'),
    }
}

I used this code to access them from my views.py file:

os.environ['GOOGLE_CRED']

where GOOGLE_CRED contains the content of the credentials.json file as indicated in this question: How to expose Gmail API credentials.json to env

Shown below is the method that calls the API and creates an event based on what the user entered on the frontend side:

# Function that creates an event in the calendar
def createEvent(summary, start_time):

    creds = None

    if os.path.exists("token.json"):
        creds = Credentials.from_authorized_user_file('token.json', os.environ['GOOGLE_SCOPE'])

    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())

        else:
            flow = InstalledAppFlow.from_client_secrets_file(os.environ['GOOGLE_CRED'],
                   os.environ['GOOGLE_SCOPE'])
            creds = flow.run_local_server(port = 8080)

            with open('token.json', 'w') as token:
                json.dumps(creds, token)

    try:
        service = build('calendar', 'v3', credentials = creds)

        end_time = start_time + timedelta(min = 30)

        event = {
            'summary' : summary,
            'location' : "random location",
            'description' : summary,
            'start': {
                'dateTime': start_time.strftime("%Y-%m-%dT%H:%M:%S"),
                'timeZone': 'Canada/Eastern',
            },
            'end': {
                'dateTime': end_time.strftime("%Y-%m-%dT%H:%M:%S"),
                'timeZone': 'Canada/Eastern',
            }
        }

        service.events().insert(calendarId='primary', body=event).execute()

    except HttpError as error:
        print('An error occurred: %s' % error)

When i run the method, this is the error that I get:

raise KeyError(key) from None
KeyError: 'GOOGLE_CRED'

I am not sure how the GOOGLE_CRED environment variable is null. When I printed the os.environ, I noticed that the CRED entry in the .env file was missing in the output, but not the SCOPE one. Was I not supposed to copy the whole credentials.json file in that entry? Also, I don't know if this is relevant but each entry of my .env file does not contain quotation marks.

I appreciate the help!


问:
How to change border Color of thumb of switch react core component
on pressing the thumb of switch of react native its giving me default color in place of thumb color border should be of nearby to orange how to eliminate it? and substitute the color

```<code>import React, { FunctionComponent } from 'react';
import { Switch, View } from 'react-native';
import { useTheme } from 'react-native-paper';

interface IMSwitchProps {
  toggleValue: boolean;
  onToggleChange: (value?: any) => void;
  disableSwitch?: boolean;
  testId?: string;
}

const IMSwitch: FunctionComponent<IMSwitchProps> = (props: IMSwitchProps) => {
  const theme = useTheme();

  return (
    <View>
      <Switch
        value={props.toggleValue}
        onValueChange={(value) => {
          props.onToggleChange(value);
        }}
        trackColor={{
          false: props.disableSwitch ? theme.Palette.grey[100] : theme.Palette.grey[500],
          true: props.disableSwitch ? theme.Palette.grey[100] : theme.Palette.IMPrimary.border,
        }}
        thumbColor={
          props.disableSwitch
            ? theme.Palette.background
            : props.toggleValue
            ? theme.Palette.IMPrimary.main
            : theme.Palette.background
        }
        disabled={props.disableSwitch}
        testID={props.testId}
      />
    </View>
  );
};
export default IMSwitch;

</code>```

tried by giving style to switch

Body:
on pressing the thumb of switch of react native its giving me default color in place of thumb color border should be of nearby to orange how to eliminate it? and substitute the color

import React, { FunctionComponent } from 'react';
import { Switch, View } from 'react-native';
import { useTheme } from 'react-native-paper';

interface IMSwitchProps {
  toggleValue: boolean;
  onToggleChange: (value?: any) => void;
  disableSwitch?: boolean;
  testId?: string;
}

const IMSwitch: FunctionComponent<IMSwitchProps> = (props: IMSwitchProps) => {
  const theme = useTheme();

  return (
    <View>
      <Switch
        value={props.toggleValue}
        onValueChange={(value) => {
          props.onToggleChange(value);
        }}
        trackColor={{
          false: props.disableSwitch ? theme.Palette.grey[100] : theme.Palette.grey[500],
          true: props.disableSwitch ? theme.Palette.grey[100] : theme.Palette.IMPrimary.border,
        }}
        thumbColor={
          props.disableSwitch
            ? theme.Palette.background
            : props.toggleValue
            ? theme.Palette.IMPrimary.main
            : theme.Palette.background
        }
        disabled={props.disableSwitch}
        testID={props.testId}
      />
    </View>
  );
};
export default IMSwitch;

tried by giving style to switch


问:
Transform scale property not working on image carousel
I have an image carousel built with Mantine carousel that's based on Embla carousel. I'm trying to add a scale animation feature to transform the image that's currently in view by adding classes to it and then removing the classes before scrolling to the next image, essentially emulating this website's image carousel.

I've tried using Embla's selectedScrollSnap method with scrollSnapList to get the currently displayed image which returns the error: Property 'classList' does not exist on type 'number'.

ImageSlide.tsx

```<code>import { useCallback, useEffect, useRef, useState } from "react";
import Autoplay from "embla-carousel-autoplay";
import { Carousel, Embla } from "@mantine/carousel";
import Image from "next/image";
import imagesAndText from "../../public/media";
import { FaLongArrowAltRight } from "react-icons/fa";
import { BsArrowDownCircle } from "react-icons/bs";
import Link from "next/link";

export default function ImgSlides({ startRef }: { startRef: null | any }) {
  const [embla, setEmbla] = useState<Embla | null>(null);
  const autoplay = useRef(Autoplay({ delay: 5000 }));

  // transfrom scale
  const [activeIndex,setActiveIndex] = useState(0)

  useEffect(()=> {
    if(embla) {
      setActiveIndex(embla.selectedScrollSnap())
    }
  },[embla])

  useEffect(()=> {
    const currentImage = embla?.scrollSnapList()[activeIndex]
    currentImage?.classList.add("transform", "scale-150")
    currentImage.addEventListener("transitioned", ()={currentImage.classList.remove("transform", "scale-150")})
  })

  const handleButtonClick = useCallback(
    (startRef: null | any) => {
      if (startRef.current) {
        window.scrollTo({
          top: startRef.current.offsetTop,
          behavior: "smooth",
        });
      }

      if (!embla) return;
      embla.reInit();
    },
    [embla]
  );

  const slides = imagesAndText.map((item, i) => (
    <Carousel.Slide key={i}>
      <div className="h-screen bg-inherit flex w-full relative">
        <Image
          src={item.image.src}
          alt="tali consultancy"
          fill
          className="object-cover"
          data-pin-no-hover="true"
        />
        <div className="absolute top-1/3 md:mt-6 h-auto flex flex-col">
          <div className="text-sm opacity-90 w-fit mb-2 pl-11 lg:pl-12 text-gray-100 font-bold px-2 py-2 ">
            {item.headline}
          </div>
          <Link
            href="/"
            className="pl-11 lg:pl-12 text-gray-50 mb-4 lg:mb-6 text-4xl lg:text-5xl xl:text-6xl font-semibold md:left-16 z-10"
          >
            {item.article}
          </Link>
          <Link
            href="/"
            className="text-gray-50 lg:pl-12 pl-11 uppercase flex items-center font-semibold text-sm"
          >
            Learn more
            <FaLongArrowAltRight className="text-2xl font-semibold pt-1 pl-2" />
          </Link>
        </div>
        <div className="flex justify-center absolute bottom-10 pb-8 lg:pb-0 lg:bottom-7 w-full">
        <button
          className="text-gray-50 font-bold left-1/2 animate-bounce text-lg lg:text-base"
          onClick={() => handleButtonClick(startRef)}
        >
          <BsArrowDownCircle />
        </button>
        </div>
      </div>
    </Carousel.Slide>
  ));

  return (
    <Carousel
      mx="auto"
      // withIndicators
      plugins={[autoplay.current]}
      onMouseEnter={autoplay.current.stop}
      onMouseLeave={autoplay.current.reset}
      loop={true}
      getEmblaApi={setEmbla}
    >
      {slides}
    </Carousel>
  );
}

</code>```

Media.tsx

```<code>import img1 from "./img19-large.png";
import img2 from "./img1-large.png";
import img3 from "./img18.png";
import img4 from "./img13.png";

const imagesAndText = [
  {
    image: img1,
    headline: "Sustainability and Climate Change",
    article: "Profitability through Creating Shared Value",
  },
  {
    image: img2,
    headline: "Innovation and Strategy",
    article: "Assessing the potential of disruptive technologies",
  },
  {
    image: img3,
    headline: "Talent Acquisition and Retention",
    article: "How the best businesses win the War for Talent",
  },
  {
    image: img4,
    headline: "Cyber Security",
    article: "Are Incident Response Plans worth it?",
  },
];

export default imagesAndText;

</code>```

Thanks in advance!

Body:
I have an image carousel built with Mantine carousel that's based on Embla carousel. I'm trying to add a scale animation feature to transform the image that's currently in view by adding classes to it and then removing the classes before scrolling to the next image, essentially emulating this website's image carousel.

I've tried using Embla's selectedScrollSnap method with scrollSnapList to get the currently displayed image which returns the error: Property 'classList' does not exist on type 'number'.

ImageSlide.tsx

import { useCallback, useEffect, useRef, useState } from "react";
import Autoplay from "embla-carousel-autoplay";
import { Carousel, Embla } from "@mantine/carousel";
import Image from "next/image";
import imagesAndText from "../../public/media";
import { FaLongArrowAltRight } from "react-icons/fa";
import { BsArrowDownCircle } from "react-icons/bs";
import Link from "next/link";

export default function ImgSlides({ startRef }: { startRef: null | any }) {
  const [embla, setEmbla] = useState<Embla | null>(null);
  const autoplay = useRef(Autoplay({ delay: 5000 }));

  // transfrom scale
  const [activeIndex,setActiveIndex] = useState(0)

  useEffect(()=> {
    if(embla) {
      setActiveIndex(embla.selectedScrollSnap())
    }
  },[embla])

  useEffect(()=> {
    const currentImage = embla?.scrollSnapList()[activeIndex]
    currentImage?.classList.add("transform", "scale-150")
    currentImage.addEventListener("transitioned", ()={currentImage.classList.remove("transform", "scale-150")})
  })

  const handleButtonClick = useCallback(
    (startRef: null | any) => {
      if (startRef.current) {
        window.scrollTo({
          top: startRef.current.offsetTop,
          behavior: "smooth",
        });
      }

      if (!embla) return;
      embla.reInit();
    },
    [embla]
  );

  const slides = imagesAndText.map((item, i) => (
    <Carousel.Slide key={i}>

        <Image
          src={item.image.src}
          alt="tali consultancy"
          fill
          className="object-cover"
          data-pin-no-hover="true"
        />

            {item.headline}

          <Link
            href="/"
            className="pl-11 lg:pl-12 text-gray-50 mb-4 lg:mb-6 text-4xl lg:text-5xl xl:text-6xl font-semibold md:left-16 z-10"
          >
            {item.article}
          </Link>
          <Link
            href="/"
            className="text-gray-50 lg:pl-12 pl-11 uppercase flex items-center font-semibold text-sm"
          >
            Learn more
            <FaLongArrowAltRight className="text-2xl font-semibold pt-1 pl-2" />
          </Link>

        <button
          className="text-gray-50 font-bold left-1/2 animate-bounce text-lg lg:text-base"
          onClick={() => handleButtonClick(startRef)}
        >
          <BsArrowDownCircle />
        </button>

    </Carousel.Slide>
  ));

  return (
    <Carousel
      mx="auto"
      // withIndicators
      plugins={[autoplay.current]}
      onMouseEnter={autoplay.current.stop}
      onMouseLeave={autoplay.current.reset}
      loop={true}
      getEmblaApi={setEmbla}
    >
      {slides}
    </Carousel>
  );
}

Media.tsx

import img1 from "./img19-large.png";
import img2 from "./img1-large.png";
import img3 from "./img18.png";
import img4 from "./img13.png";

const imagesAndText = [
  {
    image: img1,
    headline: "Sustainability and Climate Change",
    article: "Profitability through Creating Shared Value",
  },
  {
    image: img2,
    headline: "Innovation and Strategy",
    article: "Assessing the potential of disruptive technologies",
  },
  {
    image: img3,
    headline: "Talent Acquisition and Retention",
    article: "How the best businesses win the War for Talent",
  },
  {
    image: img4,
    headline: "Cyber Security",
    article: "Are Incident Response Plans worth it?",
  },
];

export default imagesAndText;

Thanks in advance!


问:
While using .predict method for prediction in ARIMA model, pprediction output shows predicted_mean
What does it mean? Is this prediction is good as without the mean of prediction?

Prediction shows as prediction_mean

What should I have to change if I do not want prediction_mean as the prediction output.


问:
How to override allure result folder automatically before every test run
After generating allure report using allure serve command, I saw that I got my old test run results also in my report. This is because my allure result folder containing old log files in it. How to override this folder before every run. Is there any code that I can add in before test method ?

I am trying to run test and generate allure report.


问:
how to insert mathematical equation in pdf flutter?
How to generate a pdf that contain complex mathematical equations in flutter

complex mathematical equations

I have used the pdf package to generate pdf, i can easily insert text , image but when it comes to mathType equation i can't. I dont want to use image for inserting equation. I have been stuck with this for days.

please help and thank you all in advance.


问:
Want to add both dependencies but it causes duplicate dependency error
I have two dependencies 'org.tensorflow:tensorflow-lite:1.15.0' and 'org.tensorflow:tensorflow-lite-task-vision:0.3.0' so when I add these in build.gradle file. and sync the project. It is showing  -->

```<code>Duplicate class org.tensorflow.lite.DataType found in modules jetified-tensorflow-lite-1.15.0-runtime (org.tensorflow:tensorflow-lite:1.15.0)
and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.DataType$1 found in modules jetified-tensorflow-lite-1.15.0-runtime (org.tensorflow:tensorflow-lite:1.15.0)
and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.Delegate found in modules jetified-tensorflow-lite-1.15.0-runtime (org.tensorflow:tensorflow-lite:1.15.0)
and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.Tensor found in modules jetified-tensorflow-lite-1.15.0-runtime (org.tensorflow:tensorflow-lite:1.15.0) and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
</code>```

How to resolve this dependency error. I have tried by adding one one dependencies and now I am getting that error causes by adding this dependency 'org.tensorflow:tensorflow-lite-task-vision:0.3.0'

By removing one of these dependencies I'm getting error in my java files.

My build.gradle file

```<code>apply plugin: 'com.android.application'
//apply plugin: 'de.undercouch.download'

android {
    compileSdkVersion 31
    defaultConfig {
        applicationId "org.tensorflow.lite.examples.detection"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    aaptOptions {
        noCompress "tflite"
    }

    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
    lintOptions {
        abortOnError false
    }
    android {
        ndkVersion '21.1.6528147'
    }
    flavorDimensions "tfliteInference"
    productFlavors {
       // The TFLite inference is built using the TFLite Java interpreter.
       interpreter {
           dimension "tfliteInference"
       }
       // Default: The TFLite inference is built using the TFLite Task library (high-level API).
       taskApi {
           getIsDefault().set(true)
           dimension "tfliteInference"
       }
    }

}

// import DownloadModels task
project.ext.ASSET_DIR = projectDir.toString() + '/src/main/assets'
project.ext.TMP_DIR   = project.buildDir.toString() + '/downloads'

// Download default models; if you wish to use your own models then
// place them in the "assets" directory and comment out this line.
apply from:'download.gradle'
apply plugin: 'com.google.gms.google-services'

dependencies {
     implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'com.google.android.gms:play-services-vision-common:19.1.3'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
    implementation 'com.google.android.gms:play-services-location:20.0.0'

         implementation 'androidx.appcompat:appcompat:1.0.0'

    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    def camerax_version = "1.0.0-beta07"
    implementation "androidx.camera:camera-camera2:$camerax_version"
     implementation 'androidx.core:core-ktx:1.3.0'

    implementation 'org.tensorflow:tensorflow-lite:1.15.0'
    implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly-SNAPSHOT'
     implementation 'org.tensorflow:tensorflow-lite-gpu:2.9.0'
    implementation 'org.tensorflow:tensorflow-lite-task-vision:0.3.0'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'com.google.truth:truth:1.0.1'
    androidTestImplementation 'androidx.test:rules:1.1.0'
}
</code>```

Body:
I have two dependencies 'org.tensorflow:tensorflow-lite:1.15.0' and 'org.tensorflow:tensorflow-lite-task-vision:0.3.0' so when I add these in build.gradle file. and sync the project. It is showing  -->

Duplicate class org.tensorflow.lite.DataType found in modules jetified-tensorflow-lite-1.15.0-runtime (org.tensorflow:tensorflow-lite:1.15.0)
and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.DataType$1 found in modules jetified-tensorflow-lite-1.15.0-runtime (org.tensorflow:tensorflow-lite:1.15.0)
and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.Delegate found in modules jetified-tensorflow-lite-1.15.0-runtime (org.tensorflow:tensorflow-lite:1.15.0)
and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.Tensor found in modules jetified-tensorflow-lite-1.15.0-runtime (org.tensorflow:tensorflow-lite:1.15.0) and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)

How to resolve this dependency error. I have tried by adding one one dependencies and now I am getting that error causes by adding this dependency 'org.tensorflow:tensorflow-lite-task-vision:0.3.0'

By removing one of these dependencies I'm getting error in my java files.

My build.gradle file

apply plugin: 'com.android.application'
//apply plugin: 'de.undercouch.download'

android {
    compileSdkVersion 31
    defaultConfig {
        applicationId "org.tensorflow.lite.examples.detection"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    aaptOptions {
        noCompress "tflite"
    }

    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
    lintOptions {
        abortOnError false
    }
    android {
        ndkVersion '21.1.6528147'
    }
    flavorDimensions "tfliteInference"
    productFlavors {
       // The TFLite inference is built using the TFLite Java interpreter.
       interpreter {
           dimension "tfliteInference"
       }
       // Default: The TFLite inference is built using the TFLite Task library (high-level API).
       taskApi {
           getIsDefault().set(true)
           dimension "tfliteInference"
       }
    }

}

// import DownloadModels task
project.ext.ASSET_DIR = projectDir.toString() + '/src/main/assets'
project.ext.TMP_DIR   = project.buildDir.toString() + '/downloads'

// Download default models; if you wish to use your own models then
// place them in the "assets" directory and comment out this line.
apply from:'download.gradle'
apply plugin: 'com.google.gms.google-services'

dependencies {
     implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'com.google.android.gms:play-services-vision-common:19.1.3'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
    implementation 'com.google.android.gms:play-services-location:20.0.0'

         implementation 'androidx.appcompat:appcompat:1.0.0'

    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    def camerax_version = "1.0.0-beta07"
    implementation "androidx.camera:camera-camera2:$camerax_version"
     implementation 'androidx.core:core-ktx:1.3.0'

    implementation 'org.tensorflow:tensorflow-lite:1.15.0'
    implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly-SNAPSHOT'
     implementation 'org.tensorflow:tensorflow-lite-gpu:2.9.0'
    implementation 'org.tensorflow:tensorflow-lite-task-vision:0.3.0'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'com.google.truth:truth:1.0.1'
    androidTestImplementation 'androidx.test:rules:1.1.0'
}


问:
Insertion sort - Array index is not reassigned in for loop
I wish to implement insertion sort. My code is as follows:

```<code>#include <stdio.h>

void insertionSort(int arr[], int n);

// Driver code
int main() {
  int i;
  int data[] = {9, 5, 1, 4, 3};
  int size = sizeof(data) / sizeof(data[0]);
  insertionSort(data, size);
  printf("Sorted array in ascending order:\n");
  for (i = 0; i < size; i++) {
    printf("%d ", data[i]);
  }
  printf("\n");
}

void insertionSort(int arr[], int n){
    int i;
    for(i = 1; i < n; i++){
        int j = i;
        int current = arr[i];
        int adj = arr[i-1];
        while(arr[j]<adj && j>=0){
            arr[j] = arr[j-1];
            j--;
        }
        arr[j] = current;
    }
}
</code>```

It gives the wrong sorted array {5, 1, 4, 3, 9}. When I put it through a debugger, the value of adj always stays at arr[0] = 9 and is not changed upon later iterations. Why is this?

Thank you.

Body:
I wish to implement insertion sort. My code is as follows:

#include <stdio.h>

void insertionSort(int arr[], int n);

// Driver code
int main() {
  int i;
  int data[] = {9, 5, 1, 4, 3};
  int size = sizeof(data) / sizeof(data[0]);
  insertionSort(data, size);
  printf("Sorted array in ascending order:\n");
  for (i = 0; i < size; i++) {
    printf("%d ", data[i]);
  }
  printf("\n");
}

void insertionSort(int arr[], int n){
    int i;
    for(i = 1; i < n; i++){
        int j = i;
        int current = arr[i];
        int adj = arr[i-1];
        while(arr[j]<adj && j>=0){
            arr[j] = arr[j-1];
            j--;
        }
        arr[j] = current;
    }
}

It gives the wrong sorted array {5, 1, 4, 3, 9}. When I put it through a debugger, the value of adj always stays at arr[0] = 9 and is not changed upon later iterations. Why is this?

Thank you.


问:
Angular Material popup alignment issue with first time load
When user click on popup button as a first time, I am getting alignment issue like this:

When click on second time, it look fine. How can I solve this? is it require to add any delay? or needs any refresh approach?

Actual:

Code :

```<code> openDialog(templateRef: TemplateRef<HTMLAllCollection>) {
        this.addClinicDialogRef = this.dialog.open(templateRef, {
            height: '80%',
            width: '80%',
            panelClass: ['add-clinic-dialog'],
        });
    }
</code>```

Body:
When user click on popup button as a first time, I am getting alignment issue like this:

When click on second time, it look fine. How can I solve this? is it require to add any delay? or needs any refresh approach?

Actual:

Code :

 openDialog(templateRef: TemplateRef<HTMLAllCollection>) {
        this.addClinicDialogRef = this.dialog.open(templateRef, {
            height: '80%',
            width: '80%',
            panelClass: ['add-clinic-dialog'],
        });
    }


问:
White space comes up with keyboard when clicking on input fields in Custom tab inside a Teams Personal app (Iframe)
We have created an App in Teams developer portal with a feature of "Personal App". We have filled in all the details, for example, content url, website url etc. The Iframe inside the app loads correctly in the browser and desktop versions. But we are facing some user interface issues when opening the app in mobile app.

When ever we click on the input fields, keyboard pops up with a white space attached on top of it. The white space usually disappears after the keyboard closes but there were instances where we see a white space on the bottom of the app after the keyboard is closed also. This is occurring mostly in  Android mobiles and sometimes in IOS too. I am attaching the screenshots of the issue. Please look into it. Please let us know what we can do to solve this issue.

Also, the white space doesn't come up if our website is loaded on a normal browser. So the problem is occurring only if we open the website as an iframe inside teams.
Example of the white space

We have tried clearing cache, uninstalling the app and reinstalling it. But the issue doesn't seemed to be solved.

Example manifest.json file. Please sideload it in your desktop teams and view it in mobile. We can see the issue when clicked on input tags.

{"$schema":"https://developer.microsoft.com/en-us/json-schemas/teams/v1.15/MicrosoftTeams.schema.json","version":"1.0.0","manifestVersion":"1.15","id":"a4de606e-5ec1-4ea4-93b3-579b9999a329","packageName":"com.package.name","name":{"short":"test","full":""},"developer":{"name":"test","mpnId":"","websiteUrl":"https://allwebco-templates.com/support/","privacyUrl":"https://allwebco-templates.com/support/","termsOfUseUrl":"https://allwebco-templates.com/support/"},"description":{"short":"qwerty","full":"asdfg"},"icons":{"outline":"outline.png","color":"color.png"},"accentColor":"#FFFFFF","staticTabs":[{"entityId":"84fbd37d-1759-4da9-96af-cc86fb98b3f0","name":"home","contentUrl":"https://allwebco-templates.com/support/","scopes":["personal"]},{"entityId":"about","scopes":["personal"]}],"validDomains":["allwebco-templates.com"],"isFullScreen":true,"defaultGroupCapability":{"team":"tab","groupchat":"tab","meetings":"tab"}}


问:
How to know accessibility tools(talkback, voiceover) are on by javascript?
I'm developing webview. I want to check user who is using accessibility tools like voiceover(iOS), talkback(android).
Can I check these accessibility tools are running by javascript??</p>


问:
phpMyAdmin-php81-4.9.10 got error Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos()
when running phpMyAdmin-php81-4.9.10, got the following error

I have php8.1 with extension installed.

```<code>Fatal error: Uncaught Error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos() in /usr/local/www/phpMyAdmin/vendor/symfony/polyfill-mbstring/Mbstring.php:501 Stack trace: #0 /usr/local/www/phpMyAdmin/vendor/symfony/polyfill-mbstring/bootstrap.php(60): Symfony\Polyfill\Mbstring\Mbstring::mb_strpos('&', ';', 0, 'UTF-8') #1
/usr/local/www/phpMyAdmin/libraries/classes/Url.php(331): mb_strpos('&', ';') #2
/usr/local/www/phpMyAdmin/libraries/classes/Url.php(243): PhpMyAdmin\Url::getArgSeparator() #3
/usr/local/www/phpMyAdmin/libraries/classes/Url.php(224): PhpMyAdmin\Url::buildHttpQuery(Array, true) #4
/usr/local/www/phpMyAdmin/libraries/classes/Url.php(172): PhpMyAdmin\Url::getCommonRaw(Array, '?', true) #5 /usr/local/www/phpMyAdmin/libraries/classes/Core.php(749): PhpMyAdmin\Url::getCommon(Array) #6 /usr/local/www/phpMyAdmin/libraries/classes/Core.php(330): PhpMyAdmin\Core::linkURL('https://secure....') #7
/usr/local/www/phpMyAdmin/libraries/classes/Core.php(353): PhpMyAdmin\Core::getPHPDocLink('book.session.ph...') #8
/usr/local/www/phpMyAdmin/libraries/classes/Session.php(118): PhpMyAdmin\Core::warnMissingExtension('session', true) #9
/usr/local/www/phpMyAdmin/libraries/common.inc.php(132): PhpMyAdmin\Session::setUp(Object(PhpMyAdmin\Config), Object(PhpMyAdmin\ErrorHandler)) #10
/usr/local/www/phpMyAdmin/index.php(27): require_once('/usr/local/www/...') #11 {main} thrown in /usr/local/www/phpMyAdmin/vendor/symfony/polyfill-mbstring/Mbstring.php on line 501
</code>```

I have checked that iconv has been installed.

```<code>php --ri iconv

iconv

iconv support => enabled
iconv implementation => libiconv
iconv library version => 1.17

Directive => Local Value => Master Value
iconv.input_encoding => no value => no value
iconv.output_encoding => no value => no value
iconv.internal_encoding => no value => no value
</code>```

Body:
when running phpMyAdmin-php81-4.9.10, got the following error

I have php8.1 with extension installed.

Fatal error: Uncaught Error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos() in /usr/local/www/phpMyAdmin/vendor/symfony/polyfill-mbstring/Mbstring.php:501 Stack trace: #0 /usr/local/www/phpMyAdmin/vendor/symfony/polyfill-mbstring/bootstrap.php(60): Symfony\Polyfill\Mbstring\Mbstring::mb_strpos('&', ';', 0, 'UTF-8') #1
/usr/local/www/phpMyAdmin/libraries/classes/Url.php(331): mb_strpos('&', ';') #2
/usr/local/www/phpMyAdmin/libraries/classes/Url.php(243): PhpMyAdmin\Url::getArgSeparator() #3
/usr/local/www/phpMyAdmin/libraries/classes/Url.php(224): PhpMyAdmin\Url::buildHttpQuery(Array, true) #4
/usr/local/www/phpMyAdmin/libraries/classes/Url.php(172): PhpMyAdmin\Url::getCommonRaw(Array, '?', true) #5 /usr/local/www/phpMyAdmin/libraries/classes/Core.php(749): PhpMyAdmin\Url::getCommon(Array) #6 /usr/local/www/phpMyAdmin/libraries/classes/Core.php(330): PhpMyAdmin\Core::linkURL('https://secure....') #7
/usr/local/www/phpMyAdmin/libraries/classes/Core.php(353): PhpMyAdmin\Core::getPHPDocLink('book.session.ph...') #8
/usr/local/www/phpMyAdmin/libraries/classes/Session.php(118): PhpMyAdmin\Core::warnMissingExtension('session', true) #9
/usr/local/www/phpMyAdmin/libraries/common.inc.php(132): PhpMyAdmin\Session::setUp(Object(PhpMyAdmin\Config), Object(PhpMyAdmin\ErrorHandler)) #10
/usr/local/www/phpMyAdmin/index.php(27): require_once('/usr/local/www/...') #11 {main} thrown in /usr/local/www/phpMyAdmin/vendor/symfony/polyfill-mbstring/Mbstring.php on line 501

I have checked that iconv has been installed.

php --ri iconv

iconv

iconv support => enabled
iconv implementation => libiconv
iconv library version => 1.17

Directive => Local Value => Master Value
iconv.input_encoding => no value => no value
iconv.output_encoding => no value => no value
iconv.internal_encoding => no value => no value


问:
How to delete all lines in a text file that do not contain the specified words
It is necessary to implement a function in which an array containing several words (the number is unknown) will be passed as a parameter.
There is a source file, output.txt, it contains a large number of lines, it is necessary for the function to delete all the lines entirely if the line does not contain at least one word from the array of words

This is what I have at the moment, but this function only removes one word at a time, but it needs several

```<code>import re
with open('output.txt') as f:
    lines = f.readlines()
str = "bmw" # Keyword
pattern = re.compile(re.escape(str))
with open('output.txt', 'w') as f:
    for line in lines:
        result = pattern.search(line)
        if result is not None:
            f.write(line)

</code>```

Body:
It is necessary to implement a function in which an array containing several words (the number is unknown) will be passed as a parameter.
There is a source file, output.txt, it contains a large number of lines, it is necessary for the function to delete all the lines entirely if the line does not contain at least one word from the array of words

This is what I have at the moment, but this function only removes one word at a time, but it needs several

import re
with open('output.txt') as f:
    lines = f.readlines()
str = "bmw" # Keyword
pattern = re.compile(re.escape(str))
with open('output.txt', 'w') as f:
    for line in lines:
        result = pattern.search(line)
        if result is not None:
            f.write(line)


问:
Why am i getting a value instead of a reference error?
Since i have not declared the variable anywhere , why am i getting a value for it rather than an error . I am directly assigning it a value and not declaring it first.

```<code>let x = [0 ,1]

if(x){
    target = x[0]
}
console.log(target)
</code>```

I was expecting an reference error but got value for target that was 0

Body:
Since i have not declared the variable anywhere , why am i getting a value for it rather than an error . I am directly assigning it a value and not declaring it first.

let x = [0 ,1]

if(x){
    target = x[0]
}
console.log(target)

I was expecting an reference error but got value for target that was 0


问:
Issues with node.js bot and sqlite
I created a staty command that shows them stats from sqlite.

When I run the bot and type staty, I get the error "TypeError: rows.forEach is not a function"

Here is my code:

```<code>const fetch = require("node-fetch");

const EmbedUtil = require("../../utils/EmbedUtil");
const BaseCommand = require("../BaseCommand");
const { MessageEmbed } = require("discord.js");
const config = require("../../data/config.json");
const MessageUtil = require("../../utils/MessageUtil");
const sqlite3 = require("sqlite3").verbose();

class StatsCommand extends BaseCommand {
    constructor() {
        super("staty");
    }

    execute(bot, msg, args) {
        if (args.length === 0) {
            const embed = EmbedUtil.createEmbed("Blad", [
                `Poprawne użycie: ${config.prefix}staty (nick)`,
            ]);
            MessageUtil.replyMessageAndDelete(embed, msg, 7);
            return;
        }

        let db = new sqlite3.Database("db/DataBase.db");

        db.get(
            "SELECT * FROM `users` WHERE nick = ?", [args[0]],
            (err, rows, fields) => {
                if (err) {
                    msg.reply("Podany gracz nie istnieje!");
                    return;
                }

                rows.forEach((nick, kills, points, deaths) => {
                    const embed = EmbedUtil.createEmbed(
                        "**STATYSTYKI**",
                        `**Gracz:** ${player} \n**Zabojstwa:** ${kills} \n**Smierci:** ${deaths} \n**Punkty:** ${points} \n**Gildia:** ${guild}`
                    );
                    msg.channel.send(embed);
                    return;
                });
            }
        );
    }
}

module.exports = StatsCommand;
</code>```

I don't understand why forEach is no function.

Can someone help me? What may be the problem?

Title: Issues with node.js bot and sqlite

Body:
I created a staty command that shows them stats from sqlite.

When I run the bot and type staty, I get the error "TypeError: rows.forEach is not a function"

Here is my code:

const fetch = require("node-fetch");

const EmbedUtil = require("../../utils/EmbedUtil");
const BaseCommand = require("../BaseCommand");
const { MessageEmbed } = require("discord.js");
const config = require("../../data/config.json");
const MessageUtil = require("../../utils/MessageUtil");
const sqlite3 = require("sqlite3").verbose();

class StatsCommand extends BaseCommand {
    constructor() {
        super("staty");
    }

    execute(bot, msg, args) {
        if (args.length === 0) {
            const embed = EmbedUtil.createEmbed("Blad", [
                `Poprawne użycie: ${config.prefix}staty (nick)`,
            ]);
            MessageUtil.replyMessageAndDelete(embed, msg, 7);
            return;
        }

        let db = new sqlite3.Database("db/DataBase.db");

        db.get(
            "SELECT * FROM `users` WHERE nick = ?", [args[0]],
            (err, rows, fields) => {
                if (err) {
                    msg.reply("Podany gracz nie istnieje!");
                    return;
                }

                rows.forEach((nick, kills, points, deaths) => {
                    const embed = EmbedUtil.createEmbed(
                        "**STATYSTYKI**",
                        `**Gracz:** ${player} \n**Zabojstwa:** ${kills} \n**Smierci:** ${deaths} \n**Punkty:** ${points} \n**Gildia:** ${guild}`
                    );
                    msg.channel.send(embed);
                    return;
                });
            }
        );
    }
}

module.exports = StatsCommand;

I don't understand why forEach is no function.

Can someone help me? What may be the problem?


问:
How to transition from screen in "ContentView"
I am trying to set up animations to transition between menus on my app.

Picture showing app main menu

At the moment, I only have the setup for the first screen, coded into the default "ContentView" file in xcode. I want to know what file type I am supposed to use to set up the other pages (a lot of tutorials use viewcontrollers written in a cocoa touch class file). Is it possible to create more ContentView-like pages (normal swift files) or do I have to use the storyboard?

For more explanation, I want it so that when I press a green button at the bottom (circular green icons) that it does a sliding transition from the current screen (home icon) to whatever other icon is pressed.

If I have to use the storyboard and presumably viewcontrollers, what do I do with the code I have written in the ContentView (as in do I have to rewrite it somewhere or can I turn the contentview into a view controller or something)?

I have tried looking at many tutorials but almost all of them use segues with navigationviewcontrollers. I do not want the sort of card-stack method it uses with back buttons. I have been trying to figure out how to just slide from one screen to another, so that its all clean and has no navigation bar or weird pop up menus.


问:
How can load and handle individual child of list-views of Multiple pagination API into single Cubit or bloc in via Flutter_bloc:^8.0.1 in flutter?
How can load and handle an individual child of list-views of  Multiple pagination API into a single Cubit or bloc via Flutter_bloc:^8.0.1 in flutter?

Like there 3 Pagination APIs that load initially at page 1 and then after then 3 listview individuals handle page increment individually in cubit/ bloc in a flutter.

Multiple API calls and preview like this

Like there 3 Pagination APIs that load initially at page 1 and then after then 3 listview individuals handle page increment individually in cubit/ bloc in a flutter.


问:
Translating a DB variable on a Laravel Blade sing json file
I usually do translate from the blade like this, not from the database

```<code>{{ ___('texts.welcome')}}
</code>```

And JSON like this.

```<code>{
  "welcome": "Welcome"
}
</code>```

That works for me

But I am trying to translate the DB variable on Laravel Blade using a JSON file like I usually do I found an answer in StackOverflow but there is no answer to how to write variables in a JSON file

this answer:- Translating a DB variable on a laravel Blade

```<code>{ ___('texts.' . $value->name) }}
</code>```

I am expecting an answer on how to write variable values in my JSON file.

Body:
I usually do translate from the blade like this, not from the database

{{ ___('texts.welcome')}}

And JSON like this.

{
  "welcome": "Welcome"
}

That works for me

But I am trying to translate the DB variable on Laravel Blade using a JSON file like I usually do I found an answer in StackOverflow but there is no answer to how to write variables in a JSON file

this answer:- Translating a DB variable on a laravel Blade

{ ___('texts.' . $value->name) }}

I am expecting an answer on how to write variable values in my JSON file.


问:
Getting error "io.lettuce.core.RedisCommandExecutionException: MOVED 6203" when using redis cluster with Spring Data Redis in spring boot Application
I am using Spring data redis to connect to Redis Cluster.
when trying to trigger Redis Commands from application, it gives the following error

```<code>Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MOVED 6203 rg-69012fb7-7416-4876-8933-606a38ff54e7-0001-001.rg-69912fb7-7416-4876-8933-605a38ef54e7.vwvwdz.euc1.cache.amazonaws.com:2660
</code>```

As a solution for this, I tried configuring ClusterTopologyRefreshOption like following:

```<code>ClusterClientOptions clusterClientOptions = ClusterClientOptions.builder()
        .timeoutOptions(TimeoutOptions.enabled(Duration.ofSeconds(60L)))
        .topologyRefreshOptions(ClusterTopologyRefreshOptions.builder()
                .enablePeriodicRefresh(Duration.ofSeconds(60L)) // Refresh the topology periodically.
                .enableAllAdaptiveRefreshTriggers() // Refresh the topology based on events.
                .build())
        .build();
LettuceClientConfiguration clientConfig = LettucePoolingClientConfiguration.builder()
        .commandTimeout(Duration.ofSeconds(60L))
        .readFrom(ReadFrom.REPLICA_PREFERRED) // Preferentially read data from the replicas.
        .clientOptions(clusterClientOptions)
        .build();
RedisClusterConfiguration redisClusterConfiguration = new RedisClusterConfiguration();
redisClusterConfiguration.addClusterNode(new RedisNode(redisHost, redisPort));
redisClusterConfiguration.setPassword(redisPassword);
return new LettuceConnectionFactory(redisClusterConfiguration, clientConfig);
</code>```

I get the same error i.e.

```<code>Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MOVED 6203 rg-69012fb7-7416-4876-8933-606a38ff54e7-0001-001.rg-69912fb7-7416-4876-8933-605a38ef54e7.vwvwdz.euc1.cache.amazonaws.com:2660
</code>```

Any suggestion if I missed anything in this configuration?

Body:
I am using Spring data redis to connect to Redis Cluster.
when trying to trigger Redis Commands from application, it gives the following error

Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MOVED 6203 rg-69012fb7-7416-4876-8933-606a38ff54e7-0001-001.rg-69912fb7-7416-4876-8933-605a38ef54e7.vwvwdz.euc1.cache.amazonaws.com:2660

As a solution for this, I tried configuring ClusterTopologyRefreshOption like following:

ClusterClientOptions clusterClientOptions = ClusterClientOptions.builder()
        .timeoutOptions(TimeoutOptions.enabled(Duration.ofSeconds(60L)))
        .topologyRefreshOptions(ClusterTopologyRefreshOptions.builder()
                .enablePeriodicRefresh(Duration.ofSeconds(60L)) // Refresh the topology periodically.
                .enableAllAdaptiveRefreshTriggers() // Refresh the topology based on events.
                .build())
        .build();
LettuceClientConfiguration clientConfig = LettucePoolingClientConfiguration.builder()
        .commandTimeout(Duration.ofSeconds(60L))
        .readFrom(ReadFrom.REPLICA_PREFERRED) // Preferentially read data from the replicas.
        .clientOptions(clusterClientOptions)
        .build();
RedisClusterConfiguration redisClusterConfiguration = new RedisClusterConfiguration();
redisClusterConfiguration.addClusterNode(new RedisNode(redisHost, redisPort));
redisClusterConfiguration.setPassword(redisPassword);
return new LettuceConnectionFactory(redisClusterConfiguration, clientConfig);

I get the same error i.e.

Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MOVED 6203 rg-69012fb7-7416-4876-8933-606a38ff54e7-0001-001.rg-69912fb7-7416-4876-8933-605a38ef54e7.vwvwdz.euc1.cache.amazonaws.com:2660

Any suggestion if I missed anything in this configuration?