问:
Why is API call returning null after succesfully adding everything correctly to my list?
I'm using an API to show every pokemon in the pokedex, however after I add the JSON returned values to my public List<Data> pokemonDataList by calling the API with pokemon.results[i].url the @if (pokemon != null) statemen shows that pokemon is null again. I tried the debuggin the code and it shows how its getting all the values from the API call, but somehow after it finishes it sets everything back to null?

`

```<code>@page "/"
@using System.Globalization
@inject HttpClient Client
@using System.Net.Http.Json
@using System.Net.Http
@inject HttpClient Http

@if (pokemon != null)  //Shows null, does not enter here
{
    for (int i = 0; i < pokemon.results.Length; i++)
    {

        <div class="div2">

            <p>@pokemon.results[i].name</p>

            @if (pokemonDataList != null)
            {
                <img src="@pokemonDataList[i].sprites.front_default" width="250px" height="250px" />
            }

        </div>
    }

}

@code {
    public Rootobject pokemon { get; set; }
    Data pokemonData;
    public List<Data> pokemonDataList { get; set; } = new List<Data>();

    protected override async Task OnInitializedAsync() // Orria kargatzerakoan erakutsiko du
    {
        await GetPokemon();

    }

        async Task GetPokemon()
    {

        pokemon = await Client.GetFromJsonAsync<Rootobject>(Endpoints.GetPokemonById());

            for (int i = 0; i < pokemon.results.Length; i++)
            {
                pokemonDataList.Add(await GetPokemonData(i)); // Gets every pokemon on the list 1154
            }

    }

    async Task<Data> GetPokemonData(int i)
    {

        return await Http.GetFromJsonAsync<Data>(pokemon.results[i].url);

    }

}
</code>```

`

I tried various if(!null) and while(!null) but it doesn't seem to work

Edit: After debugging it and changing @if (pokemon != null) to @if (pokemon == null) it looks like the methods are executed afterwards loading the html, despite putting await on the methods.

Body:
I'm using an API to show every pokemon in the pokedex, however after I add the JSON returned values to my public List<Data> pokemonDataList by calling the API with pokemon.results[i].url the @if (pokemon != null) statemen shows that pokemon is null again. I tried the debuggin the code and it shows how its getting all the values from the API call, but somehow after it finishes it sets everything back to null?

`

@page "/"
@using System.Globalization
@inject HttpClient Client
@using System.Net.Http.Json
@using System.Net.Http
@inject HttpClient Http

@if (pokemon != null)  //Shows null, does not enter here
{
    for (int i = 0; i < pokemon.results.Length; i++)
    {

@pokemon.results[i].name

            @if (pokemonDataList != null)
            {

            }

    }

}

@code {
    public Rootobject pokemon { get; set; }
    Data pokemonData;
    public List<Data> pokemonDataList { get; set; } = new List<Data>();

    protected override async Task OnInitializedAsync() // Orria kargatzerakoan erakutsiko du
    {
        await GetPokemon();

    }

        async Task GetPokemon()
    {

        pokemon = await Client.GetFromJsonAsync<Rootobject>(Endpoints.GetPokemonById());

            for (int i = 0; i < pokemon.results.Length; i++)
            {
                pokemonDataList.Add(await GetPokemonData(i)); // Gets every pokemon on the list 1154
            }

    }

    async Task<Data> GetPokemonData(int i)
    {

        return await Http.GetFromJsonAsync<Data>(pokemon.results[i].url);

    }

}

`

I tried various if(!null) and while(!null) but it doesn't seem to work

Edit: After debugging it and changing @if (pokemon != null) to @if (pokemon == null) it looks like the methods are executed afterwards loading the html, despite putting await on the methods.


来源: stackexchange

问:
github: get the consolidate view of test cases from all the repo
I have 5-6 github python repos. These repos has python test cases as well, which ran using pytest and github action. I want see the results of test cases running in all the repos at a single place/tool.

please suggest

ContentLicense: CC BY-SA 4.0


问:
How to create and update object from frontend with with pimcore/graphql?
In pimcore I made several classes, and some classes are nested. In my example, there is a user object, the user has a questions property, which is also an object, and the questions object has also an answers array, in which are answers objects.

To get the data, the fetch request looks like this:

```<code>query {
getUser(id:19){id
username
password
points
ghostRecord
admin
character
questions{
... on object_question{
id
text
answered
points
answers{
... on object_answer{answer, correct}
}
}
}
}
</code>```

How can I update the user or create a new user?
With mutation, I'm able to update the properties like username, or password like this:

```<code>mutation {
updateUser(id: 10, input: {
username: "Mike", points:"3", answers:${newAnswersObj}
}
) {
success
output {
modificationDate
}
}
}
</code>```

But how can I update the questions and answers objects?
Is it even possible? Thanks in advance!

```<code>mutation {
updateUser(id: 10, input: {
username: "Mike", points:"3", answers:${newAnswersObj}
}
) {
success
output {
modificationDate
}
}
}
</code>```

This above doesn't work.

Body:
In pimcore I made several classes, and some classes are nested. In my example, there is a user object, the user has a questions property, which is also an object, and the questions object has also an answers array, in which are answers objects.

To get the data, the fetch request looks like this:

query {
getUser(id:19){id
username
password
points
ghostRecord
admin
character
questions{
... on object_question{
id
text
answered
points
answers{
... on object_answer{answer, correct}
}
}
}
}

How can I update the user or create a new user?
With mutation, I'm able to update the properties like username, or password like this:

mutation {
updateUser(id: 10, input: {
username: "Mike", points:"3", answers:${newAnswersObj}
}
) {
success
output {
modificationDate
}
}
}

But how can I update the questions and answers objects?
Is it even possible? Thanks in advance!

mutation {
updateUser(id: 10, input: {
username: "Mike", points:"3", answers:${newAnswersObj}
}
) {
success
output {
modificationDate
}
}
}

This above doesn't work.


问:
Random newlines in Github Gist iPython notebooks
I have noticed across all of my Jupyter notebooks stored as Github Gists that newlines have been added to them, in both new and old notebooks. Am I doing something wrong? Here is an example:

The code for the first block is:

{
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([30522])"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import torch\n",
    "\n",
    "vec = torch.max(\n",
    "    torch.log(\n",
    "        1 + torch.relu(output.logits)\n",
    "    ) * tokens.attention_mask.unsqueeze(-1),\n",
    "dim=1)[0].squeeze()\n",
    "\n",
    "vec.shape"
   ]
  }
```

And the link

Body:
I have noticed across all of my Jupyter notebooks stored as Github Gists that newlines have been added to them, in both new and old notebooks. Am I doing something wrong? Here is an example:

The code for the first block is:

{
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([30522])"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import torch\n",
    "\n",
    "vec = torch.max(\n",
    "    torch.log(\n",
    "        1 + torch.relu(output.logits)\n",
    "    ) * tokens.attention_mask.unsqueeze(-1),\n",
    "dim=1)[0].squeeze()\n",
    "\n",
    "vec.shape"
   ]
  }

And the link


问:
pywinauto print_control_identifiers only detect the title name - no automation id
I try to use print_control_identifiers with pywinauto module but the result just application title

This is the source code

from pywinauto import Application, Desktop
app = Application().start(r"C:\Users\user\Desktop\Pandora_v2.0\Pandora v2.0.exe")

dlg = Desktop().window(title="discord.gg/asakin")
dlg.print_control_identifiers()
```

I already put backend="uia" but the result still same.
Windows SDK already installed. I already try inspector.exe, swapy, etc but still no luck

Body:
I try to use print_control_identifiers with pywinauto module but the result just application title

This is the source code

from pywinauto import Application, Desktop
app = Application().start(r"C:\Users\user\Desktop\Pandora_v2.0\Pandora v2.0.exe")

dlg = Desktop().window(title="discord.gg/asakin")
dlg.print_control_identifiers()

I already put backend="uia" but the result still same.
Windows SDK already installed. I already try inspector.exe, swapy, etc but still no luck


问:
Selenium Port to access external site URLs
I am working in a corporate organization and we are in the process of setting our automation tests to run in CI/CD pipeline. Our tests includes scenarios where we need to access some external application URLs. The CI/CD agents by default not enabled to access the external URLs and in order to allow the access, the network team is asking us to confirm the port number on which we want to access the external application URL's. We also use a proxy with port number 8080. Should we use the same port as the proxy port on which we would need to access the external URLs?

Any suggestion is appreciated, thanks.

It is a suggestion based question.


问:
How to transmit in REACT a real-time video feed?
I'm building a website using REACT the purpose of which is to show a real-time simulated video feed. I'm a novice developer and I'm stuck on this problem for a while. Therefore, your help will be greatly appreciated! For more details please read below.

I have a simulation engine that runs on one of my machines (there are 2 in total) and generates a simulated video of a vehicle that drives on a road. I'm using Python libraries in order to capture a screenshot of the simulated video on machine 1 and delivers it via sockets to machine 2, where my REACT website is running.

I can successfully capture the screenshot and deliver it using sockets (as bytes) from one machine to another. However, I don't know how to "catch" the bytes in REACT and transform them back to an streaming video image.

Your assistance will be greatly appreciated.
Thanks in advance,
Felix.


问:
undefined async handler using sinon.stub()
I know it's something obvious that I'm missing but I'm trying to write unit tests using mocha, chai and sinon for an async handler that's referencing another async service. Here's the code for what I'm dealing with:

authenticateService.js

```<code>module.exports = (() => {
    ...
    async authenticate(username, password) {
        const isValid = await validCreds(username)
        if (!isValid) {
            throw Error(`invalid_credentials`)
        }
        return isValid
    }
}

</code>```

authenticateHandler.js

```<code>module.export.handler = {
    async (event) => {
        const auth = await authenticate(username, password)
        if (auth) {
            // do things
        }
        return {statusCodes.OK}
    }
}
</code>```

unit test

