问:
Getting deadlock in this program
I want to read from a channel and output the square of the same to another channel and print it in the main goroutine. But I am getting deadlock here. Any help please.

```<code>package main

import (
    "fmt"
)

func helloWorld(numbers chan int, sig chan string, output chan int) {
    fmt.Println("Hello World !")
    for {
        select {
        case i := <-numbers:
            output <- i * i
        case s := <-sig:
            if s == "Close" {
                return
            }
        }
    }
}

func main() {
    closeSignal := make(chan string)
    numbers := make(chan int)
    output := make(chan int)
    defer close(numbers)
    defer close(output)
    defer close(closeSignal)
    go helloWorld(numbers, closeSignal, output)
    numbers <- 1
    numbers <- 2
    closeSignal <- "Close"
    for j := range output {
        fmt.Println("Squared number is ", j)
    }
}

</code>```

Output when the program is deadlocked:

```<code>Hello World !
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
main.main()
        C:/Users/ankit/go/src/interview/main.go:30 +0x18c

goroutine 6 [chan send]:
main.helloWorld(0xc00001c120, 0xc00001c0c0, 0x0?)
        C:/Users/ankit/go/src/interview/main.go:12 +0x135
created by main.main
        C:/Users/ankit/go/src/interview/main.go:28 +0x16a
exit status 2
</code>```

Title: Getting deadlock in this program

Body:
I want to read from a channel and output the square of the same to another channel and print it in the main goroutine. But I am getting deadlock here. Any help please.

package main

import (
    "fmt"
)

func helloWorld(numbers chan int, sig chan string, output chan int) {
    fmt.Println("Hello World !")
    for {
        select {
        case i := <-numbers:
            output <- i * i
        case s := <-sig:
            if s == "Close" {
                return
            }
        }
    }
}

func main() {
    closeSignal := make(chan string)
    numbers := make(chan int)
    output := make(chan int)
    defer close(numbers)
    defer close(output)
    defer close(closeSignal)
    go helloWorld(numbers, closeSignal, output)
    numbers <- 1
    numbers <- 2
    closeSignal <- "Close"
    for j := range output {
        fmt.Println("Squared number is ", j)
    }
}

Output when the program is deadlocked:

Hello World !
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
main.main()
        C:/Users/ankit/go/src/interview/main.go:30 +0x18c

goroutine 6 [chan send]:
main.helloWorld(0xc00001c120, 0xc00001c0c0, 0x0?)
        C:/Users/ankit/go/src/interview/main.go:12 +0x135
created by main.main
        C:/Users/ankit/go/src/interview/main.go:28 +0x16a
exit status 2


来源: stackexchange

问:
NextAuth + NextJS v12 api folder structure
Is it required to put the signin and signup components inside api/auth path? because I put mine same as other pages file.

```<code>|- pages
    |- api (folder)
       |- auth (folder)
    |- _app.js
    |- _index.js
    |- login.js  #import Signin component for design
    |- signup.js #import Register component for design
|- components
    |- credentials (folder)
        |- Signin.js
        |- Register.js
</code>```

I am confused wheter to follow other file structure or my method is fine.

ContentLicense: CC BY-SA 4.0

Body:
Is it required to put the signin and signup components inside api/auth path? because I put mine same as other pages file.

|- pages
    |- api (folder)
       |- auth (folder)
    |- _app.js
    |- _index.js
    |- login.js  #import Signin component for design
    |- signup.js #import Register component for design
|- components
    |- credentials (folder)
        |- Signin.js
        |- Register.js

I am confused wheter to follow other file structure or my method is fine.


问:
Cant access NUXT routes when hosted through pm2 and apache proxypass config
I have setup working nuxtjs ssr app using pm2 on the vps linux cloud. Its works well on the localhost. For the online deployment, I use pm2 to get the app running. The app is accessible through the domain address. But the issue is with the routes, for example I have set the address as : www.someurl.com/ssrapp , the apache uses proxypass to map the /ssrapp to the www.localhost:3000/ address. But after the app page loads, it says /ssrapp route not found. I can see this issue could be with mapping done in the apache proxypass. But how to configure this part? I cant use nginx ,so can only proceed with apache setup for this.</p>


问:
Link tracking with nodeJS
I want to create a service to track affiliate link clicks. The logic is simple, When a user is clicked on the link provided by the service will redirect to an original affiliate link.

I stored data in MongoDB. I want to get the original affiliate link bypassing the offerID(Service provided offerID).

I wrote the following code:

```<code>app.get('/click', async (req, res) => {

    //Tracking link : https://myservice.com/click?a=500&o=15112

    const url =req.protocol + '://' + req.get('host') + req.originalUrl
    const affiliateId = new URL(url).searchParams.get('a')
    const offerID = new URL(url).searchParams.get('o')
    //Getting affiliateID and offerID from URL

    const link = await Links.findOne({oID: offerID}) //Getting the affiliate link from the MongoDB by passing offerID
    if (link == null) return res.sendStatus(404)

    const userAgent =  navigator.userAgent //Getting the userAgent
    const clickID = shortId.generate //Generating a unique clickID
    const finalLink = link.affiliateLink.concat(`&clickID=${clickID}&sub1=${affiliateId}`) //Creating the link from the affiliates
    //Link will be like https://offer.com/clicks?affiliateoffer=500&affiliateid=1000&clickID=12151212121&sub1=500

    const click = new Click({
        affID: affiliateId,
        oID: offerID,
        clickID: clickID,
        userAgent: userAgent,
    });

    Click.save(click) // Saving the click on the database(mongodb)
    res.redirect(finalLink) //Redirecting to affiliate link
})
</code>```

Will that work when thousands of clicks at the same time?
Any improvements that I can do to increase the redirection time?

Title: Link tracking with nodeJS

Body:
I want to create a service to track affiliate link clicks. The logic is simple, When a user is clicked on the link provided by the service will redirect to an original affiliate link.

I stored data in MongoDB. I want to get the original affiliate link bypassing the offerID(Service provided offerID).

I wrote the following code:

app.get('/click', async (req, res) => {

    //Tracking link : https://myservice.com/click?a=500&o=15112

    const url =req.protocol + '://' + req.get('host') + req.originalUrl
    const affiliateId = new URL(url).searchParams.get('a')
    const offerID = new URL(url).searchParams.get('o')
    //Getting affiliateID and offerID from URL

    const link = await Links.findOne({oID: offerID}) //Getting the affiliate link from the MongoDB by passing offerID
    if (link == null) return res.sendStatus(404)

    const userAgent =  navigator.userAgent //Getting the userAgent
    const clickID = shortId.generate //Generating a unique clickID
    const finalLink = link.affiliateLink.concat(`&clickID=${clickID}&sub1=${affiliateId}`) //Creating the link from the affiliates
    //Link will be like https://offer.com/clicks?affiliateoffer=500&affiliateid=1000&clickID=12151212121&sub1=500

    const click = new Click({
        affID: affiliateId,
        oID: offerID,
        clickID: clickID,
        userAgent: userAgent,
    });

    Click.save(click) // Saving the click on the database(mongodb)
    res.redirect(finalLink) //Redirecting to affiliate link
})

Will that work when thousands of clicks at the same time?
Any improvements that I can do to increase the redirection time?


问:
looping from long array is slow in ejs node js template engine
I am getting data from MongoDB and looping from it in ejs. and it is long data. it is an array of more than 28k objects because of that it's slow to load is there any way I can load all of the data without having to compromise performance?

I was trying to load data from MongoDB in ejs temp and print HTML  select options it is printing but it is slow


问:
'pyqt5' is not recognized as an internal or external command, operable program or batch file
I have a question I try installing this library https://github.com/heartexlabs/labelImg however when I type pyrcc5 -o libs/resources.py resources.qrc it gives me an error "'pyqt5' is not recognized as an internal or external command, operable program or batch file."

I've installed PyQt5 using pip install pyqt5 and added the PATH env variable this is the path "C:\Users\Jason\AppData\Local\Programs\Python\Python310\Lib\site-packages\PyQt5\Qt5\bin" after restarting the cmd the same error still occurs. Any solution would be very helpful, thanks.


问:
Trying to fetch loged in user data in external PHP file in WordPress
I want to fetch logged-in user data in an external PHP file. The file contains PHP code that displays records from the MySQL table to the frontend page.

When I include the wp-load.php file in my PHP file, my PHP code stop showing data on the front page.

I am using this code to include the wp-load.php file

require_once(rtrim($_SERVER[‘DOCUMENT_ROOT’], ‘/’) . ‘/wp-load.php’);

$current_user = wp_get_current_user();

$username=$current_user->user_login;

My custom PHP file path is /api/advance.php

Looking for help from experts to solve this issue.


问:
How to add multiple coordinates to the map using the react-simple map
I'm attempting to add cordinates to my map of USa using react-simple-map, I want to have single origin point and but multiple destinations.

but this is how it renders.

https://codesandbox.io/s/equator-forked-62oi7x.

Do we need a to and from properties as well? Checked in the doc and I dont see anything passed apart from cordinates prop.
My code:

```<code>const MapChart = () => {
  return (
    <ComposableMap projection="geoAlbersUsa">
      <Graticule stroke="#DDD" strokeWidth={0.5} />
      <Sphere stroke="#DDD" strokeWidth={0.5} />
      <Geographies geography={geoUrl}>
        {({ geographies }) =>
          geographies.map((geo) => (
            <Geography
              key={geo.rsmKey}
              geography={geo}
              fill="#DDD"
              stroke="#FFF"
            />
          ))
        }
      </Geographies>
      <Line
        coordinates={[
          [-114.09056, 46.91631],
          [-93.21692, 44.88055],
          [-90.25803, 29.99339],
          [-107.89383, 38.50887],
          [-70.61433, 41.39303]
        ]}
        stroke="#F53"
        strokeWidth={2}
      />
    </ComposableMap>
  );
};
</code>```

any idea what 'm missing?

Body:
I'm attempting to add cordinates to my map of USa using react-simple-map, I want to have single origin point and but multiple destinations.

but this is how it renders.

https://codesandbox.io/s/equator-forked-62oi7x.

Do we need a to and from properties as well? Checked in the doc and I dont see anything passed apart from cordinates prop.
My code:

const MapChart = () => {
  return (
    <ComposableMap projection="geoAlbersUsa">
      <Graticule stroke="#DDD" strokeWidth={0.5} />
      <Sphere stroke="#DDD" strokeWidth={0.5} />
      <Geographies geography={geoUrl}>
        {({ geographies }) =>
          geographies.map((geo) => (
            <Geography
              key={geo.rsmKey}
              geography={geo}
              fill="#DDD"
              stroke="#FFF"
            />
          ))
        }
      </Geographies>
      <Line
        coordinates={[
          [-114.09056, 46.91631],
          [-93.21692, 44.88055],
          [-90.25803, 29.99339],
          [-107.89383, 38.50887],
          [-70.61433, 41.39303]
        ]}
        stroke="#F53"
        strokeWidth={2}
      />
    </ComposableMap>
  );
};

any idea what 'm missing?


问:
C# selenium Add cookies from json file
I got json file contain cookies that I copy from chrome extension (editthiscookies chrome extension), format something like this

```<code>[
{
    "domain": ".sample.com",
    "expirationDate": 1702792429.54642,
    "hostOnly": false,
    "httpOnly": false,
    "name": "_abck",
    "path": "/",
    "sameSite": "unspecified",
    "secure": true,
    "session": false,
    "storeId": "0",
    "value": "4u4y46htdhdg",
    "id": 1
},
{
    "domain": ".sample.com",
    "expirationDate": 1671263624.503405,
    "hostOnly": false,
    "httpOnly": true,
    "name": "ak_bmsc",
    "path": "/",
    "sameSite": "unspecified",
    "secure": false,
    "session": false,
    "storeId": "0",
    "value": "446363565365fdghdghj",
    "id": 2
},
</code>```

is this cookies type can be use in C# and selenium, something like, store this cookies in txt file and load using C# to use in selenium to avoid input login and password every time visiting target site?

been read this thread Creating cookies from Json file - does the type of the value matter? but still not understand how to use it (newbie here) meanwhile in selenium documentation, to add cookies, the format is something like

```<code>driver.Manage().Cookies.AddCookie(new Cookie("key", "value"));
</code>```

should I explode each of them each? or put it as .toString(), but what the key what the value?? Sorry for newbie question

Thank you..

Title: C# selenium Add cookies from json file

Body:
I got json file contain cookies that I copy from chrome extension (editthiscookies chrome extension), format something like this