```<code>describe(`Admin Module`, () => {
    beforeEach(() => {
        sinon.stub(authenticateService.prototype, "authenticate")
            .callsFake(() => Promise.resolve({status:200}))

    })

    afterEach(() => {
        authenticationService.restore()
    })

    describe(`test auth`, () => {
        it(`Receives GET event expects statusCode 200`, async () => {
            const event = {
                httpMethod: `POST`,
                resourcePath: `/admin/authentications`,
                body: {
                    username: `fizz@email.com`,
                    password: `buzz`,
                    recaptchaToken: `some_token`
                },
            }

            expect(response.statusCode).to.equal(200)
        })
    })
</code>```

I tried setting the following:

setting it in a sandbox

using yields, resolve, return and could not figure out how to stub it correctly

tried mocking the nested authenticateService, mocking the handler and mocking both

I keep getting Error: Trying to stub property 'authenticate' of undefined so I know it must not be instantiating the service correctly. Frankly it seems like a simple thing but I just cannot figure out what I am missing.

Body:
I know it's something obvious that I'm missing but I'm trying to write unit tests using mocha, chai and sinon for an async handler that's referencing another async service. Here's the code for what I'm dealing with:

authenticateService.js

module.exports = (() => {
    ...
    async authenticate(username, password) {
        const isValid = await validCreds(username)
        if (!isValid) {
            throw Error(`invalid_credentials`)
        }
        return isValid
    }
}

authenticateHandler.js

module.export.handler = {
    async (event) => {
        const auth = await authenticate(username, password)
        if (auth) {
            // do things
        }
        return {statusCodes.OK}
    }
}

unit test

describe(`Admin Module`, () => {
    beforeEach(() => {
        sinon.stub(authenticateService.prototype, "authenticate")
            .callsFake(() => Promise.resolve({status:200}))

    })

    afterEach(() => {
        authenticationService.restore()
    })

    describe(`test auth`, () => {
        it(`Receives GET event expects statusCode 200`, async () => {
            const event = {
                httpMethod: `POST`,
                resourcePath: `/admin/authentications`,
                body: {
                    username: `fizz@email.com`,
                    password: `buzz`,
                    recaptchaToken: `some_token`
                },
            }

            expect(response.statusCode).to.equal(200)
        })
    })

I tried setting the following:

setting it in a sandbox

using yields, resolve, return and could not figure out how to stub it correctly

tried mocking the nested authenticateService, mocking the handler and mocking both

I keep getting Error: Trying to stub property 'authenticate' of undefined so I know it must not be instantiating the service correctly. Frankly it seems like a simple thing but I just cannot figure out what I am missing.


问:
For header file # include "stdafx.h" getting error message no such file or directory , for newly created project in Visual studio 2015
For project created in visual studio 2015,
Source file Code contains code line having #include "stdafx.h"
But in header file no file is added.

After building the solution error message is stdafx: no such file or directory.
How to resolve this issue??

Tried adding header file named stdafx.h


问:
Power BI Dax New Customers, Lost customers, Returning customers and Active customers
I have been banging my head on this for the last few days, I am a newbie to DAX.

I have to calculate New Customers, Lost customers, Returning customers, and Active customers.
New Customers: customers who never made any purchase
If a person has not bought anything in the last 3 months he is considered a lost customer and if he starts again he is a Returning customer. Any person who has bought in the last 3 months is an active customer.

My measures work on a few dimensions for example I can use them to see the evolution of all 4 metrics over time, but I do not get correct numbers on store level and customer characteristics

I tried the cumulative Sum approach to solve this as I can reuse the measures again.

Measure:

```<code>Total Qty = Sum(sales[Qty])
</code>```

All Months' cumulative

```<code>Cum Volume = CALCULATE(SUM(sale[Order]), FILTER(ALL(date table), date table [Date]<=MAX(Calendar_lookup[Date])))
</code>```

Last 3 months' cumulative

```<code>Cum Sum last 3 = CALCULATE (SUM(DateTable[Order]), DATESINPERIOD(Calendar_lookup[Start of Month],MAX(Calendar_lookup[Start of Month]),-3,MONTH))

New Starts =
    VAR FirstTransaction = FILTER(DateTable, CALCULATE([Total Order],ALLEXCEPT(DateTable,DateTable[Customer ID],Calendar_lookup[Date],DateTable[FULL_PRODUCT_NAME])) = CALCULATE([Total Order],ALLEXCEPT(DateTable,DateTable[Customer ID],Calendar_lookup[Date],DateTable[PRODUCT_NAME])))
    RETURN CALCULATE(DISTINCTCOUNT(DateTable[Customer ID]),FirstTransaction)

Lost Customers =
    VAR NoTransaction3month = FILTER(All(Sales[Customer ID]),[Cum Sum last 3]=0 && [Cum Sum last 4]<>0)
    RETURN COUNTROWS(NoTransaction3month)

Restart =
    VAR ReactivateTransaction = FILTER(VALUES(Sales[Customer ID]), [Total shipped]=[Cum Sum last 4] && [Total Order]>[Qty])
    RETURN CALCULATE(DISTINCTCOUNT(Sales[Cust ID]),ReactivateTransaction )

Active Customer =
    VAR ActiveTransaction = FILTER(All(Sales[Customer ID]),[Cum Sum last 3]<>0 )
    RETURN COUNTROWS(ActiveTransaction)
</code>```

Highly appreciates. Thank you

To calculate New Customers, Lost customers, Returning customers, and Active customers.

Body:
I have been banging my head on this for the last few days, I am a newbie to DAX.

I have to calculate New Customers, Lost customers, Returning customers, and Active customers.
New Customers: customers who never made any purchase
If a person has not bought anything in the last 3 months he is considered a lost customer and if he starts again he is a Returning customer. Any person who has bought in the last 3 months is an active customer.

My measures work on a few dimensions for example I can use them to see the evolution of all 4 metrics over time, but I do not get correct numbers on store level and customer characteristics

I tried the cumulative Sum approach to solve this as I can reuse the measures again.

Measure:

Total Qty = Sum(sales[Qty])

All Months' cumulative

Cum Volume = CALCULATE(SUM(sale[Order]), FILTER(ALL(date table), date table [Date]<=MAX(Calendar_lookup[Date])))

Last 3 months' cumulative

Cum Sum last 3 = CALCULATE (SUM(DateTable[Order]), DATESINPERIOD(Calendar_lookup[Start of Month],MAX(Calendar_lookup[Start of Month]),-3,MONTH))

New Starts =
    VAR FirstTransaction = FILTER(DateTable, CALCULATE([Total Order],ALLEXCEPT(DateTable,DateTable[Customer ID],Calendar_lookup[Date],DateTable[FULL_PRODUCT_NAME])) = CALCULATE([Total Order],ALLEXCEPT(DateTable,DateTable[Customer ID],Calendar_lookup[Date],DateTable[PRODUCT_NAME])))
    RETURN CALCULATE(DISTINCTCOUNT(DateTable[Customer ID]),FirstTransaction)

Lost Customers =
    VAR NoTransaction3month = FILTER(All(Sales[Customer ID]),[Cum Sum last 3]=0 && [Cum Sum last 4]<>0)
    RETURN COUNTROWS(NoTransaction3month)

Restart =
    VAR ReactivateTransaction = FILTER(VALUES(Sales[Customer ID]), [Total shipped]=[Cum Sum last 4] && [Total Order]>[Qty])
    RETURN CALCULATE(DISTINCTCOUNT(Sales[Cust ID]),ReactivateTransaction )

Active Customer =
    VAR ActiveTransaction = FILTER(All(Sales[Customer ID]),[Cum Sum last 3]<>0 )
    RETURN COUNTROWS(ActiveTransaction)

Highly appreciates. Thank you

To calculate New Customers, Lost customers, Returning customers, and Active customers.


问:
Recycle view isn’t scrolling after updating adapter with values from database
I have a homepage layout with a recycle view that scrolls vertically but for some reason after I populate it with DB data it stops scrolling(i see that the remaining data is loading below the viewport but I can’t scroll up to see them and i have other components in the layout which is why I can’t set the recycle view height to “match parent”. The recycle view is set to vertical layout manager too.

I’ve tried nestedscrollview but that just restricted it to 1 cardview which scrolls but i want a list that displays multiple card( I can’t use “match parent” cus of other view components in the layout) and adding an inner container didn’t fix it either

This is the xml layout (the recycleview with id = product_View is the issue)

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/bottomNavigation"
    android:background="#Fffdd0"
    android:padding="10dp">

    <TextView
        android:id="@+id/tit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:gravity="center"
        android:text="Text"
        android:textColor="#FF6200EE"
        android:textSize="40sp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

    </TextView>

    <TextView
        android:id="@+id/titsub"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:gravity="center"
        android:text="Search through... "
        android:textColor="#000"
        android:textSize="13dp"
        android:textStyle="italic|bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/tit">

    </TextView>

    <TextView
        android:id="@+id/category"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:gravity="start"
        android:text="Categories"
        android:textColor="#000"
        android:textSize="25dp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/titsub">

    </TextView>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/category_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#Fffdd0"
        android:padding="5dp"
        android:scrollbars="none"
        app:layout_constraintBottom_toTopOf="@id/textView2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/category"
        tools:itemCount="1"
        tools:listitem="@layout/design">

    </androidx.recyclerview.widget.RecyclerView>

    <TextView
        android:id="@+id/textView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:gravity="start"
        android:text="Popular"
        android:textColor="#000"
        android:textSize="25dp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/category_view">

    </TextView>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/product_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:background="#Fffdd0"
        android:padding="5dp"
        android:scrollbars="none"
        android:nestedScrollingEnabled="true"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/textView2"
        tools:itemCount="3"
        tools:listitem="@layout/design2">

    </androidx.recyclerview.widget.RecyclerView>

</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

This is the code that gets data and populates the recycleview

```<code>private fun getData() {

        //val loading = view?.findViewById<ImageView>(R.id.loadingPage)

        val ref = db.collection("popular")
        val list = ArrayList<data2>()

        ref.get()
            .addOnSuccessListener { result ->
                for (doc in result) {
                    val id = doc.id

                    // getting business Info
                    ref.document(id)
                        .get()
                        .addOnSuccessListener { document ->
                            if (document != null) {
                                val n = document.data?.get("name").toString()
                                val r = document.data?.get("rating").toString()?.toFloat()
                                val d = document.data?.get("description").toString()
                                Log.d("TAG", n)

                                //passing result to new list
                                list.add(
                                    data2(
                                        R.drawable.photography_img,
                                        n,
                                        d,
                                        r
                                    )
                                )

                                Log.d("TAG data", list.toString())
                                //clearing the placeholder data and feeding it the result from the Database
                                data2.clear()
                                data2.addAll(list)
                                adapter.notifyDataSetChanged()
                             //   loading?.visibility = View.GONE
                            }
                        }
                }
            }
            .addOnFailureListener { exception ->
                Log.d("TAG", "get failed with ", exception)
            }
    }
</code>```

Body:
I have a homepage layout with a recycle view that scrolls vertically but for some reason after I populate it with DB data it stops scrolling(i see that the remaining data is loading below the viewport but I can’t scroll up to see them and i have other components in the layout which is why I can’t set the recycle view height to “match parent”. The recycle view is set to vertical layout manager too.

I’ve tried nestedscrollview but that just restricted it to 1 cardview which scrolls but i want a list that displays multiple card( I can’t use “match parent” cus of other view components in the layout) and adding an inner container didn’t fix it either

This is the xml layout (the recycleview with id = product_View is the issue)

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/bottomNavigation"
    android:background="#Fffdd0"
    android:padding="10dp">

    <TextView
        android:id="@+id/tit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:gravity="center"
        android:text="Text"
        android:textColor="#FF6200EE"
        android:textSize="40sp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

    </TextView>

    <TextView
        android:id="@+id/titsub"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:gravity="center"
        android:text="Search through... "
        android:textColor="#000"
        android:textSize="13dp"
        android:textStyle="italic|bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/tit">

    </TextView>

    <TextView
        android:id="@+id/category"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:gravity="start"
        android:text="Categories"
        android:textColor="#000"
        android:textSize="25dp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/titsub">

    </TextView>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/category_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#Fffdd0"
        android:padding="5dp"
        android:scrollbars="none"
        app:layout_constraintBottom_toTopOf="@id/textView2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/category"
        tools:itemCount="1"
        tools:listitem="@layout/design">

    </androidx.recyclerview.widget.RecyclerView>

    <TextView
        android:id="@+id/textView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:gravity="start"
        android:text="Popular"
        android:textColor="#000"
        android:textSize="25dp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/category_view">

    </TextView>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/product_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:background="#Fffdd0"
        android:padding="5dp"
        android:scrollbars="none"
        android:nestedScrollingEnabled="true"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/textView2"
        tools:itemCount="3"
        tools:listitem="@layout/design2">

    </androidx.recyclerview.widget.RecyclerView>

</androidx.constraintlayout.widget.ConstraintLayout>

This is the code that gets data and populates the recycleview

private fun getData() {

        //val loading = view?.findViewById<ImageView>(R.id.loadingPage)

        val ref = db.collection("popular")
        val list = ArrayList<data2>()

        ref.get()
            .addOnSuccessListener { result ->
                for (doc in result) {
                    val id = doc.id

                    // getting business Info
                    ref.document(id)
                        .get()
                        .addOnSuccessListener { document ->
                            if (document != null) {
                                val n = document.data?.get("name").toString()
                                val r = document.data?.get("rating").toString()?.toFloat()
                                val d = document.data?.get("description").toString()
                                Log.d("TAG", n)

                                //passing result to new list
                                list.add(
                                    data2(
                                        R.drawable.photography_img,
                                        n,
                                        d,
                                        r
                                    )
                                )

                                Log.d("TAG data", list.toString())
                                //clearing the placeholder data and feeding it the result from the Database
                                data2.clear()
                                data2.addAll(list)
                                adapter.notifyDataSetChanged()
                             //   loading?.visibility = View.GONE
                            }
                        }
                }
            }
            .addOnFailureListener { exception ->
                Log.d("TAG", "get failed with ", exception)
            }
    }


问:
How to upload a ftl file, render the content, and read the attributes of a ftl file inside a react project?
Background

I am entirely new to free marker template files. I have searched on integrating react applications with ftl. But, haven't found any resources regarding this. I wonder whether this is achievable or not.

The things I want to achieve are;

Upload an ftl file in a way that I can render the file's content inside the react app.

Render the template inside a react app.

Identify the attributes/variables defined in the ftl file.

Additional Info:

In my requirement, the ftl file contains an email template.

Please let me know if more information is needed. An answer which explains why it is not achievable is also welcomed. It would minimize fellow developers' time spent searching on this topic.


问:
Nginx Dynamic Reverse Proxy to Cloud Front Distribution returns 502
We would like to have single Nginx to dynamically route requests to different CloudFront ditrbution.
The requester will be passing the CloudFront domains in the Request header and the Nginx will be using the information to route the requests.

`Nginx Domain name  ---> https://nginxdomain

CloudFront Domain1 ---> https://cf-domain1
CloudFront Domain2 ---> https://cf-domain2
CloudFront Domain3 ---> https://cf-domain3`

When the client send the http requests it will include the cloudFront domain Name in the http request as header with name "destination_host".

On making http request from the client, we are getting 502 response.

NGINX Config

```<code>user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;
events {
    worker_connections 1024;
}
http {
    server {
    listen 80 default_server;
    listen [::]:80; # For IPv6 addresses
    server_name ,;
    client_max_body_size 15G;
    proxy_request_buffering off;

    location / {
        proxy_set_header Host $http_destination_host;
        proxy_pass https://$http_destination_host;
        proxy_ssl_server_name on;
    }
  }
}
</code>```

Sample rest call

```<code>curl -i -X GET \
   -H "destination_host:https://cf-domain1" \
 'https://nginxdomain/v1/healthcheck'
</code>```

Instead of dynamically including the value from http header, if we use if condition as shown below, it works fine.  On making any http request with below nginx config its returning 200 status code.

```<code>location / {
    proxy_set_header Host http_destination_host;
    # Here the client sends destination_host as http header when making rest calls
    # we are using a if condition to check the value before redirecting..

    if ($http_destination_host = "https://cf-domain1") {
        proxy_pass https://cf-domain1;
    }

    if ($http_destination_host = "https://cf-domain2") {
        proxy_pass https://cf-domain2;
    }

    if ($http_destination_host = "https://cf-domain3") {
        proxy_pass https://cf-domain3;
    }

    proxy_ssl_server_name on;
}
</code>```

We are expecting a positive response like 200 ok but its returning 502 error

Body:
We would like to have single Nginx to dynamically route requests to different CloudFront ditrbution.
The requester will be passing the CloudFront domains in the Request header and the Nginx will be using the information to route the requests.

`Nginx Domain name  ---> https://nginxdomain

CloudFront Domain1 ---> https://cf-domain1
CloudFront Domain2 ---> https://cf-domain2
CloudFront Domain3 ---> https://cf-domain3`

When the client send the http requests it will include the cloudFront domain Name in the http request as header with name "destination_host".

On making http request from the client, we are getting 502 response.

NGINX Config

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;
events {
    worker_connections 1024;
}
http {
    server {
    listen 80 default_server;
    listen [::]:80; # For IPv6 addresses
    server_name ,;
    client_max_body_size 15G;
    proxy_request_buffering off;

    location / {
        proxy_set_header Host $http_destination_host;
        proxy_pass https://$http_destination_host;
        proxy_ssl_server_name on;
    }
  }
}

Sample rest call

curl -i -X GET \
   -H "destination_host:https://cf-domain1" \
 'https://nginxdomain/v1/healthcheck'

Instead of dynamically including the value from http header, if we use if condition as shown below, it works fine.  On making any http request with below nginx config its returning 200 status code.

location / {
    proxy_set_header Host http_destination_host;
    # Here the client sends destination_host as http header when making rest calls
    # we are using a if condition to check the value before redirecting..

    if ($http_destination_host = "https://cf-domain1") {
        proxy_pass https://cf-domain1;
    }

    if ($http_destination_host = "https://cf-domain2") {
        proxy_pass https://cf-domain2;
    }

    if ($http_destination_host = "https://cf-domain3") {
        proxy_pass https://cf-domain3;
    }

    proxy_ssl_server_name on;
}

We are expecting a positive response like 200 ok but its returning 502 error


问:
X509Chain Build Failed on kubernetes but works with windows machine

I want to validate a client certificate against root certificate (CA) using X509Chain Build(),it works fine with windows machine but when deployed on kubernetes (linux). I am getting below error.

root certificate present inside kubernetes path (root.pem) :  /etc/ssl/certs/
also tried by adding root certificate to this path : /usr/local/share/ca-certificates/

```<code>X509Chain x509Chain = new()
x509Chain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
x509Chain.ChainPolicy.UrlRetrievalTimeout = TimeSpan.FromSeconds(0);
x509Chain.ChainPolicy.VerificationTime = DateTime.Now;
_ = x509Chain.ChainPolicy.ExtraStore.Add(rootCertificate);
Console.WriteLine("Chain Build Status: " + x509Chain.Build(clientCertificate));
</code>```

Error Message :
Certificate Status Information : unable to get local issuer certificate

Certificate Status : PartialChain

I have tried below code with adding to extra store as well as CustomStore but getting

```<code>x509Chain.Build(clientCertificate) returns false and x509Chain.ChainElements.Count = 1

</code>```
```<code>_x509Chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
_ = _x509Chain.ChainPolicy.CustomTrustStore.Add(rootCertificate);
</code>```

Body:
I want to validate a client certificate against root certificate (CA) using X509Chain Build(),it works fine with windows machine but when deployed on kubernetes (linux). I am getting below error.

root certificate present inside kubernetes path (root.pem) :  /etc/ssl/certs/
also tried by adding root certificate to this path : /usr/local/share/ca-certificates/

X509Chain x509Chain = new()
x509Chain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
x509Chain.ChainPolicy.UrlRetrievalTimeout = TimeSpan.FromSeconds(0);
x509Chain.ChainPolicy.VerificationTime = DateTime.Now;
_ = x509Chain.ChainPolicy.ExtraStore.Add(rootCertificate);
Console.WriteLine("Chain Build Status: " + x509Chain.Build(clientCertificate));

Error Message :
Certificate Status Information : unable to get local issuer certificate

Certificate Status : PartialChain

I have tried below code with adding to extra store as well as CustomStore but getting

x509Chain.Build(clientCertificate) returns false and x509Chain.ChainElements.Count = 1

_x509Chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
_ = _x509Chain.ChainPolicy.CustomTrustStore.Add(rootCertificate);


问:
How can I use handcrafted features along with a Pretrained model for image classification
I want to use a handcrafted feature like HOG etc and combine it with a Pretrained model like VGG and study the accuracy

I just dont know how to combine both the things together


问:
framer motion exit animation does not update as expected
I am having problems applying framer motion exit animations in React.
My application requires building an image slider that shows an animation after changing an image.

while pressing the buttons to change images all animations work ok. However, if we change directions (for example slide down and then up) the exit animation does not update the first time and goes in the opposite direction.

here is a repro:
https://codesandbox.io/s/eager-vaughan-nbnlsm?file=/src/App.js

I understand that this problem is caused because the element is already loaded on the DOM with that animation specs, however, I would like to see if there is any workaround to this problem.


问:
How to create a screenshot on Gnome Wayland using c++?
The code using org.gnome.Shell.Screenshot does not work anymore, because GNOME Shell screenshot API no longer allowed. I receive "AccessDenied: Screenshot is not allowed."

Can my desktop application get any permission to create a screenshot? Should I write Wayland compositor? Is there any ideas?

For example, macOS shows security alert with Allow/Deny buttons.


问:
Show Bootstrap carousel indicator as number
I would like to display the slide number of a bootstrap carousel as text in a HTML page, not using the standard indicators, for example 2 of 6 and have it update as slides change. My implantation of the carousel only displays 1 slide at a time. How do I go about that ?</p>


问:
My Selenium scripts in VScode are closing before i can do aynthing on the website it opened
So for about a week ive had this problem where all my selenium files (previously worked fine) are now closing itself the same second the website it opened fully loads. there is no

```<code>driver.quit()
</code>```

in my script so this shouldnt be happening right?

I have tried reinstalling everything and even went as far as reinstalling windows thinking it was somehow corrupting the files but nothing worked. As anyone experienced this? also adding time.sleep doesnt seem to help aswell

Body:
So for about a week ive had this problem where all my selenium files (previously worked fine) are now closing itself the same second the website it opened fully loads. there is no

driver.quit()

in my script so this shouldnt be happening right?

I have tried reinstalling everything and even went as far as reinstalling windows thinking it was somehow corrupting the files but nothing worked. As anyone experienced this? also adding time.sleep doesnt seem to help aswell


问:
Got error when building a project with maven -" cannot find symbol symbol: class Nonnull location: package javax.annotation"
I was trying to build a project following the instruction here https://github.com/MovingImage24/JmeterSockJsSampler, but I got the errors:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[24,24] cannot find symbol
  symbol:   class Nonnull
  location: package javax.annotation
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[25,29] package javax.annotation.meta does not exist
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[26,29] package javax.annotation.meta does not exist
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[49,2] cannot find symbol
  symbol: class Nonnull
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[50,2] cannot find symbol
  symbol: class TypeQualifierNickname
......
```

openjdk version "1.8.0_352-352"

OpenJDK Runtime Environment (build 1.8.0_352-352-b08)

OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)

Body:
I was trying to build a project following the instruction here https://github.com/MovingImage24/JmeterSockJsSampler, but I got the errors:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[24,24] cannot find symbol
  symbol:   class Nonnull
  location: package javax.annotation
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[25,29] package javax.annotation.meta does not exist
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[26,29] package javax.annotation.meta does not exist
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[49,2] cannot find symbol
  symbol: class Nonnull
[ERROR] /C:/D/app/JmeterSockJsSampler/JmeterSockJsSampler/src/main/java/orgMiJmeterSockjsSampler/Nullable.java:[50,2] cannot find symbol
  symbol: class TypeQualifierNickname
......

openjdk version "1.8.0_352-352"

OpenJDK Runtime Environment (build 1.8.0_352-352-b08)

OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)


问:
Why is my order_id in my pivot table not being updated but everything else is?
I have two models, a marketsegment model and a product model, both have a many to many relation with eachother.

Example in MarketSegment.php:

```<code>public function products()
{
    return $this->belongsToMany(Product::class);
}
</code>```

Now I post the following array to a function that updates the pivot table:

```<code>products[]:
6
products[]:
11
</code>```

I want to update market_segment_product to contain all products belonging to a market segment and add the sort order of them for the column order_id. As the order_id I want to use the keys of the above array, so the full data example would be:

```<code>market_segment_id - 7
product_id - 6
order_id - 0

market_segment_id - 7
product_id - 11
order_id - 1
</code>```

I have the following function to update the pivot table:

```<code>public function updateProducts(Request $request, $id)
{

    $marketSegment = MarketSegment::find($id);
    $products = $request->input('products');
    $order = [];
    $i = 0;
    foreach ($products as $id) {
        $order[$id] = $i;
        $i++;
    }
    $data = [];
    foreach ($products as $id) {
        $data[$id] = ['order_id' => $order[$id]];
    }
    $marketSegment->products()->sync($products, $data);

    return [
        'error' => false,
        'message' => 'Producten gewijzigd'
    ];
}
</code>```

But this updates everything except the order_id which stays 0 for all rows. Why doesn't it update the order_id ? I am using laravel 6.

Body:
I have two models, a marketsegment model and a product model, both have a many to many relation with eachother.

Example in MarketSegment.php:

public function products()
{
    return $this->belongsToMany(Product::class);
}

Now I post the following array to a function that updates the pivot table:

products[]:
6
products[]:
11

I want to update market_segment_product to contain all products belonging to a market segment and add the sort order of them for the column order_id. As the order_id I want to use the keys of the above array, so the full data example would be:

market_segment_id - 7
product_id - 6
order_id - 0

market_segment_id - 7
product_id - 11
order_id - 1

I have the following function to update the pivot table:

public function updateProducts(Request $request, $id)
{

    $marketSegment = MarketSegment::find($id);
    $products = $request->input('products');
    $order = [];
    $i = 0;
    foreach ($products as $id) {
        $order[$id] = $i;
        $i++;
    }
    $data = [];
    foreach ($products as $id) {
        $data[$id] = ['order_id' => $order[$id]];
    }
    $marketSegment->products()->sync($products, $data);

    return [
        'error' => false,
        'message' => 'Producten gewijzigd'
    ];
}

But this updates everything except the order_id which stays 0 for all rows. Why doesn't it update the order_id ? I am using laravel 6.


问:
How to label a whole dataset?
I have a question.I have a pandas dataframe that contains 5000 columns and 12 rows. Each row represents the signal received from an electrocardiogram lead. I want to assign 3 labels to this dataset. These 3 tags belong to the entire dataset and are not related to a specific row. How can I do this?

I have attached the picture of my dataframepandas dataframe.

and my labels are: Atrial Fibrillation:0,
right bundle branch block:1,
T Wave Change:2

I tried to assign 3 labels to a large dataset
(Not for a specific row or column)
but I didn't find a solution.

As you see, it has 12 rows and 5000 columns. each row represents 5000 data from one specific lead and overall we have 12 leads which refers to this 12 rows (I, II, III, aVR,.... V6) in my data frame. professional experts are recognised 3 label for this data frame which helps us to train a ML Model to detect different heart disease. I have 10000 data frame just like this and each one has 3 or 4 specific labels. Here is my question: How can I assign these 3 labels to this dataset that I mentioned.as I told before these labels don't refers to specific rows, in fact each data frame has 3 or 4 label for its whole. I mean, How can I assign 3 label to a whole data frame?

Title: How to label a whole dataset?


问:
Typescript get function parameters
```<code>let func = (myFunc: (arg1: any, arg2: any) => void)=>{
    // WHEN I PASS the *testFunction* in parameter:

    console.log(myFunc.name);// THIS PRINTS "testFunction"

    //console.log( typeof myFunc.params[1])   /* I WANT THIS TO LOG "string" */

    //console.log( typeof myFunc.params[2])   /* I WANT THIS TO LOG "number" */

}

let testFunction = (arg1: string, arg2: number) => { }
</code>```

I need to know the type of arguments of the function that has been passed.

Anyone can help please?

Title: Typescript get function parameters

Body:
let func = (myFunc: (arg1: any, arg2: any) => void)=>{
    // WHEN I PASS the *testFunction* in parameter:

    console.log(myFunc.name);// THIS PRINTS "testFunction"

    //console.log( typeof myFunc.params[1])   /* I WANT THIS TO LOG "string" */

    //console.log( typeof myFunc.params[2])   /* I WANT THIS TO LOG "number" */

}

let testFunction = (arg1: string, arg2: number) => { }

I need to know the type of arguments of the function that has been passed.

Anyone can help please?


问:
Frida pass hookDetected and isJailBroken methods on Android
We are working on a react native app that uses "jail-monkey": "^2.7.0", and at the initialisation of the app we check if the device is jail broken or in case there are any hooking methods attached to our app with JailMonkey.hookDetected() || JailMonkey.isJailBroken() so we can throw a warning message to the user, but the problem is that just by doing that, a pentest team achieved to use the Android app without getting the warning message using Frida.

My question: should we add something else beside that? Is there any known issue where Frida can penetrate these methods?

Thank you for your time!


问:
Vercel Really Slow Server Response of Assets
I built a website with the help of Next.js. The website contains images and videos. The videos are autoplayed which means they are fetched immediately. The website has been deployed on Vercel. I experience big issues with the loading times of all assets not only the videos:

Chrome Dev Tools showing loading times of assets

It seems like the assets are served one after another and since some of the videos are quite big ~10Mb other resources are blocked for quite a while.

Is it normal that Vercel does only serve one asset at a time? I thought that multiple videos or images could be served simultaneously.

Also, I am wondering why it does take so long in the first place. My internet connection is roughly 100Mbit/s and I do not experience any issues on other websites I have deployed to Vercel. Just this one is incredibly slow and has issues serving the assets.

Does anyone know what's happening?

I already thought the problem was that there were too many and too big videos on the website which is why I reduced the size of each video and added a lazy loading functionality to the videos so they are just loaded when needed. However, this didn't solve the issue.


问:
How to check whether a crt file is wildcard when its CN is not domain
I have some crt file which their CNs are as follows, AAA Certificate Services, Sectigo RSA Domain Validation Secure Server CA, USERTrust RSA Certification Authority.

Are them the main certificate file? How can I detect their domains? How to check whether they are wildcard or not?

I have searched about it. It seems as if they are root and intermediate certificates. I wonder whether it is correct or not. If so, I cannot reach domain?


问:
GUID(contains hashes (non hex-encoded data)) in Dbus message
I'am working on a project(c++) that have already dbus communication working well. I added one feild (GUID) in existing message. My application receives this message from outside. Then, if this message contains the new field converted to std::string all works well but the size of message is, logically, too big than expected. And if this feild is not converted and contains hashes that kill the dbus-deamon without any exception.
is it possible to send non hex-encoded data in dbus messages ?</p>


问:
How do I create a locale backup from my mongo DB in Atlas?
I've been searching for a way to make a backup and while the page seems to have much information I can't find a way to backup the db from Atlas to my locale. The closest I've found is the mongodump command but what would I have to indicate if it's even possible with this command?


问:
Google Sign In Integration Testing Flutter
I have implemented Google Sign In using Firebase, but somehow while performing the Integration Testing, I am not able to click the different email address options when the default dialog box opens to sign in. Is there any way I can click on the email given in the dialog box and navigate to the next screen.
The test for finding the login button passess successfully, but the testing app closes once the test has passed not clicking any of the given email addressess on the dialog box.
Attaching screen shots of start screen and email dialog box for better understanding.

Code

```<code>void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  group('end-to-end test', () {
    var log = find.byType(LoginButton);

    testWidgets('Login Button Test', (tester) async {
      app.main();
      await tester.pumpAndSettle();
      await tester.tap(log);
      await tester.pumpAndSettle();
    });
  });
}
</code>```

Body:
I have implemented Google Sign In using Firebase, but somehow while performing the Integration Testing, I am not able to click the different email address options when the default dialog box opens to sign in. Is there any way I can click on the email given in the dialog box and navigate to the next screen.
The test for finding the login button passess successfully, but the testing app closes once the test has passed not clicking any of the given email addressess on the dialog box.
Attaching screen shots of start screen and email dialog box for better understanding.

Code

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  group('end-to-end test', () {
    var log = find.byType(LoginButton);

    testWidgets('Login Button Test', (tester) async {
      app.main();
      await tester.pumpAndSettle();
      await tester.tap(log);
      await tester.pumpAndSettle();
    });
  });
}


问:
Hack to delete characters on Copy Paste routine
I need to copy paste a number of tag names manually, and the syntax of the tag names is different on the source.

Eg ["name"."value"] need to be converted to [name.value]

Is there some kid of app that can replace chars on the fly, not needing to paste into a different app to remove characters, or remove them manually?


问:
Laravel Sail Project - Change working directory of a controller (php file) or integrate php project with laravel's sail project
I am working on a project with Laravel. I have created it with sail. I am trying to use the api from a different tool, so following it's instructions it guides me to download from swagger editor a generated client.So independently, I have a php project (php-client from swagger editor) which I can interact with the tool. I am trying to include the files of this project inside my laravel's sail project, but because the use of containers and etc. the working directory of php laravel script is totally different. I don't know how to approach the solution. I can understand that the laravel sail project use a totally "different machine" because of sail. But how can I integrate this project to my laravel sail project or how can I serve this project with same working directory, just to make an include.</p>


问:
Get env variables in vue template without "vue_app" prefix
I ran into an issue where I would need to get the app url from env in my vue template. And I found out that to get something from env in vue, they need a prefix "VUE_APP". Eventually resolved it by using: window.location.origin+'/'. Thing is, I wont always have control over the naming of env or the customer (or if they insist on NOT putting anything on constant.php). And someday I might require something that cant be replicated by anything else. Is there a way to get env variables without the prefix?

Note: I know this has been asked before here: Vue cli env without prefix VUE_APP

But all this says is: dont do this. So what can I do if I face something like this? Is there a workaround or do I just pray that I dont get screwed by the requirements?


问:
Can I create a static page (user facing) which will be handled by my plugin?
I am trying to integrate a payment gateway by creating a plugin. So I'll need a page where after the user places an order and pays, the payment gateway will redirect to with some query params which I can use to verify the status of the transaction. I'll appreciate any help</p>


问:
What is the correct way to add JBoss EAP 7.4.3 cipher-suite configuration? please explain in detail
I want to add this cipher in jboss EAP 7.4.3 how could i with SSL=true for "TLSv1.2"

TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256"

we tried to add ciphers in ManagementRelam but i think the way i put the ciphers are not correct as well as
location where i put it is also not correct.


问:
Asynchronous execution of a loop: how to make it synchronous
spring-boot-starter-parent 3.0.0

It may be important. Anyway, under the hood:
<spring-framework.version>6.0.2</spring-framework.version>

```<code>import lombok.Synchronized;
...

@Service
@RequiredArgsConstructor
public class RequestService {

    @Synchronized
    public void scrape() {
        List<SiteEntity> sites = siteRepository.findAllByActiveTrue();
        System.out.println("Method: The Thread name is " + Thread.currentThread().getName());

        for (SiteEntity site : sites) {
            System.out.println("Site: " + site.getUrl());

            System.out.println("Outer: The Thread name is " + Thread.currentThread().getName());

            List<PhraseEntity> phrases = phraseRepository.findAllActivePhrasesBySite(site.getId());
            assertSameSite(phrases, site);

            final int CHUNK = 10;
            List<List<PhraseEntity>> phraseChunks = Lists.partition(phrases, CHUNK);

            for (List<PhraseEntity> chunk : phraseChunks) {

                System.out.println("Inner: The Thread name is " + Thread.currentThread().getName());

                System.out.println(chunk.get(0).getPhrase() + " : " + chunk.get(chunk.size() - 1).getPhrase());
                Document doc = sendRequest(chunk, 0);

                saveManager.save(doc);
            }
        }
    }
}
</code>```

The service is scraping positions of a web site in a search engine.

For debug purpose I have input each site 100 phrases. That totals to 200 phrases.

This loop can change sites arbitrarily. And the total amount of results can be like 380 (despite the fact that the total amount of phrases is 200).

The reason of that is asynchronicity. I print the names of threads. They change.

Lombok's @Synchronized has not helped

Questions:

Am I right that Spring is asynchronous by default? Documentation: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.task-execution-and-scheduling

How can I execute this loop synchronously?

Body:
spring-boot-starter-parent 3.0.0

It may be important. Anyway, under the hood:
<spring-framework.version>6.0.2</spring-framework.version>

import lombok.Synchronized;
...

@Service
@RequiredArgsConstructor
public class RequestService {

    @Synchronized
    public void scrape() {
        List<SiteEntity> sites = siteRepository.findAllByActiveTrue();
        System.out.println("Method: The Thread name is " + Thread.currentThread().getName());

        for (SiteEntity site : sites) {
            System.out.println("Site: " + site.getUrl());

            System.out.println("Outer: The Thread name is " + Thread.currentThread().getName());

            List<PhraseEntity> phrases = phraseRepository.findAllActivePhrasesBySite(site.getId());
            assertSameSite(phrases, site);

            final int CHUNK = 10;
            List<List<PhraseEntity>> phraseChunks = Lists.partition(phrases, CHUNK);

            for (List<PhraseEntity> chunk : phraseChunks) {

                System.out.println("Inner: The Thread name is " + Thread.currentThread().getName());

                System.out.println(chunk.get(0).getPhrase() + " : " + chunk.get(chunk.size() - 1).getPhrase());
                Document doc = sendRequest(chunk, 0);

                saveManager.save(doc);
            }
        }
    }
}

The service is scraping positions of a web site in a search engine.

For debug purpose I have input each site 100 phrases. That totals to 200 phrases.

This loop can change sites arbitrarily. And the total amount of results can be like 380 (despite the fact that the total amount of phrases is 200).

The reason of that is asynchronicity. I print the names of threads. They change.

Lombok's @Synchronized has not helped

Questions:

Am I right that Spring is asynchronous by default? Documentation: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.task-execution-and-scheduling

How can I execute this loop synchronously?


问:
convert a string of a wire/reg name to the actual wire systemverilog
Let's say that I have a wire name in a string.
I want to get access the wire itself, via the string (i.e., some type of casting from name to the name itself), in verilog.
 The code would like (if we use force):

force string_to_wire( "if.kl[1:0]" ) = 2'b10;

It will apply value 2'b10 to wire/reg if.kl[1:0]

Is that doable?
Thanks


问:
Read and Edit TGZ or Zip (containing CSV file) file in Spring Batch
I have a tgz file which contains the mulitple folder of specific date and each folder contains various CSV files. So I have to edit some of the files in each folder using spring batch, after editing I should have new edited tgz file. I guess I would need to write my own ItemReader and ItemWriter to work with tgz or zip file.

I am not sure how would the implementation will look like, do I'd need to extract them first in ItemReader and then edit them , or only extract the files that I have edit and then write them in tgz file(I am not sure if that's possible). Extracting the whole tgz file will not work because, we don't have enough space, that's why we want to work with tgz or zip file.

And can I directly read from tgz or zip file without extracting them ? Any suggestion how should I build this application ?


问:
C++20 function overloading with references
I'm diving into the implicit conversions of C++20, and came up with this example:

```<code>#include <iostream>

void f(int a){ std::cout << 1; }
void f(int &a){ std::cout << 2; }

int main(){
  int a = 1;
  int &b = a;

  f(a); // This is ambiguous
  f(b); // So is this

  const int c = 1;
  f(c); // This works, as you cannot take a reference of a const
  f(42); // So does this, normal
}
</code>```

Which leaves me with the following questions:

How can I call the second definition of f?

If I cannot call it, why doesn't the compiler tell me so?

For 2., I'm currently learning rust (since 2 years), and am used to be informed for every stupid thing I do by the compiler...

Thanks for any help,

Linus

Body:
I'm diving into the implicit conversions of C++20, and came up with this example:

#include <iostream>

void f(int a){ std::cout << 1; }
void f(int &a){ std::cout << 2; }

int main(){
  int a = 1;
  int &b = a;

  f(a); // This is ambiguous
  f(b); // So is this

  const int c = 1;
  f(c); // This works, as you cannot take a reference of a const
  f(42); // So does this, normal
}

Which leaves me with the following questions:

How can I call the second definition of f?

If I cannot call it, why doesn't the compiler tell me so?

For 2., I'm currently learning rust (since 2 years), and am used to be informed for every stupid thing I do by the compiler...

Thanks for any help,

Linus


问:
Android 13 request notification permission crash
I am running an App that targets Android 13 on a Samsung device with Android 13.

I need to check at runtime if the notifications permission is granted or not and if it is not granted I need to request it,

here is how to request the new permission

```<code>pushNotificationPermissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS)

  private val pushNotificationPermissionLauncher = registerForActivityResult(
    ActivityResultContracts.RequestPermission()
) { granted ->

}
</code>```

My Mainfest have the required permission delaration

```<code><uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
</code>```

But when i request the permisison i am getting this crash,

```<code>Failed looking up ApplicationInfo for com.testapp

</code>```

android.content.pm.PackageManager$NameNotFoundException: com.testapp                                                                                at android.app.ApplicationPackageManager.getApplicationInfoAsUser(ApplicationPackageManager.java:504)
at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:487)
at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:481)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver.resolveNotificationSdk(TargetSdkResolver.kt:46)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver.access$resolveNotificationSdk(TargetSdkResolver.kt:29)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver$initialize$1.onEntryBind(TargetSdkResolver.kt:36)
at com.android.systemui.statusbar.notification.collection.notifcollection.BindEntryEvent.dispatchToListener(NotifEvent.kt:48)
at com.android.systemui.statusbar.notification.collection.notifcollection.NotifEvent.dispatchTo(NotifEvent.kt:36)
at com.android.systemui.statusbar.notification.collection.NotifCollection.dispatchEventsAndRebuildList(NotifCollection.java:593)
at com.android.systemui.statusbar.notification.collection.NotifCollection.onNotificationPosted(NotifCollection.java:398)
at com.android.systemui.statusbar.notification.collection.NotifCollection.-$$Nest$monNotificationPosted(Unknown Source:0)
at com.android.systemui.statusbar.notification.collection.NotifCollection$1.onNotificationPosted(NotifCollection.java:838)
at com.android.systemui.statusbar.notification.collection.coalescer.GroupCoalescer$1.onNotificationPosted(GroupCoalescer.java:131)
at com.android.systemui.statusbar.NotificationListener.lambda$onNotificationPosted$1(NotificationListener.java:145)
at com.android.systemui.statusbar.NotificationListener.$r8$lambda$fICxp1QDMnCbsW19erR3r8vu9YQ(Unknown Source:0)
at com.android.systemui.statusbar.NotificationListener$$ExternalSyntheticLambda2.run(Unknown Source:6)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

any help, please?

Body:
I am running an App that targets Android 13 on a Samsung device with Android 13.

I need to check at runtime if the notifications permission is granted or not and if it is not granted I need to request it,

here is how to request the new permission

pushNotificationPermissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS)

  private val pushNotificationPermissionLauncher = registerForActivityResult(
    ActivityResultContracts.RequestPermission()
) { granted ->

}

My Mainfest have the required permission delaration

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

But when i request the permisison i am getting this crash,

Failed looking up ApplicationInfo for com.testapp

android.content.pm.PackageManager$NameNotFoundException: com.testapp                                                                                at android.app.ApplicationPackageManager.getApplicationInfoAsUser(ApplicationPackageManager.java:504)
at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:487)
at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:481)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver.resolveNotificationSdk(TargetSdkResolver.kt:46)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver.access$resolveNotificationSdk(TargetSdkResolver.kt:29)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver$initialize$1.onEntryBind(TargetSdkResolver.kt:36)
at com.android.systemui.statusbar.notification.collection.notifcollection.BindEntryEvent.dispatchToListener(NotifEvent.kt:48)
at com.android.systemui.statusbar.notification.collection.notifcollection.NotifEvent.dispatchTo(NotifEvent.kt:36)
at com.android.systemui.statusbar.notification.collection.NotifCollection.dispatchEventsAndRebuildList(NotifCollection.java:593)
at com.android.systemui.statusbar.notification.collection.NotifCollection.onNotificationPosted(NotifCollection.java:398)
at com.android.systemui.statusbar.notification.collection.NotifCollection.-$$Nest$monNotificationPosted(Unknown Source:0)
at com.android.systemui.statusbar.notification.collection.NotifCollection$1.onNotificationPosted(NotifCollection.java:838)
at com.android.systemui.statusbar.notification.collection.coalescer.GroupCoalescer$1.onNotificationPosted(GroupCoalescer.java:131)
at com.android.systemui.statusbar.NotificationListener.lambda$onNotificationPosted$1(NotificationListener.java:145)
at com.android.systemui.statusbar.NotificationListener.$r8$lambda$fICxp1QDMnCbsW19erR3r8vu9YQ(Unknown Source:0)
at com.android.systemui.statusbar.NotificationListener$$ExternalSyntheticLambda2.run(Unknown Source:6)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

any help, please?


问:
Open a blog post in a pop-up modal with wordpress like instagram does
as the question already says I am looking for a way to open a wordpress blog as a modal. For easier understanding, I want to recreate/customize the Instagram page for my purposes. So it's from the home page layout like Instagram and the modal pop-up should also open like there. Is there any way whether as code or plugin that I can dynamically play out the content from each blog item for each post in a modal?

For the implementation of the project, I use the Avada theme, maybe this is still a helpful information :)

Example image attached...

Thanks a lot for your help,
Greetings Alex

Overview
Modal-Popup

So far I have only tried to open the modal as a pop-up at all, however not even that has worked so far. I look forward to your support, thank you.


问:
JSON.stringify() arguments returns objects in a straight line with slashes // in between
JSON.stringify() arguments still returns objects in a straight line with slashes // in between.

I added ```JSON.stringify(stringifiedData, null, 4) to my code to prettify my object. But I am still getting all my data in a straight line with slashes in between.</p>
<p><strong>what I am getting:</strong></p>
<p><code>"{\"stringifiedData\":\"\\\"{\\\\\\\"collection\\\\\\\":[{\\\\\\\"fruit\\\\\\\":\\\\\\\"apple\\\\\\\",\\\\\\\"clothings\\\\\\\":{\\\\\\\"item\\\\\\\":\\\\\\\"winter\\\\\\\"}},{\\\\\\\"fitness\\\\\\\":\\\\\\\"treadmill\\\\\\\",\\\\\\\"mindfulness\\\\\\\":\\\\\\\"app called calm\\\\\\\"}]}\\\"\"}"</code></p>
<p><strong>Here's the code:</strong></p>
```const fs = require("fs").promises;

async function dataReader(filePath, data) {
  const result = await fs.readFile(filePath);
  try {
    return JSON.parse(result);
  } catch (e) {
    console.error(e);
  }
}

//read values.json
(async () => {
  const value = await dataReader("./values.json");

  //read collection.json
  const data = await dataReader("./collections.json");

  //replace tokens in `collection.js` with `values.js`
  let stringifiedData = JSON.stringify(data);
  Object.keys(value).forEach((token) => {
    stringifiedData = stringifiedData.replaceAll(`__${token}__`, value[token])
  });

  // write/save the new replaced token values in collection.json
  await fs.writeFile("./collections.json", JSON.stringify(stringifiedData, null, 4));
})();
```
<p><strong>collection.json</strong></p>
```{
  "collection" : [
    {
      "fruit": "__fruit_type__",
    "clothings":{
      "item": "__clothing_type__}"
    }
  },
  {
    "fitness": "__fitness_equipment__",
    "mindfulness": "app called __meditation_app__"
  }
]
}

```
```**values.json**
```
```{
    "clothing_type": "winter",
   "fruit_type": "apple",
   "fitness_equipment": "treadmill",
   "meditation_app": "calm"
}
```
<p><strong>expected result:</strong></p>
```{
  "collection": [
    {
      "fruit":"apple",
      "clothings":{
        "item":"winter}"
      }
    },
    {
      "fitness":"treadmill",
      "mindfulness":"app called calm"
    }
  ]
}
```

Body:
JSON.stringify() arguments still returns objects in a straight line with slashes // in between.

I added ```JSON.stringify(stringifiedData, null, 4) to my code to prettify my object. But I am still getting all my data in a straight line with slashes in between.

what I am getting:

"{\"stringifiedData\":\"\\\"{\\\\\\\"collection\\\\\\\":[{\\\\\\\"fruit\\\\\\\":\\\\\\\"apple\\\\\\\",\\\\\\\"clothings\\\\\\\":{\\\\\\\"item\\\\\\\":\\\\\\\"winter\\\\\\\"}},{\\\\\\\"fitness\\\\\\\":\\\\\\\"treadmill\\\\\\\",\\\\\\\"mindfulness\\\\\\\":\\\\\\\"app called calm\\\\\\\"}]}\\\"\"}"

Here's the code:

const fs = require("fs").promises;

async function dataReader(filePath, data) {
  const result = await fs.readFile(filePath);
  try {
    return JSON.parse(result);
  } catch (e) {
    console.error(e);
  }
}

//read values.json
(async () => {
  const value = await dataReader("./values.json");

  //read collection.json
  const data = await dataReader("./collections.json");

  //replace tokens in `collection.js` with `values.js`
  let stringifiedData = JSON.stringify(data);
  Object.keys(value).forEach((token) => {
    stringifiedData = stringifiedData.replaceAll(`__${token}__`, value[token])
  });

  // write/save the new replaced token values in collection.json
  await fs.writeFile("./collections.json", JSON.stringify(stringifiedData, null, 4));
})();

collection.json

{
  "collection" : [
    {
      "fruit": "__fruit_type__",
    "clothings":{
      "item": "__clothing_type__}"
    }
  },
  {
    "fitness": "__fitness_equipment__",
    "mindfulness": "app called __meditation_app__"
  }
]
}

**values.json**

{
    "clothing_type": "winter",
   "fruit_type": "apple",
   "fitness_equipment": "treadmill",
   "meditation_app": "calm"
}

expected result:

{
  "collection": [
    {
      "fruit":"apple",
      "clothings":{
        "item":"winter}"
      }
    },
    {
      "fitness":"treadmill",
      "mindfulness":"app called calm"
    }
  ]
}


问:
My React Native App Syncing with Expo App
I created an App in Expo first but for bluetooth printing i shift my project to react-native
then after some time i want to update something but react-native android build was failing so i just copy project removed print button and build in expo but the problem is now the already build apk hiding that print button sometimes why it is happening both are different apk different platform
one is react-native cli other is expo cli why it is syncing with each other.

Anybody having this problem ?


问:
Regex to find html comment if it is not within a code block
I'm looking for a regex to find HTML comments if the comment is not within a code block (represented by three backticks ```).</p>
<p>So far, I can prevent finding HTML comments if the backticks are in the same line, but I can't find a way to avoid it if there are on the line before.</p>
<p>My regex now: <code>^((```){0})\s*)

Some of my tests, the first three should work, not the last three (I can't write them because of the formatting with the backticks)


问:
How to enable multithreading for dsyev when wrapped with pybind11 in c++
I am trying to wrap a some of c++ code with pybind11. But, I am not able enable multi-threading for LAPACK/BLAS functions.

Currently, I just use ‘-fopenmp’ while compiling with gcc to enable parallelisation. With this I am able to parallelise other functions like matrix-matrix multiplication from Eigen but not the LAPACK/BLAS functions.


问:
reading (not writing) last_write_time gives a file creation error
I'm stumped... it took me a while to track this down.. because I don't have visual C++ IDE installed on the problematic system (it is windows server 2019)... my code works fine with VS 2022 on my laptop (W11 22H2)... anyhow.. I get this exception

Cannot create a file when that file already exists

I tracked it down to this code:

const auto fileTime = fs::last_write_time(p);
```

apparently this function can also write to the file to modify the time.

but I'm just trying to read it... (I didn't add the arguments necessary to write)

does anyone have any idea why this error might be happening?

https://en.cppreference.com/w/cpp/filesystem/last_write_time

please note it is highly likely that sometimes the file is actually being written to when I call this code (this code is called in a loop, and so is the file that is being written by another program)

Body:
I'm stumped... it took me a while to track this down.. because I don't have visual C++ IDE installed on the problematic system (it is windows server 2019)... my code works fine with VS 2022 on my laptop (W11 22H2)... anyhow.. I get this exception

Cannot create a file when that file already exists

I tracked it down to this code:

const auto fileTime = fs::last_write_time(p);

apparently this function can also write to the file to modify the time.

but I'm just trying to read it... (I didn't add the arguments necessary to write)

does anyone have any idea why this error might be happening?

https://en.cppreference.com/w/cpp/filesystem/last_write_time

please note it is highly likely that sometimes the file is actually being written to when I call this code (this code is called in a loop, and so is the file that is being written by another program)


问:
How to search a product by specific category in Laravel with jQuery function?
I am developing a website and I am stuck in a problem where I am not getting products by categories when I select "All Categories" its working fine but when I try to select a category it again displays me the products that are shown in "All Categories" I am not getting any clue why is it happening.
Shortly, I need to get all products as well as I need products from specific category.

i tried to do it like that:

Frontend Controller

Function for returning data into view

```<code>   public function search_load($keyword) {
        $Cat = "";
        $Desc = 1;
        $Model = 1;
        $Filter = array();
        if(isset($_GET['category'])) {
            if($_GET['category'] != "") {
                $Cat = $_GET['category'];
            }
        }
        if(isset($_GET['desc'])) {
            if($_GET['desc'] != "") {
                $Desc = $_GET['desc'];
            }
        }
        if(isset($_GET['model'])) {
            if($_GET['model'] != "") {
                $Model = $_GET['model'];
            }
        }
        $Filter = ["category" => $Cat, "desc" => $Desc, "model" => $Model];
        $search =  $this->search_products($keyword, $Filter);
        $cat = $this->get_categories();
        $ProductNames = $this->product_names();
        $cart_item = $this->get_cart_products();
        return view("search-result", compact('cat','ProductNames','search','keyword','cart_item'));
    }
</code>```

Function for keyword related product searching Product

```<code>    public function search_products($keyword, $filter = array()) {
        $Products = Product::query();
        if(!empty($filter)) {
            if($filter['desc'] == "1") {
                $Products = $Products->orWhere('description','like','%' . $keyword . '%');
            }
            if($filter['model'] == "1") {
                $Products = $Products->orWhere('model_no','like','%' . $keyword . '%');
            }

            if($filter['category'] != "" && $filter['category'] > "0") {
                $cat = $filter['category'];
                // return $cat;
                $Products = $Products->whereIn('parent_category', [$cat]);
            }
            $Products = $Products->where('name','like','%' . $keyword . '%')
            ->orWhere('upc_code','like','%' . $keyword . '%')
            ->orWhere('consumer_upc1','like','%' . $keyword . '%')
            ->orWhere('consumer_upc2','like','%' . $keyword . '%');
        }

        $Products = $Products->where('status','1')->paginate(20);
        return $Products;
    }
</code>```

jQuery Function

```<code>function search22()
{
    var SText = document.getElementById("text-search").value;
    SText = SText.replace("&","amp;");
    var Category = document.getElementById("category").value;
    var PDesc = 1;
    var PModel = 1;
    var link = "/search/"+ SText;
    var parameter = "";
    if(SText != "")
    {
        if(Category != "")

        {
            parameter = "category=" + Category;
        }
        if(PDesc == "1"){
            if(parameter != ""){

                parameter += "&desc=1";
            }
            else{
                parameter = "desc=1";
            }
        }
        if(PModel == "1"){
            if(parameter != ""){

                parameter +=  "&model=1";
            }
            else{
                parameter = "model=1";
            }
        }
        if(parameter != ""){
            link += "?" + parameter;
        }

     window.location.href = link;

        }

    }
</code>```

`

Body:
I am developing a website and I am stuck in a problem where I am not getting products by categories when I select "All Categories" its working fine but when I try to select a category it again displays me the products that are shown in "All Categories" I am not getting any clue why is it happening.
Shortly, I need to get all products as well as I need products from specific category.

i tried to do it like that:

Frontend Controller

Function for returning data into view

   public function search_load($keyword) {
        $Cat = "";
        $Desc = 1;
        $Model = 1;
        $Filter = array();
        if(isset($_GET['category'])) {
            if($_GET['category'] != "") {
                $Cat = $_GET['category'];
            }
        }
        if(isset($_GET['desc'])) {
            if($_GET['desc'] != "") {
                $Desc = $_GET['desc'];
            }
        }
        if(isset($_GET['model'])) {
            if($_GET['model'] != "") {
                $Model = $_GET['model'];
            }
        }
        $Filter = ["category" => $Cat, "desc" => $Desc, "model" => $Model];
        $search =  $this->search_products($keyword, $Filter);
        $cat = $this->get_categories();
        $ProductNames = $this->product_names();
        $cart_item = $this->get_cart_products();
        return view("search-result", compact('cat','ProductNames','search','keyword','cart_item'));
    }

Function for keyword related product searching Product

    public function search_products($keyword, $filter = array()) {
        $Products = Product::query();
        if(!empty($filter)) {
            if($filter['desc'] == "1") {
                $Products = $Products->orWhere('description','like','%' . $keyword . '%');
            }
            if($filter['model'] == "1") {
                $Products = $Products->orWhere('model_no','like','%' . $keyword . '%');
            }

            if($filter['category'] != "" && $filter['category'] > "0") {
                $cat = $filter['category'];
                // return $cat;
                $Products = $Products->whereIn('parent_category', [$cat]);
            }
            $Products = $Products->where('name','like','%' . $keyword . '%')
            ->orWhere('upc_code','like','%' . $keyword . '%')
            ->orWhere('consumer_upc1','like','%' . $keyword . '%')
            ->orWhere('consumer_upc2','like','%' . $keyword . '%');
        }

        $Products = $Products->where('status','1')->paginate(20);
        return $Products;
    }

jQuery Function

function search22()
{
    var SText = document.getElementById("text-search").value;
    SText = SText.replace("&","amp;");
    var Category = document.getElementById("category").value;
    var PDesc = 1;
    var PModel = 1;
    var link = "/search/"+ SText;
    var parameter = "";
    if(SText != "")
    {
        if(Category != "")

        {
            parameter = "category=" + Category;
        }
        if(PDesc == "1"){
            if(parameter != ""){

                parameter += "&desc=1";
            }
            else{
                parameter = "desc=1";
            }
        }
        if(PModel == "1"){
            if(parameter != ""){

                parameter +=  "&model=1";
            }
            else{
                parameter = "model=1";
            }
        }
        if(parameter != ""){
            link += "?" + parameter;
        }

     window.location.href = link;

        }

    }

`


问:
passing parameter from custom filter to web api controller
I am working on a web application in which we are using web-api and oAuth2.

I had stored my UserId in front-end but now for security reason I am storing my UserId in backend against the token generated from oAuth2.

So I have around 800 api's in my application all of them are POST api's and the data is passing in those api's like below

Type 1

```<code>[HttpPost]
[Authorize]
[ActionName("GetList")]
[Filters.AuthorizeLoginApi()]
public List<BusinessEntities.Admin.Users> GetList(Dictionary<string, string> Parameters)
{
    try
    {
        if (Parameters != null)
        {
            BusinessLayer.IAdmin.IUsers a = (BusinessLayer.IAdmin.IUsers)DALFinder.GetInstance(typeof(BusinessLayer.IAdmin.IUsers));
            return a.GetList(Convert.ToString(Parameters["LoginText"]), Convert.ToString(Parameters["Name"])
                , Convert.ToString(Parameters["Email"]), Convert.ToInt32(Parameters["UserTypeId"]), Convert.ToString(Parameters["IsActive"])
                , Convert.ToInt32(Parameters["UserId"])); /*(LoginText, Name, Email, UserTypeId, IsActive, UserId);*/
        }
        else
        {
            return new List<BusinessEntities.Admin.Users>();
        }
    }
    catch (Exception ex)
    {
        Utils.Logger.Instance.LogException(ex);
        return new List<BusinessEntities.Admin.Users>();
    }
}
</code>```

In the above code I have a Dictionary parameter in which I am storing my userId

Type 2

```<code>[HttpPost]
[Authorize]
[ActionName("Delete")]
[Filters.AuthorizeLoginApi()]
public SPResponse Delete(BusinessEntities.Admin.Users item)
{
    SPResponse response = new SPResponse();
    try
    {
        //item.ModifiedByUserId is my UserId
        BusinessLayer.IAdmin.IUsers a = (BusinessLayer.IAdmin.IUsers)DALFinder.GetInstance(typeof(BusinessLayer.IAdmin.IUsers));
        response = a.Delete(item);
    }
    catch (Exception ex)
    {
        response.ReturnMessage = ex.Message;
    }
    return response;
}
</code>```

I am doing custom validation in each and every api calls like below

```<code>public class AuthorizeLoginApi : ActionFilterAttribute
{
    public override void OnActionExecuting(HttpActionContext actionContext)
    {
        //Code to Get userId from database
        //int UserId = data coming from db
        //pass the above UserId Parameter into every apis as UserId/ModifiedByUserId
    }
}
</code>```

Now I want to Pass UserId/ModifiedByUserId from OnActionExecuting filter method into my respective API's

How can I achieve this

Body:
I am working on a web application in which we are using web-api and oAuth2.

I had stored my UserId in front-end but now for security reason I am storing my UserId in backend against the token generated from oAuth2.

So I have around 800 api's in my application all of them are POST api's and the data is passing in those api's like below

Type 1

[HttpPost]
[Authorize]
[ActionName("GetList")]
[Filters.AuthorizeLoginApi()]
public List<BusinessEntities.Admin.Users> GetList(Dictionary<string, string> Parameters)
{
    try
    {
        if (Parameters != null)
        {
            BusinessLayer.IAdmin.IUsers a = (BusinessLayer.IAdmin.IUsers)DALFinder.GetInstance(typeof(BusinessLayer.IAdmin.IUsers));
            return a.GetList(Convert.ToString(Parameters["LoginText"]), Convert.ToString(Parameters["Name"])
                , Convert.ToString(Parameters["Email"]), Convert.ToInt32(Parameters["UserTypeId"]), Convert.ToString(Parameters["IsActive"])
                , Convert.ToInt32(Parameters["UserId"])); /*(LoginText, Name, Email, UserTypeId, IsActive, UserId);*/
        }
        else
        {
            return new List<BusinessEntities.Admin.Users>();
        }
    }
    catch (Exception ex)
    {
        Utils.Logger.Instance.LogException(ex);
        return new List<BusinessEntities.Admin.Users>();
    }
}

In the above code I have a Dictionary parameter in which I am storing my userId

Type 2

[HttpPost]
[Authorize]
[ActionName("Delete")]
[Filters.AuthorizeLoginApi()]
public SPResponse Delete(BusinessEntities.Admin.Users item)
{
    SPResponse response = new SPResponse();
    try
    {
        //item.ModifiedByUserId is my UserId
        BusinessLayer.IAdmin.IUsers a = (BusinessLayer.IAdmin.IUsers)DALFinder.GetInstance(typeof(BusinessLayer.IAdmin.IUsers));
        response = a.Delete(item);
    }
    catch (Exception ex)
    {
        response.ReturnMessage = ex.Message;
    }
    return response;
}

I am doing custom validation in each and every api calls like below

public class AuthorizeLoginApi : ActionFilterAttribute
{
    public override void OnActionExecuting(HttpActionContext actionContext)
    {
        //Code to Get userId from database
        //int UserId = data coming from db
        //pass the above UserId Parameter into every apis as UserId/ModifiedByUserId
    }
}

Now I want to Pass UserId/ModifiedByUserId from OnActionExecuting filter method into my respective API's

How can I achieve this


问:
Can i use service account to login to server and execute uipath bots via task scheduler?
we are using admin accounts as admin account have most of the rights to execute and access files from the all locations so uipath automation runs smoothly.
admin account  : CORP\ADM-FR-SFAKHORI
sefrvice account : SVC-FR-S2DCAUTO
we conenct our production using admin account , and now need is there to run more automations and we dont have free slots for admin accounts to run / admin account is occupied with existing automation.
Team provided us service account instead admin account to  connect our vm and to run automations.
to login certain applications via servcie account is possible which we are doing currenly also but can we run automations using servcie account?
we are using task scheduler and for now our vm is not able to connect with service account as servcie account deoent have logon accesss.
my question is if team provides logon access to servcie account then can we execute our scripts without any issue ? or can we ask for admin account to the team ?
we are using ateended named user license.
Please help us on same.

i tried by connecting using service account to vm but it is just connecting and disconnecting.
so we are not sure if team provides us login access then also we can able to accseess/execute or not.
so we want that surety .
enter image description here


问:
how can i find a specific sized rectangle in a 2d array?
I'm trying to find x and y coordinates of 67x45 sized rectangle (one-pixel wide) in the background image using Numpy.

The background is variable and the color of rectangle may differ.

The rectangle's height sometimes will only have the half size. (67x22)  but without bottom line of rectangle (check rectangle in template2).

I want to use Numpy for my intention but I'm having a hard time doing it.

Template:

Rectangle in template:

Rectangle in template2:

Background image:

I tried cv2.matchtemplate but it didn't quite work well. Maybe because color of rectangles border is variable? Not sure.
Below code is by @claudio. This code actually works but it is slow for my intention. And it also doesn't detect half cut rectangle.

```<code>import cv2
import numpy as np

img_filename = "background.png"
ibgr = cv2.imread(img_filename, cv2.IMREAD_UNCHANGED)
assert ibgr.shape[2] == 3
sizeY, sizeX, _ = ibgr.shape
# Convert uint8 BGR tuples to uint32 value:
iint32 = np.dstack((ibgr, np.zeros(ibgr.shape[:2], "uint8"))).view("uint32").squeeze(-1)

img_filename = "template.png"
grey_t = cv2.imread(img_filename, cv2.IMREAD_GRAYSCALE)
t_sizeY, t_sizeX = grey_t.shape

rectAt = []
for x in range(sizeX - t_sizeX):
    for y in range(sizeY - t_sizeY):
        if (
            (iint32[y, x] == iint32[y + 1 : y + t_sizeY, x]).all()
            and (iint32[y, x] == iint32[y, x + 1 : x + t_sizeX]).all()
            and (iint32[y, x] == iint32[y + 1 : y + t_sizeY, x + t_sizeX - 1]).all()
            and (iint32[y, x] == iint32[y + t_sizeY - 1, x + 1 : x + t_sizeX]).all()
            and (iint32[y, x] != iint32[y + 1, x + 1])
            and True
        ):
            rectAt.append((x, y))
print(rectAt)

for x, y in rectAt:
    cv2.rectangle(ibgr, (x - 1, y - 1), (x + t_sizeX, y + t_sizeY), (0, 255, 255), 1)
cv2.imshow("ibgr", ibgr)
cv2.waitKey(0)
cv2.destroyAllWindows()
</code>```

Body:
I'm trying to find x and y coordinates of 67x45 sized rectangle (one-pixel wide) in the background image using Numpy.

The background is variable and the color of rectangle may differ.

The rectangle's height sometimes will only have the half size. (67x22)  but without bottom line of rectangle (check rectangle in template2).

I want to use Numpy for my intention but I'm having a hard time doing it.

Template:

Rectangle in template:

Rectangle in template2:

Background image:

I tried cv2.matchtemplate but it didn't quite work well. Maybe because color of rectangles border is variable? Not sure.
Below code is by @claudio. This code actually works but it is slow for my intention. And it also doesn't detect half cut rectangle.

import cv2
import numpy as np

img_filename = "background.png"
ibgr = cv2.imread(img_filename, cv2.IMREAD_UNCHANGED)
assert ibgr.shape[2] == 3
sizeY, sizeX, _ = ibgr.shape
# Convert uint8 BGR tuples to uint32 value:
iint32 = np.dstack((ibgr, np.zeros(ibgr.shape[:2], "uint8"))).view("uint32").squeeze(-1)

img_filename = "template.png"
grey_t = cv2.imread(img_filename, cv2.IMREAD_GRAYSCALE)
t_sizeY, t_sizeX = grey_t.shape

rectAt = []
for x in range(sizeX - t_sizeX):
    for y in range(sizeY - t_sizeY):
        if (
            (iint32[y, x] == iint32[y + 1 : y + t_sizeY, x]).all()
            and (iint32[y, x] == iint32[y, x + 1 : x + t_sizeX]).all()
            and (iint32[y, x] == iint32[y + 1 : y + t_sizeY, x + t_sizeX - 1]).all()
            and (iint32[y, x] == iint32[y + t_sizeY - 1, x + 1 : x + t_sizeX]).all()
            and (iint32[y, x] != iint32[y + 1, x + 1])
            and True
        ):
            rectAt.append((x, y))
print(rectAt)

for x, y in rectAt:
    cv2.rectangle(ibgr, (x - 1, y - 1), (x + t_sizeX, y + t_sizeY), (0, 255, 255), 1)
cv2.imshow("ibgr", ibgr)
cv2.waitKey(0)
cv2.destroyAllWindows()