[
{
    "domain": ".sample.com",
    "expirationDate": 1702792429.54642,
    "hostOnly": false,
    "httpOnly": false,
    "name": "_abck",
    "path": "/",
    "sameSite": "unspecified",
    "secure": true,
    "session": false,
    "storeId": "0",
    "value": "4u4y46htdhdg",
    "id": 1
},
{
    "domain": ".sample.com",
    "expirationDate": 1671263624.503405,
    "hostOnly": false,
    "httpOnly": true,
    "name": "ak_bmsc",
    "path": "/",
    "sameSite": "unspecified",
    "secure": false,
    "session": false,
    "storeId": "0",
    "value": "446363565365fdghdghj",
    "id": 2
},

is this cookies type can be use in C# and selenium, something like, store this cookies in txt file and load using C# to use in selenium to avoid input login and password every time visiting target site?

been read this thread Creating cookies from Json file - does the type of the value matter? but still not understand how to use it (newbie here) meanwhile in selenium documentation, to add cookies, the format is something like

driver.Manage().Cookies.AddCookie(new Cookie("key", "value"));

should I explode each of them each? or put it as .toString(), but what the key what the value?? Sorry for newbie question

Thank you..


问:
JVM Heap memory usage increases with increase in writing data using PipedInputStream and PipedOutputStream
I am using Spring Boot to read through CSV file and processing the data.
But I notice, while reading the data and PipedOutputStream to write data into PipedInputStream and later reading the InputStream increases the heap memory usage?
Why is that happening since we are not storing anything in memory, the maximum heap memory for my system is 1GB and file size is 51MB.
I am using the following code to read the file:</p>
```<code>//data => FilePart data is read from API
 PipedOutputStream osPipe = new PipedOutputStream();
    PipedInputStream isPipe = new PipedInputStream(osPipe);
    DataBufferUtils.write(data, osPipe)
        .doOnComplete(() -> {
            osPipe.close();
        })
        .subscribe(DataBufferUtils.releaseConsumer());
    BufferedReader reader = new InputStreamReader(isPipe);
    CsvToBean<T> cb = new CsvToBeanBuilder<T>(reader).withType(clazz).withFilter(
        lineString -> Arrays.stream(lineString).map(String::trim)
            .anyMatch(value -> value.length() > 0)).build();
    return cb.parse();

</code>```

Body:
I am using Spring Boot to read through CSV file and processing the data.
But I notice, while reading the data and PipedOutputStream to write data into PipedInputStream and later reading the InputStream increases the heap memory usage?
Why is that happening since we are not storing anything in memory, the maximum heap memory for my system is 1GB and file size is 51MB.
I am using the following code to read the file:

//data => FilePart data is read from API
 PipedOutputStream osPipe = new PipedOutputStream();
    PipedInputStream isPipe = new PipedInputStream(osPipe);
    DataBufferUtils.write(data, osPipe)
        .doOnComplete(() -> {
            osPipe.close();
        })
        .subscribe(DataBufferUtils.releaseConsumer());
    BufferedReader reader = new InputStreamReader(isPipe);
    CsvToBean<T> cb = new CsvToBeanBuilder<T>(reader).withType(clazz).withFilter(
        lineString -> Arrays.stream(lineString).map(String::trim)
            .anyMatch(value -> value.length() > 0)).build();
    return cb.parse();


问:
In podman how do I pass through a request over a podman pod to a specific container inside the pod
I'm trying to a series of rootless podman containers accessible from a podman nginx reverse proxy.
The containers are:

nginx

heimdall

python web-server

Each container is rootless and will internally bind to port 80 and will all be in the same pod called apps.

The 'apps' pod will bind host address 8080 to 80 internally. How do I setup the host on port 8080, to direct to the nginx container on port 80? I can't change the container internal ports.

I originally tried the link flag instead of pods to link nginx to each container and then just bind host port 8080 to the containers port 80. But the --link flag is deprecated from the run command.

My understanding is all containers share the same namespace, so I'm not sure how to direct the host request directly to nginx while in a pod and still be able to access the other containers via their podman --name hostname from within the pod.

Architecture Diagram:

The commands to setup my pod and containers are:

podman pod create --name apps -p 8080:80

podman create \
--name=apps-heimdall \
--pod apps \
-e TZ=australia/sydney \
-v /home/jake/volumes/heimdall:/config \
--restart unless-stopped \
linuxserver/heimdall

podman create \
--name apps-nginx \
--pod apps \
-v /home/jake/volumes/nginx/nginx_conf/nginx.conf:/etc/nginx/nginx.conf \
-v /home/jake/volumes/nginx/html/:/var/www/html \
docker.io/library/nginx:latest

podman start apps-heimdall
podman start apps-nginx```


问:
raise ProgrammingError( mysql.connector.errors.ProgrammingError: Not all parameters were used in the SQL statement
i am trying to populate data in mysql from python using csv.
till tuple my program is working fine. am able to see data
but while uploading in sql. its giving error "Not all parameters used in sql statement"

```<code>with open("USERS.csv", "r") as f:
    val = []
    data = csv.reader(f)
    for row in data:
        val.append(tuple(row))
        print(tuple(row))
        cursor = mydb.cursor()
        sql=("insert into users (user_id, user_name, user_email,user_password,user_address,is_vendor)"
            " values(%s, %s , %s , %s , %s ,%d)")
        cursor.execute(sql,tuple(row))
</code>```

i al ready described above

Body:
i am trying to populate data in mysql from python using csv.
till tuple my program is working fine. am able to see data
but while uploading in sql. its giving error "Not all parameters used in sql statement"

with open("USERS.csv", "r") as f:
    val = []
    data = csv.reader(f)
    for row in data:
        val.append(tuple(row))
        print(tuple(row))
        cursor = mydb.cursor()
        sql=("insert into users (user_id, user_name, user_email,user_password,user_address,is_vendor)"
            " values(%s, %s , %s , %s , %s ,%d)")
        cursor.execute(sql,tuple(row))

i al ready described above


问:
Why Tailwind CSS classes is not working after restarting my PC?
The Project with React + Tailwind was running perfect but when I restarted the project after shutdown my PC.
Tailwind classes are not working. Do I need to install or start anything for Tailwind too just like react server npm start?

I tried
npm install -D tailwindcss postcss autoprefixer
and
npm install postcss@latest


问:
How to solve neuralintents installation error (Cannot install)?
I got an error installing neuralintents package

```<code>ERROR: Cannot install neuralintents==0.0.1, neuralintents==0.0.2, neuralintents==0.0.3 and neuralintents==0.0.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    neuralintents 0.0.4 depends on tensorflow
    neuralintents 0.0.3 depends on tensorflow
    neuralintents 0.0.2 depends on tensorflow
    neuralintents 0.0.1 depends on tensorflow

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
</code>```

Error after:

```<code>Collecting neuralintents
  Using cached neuralintents-0.0.4-py3-none-any.whl (5.0 kB)
Requirement already satisfied: numpy in c:\users\smura\appdata\local\programs\python\python311\lib\site-packages (from neuralintents) (1.23.5)
Requirement already satisfied: nltk in c:\users\smura\appdata\local\programs\python\python311\lib\site-packages (from neuralintents) (3.8)
  Using cached neuralintents-0.0.3-py3-none-any.whl (5.0 kB)
  Using cached neuralintents-0.0.2-py3-none-any.whl (4.3 kB)
  Using cached neuralintents-0.0.1-py3-none-any.whl (2.6 kB)
</code>```

I tried to uninstall and reinstall tensorflow, but it doesn't work.

```<code>pip install neuralintents
</code>```

This is what I used to install. Thanks in Advance <3

Body:
I got an error installing neuralintents package

ERROR: Cannot install neuralintents==0.0.1, neuralintents==0.0.2, neuralintents==0.0.3 and neuralintents==0.0.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    neuralintents 0.0.4 depends on tensorflow
    neuralintents 0.0.3 depends on tensorflow
    neuralintents 0.0.2 depends on tensorflow
    neuralintents 0.0.1 depends on tensorflow

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Error after:

Collecting neuralintents
  Using cached neuralintents-0.0.4-py3-none-any.whl (5.0 kB)
Requirement already satisfied: numpy in c:\users\smura\appdata\local\programs\python\python311\lib\site-packages (from neuralintents) (1.23.5)
Requirement already satisfied: nltk in c:\users\smura\appdata\local\programs\python\python311\lib\site-packages (from neuralintents) (3.8)
  Using cached neuralintents-0.0.3-py3-none-any.whl (5.0 kB)
  Using cached neuralintents-0.0.2-py3-none-any.whl (4.3 kB)
  Using cached neuralintents-0.0.1-py3-none-any.whl (2.6 kB)

I tried to uninstall and reinstall tensorflow, but it doesn't work.

pip install neuralintents

This is what I used to install. Thanks in Advance <3


问:
Designing interface/base classes: How to access list of base class without casting?
I just wrote this modified code to test some new dotnet features:

```<code>using System.Text;

namespace Lib1;

public class WriteOnlySqlFile : BaseFile, IWriteOnlySqlFile
{
    public string SaveText()
    {
        Console.WriteLine("{0}, {1}, save text sql file", FilePath, FileText);
        return "";
    }
}

public class ReadOnlySqlFile : BaseFile, IReadOnlySqlFile
{
    public string LoadText()
    {
        Console.WriteLine("{0} {1}, readonly sql file loading text here!", FilePath, FileText);
        return "";
    }
}

public interface IReadOnlySqlFile
{
    public string LoadText();
}

public interface IWriteOnlySqlFile
{
    public string SaveText();
}

public abstract class BaseFile
{
    public string FilePath { get; init; } = string.Empty;
    public string FileText { get; init; } = string.Empty;
}

public static class SqlFileManager
{
    public static string GetTextFromFiles(List<IReadOnlySqlFile> readOnlySqlFiles)
    {
        StringBuilder objStrBuilder = new StringBuilder();
        foreach (var objFile in readOnlySqlFiles)
        {
            objStrBuilder.Append(objFile.LoadText());
        }

        return objStrBuilder.ToString();
    }

    public static void SaveTextIntoFiles(List<IWriteOnlySqlFile> writeOnlySqlFiles)
    {
        foreach (var objFile in writeOnlySqlFiles)
        {
            objFile.SaveText();
        }
    }
}
</code>```

Question is: Can I make SqlFileManager non-static and have an instance variable of BaseFiles, and iterate over that variable, but without the commented line:

```<code>{
    public SqlFileManager(List<BaseFile> files)
    {
        LstSqlFiles = files;
    }

    private List<BaseFile> LstSqlFiles { get; }

    public string GetTextFromFiles()
    {
        StringBuilder objStrBuilder = new StringBuilder();
        foreach (var objFile in LstSqlFiles)
        {
            //Any SOLID way to access this method but not do the cast? Obviously same cast
            //will have to be in the SaveTextIntoFiles method
            var sqlFile = objFile as ReadOnlySqlFile;
            objStrBuilder.Append(sqlFile?.LoadText());
        }

        return objStrBuilder.ToString();
    }
</code>```

Body:
I just wrote this modified code to test some new dotnet features:

using System.Text;

namespace Lib1;

public class WriteOnlySqlFile : BaseFile, IWriteOnlySqlFile
{
    public string SaveText()
    {
        Console.WriteLine("{0}, {1}, save text sql file", FilePath, FileText);
        return "";
    }
}

public class ReadOnlySqlFile : BaseFile, IReadOnlySqlFile
{
    public string LoadText()
    {
        Console.WriteLine("{0} {1}, readonly sql file loading text here!", FilePath, FileText);
        return "";
    }
}

public interface IReadOnlySqlFile
{
    public string LoadText();
}

public interface IWriteOnlySqlFile
{
    public string SaveText();
}

public abstract class BaseFile
{
    public string FilePath { get; init; } = string.Empty;
    public string FileText { get; init; } = string.Empty;
}

public static class SqlFileManager
{
    public static string GetTextFromFiles(List<IReadOnlySqlFile> readOnlySqlFiles)
    {
        StringBuilder objStrBuilder = new StringBuilder();
        foreach (var objFile in readOnlySqlFiles)
        {
            objStrBuilder.Append(objFile.LoadText());
        }

        return objStrBuilder.ToString();
    }

    public static void SaveTextIntoFiles(List<IWriteOnlySqlFile> writeOnlySqlFiles)
    {
        foreach (var objFile in writeOnlySqlFiles)
        {
            objFile.SaveText();
        }
    }
}

Question is: Can I make SqlFileManager non-static and have an instance variable of BaseFiles, and iterate over that variable, but without the commented line:

{
    public SqlFileManager(List<BaseFile> files)
    {
        LstSqlFiles = files;
    }

    private List<BaseFile> LstSqlFiles { get; }

    public string GetTextFromFiles()
    {
        StringBuilder objStrBuilder = new StringBuilder();
        foreach (var objFile in LstSqlFiles)
        {
            //Any SOLID way to access this method but not do the cast? Obviously same cast
            //will have to be in the SaveTextIntoFiles method
            var sqlFile = objFile as ReadOnlySqlFile;
            objStrBuilder.Append(sqlFile?.LoadText());
        }

        return objStrBuilder.ToString();
    }


问:
Images as buttons in Wordpress
How can I make 4 photos act like buttons on my wordpress site. A good example of what I would like to do is in this page footer.
enter image description here

So it would be: background image + transition on hover // overlay icons and text

I tried using the gallery block but the results are not as intended... also tried grouping 4 separate images but that leaves spaces between them.

Title: Images as buttons in Wordpress


问:
How to fix this error " fatal: protocol '/home/foziya/https' is not supported'?
I want to inistall mininet by using command line it clone https://github.com/mininet/mininet
but when i click enter after this command they pop as follows Cloning into 'mininet'...
fatal: protocol '/home/foziya/https' is not supported
How do i fix it and continuing my installation of mininet</p>


问:
Cannot install tensorflow-deps on M1 mac pro
I created and activated a new conda environment using
conda create --name tf python=3.10
in process of installing tensorflow on my M1 mac but while installing tensorflow-deps with conda install -c apple tensorflow-deps, I got the following error:

```<code>(tf) prabasadhikari@Prabass-MBP Major Project % conda install -c apple tensorflow-deps

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - tensorflow-deps

Current channels:

  - https://conda.anaconda.org/apple/osx-64
  - https://conda.anaconda.org/apple/noarch
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.
</code>```

I'm sure that the package I want is available at https://anaconda.org/apple/tensorflow-deps. Can anyone fix the problem I am facing?

Body:
I created and activated a new conda environment using
conda create --name tf python=3.10
in process of installing tensorflow on my M1 mac but while installing tensorflow-deps with conda install -c apple tensorflow-deps, I got the following error:

(tf) prabasadhikari@Prabass-MBP Major Project % conda install -c apple tensorflow-deps

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - tensorflow-deps

Current channels:

  - https://conda.anaconda.org/apple/osx-64
  - https://conda.anaconda.org/apple/noarch
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

I'm sure that the package I want is available at https://anaconda.org/apple/tensorflow-deps. Can anyone fix the problem I am facing?


问:
Vite: process CSS after JS is tree-shaken
I want to run purgeCSS on my CSS, by looking at my .js code to see which selectors are used, but that will only be useful once all dead code was eliminated.

How do I hook into the build so that after the js bundles are written, the .css files can be altered by purgeCSS?

Will that still allow naming the files after their content hash?


问:
Track user activity in electron window
I have a simple electron app with a local startpage and links to specific websites. The task is to switch back to my local startpage when the user is idle for more then x minutes. I use an adaption of the fantastic script provided here to track for idle time and it works great.

But if an Iframe or pdf is opened on one of the external pages tracking of idle time stops of course as long as the user moves inside this document.

Does anybody know a way to track user inputs (touch, mousemove, keydown...) inside the electron renderer window regardless of it's content?

Title: Track user activity in electron window


问:
AttributeError: 'Series' object has no attribute 'difference' , (PYTHON)
```<code>import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy.ndimage import uniform_filter1d

df = pd.read_csv("/Users/apple/Downloads/N).csv")
y = df['ABC']
x = np.array(uniform_filter1d(y,size=15))

a = y.difference(x)

print(a)
</code>```

this statement gives an error of

```<code>Traceback (most recent call last):
  File "/Users/apple/PycharmProjects/trial/main.py", line 14, in <module>
    a = y.difference(x)
        ^^^^^^^^^^^^
  File "/Users/apple/PycharmProjects/trial/venv/lib/python3.11/site-packages/pandas/core/generic.py", line 5902, in __getattr__
    return object.__getattribute__(self, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Series' object has no attribute 'difference'
</code>```

how to resolve the issue. as needed values of x not in y

Body:
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy.ndimage import uniform_filter1d

df = pd.read_csv("/Users/apple/Downloads/N).csv")
y = df['ABC']
x = np.array(uniform_filter1d(y,size=15))

a = y.difference(x)

print(a)

this statement gives an error of

Traceback (most recent call last):
  File "/Users/apple/PycharmProjects/trial/main.py", line 14, in <module>
    a = y.difference(x)
        ^^^^^^^^^^^^
  File "/Users/apple/PycharmProjects/trial/venv/lib/python3.11/site-packages/pandas/core/generic.py", line 5902, in __getattr__
    return object.__getattribute__(self, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Series' object has no attribute 'difference'

how to resolve the issue. as needed values of x not in y


问:
how to animated a swiper.js slider
This slider has 3 slides per view and also has a full-width background image. Whenever the slider changes, the background image will change according to the slider index. I tried animating it like the site https://stinna-it.nl/alle-projecten. Not only did I try to animate it, I tried to create exactly this slider using Swiper.js. For the animation, I used GSAP but I can only use autoAlpha for now; if I try to use other things like scale(0) to scale(1), it gets messed up.
I only use two image for example which changes according to index value. but the animation didn't looks the reference website

  const imgs = document.querySelectorAll(".prjctbg");

  var swiper = new Swiper(".swiper-container", {
    pagination: {
      el: ".swiper-pagination",
      clickable: true,
    },
    spaceBetween: 1,
    slidesPerView: 2.5,
    centeredSlides: true,
    roundLengths: true,
    loop: true,
    loopAdditionalSlides: 30,
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
    on: {
      slideChangeTransitionStart: function () {
        // Get the current slide index
        var slideIndex = this.realIndex;
         // console.log(slideIndex);
        imgs.forEach((img) => {
          const index = img.getAttribute("data-index");
          if (index == slideIndex) {
            img.classList.add("activeBG");
          } else {
            img.classList.remove("activeBG");
          }
        });
        gsap.fromTo(
          ".activeBG",
          1,
          {
            autoAlpha: 0,
            scale: 1.2,
          },
          {
            autoAlpha: 1,
            scale: 1,
          }
        );
      },
    },
    breakpoints: {
      768: {
        slidesPerView: 1,
      },
    },
  });```
<pre class="snippet-code-css lang-css prettyprint-override"><code>      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
    on: {
      slideChangeTransitionStart: function () {
        // Get the current slide index
        var slideIndex = this.realIndex;
         // console.log(slideIndex);
        imgs.forEach((img) => {
          const index = img.getAttribute("data-index");
          if (index == slideIndex) {
            img.classList.add("activeBG");
          } else {
            img.classList.remove("activeBG");
          }
        });
        gsap.fromTo(
          ".activeBG",
          1,
          {
            autoAlpha: 0,
            scale: 1.2,
          },
          {
            autoAlpha: 1,
            scale: 1,
          }
        );
      },
    },
    breakpoints: {
      768: {
        slidesPerView: 1,
      },
    },
  });

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;1,200&display=swap');
* {
  margin: 0;
  padding: 0;
font-family: 'Poppins', sans-serif;
  box-sizing: border-box;
}

body a {
  text-decoration: none;
  color: #ffffff;
}

.projectSlider {
  width: 100vw;
  height: 100vh;
  position: relative;
}
.projectSlider .swiper-pagination-fraction,
.projectSlider .swiper-pagination-custom,
.projectSlider .swiper-container-horizontal > .swiper-pagination-bullets {
  bottom: 26px;
}
.projectSlider .swiper-slide.swiper-slide-prev {
  display: flex;
  justify-content: flex-end;
}
.projectSlider .swiper-slide.swiper-slide-next {
  display: flex;
  justify-content: flex-start;
}
.projectSlider .swiper-button-prev,
.projectSlider .swiper-container-rtl .swiper-button-next {
  background-image: url("../images/icons/prev.svg");
  left: inherit;
  right: 100px;
}
.projectSlider .swiper-button-next,
.projectSlider .swiper-container-rtl .swiper-button-prev {
  background-image: url("../images/icons/next.svg");
  right: 35px;
  left: auto;
}
.projectSlider .swiper-button-prev,
.projectSlider .swiper-button-next {
  top: 94%;
  width: 50px;
  height: 50px;
  background-size: contain;
  background-position: center;
}
.projectSlider .container {
  width: 100%;
  height: 100%;
}
.projectSlider .prjctbg {
  position: absolute;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  filter: blur(8px);
  -webkit-filter: blur(8px);
}
.projectSlider .prjctbg.activeBG {
  z-index: 1;
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
}

.swiper-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.swiper-slide {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms cubic-bezier(0.165, 0.84, 0.44, 1);
  transform: scale(0.8);
  text-align: center;
}
.swiper-slide p {
  overflow: hidden;
  color: #fff;
  font-size: 1em;
}
.swiper-slide p span {
  transform: translateY(100px);
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
  display: block;
}
.swiper-slide h1 {
  color: #fff;
  font-size: 3.8em;
  line-height: 100%;
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
  margin: 0px 0px 30px 0px;
  transform: scale(0.5);
  font-weight: 600;
}
.swiper-slide.swiper-slide-active {
  transform: scale(1);
}
.swiper-slide.swiper-slide-active p {
  opacity: 1;
  transition-delay: 0.5s;
}
.swiper-slide.swiper-slide-active p span {
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
  transform: translateY(0px);
  display: block;
}
.swiper-slide.swiper-slide-active h1 {
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
  transition-delay: 0.15s;
  transform: scale(1);
}</code>```

   <link
  rel="stylesheet"
  href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.2/css/swiper.css"
/>

                      Audiovisual

                      Design

                       Video Installation

                      Exhibition

                      Design

                       Multimedia Exhibition

                      Texts and

                      Images

                       website + Print Magazine

                      Material and

                      Light

                       Short Video

                      Dimension

                      Design

                       Rendered Image

                      App

                      Design

                       Sustainability App

```

Title: how to animated a swiper.js slider

Body:
This slider has 3 slides per view and also has a full-width background image. Whenever the slider changes, the background image will change according to the slider index. I tried animating it like the site https://stinna-it.nl/alle-projecten. Not only did I try to animate it, I tried to create exactly this slider using Swiper.js. For the animation, I used GSAP but I can only use autoAlpha for now; if I try to use other things like scale(0) to scale(1), it gets messed up.
I only use two image for example which changes according to index value. but the animation didn't looks the reference website

  const imgs = document.querySelectorAll(".prjctbg");

  var swiper = new Swiper(".swiper-container", {
    pagination: {
      el: ".swiper-pagination",
      clickable: true,
    },
    spaceBetween: 1,
    slidesPerView: 2.5,
    centeredSlides: true,
    roundLengths: true,
    loop: true,
    loopAdditionalSlides: 30,
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
    on: {
      slideChangeTransitionStart: function () {
        // Get the current slide index
        var slideIndex = this.realIndex;
         // console.log(slideIndex);
        imgs.forEach((img) => {
          const index = img.getAttribute("data-index");
          if (index == slideIndex) {
            img.classList.add("activeBG");
          } else {
            img.classList.remove("activeBG");
          }
        });
        gsap.fromTo(
          ".activeBG",
          1,
          {
            autoAlpha: 0,
            scale: 1.2,
          },
          {
            autoAlpha: 1,
            scale: 1,
          }
        );
      },
    },
    breakpoints: {
      768: {
        slidesPerView: 1,
      },
    },
  });

      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
    on: {
      slideChangeTransitionStart: function () {
        // Get the current slide index
        var slideIndex = this.realIndex;
         // console.log(slideIndex);
        imgs.forEach((img) => {
          const index = img.getAttribute("data-index");
          if (index == slideIndex) {
            img.classList.add("activeBG");
          } else {
            img.classList.remove("activeBG");
          }
        });
        gsap.fromTo(
          ".activeBG",
          1,
          {
            autoAlpha: 0,
            scale: 1.2,
          },
          {
            autoAlpha: 1,
            scale: 1,
          }
        );
      },
    },
    breakpoints: {
      768: {
        slidesPerView: 1,
      },
    },
  });

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;1,200&display=swap');
* {
  margin: 0;
  padding: 0;
font-family: 'Poppins', sans-serif;
  box-sizing: border-box;
}

body a {
  text-decoration: none;
  color: #ffffff;
}

.projectSlider {
  width: 100vw;
  height: 100vh;
  position: relative;
}
.projectSlider .swiper-pagination-fraction,
.projectSlider .swiper-pagination-custom,
.projectSlider .swiper-container-horizontal > .swiper-pagination-bullets {
  bottom: 26px;
}
.projectSlider .swiper-slide.swiper-slide-prev {
  display: flex;
  justify-content: flex-end;
}
.projectSlider .swiper-slide.swiper-slide-next {
  display: flex;
  justify-content: flex-start;
}
.projectSlider .swiper-button-prev,
.projectSlider .swiper-container-rtl .swiper-button-next {
  background-image: url("../images/icons/prev.svg");
  left: inherit;
  right: 100px;
}
.projectSlider .swiper-button-next,
.projectSlider .swiper-container-rtl .swiper-button-prev {
  background-image: url("../images/icons/next.svg");
  right: 35px;
  left: auto;
}
.projectSlider .swiper-button-prev,
.projectSlider .swiper-button-next {
  top: 94%;
  width: 50px;
  height: 50px;
  background-size: contain;
  background-position: center;
}
.projectSlider .container {
  width: 100%;
  height: 100%;
}
.projectSlider .prjctbg {
  position: absolute;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  filter: blur(8px);
  -webkit-filter: blur(8px);
}
.projectSlider .prjctbg.activeBG {
  z-index: 1;
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
}

.swiper-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.swiper-slide {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms cubic-bezier(0.165, 0.84, 0.44, 1);
  transform: scale(0.8);
  text-align: center;
}
.swiper-slide p {
  overflow: hidden;
  color: #fff;
  font-size: 1em;
}
.swiper-slide p span {
  transform: translateY(100px);
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
  display: block;
}
.swiper-slide h1 {
  color: #fff;
  font-size: 3.8em;
  line-height: 100%;
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
  margin: 0px 0px 30px 0px;
  transform: scale(0.5);
  font-weight: 600;
}
.swiper-slide.swiper-slide-active {
  transform: scale(1);
}
.swiper-slide.swiper-slide-active p {
  opacity: 1;
  transition-delay: 0.5s;
}
.swiper-slide.swiper-slide-active p span {
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
  transform: translateY(0px);
  display: block;
}
.swiper-slide.swiper-slide-active h1 {
  transition: transform 1000ms cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s, transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
  transition-delay: 0.15s;
  transform: scale(1);
}

   <link
  rel="stylesheet"
  href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.2/css/swiper.css"
/>

                      Audiovisual

                      Design

                       Video Installation

                      Exhibition

                      Design

                       Multimedia Exhibition

                      Texts and

                      Images

                       website + Print Magazine

                      Material and

                      Light

                       Short Video

                      Dimension

                      Design

                       Rendered Image

                      App

                      Design

                       Sustainability App


问:
Nginx location conflict
I have two project on same domain
app A (static page) and app B(react app)

I want:

if example.com/fa  -> open index_fa.html at app-A

if example.com/faq -> open Route /faq    at app-B

I use this nginx config. but now if goto example.com/fa its goto app-B and get 404 error

```<code>server {
    server_name example.com;

    location /fa {
        alias /var/www/app-A/;
        index index_fa.html;
    }

    location / {
        root /var/www/app-B/dist;
        index index.html;
        try_files $uri $uri/ /index.html;
    }
}
</code>```

Title: Nginx location conflict

Body:
I have two project on same domain
app A (static page) and app B(react app)

I want:

if example.com/fa  -> open index_fa.html at app-A

if example.com/faq -> open Route /faq    at app-B

I use this nginx config. but now if goto example.com/fa its goto app-B and get 404 error

server {
    server_name example.com;

    location /fa {
        alias /var/www/app-A/;
        index index_fa.html;
    }

    location / {
        root /var/www/app-B/dist;
        index index.html;
        try_files $uri $uri/ /index.html;
    }
}


问:
How to make a atom trade across Uniswap v2 and v3 pools with web3py
For example, I want to sell $ELON for $WETH, and then sell the $WETH for $USDC. All should be done in one block.

ELON-WETH is a uniswap V2 pool and WETH-USDC is a V3 pool.

Is there any function I can use to perform the transaction？

Thanks ahead!

I read through Uniswap V3 and V2 docs, they only provide functions for v3 and v2 respectively, not a cross over function. I can't find any example showing the v3 and v2 across trade.


问:
Is there a way of restricting third party scripts from sending ajax requests to other domains?
For example, if I am using third-party scripts on my web app, and I am displaying sensitive data to authenticated users. Since all included scripts have access to the DOM, and they could send the data to an attacker via AJAX, is there a way of blocking them from sending the data to other domains? Maybe by just allowing AJAX requests only to my domain?</p>


问:
How to create AJAX Request and what's the endpoint(URL) in Klaviyo to collect user email and message?
I’m working on a shopify project and want to collect user email and message in Klaviyo. I want to use my own popup form(email, message fields and a submit button) and send AJAX request to Klaviyo. Please help me what’s the endpoint where AJAX request send to like https://manage.kmail-lists.com/ajax/subscriptions/subscribe but it’s provide information whether the user is subscribed to a specific email.

Below is my code:

requestSwatchForm.addEventListener('submit', function(e) {

e.preventDefault();

var settings = {

"async": true,

"crossDomain": true,

"url": "https://manage.kmail-lists.com/ajax/subscriptions/subscribe",

"method": "POST",

"headers": {

"content-type": "application/x-www-form-urlencoded",

"cache-control": "no-cache"

},

"data": {

"g": "S2RrTD", // replace LIST_ID with id of list to be subscribed

"email": "abidarif982@gmail.com",

// pass in additional fields, each additional field

// must be included in the $fields string separated by commas

"$fields": "$message, $first_name, $last_name",

"$message": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia, molestiae quas vel sint commodi repudiandae consequuntur voluptatum laborum numquam blanditiis",

"$first_name": "Abid",

"$last_name": "Arif"

}

};

$.ajax(settings).done(function(response) {

console.log(response);

})

});

I sent request from url https://manage.kmail-lists.com/ajax/subscriptions/subscribe but I want to find url which collects email and message field in Klaviyo.


问:
How to train dialogflow to learn for license truck number
I've used dialog flow for conversation between our truck company and us by using dialog flow link with line app so when truck company inform us the chatbot will automatic reply to truck company and pass details to another group chat to our warehouse groupchat automatically for example in group chat A the truck driver inform "I come to pick up corn in bulk at warehouse ABC and deliver to company B with truck license number 70-7193/94"

With this wording I've created entity for
product name: Corn
product type: Bulk
warehouse name: Warehouse ABC
Destination: Company B

so the bot will automatic send details of $Product $Type $WarehouseName $Destination automatically but how dialogflow will understand that 70-7193/94 is truck license number? since I don't have record before but we know the pattern like

71-7195

70-7193/94

85-8567/8134

83-3122/23, 90-9123/22

How to train them to know if first 2 number with - follow with 4 number or follow with 4number then / with two or four number will be truck license number?

If they can understand its truck icense number entity i can coding to pass the details to warehouse group.

Awaiting for your comment.

I try add truck license number 10 number and hope they can learn for the pattern for unsuccessful


问:
How to pass sequence to train agent QRnnNetwork (Dimensions must be equal erro)
I have set-up a tf_agent with a normal neural network as a q-net to learn trajectories which works fine. However, I'd now like to try a QRnnNetwork and train/learn from sequences of events but can't get it to work.

The action and observation spec in my custom env look as follows.

```<code>        self._action_spec = array_spec.BoundedArraySpec(
            shape=(), dtype=np.int32, minimum=0, maximum=num_actions-1, name='action'
        )
        self._observation_spec = array_spec.BoundedArraySpec(
            shape=(num_features,), dtype=np.int32, name='observation'
        )
</code>```

Next I've now setup the qnet

```<code>lstm_neurons = 50
train_sequence_length = 5

input_fc_layer_params=(40,)
output_fc_layer_params=(40,)

rnn_network = QRnnNetwork(
    train_env.observation_spec(),
    train_env.action_spec(),
    lstm_size=(lstm_neurons,),
    input_fc_layer_params=input_fc_layer_params,
    output_fc_layer_params=output_fc_layer_params,
)

agent = dqn_agent.DqnAgent(
        time_step_spec=train_env.time_step_spec(),
        action_spec=train_env.action_spec(),
        q_network=rnn_network,
        optimizer=optimizer,
        target_update_period=target_update_period,
        td_errors_loss_fn=tf.keras.losses.Huber(reduction="none"),
        gamma=discount,
        epsilon_greedy=lambda: epsilon_fn(train_step_counter),
        train_step_counter=train_step_counter
    )
</code>```

Next to generate and use training data I understood to pass train_sequence_length + 1 for num_steps, which was previously 2 and now more due to increased sequence size.

```<code># replay buffer and driver for training
replay_buffer = TFUniformReplayBuffer(
    agent.collect_data_spec,
    batch_size=replay_buffer_batch_size,
    max_length=replay_buffer_max_size
)

replay_buffer_observer = replay_buffer.add_batch
train_metrics = [tf_metrics.AverageReturnMetric()]

# Create q-policy to plot the learned q-values
qpolicy = QPolicy(train_env.time_step_spec(), train_env.action_spec(), rnn_network)

collect_driver = dynamic_step_driver.DynamicStepDriver(
    train_env,
    agent.collect_policy,
    observers=[replay_buffer_observer] + train_metrics,
    num_steps=collect_steps)

print('Initial data generation and setting up the dataset for training')
initial_collect_policy = random_tf_policy.RandomTFPolicy(train_env.time_step_spec(), train_env.action_spec())

init_driver = dynamic_step_driver.DynamicStepDriver(
    train_env,
    initial_collect_policy,
    observers=[replay_buffer.add_batch, ShowProgress(replay_buffer_max_size)],
    num_steps=replay_buffer_max_size)

final_time_step, final_policy_state = init_driver.run()

dataset = replay_buffer.as_dataset(sample_batch_size=16,
                                   num_steps=(train_sequence_length + 1), #2
                                   num_parallel_calls=4).prefetch(4)

collect_driver.run = common.function(collect_driver.run)
agent.train = common.function(agent.train)
</code>```

Once I start training using the below commands, I receive the error "ValueError: Dimensions must be equal, but are 5 and 16 for '{{node gradient_tape/loss/mul_4/Mul}} = Mul[T=DT_FLOAT](loss/Cast, gradient_tape/loss/Tile_1)' with input shapes: [16,5], [16,16]."
Where 16 is the sample_batch_size and 5 the sequence length I'm trying to pass.
Please advice what I'm missing here.

```<code>time_step = None
policy_state = agent.collect_policy.get_initial_state(train_env.batch_size)
iterator = iter(dataset)
time_step, policy_state = collect_driver.run(time_step, policy_state)
trajectories, buffer_info = next(iterator)
train_loss = agent.train(trajectories)
</code>```

The observations are now in shape (16, 6, 9), which seems to be correct (sample_batch_size, train_seq_length+1, nr_features). The code runs with num_steps=2.

Body:
I have set-up a tf_agent with a normal neural network as a q-net to learn trajectories which works fine. However, I'd now like to try a QRnnNetwork and train/learn from sequences of events but can't get it to work.

The action and observation spec in my custom env look as follows.

        self._action_spec = array_spec.BoundedArraySpec(
            shape=(), dtype=np.int32, minimum=0, maximum=num_actions-1, name='action'
        )
        self._observation_spec = array_spec.BoundedArraySpec(
            shape=(num_features,), dtype=np.int32, name='observation'
        )

Next I've now setup the qnet

lstm_neurons = 50
train_sequence_length = 5

input_fc_layer_params=(40,)
output_fc_layer_params=(40,)

rnn_network = QRnnNetwork(
    train_env.observation_spec(),
    train_env.action_spec(),
    lstm_size=(lstm_neurons,),
    input_fc_layer_params=input_fc_layer_params,
    output_fc_layer_params=output_fc_layer_params,
)

agent = dqn_agent.DqnAgent(
        time_step_spec=train_env.time_step_spec(),
        action_spec=train_env.action_spec(),
        q_network=rnn_network,
        optimizer=optimizer,
        target_update_period=target_update_period,
        td_errors_loss_fn=tf.keras.losses.Huber(reduction="none"),
        gamma=discount,
        epsilon_greedy=lambda: epsilon_fn(train_step_counter),
        train_step_counter=train_step_counter
    )

Next to generate and use training data I understood to pass train_sequence_length + 1 for num_steps, which was previously 2 and now more due to increased sequence size.

# replay buffer and driver for training
replay_buffer = TFUniformReplayBuffer(
    agent.collect_data_spec,
    batch_size=replay_buffer_batch_size,
    max_length=replay_buffer_max_size
)

replay_buffer_observer = replay_buffer.add_batch
train_metrics = [tf_metrics.AverageReturnMetric()]

# Create q-policy to plot the learned q-values
qpolicy = QPolicy(train_env.time_step_spec(), train_env.action_spec(), rnn_network)

collect_driver = dynamic_step_driver.DynamicStepDriver(
    train_env,
    agent.collect_policy,
    observers=[replay_buffer_observer] + train_metrics,
    num_steps=collect_steps)

print('Initial data generation and setting up the dataset for training')
initial_collect_policy = random_tf_policy.RandomTFPolicy(train_env.time_step_spec(), train_env.action_spec())

init_driver = dynamic_step_driver.DynamicStepDriver(
    train_env,
    initial_collect_policy,
    observers=[replay_buffer.add_batch, ShowProgress(replay_buffer_max_size)],
    num_steps=replay_buffer_max_size)

final_time_step, final_policy_state = init_driver.run()

dataset = replay_buffer.as_dataset(sample_batch_size=16,
                                   num_steps=(train_sequence_length + 1), #2
                                   num_parallel_calls=4).prefetch(4)

collect_driver.run = common.function(collect_driver.run)
agent.train = common.function(agent.train)

Once I start training using the below commands, I receive the error "ValueError: Dimensions must be equal, but are 5 and 16 for '{{node gradient_tape/loss/mul_4/Mul}} = Mul[T=DT_FLOAT](loss/Cast, gradient_tape/loss/Tile_1)' with input shapes: [16,5], [16,16]."
Where 16 is the sample_batch_size and 5 the sequence length I'm trying to pass.
Please advice what I'm missing here.

time_step = None
policy_state = agent.collect_policy.get_initial_state(train_env.batch_size)
iterator = iter(dataset)
time_step, policy_state = collect_driver.run(time_step, policy_state)
trajectories, buffer_info = next(iterator)
train_loss = agent.train(trajectories)

The observations are now in shape (16, 6, 9), which seems to be correct (sample_batch_size, train_seq_length+1, nr_features). The code runs with num_steps=2.


问:
C# Dynamic aggregate function call using Expression
Here I trying to create function which will use Expression to call aggreate method like "Min" or "Sum" on IEnumerable<dobule>. Somehow not working for "Sum" and "Average". Here is code:

```<code>Func<IEnumerable<double>, double> BuildFunc(string func)
{
    var source = Expression.Parameter(typeof(IEnumerable<double>), "source");

    //For now added condition to handle it.
    var methodCallExpression = func == "Sum" || func == "Average"
        ? Expression.Call(typeof(Enumerable), func, Array.Empty<Type>(), source)
        : Expression.Call(typeof(Enumerable), func, new Type[] { typeof(double) },
        source);

    Expression conversion = Expression.Convert(methodCallExpression, typeof(double));

    var methodCall = Expression.Lambda<Func<IEnumerable<double>, double>>(
        conversion,
        source);

    return methodCall.Compile();
}
</code>```

Here is call:

```<code>IEnumerable<double> myList = new List<double> { 10, 20 };

var func = BuildFunc("Min");
double result = func(myList);

var func = BuildFunc("Sum");
double result = func(myList);
</code>```

How to make this function without adding method name condition?

Body:
Here I trying to create function which will use Expression to call aggreate method like "Min" or "Sum" on IEnumerable<dobule>. Somehow not working for "Sum" and "Average". Here is code:

Func<IEnumerable<double>, double> BuildFunc(string func)
{
    var source = Expression.Parameter(typeof(IEnumerable<double>), "source");

    //For now added condition to handle it.
    var methodCallExpression = func == "Sum" || func == "Average"
        ? Expression.Call(typeof(Enumerable), func, Array.Empty<Type>(), source)
        : Expression.Call(typeof(Enumerable), func, new Type[] { typeof(double) },
        source);

    Expression conversion = Expression.Convert(methodCallExpression, typeof(double));

    var methodCall = Expression.Lambda<Func<IEnumerable<double>, double>>(
        conversion,
        source);

    return methodCall.Compile();
}

Here is call:

IEnumerable<double> myList = new List<double> { 10, 20 };

var func = BuildFunc("Min");
double result = func(myList);

var func = BuildFunc("Sum");
double result = func(myList);

How to make this function without adding method name condition?


问:
How to set filename on a text part of a multipart request with Apache Http Client
The API that I want to call requires multipart/form-data with a part of textual content (XML) and non binary transfer-encoding. Furthermore, that part is required to have a filename as well.

I am using Apache HTTP Client and cannot find a way to create a text part and also set the filename in the Content-Disposition header.

StringBody class of HTTP client returns 'null' on the getFilename methode while ByteArrayBody part returns 'binary' on the getTransferEncoding() methode. Furthermore, the 'multipartEntityBuilder.addTextBody(partName, text, contentType);' method has no way of providing a filename for a text body.

Is it possible to set the filename on a text body part with HTTP client? And if so, why is there no easy way for doing this? Is it because it's less common to set a filename on a textual part? Is it something that is deprecated by the W3C standard? Or is HTTP client API just not so complete on this point?


问:
clang-format: Insert new line between braces
Are there any ways to achieve this (the dot indicates the position of the cursor) in Visual Studio Code by using clangd formatter

```<code>void foo()
{
   .
}
</code>```

instead of this

```<code> void foo()
 {
.}
</code>```

or are there any ways to just use the c/c++ extension formatter from Microsoft while using clangd intellisense in vscode as it asks me to disable the intellisense of c/c++ if i want to use clangd however turning off the intellisense of c/c++ will also turn off the formatter of it.

Body:
Are there any ways to achieve this (the dot indicates the position of the cursor) in Visual Studio Code by using clangd formatter

void foo()
{
   .
}

instead of this

 void foo()
 {
.}

or are there any ways to just use the c/c++ extension formatter from Microsoft while using clangd intellisense in vscode as it asks me to disable the intellisense of c/c++ if i want to use clangd however turning off the intellisense of c/c++ will also turn off the formatter of it.


问:
Do I need FCM to handle local notifications in React Native app?
I have a social-network like app in React Native and firebase which requires in-app notifications, something like a notification bell with a badge count that updates if a user likes or comments on one of your posts for example.

I recently started reading about FCM and similar tools but I am not sure if that is required/preferred for my use case. From my understanding, those are typically used for Push notifications, and I think that the in-app badge count can be handled using local context and queries to firestore.

In the future, I expect to have Push notifications as well for important alerts. Are those two things independent of each other? Can I manage in-app notification a certain way and use FCM for push notifications later, or will those eventually conflict? Would FCM handle all of the above use cases?

I couldn't find too many resources online. Whenever I search for react native notifications, I only get results about FCM and Push notifications.


问:
repl.it with secrets not working when I share my code
I have the following code in replit, this is my first time using replit so I do not know what I'm messing up. I have tried reading the replit documents about enviroment varibles, and I have been working on this for hours and can't figure out what is wrong. My username and passwords are right for the login, i have already checked gmail and made sure APP password is setup.
The thing is the code works when im on replit, but if I share the code, like the link to someone, and they try to run the program it gives the following error:

```<code>AttributeError: 'NoneType' object has no attribute
</code>```

I printed the env varibles on replit and it prints out the correct info, i printed the env varible type and they are both strings...so what do I do here im stuck.

```<code>my_secret = os.getenv("EmailAddy")
my_secret2 = os.getenv("EmailPass")
import smtplib
import os

s = smtplib.SMTP('smtp.gmail.com', 587)

# start TLS for security
s.starttls()

# Authentication
s.login(f"{my_secret}",f"{my_secret2}")
</code>```

I have tried also doing os.env.get (something like that)
I have tried just doing
s.login(my_secret,my_secrete2)
I have tried generating a new app password from gmail.
..nothin works

Body:
I have the following code in replit, this is my first time using replit so I do not know what I'm messing up. I have tried reading the replit documents about enviroment varibles, and I have been working on this for hours and can't figure out what is wrong. My username and passwords are right for the login, i have already checked gmail and made sure APP password is setup.
The thing is the code works when im on replit, but if I share the code, like the link to someone, and they try to run the program it gives the following error:

AttributeError: 'NoneType' object has no attribute

I printed the env varibles on replit and it prints out the correct info, i printed the env varible type and they are both strings...so what do I do here im stuck.

my_secret = os.getenv("EmailAddy")
my_secret2 = os.getenv("EmailPass")
import smtplib
import os

s = smtplib.SMTP('smtp.gmail.com', 587)

# start TLS for security
s.starttls()

# Authentication
s.login(f"{my_secret}",f"{my_secret2}")

I have tried also doing os.env.get (something like that)
I have tried just doing
s.login(my_secret,my_secrete2)
I have tried generating a new app password from gmail.
..nothin works


问:
Can pwnat be used for connection when client and server are behind NAT?
I'm trying pwnat from this link, but I have a couple issues.

https://samy.pl/pwnat/

Can this be used to establish a connection when both client and server are behind NAT?

If yes, then what syntax would I use to establish a SSH connection? (Explained for a dummy)

I've tried following the instructions from these links

https://www.sumitgupta.net/pwnat-example/
https://www.kali.org/tools/pwnat/

And I get the message "Listening on UDP", but I'm unable to establish any connection.


问:
Unable to sort data in Angular mat-table when grouping results
I followed This video to create a grouped view in my Material table, but I am unable to sort the results.  What I would like to have is:

```<code>**YEAR**
  All activities during Spring
  All activities during Summer
  All activities during Autumn
  All activities during Winter
**YEAR**
  All activities during Spring
  All activities during Summer
  All activities during Autumn
  All activities during Winter
</code>```

I assign an activitySeasonID for each season captured (Spring is 1, Summer 2, etc) and then sort the table on activitySeasonID.

Unfortunately, the group does not have an id, so it is putting all of those entries at the top instead of having a group, sorting all the entries under it, the next group, etc.

HTML

```<code><mat-table #table [dataSource]="dataSource" matSort>

    <ng-container matColumnDef="activitySeasonID">
        <mat-header-cell *matHeaderCellDef class="bold" mat-sort-header></mat-header-cell>
        <mat-cell *matCellDef="let activity" class="field-text"> {{ activity?.activitySeasonID }} </mat-cell>
    </ng-container>

        <ng-container matColumnDef="activitySeason">
            <mat-header-cell *matHeaderCellDef class="bold"> Season </mat-header-cell>
            <mat-cell *matCellDef="let activity" class="field-text" [ngStyle]="{'color':seasonColour(activity.activitySeason)}"> {{ activity?.activitySeason }} </mat-cell>
        </ng-container>

        <ng-container matColumnDef="character">
            <mat-header-cell *matHeaderCellDef class="bold"> Character </mat-header-cell>
            <mat-cell *matCellDef="let activity" class="field-text"> {{ activity?.character }} </mat-cell>
        </ng-container>

        <ng-container matColumnDef="activity">
            <mat-header-cell *matHeaderCellDef class="bold"> Activity </mat-header-cell>
            <mat-cell *matCellDef="let activity" class="field-text"> {{ activity?.activity }} </mat-cell>
        </ng-container>

        <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
        <mat-row *matRowDef="let row; columns: displayedColumns;"  mat-row-group></mat-row>

        <ng-container matColumnDef="groupHeader">
            <mat-cell *matCellDef="let groupBy" class="bold" style="color: #ffffff; background-color: #011f43">{{groupBy.activityYear}}</mat-cell>
        </ng-container>
        <mat-row *matRowDef="let row; columns: ['groupHeader']; when: isGroup"></mat-row>

    </mat-table>
</code>```

TS

```<code>const groupBy = function (xs, key) {
  return xs.reduce(function (rv, x) {
    (rv[x[key]] = rv[x[key]] || []).push(x);
    return rv;
  }, {});
}

export class CovenantActivitiesComponent implements OnInit {

  @ViewChild(MatPaginator) paginator: MatPaginator;
  @ViewChild(MatSort) sort: MatSort;
  displayedColumns = ['activitySeason', 'character', 'activity'];
  dataSource: MatTableDataSource<CovenantActivities>;
  activityData = [];

....constructor, lots of other non-relevant code

ngOnInit(): void {
this.covenantDataService.getCovenantSeasonalActivites(this.covID).subscribe(data => {
   let tempdatasource = []
   this.activityData = groupBy(data, 'activityYear');

   Object.keys(this.activityData).forEach(key => {
     tempdatasource.push({activityYear: key, isGroupBy: true });
     let values = this.activityData[key];
     values.forEach((element) => {tempdatasource.push(element);});
   });

   this.dataSource = new MatTableDataSource<CovenantActivities>(tempdatasource)
   this.sort.sort(({ id: 'activitySeasonID', start: 'asc'}) as MatSortable);
   this.dataSource.sort = this.sort;
  });
}

isGroup (index, item): boolean {
  return item.isGroupBy;
}
</code>```

Correct grouping but unsorted:

This is what happens when I add sorting:

Sample of what is returned in my datasource:

```<code>0: {activityYear: '1220', isGroupBy: true}
1: {activityYear: '1220', activitySeason: 'Summer', activityID: 'jSJuQXp2OchWDXlKAWTS', activity: 'wefsdfsdfsdfsfs', character: 'Britta', …}
2: {activityYear: '1222', isGroupBy: true}
3: {activitySeasonID: 4, activity: 'f fsdf sdfds fsdf sdfsdfs', activitySeason: 'Winter', activityYear: '1222', character: 'Theren', …}
4: {activityYear: '1229', isGroupBy: true}
5: {activity: 'sdfs fsdfsdfsdfsdfsdfsd', activitySeason: 'Winter', activityID: '31nmWjZbix6xlytUXeCA', character: 'Sidorov', activitySeasonID: 4, …}
6: {activity: 'das dasd asd dasd asd asds', character: 'Belisarius', activitySeason: 'Winter', activityID: 'm9AQUecuwhIms7WIslQp', …}
7: {activityYear: '1230', isGroupBy: true}
8: {activity: 'dfs fsdfsdf sdfdsfsdf', activityID: '6X6kAJgakXdfOaXqqN1o', activitySeason: 'Summer', activitySeasonID: 2, activityYear: '1230', …}
9: {activitySeason: 'Spring', activitySeasonID: 1, activity: 'Stuff was done', activityID: 'OMbZzNSqdcuO2uZf9oC6', …}
10: {activityYear: '1230', activityID: 'QTWGNDMzZ01LmTBU1ZaJ', activitySeasonID: 1, character: 'Theren', activitySeason: 'Spring', …}
11: {activityYear: '1233', isGroupBy: true}
12: {activityID: '2WIe1UsWkVHDEQzx9VWp', activitySeason: 'Autumn', activity: ' fsd fsdf sdf sdf sdfsd fsdf', activityYear: '1233', character: 'Theren', …}
13: {activityYear: '1233', character: 'Albertus Magnus', activityID: '3Yfwi7pDDdYjafRBWzc3', activitySeason: 'Summer', activity: 'dsfsd fsdfsdfsdf', …}
14: {activity: 'dfsf fsdfsdfsdfs dsf', activityID: '4EkzaSTwgPAPF7nKU3Sr', activitySeasonID: 2, character: 'Sargon', activityYear: '1233', …}
15: {character: 'Britta', activity: 'sdfdfsdf', activitySeasonID: 3, activitySeason: 'Autumn', activityYear: '1233', …}
16: {activityYear: '1240', isGroupBy: true}
17: {activity: 'sdfsdf dsfsdf sdfsd', activityID: 'ck2bhNb2E1Sgo71RZniJ', activitySeason: 'Summer', character: 'Sargon', activitySeasonID: 2, …}
</code>```

Body:
I followed This video to create a grouped view in my Material table, but I am unable to sort the results.  What I would like to have is:

**YEAR**
  All activities during Spring
  All activities during Summer
  All activities during Autumn
  All activities during Winter
**YEAR**
  All activities during Spring
  All activities during Summer
  All activities during Autumn
  All activities during Winter

I assign an activitySeasonID for each season captured (Spring is 1, Summer 2, etc) and then sort the table on activitySeasonID.

Unfortunately, the group does not have an id, so it is putting all of those entries at the top instead of having a group, sorting all the entries under it, the next group, etc.

HTML

<mat-table #table [dataSource]="dataSource" matSort>

    <ng-container matColumnDef="activitySeasonID">
        <mat-header-cell *matHeaderCellDef class="bold" mat-sort-header></mat-header-cell>
        <mat-cell *matCellDef="let activity" class="field-text"> {{ activity?.activitySeasonID }} </mat-cell>
    </ng-container>

        <ng-container matColumnDef="activitySeason">
            <mat-header-cell *matHeaderCellDef class="bold"> Season </mat-header-cell>
            <mat-cell *matCellDef="let activity" class="field-text" [ngStyle]="{'color':seasonColour(activity.activitySeason)}"> {{ activity?.activitySeason }} </mat-cell>
        </ng-container>

        <ng-container matColumnDef="character">
            <mat-header-cell *matHeaderCellDef class="bold"> Character </mat-header-cell>
            <mat-cell *matCellDef="let activity" class="field-text"> {{ activity?.character }} </mat-cell>
        </ng-container>

        <ng-container matColumnDef="activity">
            <mat-header-cell *matHeaderCellDef class="bold"> Activity </mat-header-cell>
            <mat-cell *matCellDef="let activity" class="field-text"> {{ activity?.activity }} </mat-cell>
        </ng-container>

        <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
        <mat-row *matRowDef="let row; columns: displayedColumns;"  mat-row-group></mat-row>

        <ng-container matColumnDef="groupHeader">
            <mat-cell *matCellDef="let groupBy" class="bold" style="color: #ffffff; background-color: #011f43">{{groupBy.activityYear}}</mat-cell>
        </ng-container>
        <mat-row *matRowDef="let row; columns: ['groupHeader']; when: isGroup"></mat-row>

    </mat-table>

TS

const groupBy = function (xs, key) {
  return xs.reduce(function (rv, x) {
    (rv[x[key]] = rv[x[key]] || []).push(x);
    return rv;
  }, {});
}

export class CovenantActivitiesComponent implements OnInit {

  @ViewChild(MatPaginator) paginator: MatPaginator;
  @ViewChild(MatSort) sort: MatSort;
  displayedColumns = ['activitySeason', 'character', 'activity'];
  dataSource: MatTableDataSource<CovenantActivities>;
  activityData = [];

....constructor, lots of other non-relevant code

ngOnInit(): void {
this.covenantDataService.getCovenantSeasonalActivites(this.covID).subscribe(data => {
   let tempdatasource = []
   this.activityData = groupBy(data, 'activityYear');

   Object.keys(this.activityData).forEach(key => {
     tempdatasource.push({activityYear: key, isGroupBy: true });
     let values = this.activityData[key];
     values.forEach((element) => {tempdatasource.push(element);});
   });

   this.dataSource = new MatTableDataSource<CovenantActivities>(tempdatasource)
   this.sort.sort(({ id: 'activitySeasonID', start: 'asc'}) as MatSortable);
   this.dataSource.sort = this.sort;
  });
}

isGroup (index, item): boolean {
  return item.isGroupBy;
}

Correct grouping but unsorted:

This is what happens when I add sorting:

Sample of what is returned in my datasource:

0: {activityYear: '1220', isGroupBy: true}
1: {activityYear: '1220', activitySeason: 'Summer', activityID: 'jSJuQXp2OchWDXlKAWTS', activity: 'wefsdfsdfsdfsfs', character: 'Britta', …}
2: {activityYear: '1222', isGroupBy: true}
3: {activitySeasonID: 4, activity: 'f fsdf sdfds fsdf sdfsdfs', activitySeason: 'Winter', activityYear: '1222', character: 'Theren', …}
4: {activityYear: '1229', isGroupBy: true}
5: {activity: 'sdfs fsdfsdfsdfsdfsdfsd', activitySeason: 'Winter', activityID: '31nmWjZbix6xlytUXeCA', character: 'Sidorov', activitySeasonID: 4, …}
6: {activity: 'das dasd asd dasd asd asds', character: 'Belisarius', activitySeason: 'Winter', activityID: 'm9AQUecuwhIms7WIslQp', …}
7: {activityYear: '1230', isGroupBy: true}
8: {activity: 'dfs fsdfsdf sdfdsfsdf', activityID: '6X6kAJgakXdfOaXqqN1o', activitySeason: 'Summer', activitySeasonID: 2, activityYear: '1230', …}
9: {activitySeason: 'Spring', activitySeasonID: 1, activity: 'Stuff was done', activityID: 'OMbZzNSqdcuO2uZf9oC6', …}
10: {activityYear: '1230', activityID: 'QTWGNDMzZ01LmTBU1ZaJ', activitySeasonID: 1, character: 'Theren', activitySeason: 'Spring', …}
11: {activityYear: '1233', isGroupBy: true}
12: {activityID: '2WIe1UsWkVHDEQzx9VWp', activitySeason: 'Autumn', activity: ' fsd fsdf sdf sdf sdfsd fsdf', activityYear: '1233', character: 'Theren', …}
13: {activityYear: '1233', character: 'Albertus Magnus', activityID: '3Yfwi7pDDdYjafRBWzc3', activitySeason: 'Summer', activity: 'dsfsd fsdfsdfsdf', …}
14: {activity: 'dfsf fsdfsdfsdfs dsf', activityID: '4EkzaSTwgPAPF7nKU3Sr', activitySeasonID: 2, character: 'Sargon', activityYear: '1233', …}
15: {character: 'Britta', activity: 'sdfdfsdf', activitySeasonID: 3, activitySeason: 'Autumn', activityYear: '1233', …}
16: {activityYear: '1240', isGroupBy: true}
17: {activity: 'sdfsdf dsfsdf sdfsd', activityID: 'ck2bhNb2E1Sgo71RZniJ', activitySeason: 'Summer', character: 'Sargon', activitySeasonID: 2, …}


问:
how to apply a pop up effect on images in my articles
I use the colormag theme which has a code to display a pop up when you click on a featured image in the articles it works great
But I would have liked this pop-up effect to be realized on the images that I put in my article

I present you the code to display a pop up on the featured images

```<code>
</code>```
```<code>    if ( ! has_post_format( array( 'gallery' ) ) ) :
    if ( ! get_theme_mod( 'colormag_featured_image_show', 0 ) && has_post_thumbnail() ) :
        ?>
        <div class="featured-image">
            <?php if ( 1 == get_theme_mod( 'colormag_featured_image_popup', 0 ) ) : ?>
                <a href="<?php echo esc_url( $image_popup_url ); ?>" class="image-popup"><?php the_post_thumbnail( 'colormag-featured-image' ); ?></a>
                <?php
            else :
                the_post_thumbnail( 'colormag-featured-image' );
            endif;
            ?>
        </div>
        <?php
        endif;
    endif;
</code>```
```<code>
</code>```

Body:
I use the colormag theme which has a code to display a pop up when you click on a featured image in the articles it works great
But I would have liked this pop-up effect to be realized on the images that I put in my article

I present you the code to display a pop up on the featured images

    if ( ! has_post_format( array( 'gallery' ) ) ) :
    if ( ! get_theme_mod( 'colormag_featured_image_show', 0 ) && has_post_thumbnail() ) :
        ?>

            <?php if ( 1 == get_theme_mod( 'colormag_featured_image_popup', 0 ) ) : ?>
                <a href="<?php echo esc_url( $image_popup_url ); ?>" class="image-popup"><?php the_post_thumbnail( 'colormag-featured-image' ); ?>
                <?php
            else :
                the_post_thumbnail( 'colormag-featured-image' );
            endif;
            ?>

        <?php
        endif;
    endif;


问:
Failed to create table: Not found: URI gs://spls/bq-soccer-analytics/players.json
I was doing this Google cloud Sports Data Challenge

Big Query page

I cannot load this JSON file data into the big query

THESE ARE THE 4 JSON FILES

Apparently even Google couldn't solve the problem in three days time. Can anyone help me with that?

Every time I try to load these file it shows an error:

Failed to create table: Not found: URI gs://spls/bq-soccer-analytics/players.json

Error message


问:
App is not opening in ios through branch deeplinking
i have already import branch still its giving Use of undeclared identifier 'Branch'.[[enter image description here](https://i.stack.imgur.com/bv07b.jpg)](https://i.stack.imgur.com/BCy89.jpg)

I just want to open the app when we click in quick link created by branch.io

#import <Branch/Branch.h>

[Branch setUseTestBranchKey:YES];
// listener for Branch Deep Link data
[[Branch getInstance] initSessionWithLaunchOptions:launchOptions andRegisterDeepLinkHandler:^(NSDictionary * _Nonnull params, NSError * _Nullable error) {
// do stuff with deep link data (nav to a page, display content, etc)
NSLog(@"%@", params);
}];


问:
How to create undo using Snackbar in FirebaseRecyclerAdapter?
I want to create undo function using Snackbar in FirebaseRecyclerAdapter when "Delete" option is clicked.
I have achieved my goal to create Undo function using Snackbar but my main aim is to show item deleted from FirebaseRecyclerAdapter and when undo is clicked I want that deleted item to be back in FirebaseRecyclerAdapter. How can I do that? Please help me !

Here's my code of FirebaseRecyclerAdapter class.

```<code>public class MyAdapter extends FirebaseRecyclerAdapter<ExpenseModel, MyAdapter.MyViewHolder> {
    DatabaseReference databaseReference;
    GoogleSignInAccount account;
    Context context;
    int calendarClick,
            beerClick,
            rentClick,
            bikeClick,
            groceryClick,
            foodClick = 0;

    String whichCategorySelected;
    boolean isCategorySelected = false;
    String expenseType = "";
    String updateDate = "";
    String stopDelete = "";

    public MyAdapter(@NonNull FirebaseRecyclerOptions<ExpenseModel> options, Context context) {
        super(options);
        this.context = context;
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void onBindViewHolder(@NonNull MyViewHolder holder, @SuppressLint("RecyclerView") int position, @NonNull ExpenseModel model) {
        account = GoogleSignIn.getLastSignedInAccount(context);
        setDatabaseReference(account);
        holder.expenseItem.setText(model.getDescription());
        holder.expenseAmount.setText("Rs. " + model.getAmount());
        holder.expenseDate.setText(model.getTime());
        holder.category.setText(model.getExType());

        //show update dialog when clicked on recycler view item and
        //delete the selected item from recycler view
        holder.itemView.setOnClickListener(new View.OnClickListener()  {
            @Override
            public void onClick(View view) {
                int timeSnackBar = 5000;

                PopupMenu popupMenu = new PopupMenu(context, view);
                popupMenu.getMenu().add("Edit");
                popupMenu.getMenu().add("Delete");
                popupMenu.getMenu().add("Delete all");
                popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem menuItem) {
                        if (menuItem.getTitle().equals("Edit")) {
                            calendarClick = 0;
                            expenseType = model.getExType();
                            showUpdateDialog(view, model.getDescription(), model.getAmount(), model.getTime(), position);
                        } else if (menuItem.getTitle().equals("Delete")) {

                            Snackbar snackbar = Snackbar.make(view, "Item is being deleted", Snackbar.LENGTH_LONG)
                                    .setAction("UNDO", new View.OnClickListener() {
                                        @Override
                                        public void onClick(View view) {
                                            stopDelete = "STOP";
                                        }
                                    }).setDuration(timeSnackBar);
//                            snackbar.getView().getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
                            Snackbar.SnackbarLayout snackbarLayout = (Snackbar.SnackbarLayout) snackbar.getView();

                            snackbarLayout.setPadding(0,0,0,0);
                            snackbar.show();
                            new Handler().postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    if (!stopDelete.equals("STOP")) {
                                        databaseReference.child(Objects.requireNonNull(getRef(holder.getLayoutPosition()).getKey()))
                                                .removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
                                                    @Override
                                                    public void onComplete(@NonNull Task<Void> task) {
                                                        if (task.isSuccessful()) {
                                                            Toast.makeText(context, "Deleted", Toast.LENGTH_SHORT).show();
                                                            stopDelete = "";
                                                        }
                                                    }
                                                });
                                    }else {
                                        stopDelete = "";
                                    }
                                }
                            }, timeSnackBar);

                        } else {
                            new AlertDialog.Builder(context)
                                    .setTitle("Alert")
                                    .setMessage("Are you sure delete everything ?")
                                    .setCancelable(false)
                                    .setIcon(R.drawable.warning)
                                    .setPositiveButton("Continue", new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialogInterface, int i) {
                                            getDatabaseReference(account).removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
                                                @Override
                                                public void onComplete(@NonNull Task<Void> task) {
                                                    if (task.isSuccessful()) {
                                                        Toast.makeText(view.getContext(), "All expenses deleted", Toast.LENGTH_SHORT).show();
                                                    }
                                                }
                                            }).addOnFailureListener(new OnFailureListener() {
                                                @Override
                                                public void onFailure(@NonNull Exception e) {
                                                    Toast.makeText(view.getContext(), "Something went wrong. Please check your internet", Toast.LENGTH_SHORT).show();
                                                }
                                            });
                                        }
                                    }).setNegativeButton("Cancel", null)
                                    .show();
                        }
                        return true;
                    }
                });
                popupMenu.show();
            }
        });
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_view, parent, false);
        return new MyViewHolder(v);
    }

    public static class MyViewHolder extends RecyclerView.ViewHolder {
        TextView expenseItem, expenseAmount, expenseDate, category;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            expenseItem = itemView.findViewById(R.id.recyclerItemView);
            expenseAmount = itemView.findViewById(R.id.recyclerAmountView);
            expenseDate = itemView.findViewById(R.id.recyclerDateView);
            category = itemView.findViewById(R.id.recyclerCategory);
        }
    }
}
</code>```

Body:
I want to create undo function using Snackbar in FirebaseRecyclerAdapter when "Delete" option is clicked.
I have achieved my goal to create Undo function using Snackbar but my main aim is to show item deleted from FirebaseRecyclerAdapter and when undo is clicked I want that deleted item to be back in FirebaseRecyclerAdapter. How can I do that? Please help me !

Here's my code of FirebaseRecyclerAdapter class.

public class MyAdapter extends FirebaseRecyclerAdapter<ExpenseModel, MyAdapter.MyViewHolder> {
    DatabaseReference databaseReference;
    GoogleSignInAccount account;
    Context context;
    int calendarClick,
            beerClick,
            rentClick,
            bikeClick,
            groceryClick,
            foodClick = 0;

    String whichCategorySelected;
    boolean isCategorySelected = false;
    String expenseType = "";
    String updateDate = "";
    String stopDelete = "";

    public MyAdapter(@NonNull FirebaseRecyclerOptions<ExpenseModel> options, Context context) {
        super(options);
        this.context = context;
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void onBindViewHolder(@NonNull MyViewHolder holder, @SuppressLint("RecyclerView") int position, @NonNull ExpenseModel model) {
        account = GoogleSignIn.getLastSignedInAccount(context);
        setDatabaseReference(account);
        holder.expenseItem.setText(model.getDescription());
        holder.expenseAmount.setText("Rs. " + model.getAmount());
        holder.expenseDate.setText(model.getTime());
        holder.category.setText(model.getExType());

        //show update dialog when clicked on recycler view item and
        //delete the selected item from recycler view
        holder.itemView.setOnClickListener(new View.OnClickListener()  {
            @Override
            public void onClick(View view) {
                int timeSnackBar = 5000;

                PopupMenu popupMenu = new PopupMenu(context, view);
                popupMenu.getMenu().add("Edit");
                popupMenu.getMenu().add("Delete");
                popupMenu.getMenu().add("Delete all");
                popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem menuItem) {
                        if (menuItem.getTitle().equals("Edit")) {
                            calendarClick = 0;
                            expenseType = model.getExType();
                            showUpdateDialog(view, model.getDescription(), model.getAmount(), model.getTime(), position);
                        } else if (menuItem.getTitle().equals("Delete")) {

                            Snackbar snackbar = Snackbar.make(view, "Item is being deleted", Snackbar.LENGTH_LONG)
                                    .setAction("UNDO", new View.OnClickListener() {
                                        @Override
                                        public void onClick(View view) {
                                            stopDelete = "STOP";
                                        }
                                    }).setDuration(timeSnackBar);
//                            snackbar.getView().getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
                            Snackbar.SnackbarLayout snackbarLayout = (Snackbar.SnackbarLayout) snackbar.getView();

                            snackbarLayout.setPadding(0,0,0,0);
                            snackbar.show();
                            new Handler().postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    if (!stopDelete.equals("STOP")) {
                                        databaseReference.child(Objects.requireNonNull(getRef(holder.getLayoutPosition()).getKey()))
                                                .removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
                                                    @Override
                                                    public void onComplete(@NonNull Task<Void> task) {
                                                        if (task.isSuccessful()) {
                                                            Toast.makeText(context, "Deleted", Toast.LENGTH_SHORT).show();
                                                            stopDelete = "";
                                                        }
                                                    }
                                                });
                                    }else {
                                        stopDelete = "";
                                    }
                                }
                            }, timeSnackBar);

                        } else {
                            new AlertDialog.Builder(context)
                                    .setTitle("Alert")
                                    .setMessage("Are you sure delete everything ?")
                                    .setCancelable(false)
                                    .setIcon(R.drawable.warning)
                                    .setPositiveButton("Continue", new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialogInterface, int i) {
                                            getDatabaseReference(account).removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
                                                @Override
                                                public void onComplete(@NonNull Task<Void> task) {
                                                    if (task.isSuccessful()) {
                                                        Toast.makeText(view.getContext(), "All expenses deleted", Toast.LENGTH_SHORT).show();
                                                    }
                                                }
                                            }).addOnFailureListener(new OnFailureListener() {
                                                @Override
                                                public void onFailure(@NonNull Exception e) {
                                                    Toast.makeText(view.getContext(), "Something went wrong. Please check your internet", Toast.LENGTH_SHORT).show();
                                                }
                                            });
                                        }
                                    }).setNegativeButton("Cancel", null)
                                    .show();
                        }
                        return true;
                    }
                });
                popupMenu.show();
            }
        });
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_view, parent, false);
        return new MyViewHolder(v);
    }

    public static class MyViewHolder extends RecyclerView.ViewHolder {
        TextView expenseItem, expenseAmount, expenseDate, category;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            expenseItem = itemView.findViewById(R.id.recyclerItemView);
            expenseAmount = itemView.findViewById(R.id.recyclerAmountView);
            expenseDate = itemView.findViewById(R.id.recyclerDateView);
            category = itemView.findViewById(R.id.recyclerCategory);
        }
    }
}