问:
Can we completely customize the default MuiSvgIcon in mui React
I am currently using Materal UI react in my project.

[I want to change the default Svg Img {...} in this breadcrumb to an img ]enter image description here
[and also rather than listing the rest of the breadcrumbs to the right i want to list them in a dropdown list format ]
enter image description here

```<code>import Link from '@mui/material/Link';
import * as React from 'react'; import Breadcrumbs from '@mui/material/Breadcrumbs';
function handleClick(event) { event.preventDefault(); console.info('You clicked a breadcrumb.'); }

export default function Breadcrumbss() { return ( <div role="presentation" onClick={handleClick}> <Breadcrumbs separator=">" maxItems={2}>
<Link underline="none" color="inherit" href="#">
      Home
    </Link>

    <Link underline="none" color="inherit" href="#">
      Catalog
    </Link>

    <Link underline="none" color="inherit" href="#">
      Accessories
    </Link>

    <Link underline="none" color="inherit" href="#">
      New Collection
    </Link>

  </Breadcrumbs>
</div>
); }
</code>```

Body:
I am currently using Materal UI react in my project.

[I want to change the default Svg Img {...} in this breadcrumb to an img ]enter image description here
[and also rather than listing the rest of the breadcrumbs to the right i want to list them in a dropdown list format ]
enter image description here

import Link from '@mui/material/Link';
import * as React from 'react'; import Breadcrumbs from '@mui/material/Breadcrumbs';
function handleClick(event) { event.preventDefault(); console.info('You clicked a breadcrumb.'); }

export default function Breadcrumbss() { return (
 <Breadcrumbs separator=">" maxItems={2}>
<Link underline="none" color="inherit" href="#">
      Home
    </Link>

    <Link underline="none" color="inherit" href="#">
      Catalog
    </Link>

    <Link underline="none" color="inherit" href="#">
      Accessories
    </Link>

    <Link underline="none" color="inherit" href="#">
      New Collection
    </Link>

  </Breadcrumbs>

); }


来源: stackexchange

问:
Ros and another process running on same machine,how can they communicate with each other using zeromq
Ros and my own app running on the same machine(ubuntu 20.04),I want to use zeromq to publish some messages to ros and subscribe some messages from ros;How can I do?

I konw ros a little.

ContentLicense: CC BY-SA 4.0


问:
can't implement the bundle on / root page in react js ssr
Im working on a react project. And i need to use Server-Side-Rendering for the project. when i am trying to implement ssr in my react js code, it renders the bundled code inside every page (for example, http://localhost:3000/aboutUs or http://localhost:3000/contact) except the root page(http://localhost:3000/).

but at the same time, when i change the root page route to http://localhost:3000/home, the same page works for the other link. i am sure that the code is perfectly fine but there is just an issue with the root page url rendering with ssr.

can anyone please help me with the same issue ? i really appreciate it. i am worried about the problem for almost a week now.

I just want to make the ssr work in the root page (http://localhost:3000/)


问:
Elapsed time PerfTips while debugging in Visual Studio 2022 isn't working in Docker
I have a .net core project that I deploy in Docker for Desktop.

I can debug the project with breakpoints but the Elapsed time PerfTips is not showing up between lines.

I have the problem only when I launch it from the Docker config.

launchsettings.json

```<code>  "profiles": {
    "MyAppName": {
      "commandName": "Project",
 ...
    "Docker": {
      "commandName": "Docker",
 ...
</code>```

If I select the MyAppName config the Elapsed time is showing up though but would be hard to have all the config I need with it (volumes & ports).

This is enabled:
Options | Debugging | [x] Show elapsed time PerfTip while debugging

Body:
I have a .net core project that I deploy in Docker for Desktop.

I can debug the project with breakpoints but the Elapsed time PerfTips is not showing up between lines.

I have the problem only when I launch it from the Docker config.

launchsettings.json

  "profiles": {
    "MyAppName": {
      "commandName": "Project",
 ...
    "Docker": {
      "commandName": "Docker",
 ...

If I select the MyAppName config the Elapsed time is showing up though but would be hard to have all the config I need with it (volumes & ports).

This is enabled:
Options | Debugging | [x] Show elapsed time PerfTip while debugging


问:
My termux is installing lemon on every command. I made some changes in root directories but something went wrong that's why I am not these issues
I made some changes in root directories to fix some errors while installing npm by reading various articles from Google. But now it seems as if I done something wrong. Now I tried

apt install wget
But showed error in installing of lemon. However I am not installing lemon.
Error is given below.
`~ $ apt install git

Reading package lists... Done          Building dependency tree... Done

Reading state information... Done      git is already the newest version (2.39.0).                                   0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.                1 not fully installed or removed.

After this operation, 0 B of additional disk space will be used.

Do you want to continue? [Y/n] y       Setting up lemon (2.1-2) ...

npm WARN old lockfile                  npm WARN old lockfile The package-lock.json file was created with an old version of npm,

npm WARN old lockfile so supplemental metadata must be fetched from the registry.

npm WARN old lockfile

npm WARN old lockfile This is a one-time fix-up, please be patient...

npm WARN old lockfile

npm ERR! Exit handler never called!

npm ERR! This is an error with npm itself. Please report this error at:

npm ERR!     https://github.com/npm/cli/issues

npm ERR! A complete log of this run can be found in:

npm ERR!     /data/data/com.termux/files/home/.npm/_logs/2023-01-09T06_06_02_488Z-debug-0.log

dpkg: error processing package lemon (--configure):

installed lemon package post-installation script subprocess returned error exit status 1

Errors were encountered while processing:

lemon

E: Sub-process /data/data/com.termux/files/usr/bin/dpkg returned an error code (1)Then I thought that pkg update andpkg upgradewill fix these issues but this is also doing the same work  ~ $ apt upgrade                        Reading package lists... Done

Building dependency tree... Done

Reading state information... Done      Calculating upgrade... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.                1 not fully installed or removed.

After this operation, 0 B of additional disk space will be used.

Do you want to continue? [Y/n] y       Setting up lemon (2.1-2) ...

npm WARN old lockfile                  npm WARN old lockfile The package-lock.json file was created with an old version of npm,

npm WARN old lockfile so supplemental metadata must be fetched from the registry.                                    npm WARN old lockfile

npm WARN old lockfile This is a one-time fix-up, please be patient...

npm WARN old lockfile

npm ERR! Exit handler never called!

npm ERR! This is an error with npm itself. Please report this error at:

npm ERR!     https://github.com/npm/cli/issues

npm ERR! A complete log of this run can be found in:

npm ERR!     /data/data/com.termux/files/home/.npm/_logs/2023-01-09T06_22_27_388Z-debug-0.log

dpkg: error processing package lemon (--configure):

installed lemon package post-installation script subprocess returned error exit status 1

Errors were encountered while processing:

lemon

E: Sub-process /data/data/com.termux/files/usr/bin/dpkg returned an error code (1)

~ $`

Someone tell please that how can I fix this.

I described a problem which I am facing in my termux and hope that some linix experts will take me out of this problem.


问:
Revert file size in human-readable string to bytes in Javascript
I didn't see any example of reverting human-readable file size to an integer

There're a lot of functions which help to convert file size to human readble, such as:
1024 bytes -> 1KB. Here is an question about this: Converting file size in bytes to human-readable string

But I didn't see anywhere to support revert the process, such as: 1Kb -> 1024.

I recieved data from backend API, and it returns, for example 10MB, and I want to convert this String to an integer (bytes) to compare file sizes of multiple files. How to I do this in Javascript?


问:
I STORAGE [main] Max cache overflow file size custom option: 0
i got an error in my mongodb, I STORAGE [main] Max cache overflow file size custom option: 0

how can i fix it?

```<code>● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset:
   Active: failed (Result: exit-code) since Mon 2023-01-09 12:09:19 WIB; 1h 20mi
     Docs: https://docs.mongodb.org/manual
  Process: 29988 ExecStart=/usr/bin/mongod --auth --config /etc/mongod.conf (cod
 Main PID: 29988 (code=exited, status=48)

Jan 09 12:09:18 calibration systemd[1]: Started MongoDB Database Server.
Jan 09 12:09:19 calibration mongod[29988]: 2023-01-09T12:09:19.073+0700 I STORAG
Jan 09 12:09:19 calibration systemd[1]: mongod.service: Main process exited, cod
Jan 09 12:09:19 calibration systemd[1]: mongod.service: Failed with result 'exit
</code>```

Body:
i got an error in my mongodb, I STORAGE [main] Max cache overflow file size custom option: 0

how can i fix it?

● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset:
   Active: failed (Result: exit-code) since Mon 2023-01-09 12:09:19 WIB; 1h 20mi
     Docs: https://docs.mongodb.org/manual
  Process: 29988 ExecStart=/usr/bin/mongod --auth --config /etc/mongod.conf (cod
 Main PID: 29988 (code=exited, status=48)

Jan 09 12:09:18 calibration systemd[1]: Started MongoDB Database Server.
Jan 09 12:09:19 calibration mongod[29988]: 2023-01-09T12:09:19.073+0700 I STORAG
Jan 09 12:09:19 calibration systemd[1]: mongod.service: Main process exited, cod
Jan 09 12:09:19 calibration systemd[1]: mongod.service: Failed with result 'exit


问:
Can I use Three.js in React Native for Desktop?
As I understand, React Three Fiber(R3F) supports React Native, but not sure if it works in the React Native for Desktop App. (R3F).

They uses expo-gl library, and the offical document of expo says that it supports android, ios, and web.

Does this mean that I cannot use R3F in React Native for Desktop (Windows, macOS)?

I've tried to initiate the React Native for Desktop app and tried to install three, R3F, and, expo-gl and run, but it didn't work.


问:
First and Last Day of 4 Weeks in C# DateTime Objects
I'm trying to Get the First and Last Day of 4 Weeks based on the given Date.

For Example:

If the given Date is 8-Jan-2023 then the week start and end should be 1-Jan-2023 and 28-Jan-2023 respectively.

If the given Date is 10-Jan-2023 then the week start and end should be 1-Jan-2023 and 28-Jan-2023 respectively.

If the given Date is 30-Jan-2023 then the week start and end should be 29-Jan-2023 and 25-Jan-2023 respectively.

Basically, the use case depends on the very first input. If the first input is 15-Jan then the first 4 weeks are recorded in the database as 15-Jan to 11-Feb. In that case, 17-Jan belongs to that week

How to do this?

I'm getting the Start Day & end Date of the week as below:

```<code>public static DateTime FirstDayOfWeek(this DateTime dt)
{
    var culture = Thread.CurrentThread.CurrentCulture;
    var diff = dt.DayOfWeek - culture.DateTimeFormat.FirstDayOfWeek;
    if (diff < 0)
    {
        diff += 7;
    }
    return dt.AddDays(-diff).Date;
 }

 public static DateTime LastDayOfFourWeeks(this DateTime dt) =>
            dt.FirstDayOfWeek().AddDays(27);
</code>```

Body:
I'm trying to Get the First and Last Day of 4 Weeks based on the given Date.

For Example:

If the given Date is 8-Jan-2023 then the week start and end should be 1-Jan-2023 and 28-Jan-2023 respectively.

If the given Date is 10-Jan-2023 then the week start and end should be 1-Jan-2023 and 28-Jan-2023 respectively.

If the given Date is 30-Jan-2023 then the week start and end should be 29-Jan-2023 and 25-Jan-2023 respectively.

Basically, the use case depends on the very first input. If the first input is 15-Jan then the first 4 weeks are recorded in the database as 15-Jan to 11-Feb. In that case, 17-Jan belongs to that week

How to do this?

I'm getting the Start Day & end Date of the week as below:

public static DateTime FirstDayOfWeek(this DateTime dt)
{
    var culture = Thread.CurrentThread.CurrentCulture;
    var diff = dt.DayOfWeek - culture.DateTimeFormat.FirstDayOfWeek;
    if (diff < 0)
    {
        diff += 7;
    }
    return dt.AddDays(-diff).Date;
 }

 public static DateTime LastDayOfFourWeeks(this DateTime dt) =>
            dt.FirstDayOfWeek().AddDays(27);


问:
How to create a high load trap receiver?
I need to process a very large number of traps (10,000 per second). I have the simplest linux server. I tried to implement through threads, but cpu clogs up very quickly. Please tell me how to minimize the load on memory and processor, but at the same time process a large number of traps?
There is also work with the database. Writing to the database of taps</p>
```<code>from pysnmp.entity import engine, config
from pysnmp.carrier.asyncore.dgram import udp
from pysnmp.entity.rfc3413 import ntfrcv
import psycopg2
from pysnmp.hlapi import SnmpEngine as Sm, CommunityData, UdpTransportTarget,\
                         ContextData, ObjectType, ObjectIdentity, getCmd
from datetime import datetime
import logging.config
from os import getpid, system, stat, path, chdir, listdir, remove
from threading import Thread

snmpEngine = engine.SnmpEngine()

config.addTransport(
    snmpEngine,
    udp.domainName + (1,),
    udp.UdpTransport().openServerMode(('localhost', 162))
)

config.addV1System(snmpEngine, '', 'public')

class cbFun(Thread):
    def __init__(self, snmpEngine, stateReference, contextEngineId, contextName,
                 varBinds, cbCtx):
        Thread.__init__(self)
        self.snmpEngine = snmpEngine
        self.stateReference = stateReference
        self.contextEngineId = contextEngineId
        self.contextName = contextName
        self.varBinds = varBinds
        self.cbCtx = cbCtx
        self.localConnected = False
        self.localDb = None
        self.errorFlag = False
        self.start()

    def run(self):
        print('\n{0}New trap message received on {1} {0}'.format(
                '-' * 7,
                datetime.now().strftime('%d-%b-%Y at %H:%M:%S')))
        execContext = self.snmpEngine.observer.getExecutionContext(
                'rfc3412.receiveMessage:request')
        print('Trap is coming from %s:%s' % execContext['transportAddress'])
        dict_traps = {}
        for name, val in self.varBinds:
            oid = name.prettyPrint()
            value = val.prettyPrint()
            print(f'{oid} = {value}')
            dict_traps.update({oid: value})

        connectDB(dict_traps)

    def connectDB(self, values):
        connect = psycopg2.connect(dbname="test", user="test",
                                            password="test",
                                            host="test")
        cursor = connect.cursor()
        for key,value in values:

            command = f"insert into TRAPS VALUES ({key}, {value})"
            cursor.execute(command)
        connect.commit()
        connect.close()

ntfrcv.NotificationReceiver(snmpEngine, cbFun)

snmpEngine.transportDispatcher.jobStarted(1)

try:
    snmpEngine.transportDispatcher.runDispatcher()
except:
    snmpEngine.transportDispatcher.closeDispatcher()
    raise

</code>```

Body:
I need to process a very large number of traps (10,000 per second). I have the simplest linux server. I tried to implement through threads, but cpu clogs up very quickly. Please tell me how to minimize the load on memory and processor, but at the same time process a large number of traps?
There is also work with the database. Writing to the database of taps

from pysnmp.entity import engine, config
from pysnmp.carrier.asyncore.dgram import udp
from pysnmp.entity.rfc3413 import ntfrcv
import psycopg2
from pysnmp.hlapi import SnmpEngine as Sm, CommunityData, UdpTransportTarget,\
                         ContextData, ObjectType, ObjectIdentity, getCmd
from datetime import datetime
import logging.config
from os import getpid, system, stat, path, chdir, listdir, remove
from threading import Thread

snmpEngine = engine.SnmpEngine()

config.addTransport(
    snmpEngine,
    udp.domainName + (1,),
    udp.UdpTransport().openServerMode(('localhost', 162))
)

config.addV1System(snmpEngine, '', 'public')

class cbFun(Thread):
    def __init__(self, snmpEngine, stateReference, contextEngineId, contextName,
                 varBinds, cbCtx):
        Thread.__init__(self)
        self.snmpEngine = snmpEngine
        self.stateReference = stateReference
        self.contextEngineId = contextEngineId
        self.contextName = contextName
        self.varBinds = varBinds
        self.cbCtx = cbCtx
        self.localConnected = False
        self.localDb = None
        self.errorFlag = False
        self.start()

    def run(self):
        print('\n{0}New trap message received on {1} {0}'.format(
                '-' * 7,
                datetime.now().strftime('%d-%b-%Y at %H:%M:%S')))
        execContext = self.snmpEngine.observer.getExecutionContext(
                'rfc3412.receiveMessage:request')
        print('Trap is coming from %s:%s' % execContext['transportAddress'])
        dict_traps = {}
        for name, val in self.varBinds:
            oid = name.prettyPrint()
            value = val.prettyPrint()
            print(f'{oid} = {value}')
            dict_traps.update({oid: value})

        connectDB(dict_traps)

    def connectDB(self, values):
        connect = psycopg2.connect(dbname="test", user="test",
                                            password="test",
                                            host="test")
        cursor = connect.cursor()
        for key,value in values:

            command = f"insert into TRAPS VALUES ({key}, {value})"
            cursor.execute(command)
        connect.commit()
        connect.close()

ntfrcv.NotificationReceiver(snmpEngine, cbFun)

snmpEngine.transportDispatcher.jobStarted(1)

try:
    snmpEngine.transportDispatcher.runDispatcher()
except:
    snmpEngine.transportDispatcher.closeDispatcher()
    raise


问:
How to check if a plot is visible under a tab panel?
I am working on data visualization with R and shiny.

It takes some time to load my visualization and be able to provide plots under tab panels.

Ex. I made 3 tabs for box plot, bar plot, and bean plot

Taking time to visualize the result is understandable, but I am not sure how to check if the plot is visible so that users do not need to wait even though incProcess function reports the program is done.

First, I recorded the time to visualize and tried to delay some time, but it is very subjective to the data input, so I do not think that is a good solution.

Would you be able to provide me solution?

Thank you

I think I need a solution NOT to check if a code is done but the visualization is done.


问:
extract a color from an image with only Numpy without open CV
I want to extract a specific range of colors from an image represented by a Numpy array. Specifically, I would like to express the following equivalent code without using for statements.

```<code>lcol=np.array((23,22,174))
hcol=np.array((77,77,255))

def extract_color_from(img_array) :
    height=np.shape(img_array)[0]
    width=np.shape(img_array)[1]
    for y in range(0,height) :
        for x in range(0,width) :
            for i in range(0,3) :
                if lcol[i]<img_array[y,x][i]<hcol[i] :
                    pass
                else :
                    img_array[y,x]=[0,0,0]

    return img_array
</code>```

I have tried to figure it out using the np.where and np.all functions, but it doesn't work.

```<code>lcol=np.array((23,22,174))
hcol=np.array((77,77,255))

def extract_color_from2(img_array) :
    mask=np.all((lcol<=img) & (img<=hcol),axis=2)
    ?????????????????
    ?????????????????
    return img_array
</code>```

Body:
I want to extract a specific range of colors from an image represented by a Numpy array. Specifically, I would like to express the following equivalent code without using for statements.

lcol=np.array((23,22,174))
hcol=np.array((77,77,255))

def extract_color_from(img_array) :
    height=np.shape(img_array)[0]
    width=np.shape(img_array)[1]
    for y in range(0,height) :
        for x in range(0,width) :
            for i in range(0,3) :
                if lcol[i]<img_array[y,x][i]<hcol[i] :
                    pass
                else :
                    img_array[y,x]=[0,0,0]

    return img_array

I have tried to figure it out using the np.where and np.all functions, but it doesn't work.

lcol=np.array((23,22,174))
hcol=np.array((77,77,255))

def extract_color_from2(img_array) :
    mask=np.all((lcol<=img) & (img<=hcol),axis=2)
    ?????????????????
    ?????????????????
    return img_array


问:
Nginx Blocking task with long processing time
I'm trying to perform horizontal scaling of long processing task with docker compose.
To simulate that task, I used the following code in python:

```<code>@app.get("/test")
def test():
    start = time.time()
    print("Start time", time.asctime(time.localtime(start)))
    time.sleep(5)
    end = time.time()
    print("End time", time.asctime(time.localtime(end)))
    return {"start":start, "end":end}
</code>```

In docker compose I created 2 containers for the same code above. Mainly back1 and back2

```<code>version: '3.8'
services:
  back1:
    build:
      context: ./backend
      dockerfile: DockerFile
    volumes:
      - ./backend:/usr/code
    command: python main.py
    ports:
      - "8001"
  back2:
    build:
      context: ./backend
      dockerfile: DockerFile
    volumes:
      - ./backend:/usr/code
    command: python main.py
    ports:
      - "8001"

  nginx:
    build:
      context: ./backend/config
      dockerfile: DockerFile
    ports:
      - "80:80"
</code>```

And this is my nginx conf file:

```<code>upstream backend {
    server back1:8001;
    server back2:8001;

    keepalive 32;
}

server {
    listen 80;
    server_name api.localhost;
    location / {
        proxy_pass http://backend;
    }
}
</code>```

I tried to simultaneously trigger the API http://api.localhost/test. However it seems that the second request was activated after the 1st request is completed. Even though it was processed by different instance of container.

Is nginx actually blocking?? I know that we can use queueing (eg: rabbitMQ, etc), but I thought that spinning up 2 docker container and using nginx as load balancer would achieve horizontal scalling. Am I wrong?

Body:
I'm trying to perform horizontal scaling of long processing task with docker compose.
To simulate that task, I used the following code in python:

@app.get("/test")
def test():
    start = time.time()
    print("Start time", time.asctime(time.localtime(start)))
    time.sleep(5)
    end = time.time()
    print("End time", time.asctime(time.localtime(end)))
    return {"start":start, "end":end}

In docker compose I created 2 containers for the same code above. Mainly back1 and back2

version: '3.8'
services:
  back1:
    build:
      context: ./backend
      dockerfile: DockerFile
    volumes:
      - ./backend:/usr/code
    command: python main.py
    ports:
      - "8001"
  back2:
    build:
      context: ./backend
      dockerfile: DockerFile
    volumes:
      - ./backend:/usr/code
    command: python main.py
    ports:
      - "8001"

  nginx:
    build:
      context: ./backend/config
      dockerfile: DockerFile
    ports:
      - "80:80"

And this is my nginx conf file:

upstream backend {
    server back1:8001;
    server back2:8001;

    keepalive 32;
}

server {
    listen 80;
    server_name api.localhost;
    location / {
        proxy_pass http://backend;
    }
}

I tried to simultaneously trigger the API http://api.localhost/test. However it seems that the second request was activated after the 1st request is completed. Even though it was processed by different instance of container.

Is nginx actually blocking?? I know that we can use queueing (eg: rabbitMQ, etc), but I thought that spinning up 2 docker container and using nginx as load balancer would achieve horizontal scalling. Am I wrong?


问:
How to detect the switching to different wifi networks in iOS?
I'm going through the issue in identifying network switching, let's assume I have connected to wifi-1 and then immediately switched to wifi-2.
So, here is my problem that when I'm switching to wifi-2 vice versa I'm not getting updated. To get to know these status I have used Reachability and Network framework. But, still didn't found the solution.

Note: Few time I'm getting updated, when it takes time to switching to the next wifi.

Used the below code of Alamofire reachability

```<code>       NetworkReachabilityManager.default?.startListening(onUpdatePerforming: { status in
            switch status {
            case .notReachable:
                print("Off")
                DispatchQueue.main.async {
                    self.view.backgroundColor = .red
                }
            case .unknown:
                print("Unknown")
                DispatchQueue.main.async {
                    self.view.backgroundColor = .orange
                }
            case .reachable(let type):
                print("On - \(type)")
                DispatchQueue.main.async {
                    self.view.backgroundColor = .green
                }
            }
        })

</code>```

Used the below code of Network

```<code>        let monitor = NWPathMonitor()
        monitor.start(queue: DispatchQueue.global(qos: .background))
        monitor.pathUpdateHandler = { path in
            if path.status == .satisfied {
                DispatchQueue.main.async {
                    self.view.backgroundColor = .green
                }
            }else{
                DispatchQueue.main.async {
                    self.view.backgroundColor = .red
                }
            }
        }

</code>```

Body:
I'm going through the issue in identifying network switching, let's assume I have connected to wifi-1 and then immediately switched to wifi-2.
So, here is my problem that when I'm switching to wifi-2 vice versa I'm not getting updated. To get to know these status I have used Reachability and Network framework. But, still didn't found the solution.

Note: Few time I'm getting updated, when it takes time to switching to the next wifi.

Used the below code of Alamofire reachability

       NetworkReachabilityManager.default?.startListening(onUpdatePerforming: { status in
            switch status {
            case .notReachable:
                print("Off")
                DispatchQueue.main.async {
                    self.view.backgroundColor = .red
                }
            case .unknown:
                print("Unknown")
                DispatchQueue.main.async {
                    self.view.backgroundColor = .orange
                }
            case .reachable(let type):
                print("On - \(type)")
                DispatchQueue.main.async {
                    self.view.backgroundColor = .green
                }
            }
        })

Used the below code of Network

        let monitor = NWPathMonitor()
        monitor.start(queue: DispatchQueue.global(qos: .background))
        monitor.pathUpdateHandler = { path in
            if path.status == .satisfied {
                DispatchQueue.main.async {
                    self.view.backgroundColor = .green
                }
            }else{
                DispatchQueue.main.async {
                    self.view.backgroundColor = .red
                }
            }
        }


问:
TfidfVectorizer handling synonyms with custom tokeniser
While using TF-IDF there are errors on synonyms. Can this be handled by defining a custom tokeniser with TfidfVectorizer? If the synonyms are available as key-value in a dict

```<code>{
  'a': ['a1','a2','a3'],
  'b': ['b1', 'b2'],
  'c': ['c1', 'c2', 'c3', 'c4]
}
</code>```

What is the best way to handle the synonyms (e.g. a1, a2, a3 are synonyms for a) when using a TF-IDF based approach?

Body:
While using TF-IDF there are errors on synonyms. Can this be handled by defining a custom tokeniser with TfidfVectorizer? If the synonyms are available as key-value in a dict

{
  'a': ['a1','a2','a3'],
  'b': ['b1', 'b2'],
  'c': ['c1', 'c2', 'c3', 'c4]
}

What is the best way to handle the synonyms (e.g. a1, a2, a3 are synonyms for a) when using a TF-IDF based approach?


问:
How to find the most important nodes in each Louvain community?
I use the distributed NebulaGraph to run community division and want to find important nodes in each community and mine the hidden relationships.

I feel there are two ways to try, one using the nebulagraph algorithm and the other using python, except that it needs to be converted to a distributed database to run it.

For the first way of using nebulagraph algorithm.

I am running the Louvain community partitioning algorithm using a direct submission of the algorithm package:

```<code>spark-submit --master "local" --class com.vesoft.nebula.algorithm.Main /opt/offline/nebula/nebula-algorithm-3.0.0.jar -p /opt/offline/nebula/application.conf
</code>```

My question is that when the community division is run and I want to dig out the important nodes in each community, and I feel it like degree centrality, mediation centrality, or proximity centrality etc.

I see that the application.conf config file has these algorithms, but it is not clear if I can write multiple execution algorithms after executeAlgo?

```<code>algorithm: {
  # the algorithm that you are going to execute, pick one from [pagerank, louvain,
connectedcomponent
  # labelpropagation, shortestpaths, degreestatic, kore, stronglyconnectedcomponent, trianglecount,
  # betweenness, graphtriangleCount, clusteringcoefficient, bfs, hap, closeness, jaccard, node2vec]
  executeAlgo: louvain
  # PageRank parameter
  pagerank:
    maxIter: 10
    resetProb: 0.15 # default 0.15
}
  # Louvain parameter
louvain: {
    maxIter: 20
    internalIter: 10
    tol: 0.5
}
...

If I write Louvain and then write Betweenness, will the Louvain algorithm be executed first and then the betweenness algorithm? Even if the betweenness algorithm is executed, will it run the algorithm on the entire graph rather than on top of the Louvain community division result?
</code>```

Body:
I use the distributed NebulaGraph to run community division and want to find important nodes in each community and mine the hidden relationships.

I feel there are two ways to try, one using the nebulagraph algorithm and the other using python, except that it needs to be converted to a distributed database to run it.

For the first way of using nebulagraph algorithm.

I am running the Louvain community partitioning algorithm using a direct submission of the algorithm package:

spark-submit --master "local" --class com.vesoft.nebula.algorithm.Main /opt/offline/nebula/nebula-algorithm-3.0.0.jar -p /opt/offline/nebula/application.conf

My question is that when the community division is run and I want to dig out the important nodes in each community, and I feel it like degree centrality, mediation centrality, or proximity centrality etc.

I see that the application.conf config file has these algorithms, but it is not clear if I can write multiple execution algorithms after executeAlgo?

algorithm: {
  # the algorithm that you are going to execute, pick one from [pagerank, louvain,
connectedcomponent
  # labelpropagation, shortestpaths, degreestatic, kore, stronglyconnectedcomponent, trianglecount,
  # betweenness, graphtriangleCount, clusteringcoefficient, bfs, hap, closeness, jaccard, node2vec]
  executeAlgo: louvain
  # PageRank parameter
  pagerank:
    maxIter: 10
    resetProb: 0.15 # default 0.15
}
  # Louvain parameter
louvain: {
    maxIter: 20
    internalIter: 10
    tol: 0.5
}
...

If I write Louvain and then write Betweenness, will the Louvain algorithm be executed first and then the betweenness algorithm? Even if the betweenness algorithm is executed, will it run the algorithm on the entire graph rather than on top of the Louvain community division result?


问:
Pyspark convering the GDATU date format to the normal date format yyyy-mm-dd?
I am wondering how to convert the GDATU fields from the TCURR table to the normal date format yyyy-mm-dd using Pyspark.

I tried it by creating a new column, using from_unixtime. but it seems not right.

df = df.withColumn('GDATU_NEW', F.from_unixtime('GDATU', 'yyyy-mm-dd'))


问:
Data is not defined error when fetching and parsing json using nodejs
```<code>const fetch = require('node-fetch');
const url = 'https://gist.githubusercontent.com/gcollazo/884a489a50aec7b53765405f40c6fbd1/raw/49d1568c34090587ac82e80612a9c350108b62c5/sample.json';
fetch(url)
    .then(res => res.json())
    .then(data => {
        my_data = data;
});
</code>```

URL is randomly taken from the Internet.

ERROR:

```<code>Invalid REPL keyword
>       .then(data => {
Invalid REPL keyword
>               my_data = data;
Thrown:
ReferenceError: data is not defined
> });
Thrown:
});
</code>```

Body:
const fetch = require('node-fetch');
const url = 'https://gist.githubusercontent.com/gcollazo/884a489a50aec7b53765405f40c6fbd1/raw/49d1568c34090587ac82e80612a9c350108b62c5/sample.json';
fetch(url)
    .then(res => res.json())
    .then(data => {
        my_data = data;
});

URL is randomly taken from the Internet.

ERROR:

Invalid REPL keyword
>       .then(data => {
Invalid REPL keyword
>               my_data = data;
Thrown:
ReferenceError: data is not defined
> });
Thrown:
});


问:
Reference to PyTorch model name within a class function
I am working on expanding a friend's PyTorch Deep Learning Program. The custom gym environment has 5 time steps, and I am looking to decouple the original neural network by time steps to see if that improves learning. As a result, I created 5 separate neural networks model_0, model_1, ..., model_4, and I want them to have the exact same architecture.

We have a python class to define the policy as follows:

```<code>class GreedyPolicy():
    def __init__(self, env, critic_init, exploration, step_size = 1, THETA_MIN = .1, THETA_MAX = 1.0):

        self.env = env
        self.name = 'GreedyPolicy'
        # There are other declarations here, but not important for the question.

    def _get_theta(self, critic): # input: object

        self.theta = np.zeros((self.env.observation_space.spaces[0].n * self.env.observation_space.spaces[1].n, self.env.action_space.n))

        for t in range(self.env.observation_space.spaces[0].n):
            for z in range(self.env.observation_space.spaces[1].n):
                state = t, z
                if t_separator:
                    if self.__name__ == model_0:
                        critic_values = [critic.CPTpredict(state, a) for a in np.arange(self.nA)]
</code>```

Then, below, we defined the model and called on the above class GreedyPolicy, with QPG_CPT as a class to set up the neural network architecture:

```<code>if t_separator:
    model_0 = QPG_CPT(env, estimator_critic = FLRCritic, estimator_policy = GreedyPolicy, n_batch = n_batch, param_init = 0.0, critic_lr = critic_lr, step_size = step_size)
</code>```

However, self.name in the second last line of the first part of the code refers to 'GreedyPolicy' instead of 'model_0'. Is there a way to do something similar to "if self.name == model_0:"?

Body:
I am working on expanding a friend's PyTorch Deep Learning Program. The custom gym environment has 5 time steps, and I am looking to decouple the original neural network by time steps to see if that improves learning. As a result, I created 5 separate neural networks model_0, model_1, ..., model_4, and I want them to have the exact same architecture.

We have a python class to define the policy as follows:

class GreedyPolicy():
    def __init__(self, env, critic_init, exploration, step_size = 1, THETA_MIN = .1, THETA_MAX = 1.0):

        self.env = env
        self.name = 'GreedyPolicy'
        # There are other declarations here, but not important for the question.

    def _get_theta(self, critic): # input: object

        self.theta = np.zeros((self.env.observation_space.spaces[0].n * self.env.observation_space.spaces[1].n, self.env.action_space.n))

        for t in range(self.env.observation_space.spaces[0].n):
            for z in range(self.env.observation_space.spaces[1].n):
                state = t, z
                if t_separator:
                    if self.__name__ == model_0:
                        critic_values = [critic.CPTpredict(state, a) for a in np.arange(self.nA)]

Then, below, we defined the model and called on the above class GreedyPolicy, with QPG_CPT as a class to set up the neural network architecture:

if t_separator:
    model_0 = QPG_CPT(env, estimator_critic = FLRCritic, estimator_policy = GreedyPolicy, n_batch = n_batch, param_init = 0.0, critic_lr = critic_lr, step_size = step_size)

However, self.name in the second last line of the first part of the code refers to 'GreedyPolicy' instead of 'model_0'. Is there a way to do something similar to "if self.name == model_0:"?


问:
Uncaught SyntaxError: Unexpected token '<'. It is not possible to run the project build inside the docker container
Faced with the problem of building a project based on Vue 3 inside a Docker container together with Nginx.

Dockerfile:

```<code># Non-prod as builder
FROM node:18.13.0 as build-stage
WORKDIR /app
COPY package*.json ./
COPY package-lock.json ./
RUN npm ci
COPY . .
# Build the project
RUN npm run build

# Prod
FROM nginx:1.19 as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY ./.nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
</code>```

nginx.conf:

```<code>user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
  worker_connections  1024;
}
http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;
  log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';
  access_log  /var/log/nginx/access.log  main;
  sendfile        on;
  keepalive_timeout  65;
  server {
    listen       80;
    server_name  localhost;
    location / {
      root   /app;
      index  index.html;
      try_files $uri $uri/ /index.html;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
      root   /usr/share/nginx/html;
    }
  }
}
</code>```

Docker build an image for me, I launch the container with the following command:

```<code>docker run -it -p 8080:80 --rm --name vue-app-1 user/vue-app
</code>```

After trying to access it inside the browser using localhost:8080 - there is no static.

Errors in the browser console:

Uncaught SyntaxError: Unexpected token '<'

manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.

But when I try to build a project without Nginx, everything is fine. What is the problem?

Body:
Faced with the problem of building a project based on Vue 3 inside a Docker container together with Nginx.

Dockerfile:

# Non-prod as builder
FROM node:18.13.0 as build-stage
WORKDIR /app
COPY package*.json ./
COPY package-lock.json ./
RUN npm ci
COPY . .
# Build the project
RUN npm run build

# Prod
FROM nginx:1.19 as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY ./.nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80

nginx.conf:

user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
  worker_connections  1024;
}
http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;
  log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';
  access_log  /var/log/nginx/access.log  main;
  sendfile        on;
  keepalive_timeout  65;
  server {
    listen       80;
    server_name  localhost;
    location / {
      root   /app;
      index  index.html;
      try_files $uri $uri/ /index.html;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
      root   /usr/share/nginx/html;
    }
  }
}

Docker build an image for me, I launch the container with the following command:

docker run -it -p 8080:80 --rm --name vue-app-1 user/vue-app

After trying to access it inside the browser using localhost:8080 - there is no static.

Errors in the browser console:

Uncaught SyntaxError: Unexpected token '<'

manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.

But when I try to build a project without Nginx, everything is fine. What is the problem?


问:
What does "template class" keyword in C++ do?
I am a newbie to C++ and am self-learning the databases course at CMU. In the second programming project, we implement a B+ tree index. We have a BPlusTreePage class which has two children class BPlusTreeInternalPage and BPlusTreeLeafPage. The way the skeleton code handles generic class confuses me.

In b_plus_tree_internal_page.h:

```<code>template <typename KeyType, typename ValueType, typename KeyComparator>
class BPlusTreeInternalPage : public BPlusTreePage {...};
</code>```

In b_plus_tree_internal_page.cpp:

```<code>...
// valuetype for internalNode should be page id_t
template class BPlusTreeInternalPage<GenericKey<4>, page_id_t, GenericComparator<4>>;
template class BPlusTreeInternalPage<GenericKey<8>, page_id_t, GenericComparator<8>>;
template class BPlusTreeInternalPage<GenericKey<16>, page_id_t, GenericComparator<16>>;
template class BPlusTreeInternalPage<GenericKey<32>, page_id_t, GenericComparator<32>>;
template class BPlusTreeInternalPage<GenericKey<64>, page_id_t, GenericComparator<64>>;
</code>```

I'm wondering what does these lines starting with template class do? In my understanding, the code should just work without those lines, but I'm not sure if I'm correct. Thanks for helping!

Body:
I am a newbie to C++ and am self-learning the databases course at CMU. In the second programming project, we implement a B+ tree index. We have a BPlusTreePage class which has two children class BPlusTreeInternalPage and BPlusTreeLeafPage. The way the skeleton code handles generic class confuses me.

In b_plus_tree_internal_page.h:

template <typename KeyType, typename ValueType, typename KeyComparator>
class BPlusTreeInternalPage : public BPlusTreePage {...};

In b_plus_tree_internal_page.cpp:

...
// valuetype for internalNode should be page id_t
template class BPlusTreeInternalPage<GenericKey<4>, page_id_t, GenericComparator<4>>;
template class BPlusTreeInternalPage<GenericKey<8>, page_id_t, GenericComparator<8>>;
template class BPlusTreeInternalPage<GenericKey<16>, page_id_t, GenericComparator<16>>;
template class BPlusTreeInternalPage<GenericKey<32>, page_id_t, GenericComparator<32>>;
template class BPlusTreeInternalPage<GenericKey<64>, page_id_t, GenericComparator<64>>;

I'm wondering what does these lines starting with template class do? In my understanding, the code should just work without those lines, but I'm not sure if I'm correct. Thanks for helping!


问:
How to get image from HBITMAP type with ctypes?
I try to use ctypes get a image from the dll, but the dll api just return a integer number(like this: 1795493677).

I want get the image(PIL or other style),Can someone know how to do?

The dll api

HBITMAP lmc1_GetPrevBitmap2(int nBMPWIDTH,int nBMPHEIGHT);

The code

import ctypes
from ctypes import wintypes

dllPath = ""
dll = ctypes.windll.LoadLibrary(dllPath)
dll.lmc1_GetPrevBitmap2.restype = wintypes.HBITMAP
img = dll.lmc1_GetPrevBitmap2(400, 400) # img is a integer number

```


问:
Error: Cannot find module 'tailwindcss/colors'
Running npm run dev or npm run watch gives this error:

```<code>ERROR in ./node_modules/@uppy/core/dist/style.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1].use[2]!./node_modules/@uppy/core/dist/style.css)
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: Cannot find module 'tailwindcss/colors'
</code>```

Heres the full error:

```<code>ERROR in ./node_modules/@uppy/core/dist/style.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1].use[2]!./node_modules/@uppy/core/dist/style.css)
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: Cannot find module 'tailwindcss/colors'
Require stack:
- C:\Projects\myapp\vendor\wireui\wireui\tailwind.config.js
- C:\Projects\myapp\resources\views\themes\tailwind\tailwind.config.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\tailwindcss\lib\lib\setupTrackingContext.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\tailwindcss\lib\index.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\laravel-mix-tailwind\index.js
- C:\Projects\myapp\resources\views\themes\tailwind\webpack.mix.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\laravel-mix\setup\webpack.config.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\webpack-cli\lib\webpack-cli.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\webpack-cli\lib\bootstrap.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\webpack-cli\bin\cli.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\webpack\bin\webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Projects\myapp\vendor\wireui\wireui\tailwind.config.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
</code>```

Body:
Running npm run dev or npm run watch gives this error:

ERROR in ./node_modules/@uppy/core/dist/style.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1].use[2]!./node_modules/@uppy/core/dist/style.css)
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: Cannot find module 'tailwindcss/colors'

Heres the full error:

ERROR in ./node_modules/@uppy/core/dist/style.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1].use[2]!./node_modules/@uppy/core/dist/style.css)
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: Cannot find module 'tailwindcss/colors'
Require stack:
- C:\Projects\myapp\vendor\wireui\wireui\tailwind.config.js
- C:\Projects\myapp\resources\views\themes\tailwind\tailwind.config.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\tailwindcss\lib\lib\setupTrackingContext.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\tailwindcss\lib\index.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\laravel-mix-tailwind\index.js
- C:\Projects\myapp\resources\views\themes\tailwind\webpack.mix.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\laravel-mix\setup\webpack.config.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\webpack-cli\lib\webpack-cli.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\webpack-cli\lib\bootstrap.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\webpack-cli\bin\cli.js
- C:\Projects\myapp\resources\views\themes\tailwind\node_modules\webpack\bin\webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Projects\myapp\vendor\wireui\wireui\tailwind.config.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)


问:
Python 3.9 NLTK Error Loading <urlopen error [SSL] unknown error (_ssl.c:1129)>
Python version: 3.9.12

nltk version: 3.8.1

OS: Windows

```<code>import nltk
nltk.download('stopwords')
</code>```

Executing the above code results in below error

[nltk_data] Error loading all: <urlopen error [SSL] unknown error [nltk_data]     (_ssl.c:1129)>

Body:
Python version: 3.9.12

nltk version: 3.8.1

OS: Windows

import nltk
nltk.download('stopwords')

Executing the above code results in below error

[nltk_data] Error loading all: <urlopen error [SSL] unknown error [nltk_data]     (_ssl.c:1129)>


问:
Jest how to test react component which partial elements are lazy load?
The code below comes from https://headlessui.com/react/popover.

As you can see, it uses a function to render Popover.Button.
In enzyme, no matter use shallow or mount, the result tree without elements wrapped by React.Fragment.

So I want to ask is there a way to render the whole dom in enzyme or @testing-library/react

```<code>export default function Example() {
  return (
    <div className="fixed top-16 w-full max-w-sm px-4">
      <Popover className="relative">
        {({ open }) => (
          <>
            <Popover.Button
              className={`
                ${open ? '' : 'text-opacity-90'}
                group inline-flex items-center rounded-md bg-orange-700 px-3 py-2 text-base font-medium text-white hover:text-opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`}
            >
              <span>Solutions</span>
              <ChevronDownIcon
                className={`${open ? '' : 'text-opacity-70'}
                  ml-2 h-5 w-5 text-orange-300 transition duration-150 ease-in-out group-hover:text-opacity-80`}
                aria-hidden="true"
              />
            </Popover.Button>
            <Transition
              as={Fragment}
              enter="transition ease-out duration-200"
              enterFrom="opacity-0 translate-y-1"
              enterTo="opacity-100 translate-y-0"
              leave="transition ease-in duration-150"
              leaveFrom="opacity-100 translate-y-0"
              leaveTo="opacity-0 translate-y-1"
            >
              <Popover.Panel className="absolute left-1/2 z-10 mt-3 w-screen max-w-sm -translate-x-1/2 transform px-4 sm:px-0 lg:max-w-3xl">
                <div className="overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5">
                  <div className="relative grid gap-8 bg-white p-7 lg:grid-cols-2">
                    {solutions.map((item) => (
                      <a
                        key={item.name}
                        href={item.href}
                        className="-m-3 flex items-center rounded-lg p-2 transition duration-150 ease-in-out hover:bg-gray-50 focus:outline-none focus-visible:ring focus-visible:ring-orange-500 focus-visible:ring-opacity-50"
                      >
                        <div className="flex h-10 w-10 shrink-0 items-center justify-center text-white sm:h-12 sm:w-12">
                          <item.icon aria-hidden="true" />
                        </div>
                        <div className="ml-4">
                          <p className="text-sm font-medium text-gray-900">
                            {item.name}
                          </p>
                          <p className="text-sm text-gray-500">
                            {item.description}
                          </p>
                        </div>
                      </a>
                    ))}
                  </div>
                  <div className="bg-gray-50 p-4">
                    <a
                      href="##"
                      className="flow-root rounded-md px-2 py-2 transition duration-150 ease-in-out hover:bg-gray-100 focus:outline-none focus-visible:ring focus-visible:ring-orange-500 focus-visible:ring-opacity-50"
                    >
                      <span className="flex items-center">
                        <span className="text-sm font-medium text-gray-900">
                          Documentation
                        </span>
                      </span>
                      <span className="block text-sm text-gray-500">
                        Start integrating products and tools
                      </span>
                    </a>
                  </div>
                </div>
              </Popover.Panel>
            </Transition>
          </>
        )}
      </Popover>
    </div>
  )
}
</code>```

Body:
The code below comes from https://headlessui.com/react/popover.

As you can see, it uses a function to render Popover.Button.
In enzyme, no matter use shallow or mount, the result tree without elements wrapped by React.Fragment.

So I want to ask is there a way to render the whole dom in enzyme or @testing-library/react

export default function Example() {
  return (

      <Popover className="relative">
        {({ open }) => (
          <>
            <Popover.Button
              className={`
                ${open ? '' : 'text-opacity-90'}
                group inline-flex items-center rounded-md bg-orange-700 px-3 py-2 text-base font-medium text-white hover:text-opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`}
            >
              Solutions
              <ChevronDownIcon
                className={`${open ? '' : 'text-opacity-70'}
                  ml-2 h-5 w-5 text-orange-300 transition duration-150 ease-in-out group-hover:text-opacity-80`}
                aria-hidden="true"
              />
            </Popover.Button>
            <Transition
              as={Fragment}
              enter="transition ease-out duration-200"
              enterFrom="opacity-0 translate-y-1"
              enterTo="opacity-100 translate-y-0"
              leave="transition ease-in duration-150"
              leaveFrom="opacity-100 translate-y-0"
              leaveTo="opacity-0 translate-y-1"
            >
              <Popover.Panel className="absolute left-1/2 z-10 mt-3 w-screen max-w-sm -translate-x-1/2 transform px-4 sm:px-0 lg:max-w-3xl">

                    {solutions.map((item) => (

                          <item.icon aria-hidden="true" />

                            {item.name}

                            {item.description}

                    ))}

                          Documentation

                        Start integrating products and tools

              </Popover.Panel>
            </Transition>
          </>
        )}
      </Popover>

  )
}


问:
The context cannot be used while the model is being created MVC5
I recently updated my project from MVC3 to MVC5. However I get this message randomly and random pages.

The context cannot be used while the model is being created. This exception may be thrown if the context is used inside the OnModelCreating method or if the same context instance is accessed by multiple threads concurrently. Note that instance members of DbContext and related classes are not guaranteed to be thread safe.

any advices why I am getting this message?


问:
jsx file detected as c or txt file
i'm going to use react js and jsx file extensions,but when i save my code in my local,the jsx file detected as c/txt extension,and in my editor is detected same as well,why is that?

I'm using zorin os lite 16,ubuntu 20.04LTS,and geany code editor for my main editor.
THANK YOU

Title: jsx file detected as c or txt file


问:
Application_Start event not firing when there is app_offline.htm file is present
I want to enable/disable the website by introducing app_offline.htm file in the application root directory. This, I want it dynamically from a setting in database. When true, I am moving the app_offline.htm file to root, and when set to false, I am moving the file from root to another directory.

I have written the logic in global.asax file Application_Start event.
But this event is not firing when the app_offline.htm file is present in the root directory.

Below is my code snippet I tried:

```<code>{
    if (offlineMode == "1")
    {
        destination = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
        source = Path.Combine(destination, "Offline");
        MakeApplicationOffline(destination, source);
    }
    else
    {
        source = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
        destination = Path.Combine(source, "Offline");
        MakeApplicationOffline(destination, source);
    }
}

private static void MakeApplicationOffline(string destinationPath, string sourcePath)
{
    if (Directory.Exists(sourcePath))
    {
        foreach (var file in new DirectoryInfo(sourcePath).GetFiles("*.htm"))
        {
            file.MoveTo($@"{destinationPath}\{file.Name}");
        }
    }
}
</code>```

Body:
I want to enable/disable the website by introducing app_offline.htm file in the application root directory. This, I want it dynamically from a setting in database. When true, I am moving the app_offline.htm file to root, and when set to false, I am moving the file from root to another directory.

I have written the logic in global.asax file Application_Start event.
But this event is not firing when the app_offline.htm file is present in the root directory.

Below is my code snippet I tried:

{
    if (offlineMode == "1")
    {
        destination = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
        source = Path.Combine(destination, "Offline");
        MakeApplicationOffline(destination, source);
    }
    else
    {
        source = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
        destination = Path.Combine(source, "Offline");
        MakeApplicationOffline(destination, source);
    }
}

private static void MakeApplicationOffline(string destinationPath, string sourcePath)
{
    if (Directory.Exists(sourcePath))
    {
        foreach (var file in new DirectoryInfo(sourcePath).GetFiles("*.htm"))
        {
            file.MoveTo($@"{destinationPath}\{file.Name}");
        }
    }
}


问:
There is a problem using "since" in Tweety function to extract Covaxin related hashtag tweets from the starting time of Covid'19

It is saying unexpected parameter :since when running the below code

```<code>import tweepy
# Enter your own credentials obtained
# from your developer account
consumer_key = "wwww"
consumer_secret = "xxxx"
access_key = "yyyy"
access_secret = "zzzz"

# The above keys are mentioned correctly in the programming code

# Twitter authentication
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)

# Creating an API object
api = tweepy.API(auth)

hashtag_tweets = tweepy.Cursor(api.search_tweets, q="#Covaxin", tweet_mode='extended').items(5)

date_tweets = tweepy.Cursor(api.search_tweets, q="#Covaxin", since="2020-03-31", until="2022-01-09",tweet_mode='extended').items(5)
list = []
for tweet in date_tweets:
    text = tweet._json["full_text"]
    #print(text)
    refined_tweet = {'text' : text,
                   'favorite_count' : tweet.favorite_count,
                    'retweet_count' : tweet.retweet_count,
                    'created_at' : tweet.created_at}

    list.append(refined_tweet)
#print(list)
import pandas as pd
df = pd.DataFrame(list)
print(df)
df.to_csv('refined_tweets.csv')

</code>```

It is saying unexpected parameter :since when running the code

I was trying to get the output for all tweets satisfying date query for the particular hashtag Covaxin from the starting of Covid days till now.

Body:
It is saying unexpected parameter :since when running the below code

import tweepy
# Enter your own credentials obtained
# from your developer account
consumer_key = "wwww"
consumer_secret = "xxxx"
access_key = "yyyy"
access_secret = "zzzz"

# The above keys are mentioned correctly in the programming code

# Twitter authentication
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)

# Creating an API object
api = tweepy.API(auth)

hashtag_tweets = tweepy.Cursor(api.search_tweets, q="#Covaxin", tweet_mode='extended').items(5)

date_tweets = tweepy.Cursor(api.search_tweets, q="#Covaxin", since="2020-03-31", until="2022-01-09",tweet_mode='extended').items(5)
list = []
for tweet in date_tweets:
    text = tweet._json["full_text"]
    #print(text)
    refined_tweet = {'text' : text,
                   'favorite_count' : tweet.favorite_count,
                    'retweet_count' : tweet.retweet_count,
                    'created_at' : tweet.created_at}

    list.append(refined_tweet)
#print(list)
import pandas as pd
df = pd.DataFrame(list)
print(df)
df.to_csv('refined_tweets.csv')

It is saying unexpected parameter :since when running the code

I was trying to get the output for all tweets satisfying date query for the particular hashtag Covaxin from the starting of Covid days till now.


问:
unable to write proper test case in Vue3 Application using global event bus(mitt), below
unable to write proper test case in Vue3 Application using global event bus(mitt), below
snippets explains the configuration using mitt and sample spec file where am facing the
issue ie Cannot read property 'on' of undefined

const emitter = mitt();
    const app = createApp(App)
    app.config.globalProperties.emitter = emitter;

const emitter = mitt();
   const wrapper = mount(ListComponent, {
     globalProperties: {
        emitter
}
})```


问:
Is it possible to route outbound traffic from a VPC in one region through a VPC (and NAT gateway) in another region?
I have a number of resources in a VPC (ECS tasks mostly but doesn't really matter) where inbound traffic goes through an ALB.

However, I need to route outbound traffic through another VPC (and its NAT gateway) in a separate region. I've been fiddling with Transit Gateway and configured a manual setup with two VPCs in the same region where outbound traffic from VPC A routes through a NAT gateway in VPC B. It took a while but I finally got it working.

However, I'm trying to do the same across regions and I believe that the most straightforward way to do it  is by peering Transit Gateways i.e. in the use case above VPC B is in a separate region and attached to its Transit Gateway and the two Transite Gateways are peered (VPC A's and VPC B's).

There are my current questions, any help is appreciated so thanks in advance:

Is my solution even possible? As I've dug into it, I'm not sure. I
don't see how I can route traffic to the NAT Gateway in the
destination VPC. Not yet.

Is the double TG cross-region approach I have in mind the best way to
do this?

I plan to automated the above when I have something working via the
CDK. In my experience IaC is more challenging with resources like ACM
certificates and peering (VPC or TG) connections. Any recommendations
on that front would be great too.


问:
Flutter Webview: WillPopScope() + gestureNavigationEnabled
Is it possible to use 'WillPopScope' and 'gestureNavigationEnabled' functions simultaneously in Flutter Webview?

I want to apply those two functions at the same time.

But it seems to me that only one function is available.

Anyone Can handle this issue?

Below is my Webview Sorce code...

```<code>Widget build(BuildContext context) {
return GestureDetector(
  // 사용자의 화면 터치 감지..
  onTap: () {
    FocusScope.of(context).unfocus();
  },
  child: WillPopScope(
    // 화면 뒤로가기 적용 스코프...
    onWillPop: () => onWillPop(),
    child: SafeArea(
      // head.php가 모바일 화면을 벗어나지 않도록 조치
      child: WebView(
        initialUrl: _url,
        javascriptMode: JavascriptMode.unrestricted,
        // 자바스크립트 모드 활성화
        userAgent: "random",
        // 소셜 로그인 구현을 위해 에러코드 사전 방지
        onWebViewCreated: (controller) {
          _webViewController = controller;
        },
        onPageStarted: (controller) {},
        onPageFinished: (url) {
          Future.delayed(const Duration(microseconds: 500), () {
            if (mounted) {
              setState(() {});
            }
          });
        },
        zoomEnabled: true,
        gestureNavigationEnabled: true,
      ),
    ),
  ),
);
</code>```

}

Body:
Is it possible to use 'WillPopScope' and 'gestureNavigationEnabled' functions simultaneously in Flutter Webview?

I want to apply those two functions at the same time.

But it seems to me that only one function is available.

Anyone Can handle this issue?

Below is my Webview Sorce code...

Widget build(BuildContext context) {
return GestureDetector(
  // 사용자의 화면 터치 감지..
  onTap: () {
    FocusScope.of(context).unfocus();
  },
  child: WillPopScope(
    // 화면 뒤로가기 적용 스코프...
    onWillPop: () => onWillPop(),
    child: SafeArea(
      // head.php가 모바일 화면을 벗어나지 않도록 조치
      child: WebView(
        initialUrl: _url,
        javascriptMode: JavascriptMode.unrestricted,
        // 자바스크립트 모드 활성화
        userAgent: "random",
        // 소셜 로그인 구현을 위해 에러코드 사전 방지
        onWebViewCreated: (controller) {
          _webViewController = controller;
        },
        onPageStarted: (controller) {},
        onPageFinished: (url) {
          Future.delayed(const Duration(microseconds: 500), () {
            if (mounted) {
              setState(() {});
            }
          });
        },
        zoomEnabled: true,
        gestureNavigationEnabled: true,
      ),
    ),
  ),
);

}


问:
Vaadin Exception - Couldn't find the definiton of the element with tag "vaadin-crud" in any template file declared using '@JSModule' annotations
My vaadin error - Couldn't find the definiton of the element with tag "vaadin-crud"

When I try to run my web application which use vaadin crud operations that pro subscription is paid, I am getting the error shown in pic. Actually, I use other page of my application which uses vaadin's free component.

To fix this issue, I reduced my vaadin framework's version from 14.9.4 to 14.8.9 and everything came back to normal.
However, I am still wondering why this exception (or error) happened in version 14.9.4?
Why did I get this error when I tried to open crud used page?

Solution: I don't know why it's happening but I guess it's vaadin's bug. To solve this problem I downgraded the version of vaadin in pom.xml file. The old and bugless version is 19.8.9 therefore I changed version from 19.8.4 to 19.8.9.


问:
Is there a VS Code extension to highlight HTML Parser Errors
I would like to visually see mismatched HTML tags which, for instance, prevent the Prettier formatter from running successfully and thus blocking automatic formatting without any obvious reason why.

I found this issue https://github.com/Microsoft/vscode/issues/55479 which was closed suggesting that it is better served by an extension.

I couldn't find such an extension or setting. Does anyone know of one?

I tried installing:

Highlight Matching Tag, which helps but only if I select the tag with my cursor and then also notice the lack of a small yellow underline anywhere else on my page. That is to say, not really that helpful for this. But good extension nonetheless.

I found a lot of extensions for various formatters and auto-completions. I'm looking for a visual way to see mismatched HTML tags.


问:
graphene mutation: Variable '$aufmassVom' got invalid value ''; Date cannot represent value: ''
I get the message

Variable '$aufmassVom' got invalid value ''; Date cannot represent
value: ''

when I send this graphql mutation with an empty value for "aufmassVom":

```<code>mutation {
  createParzelle(standort: "test", aufmassVom: "", besonderheiten: "test"){
    id
    standort
    aufmassVom
    besonderheiten
  }
}
</code>```

My schema.py looks like that:

```<code>import graphene
from graphene_django import DjangoObjectType
from parzelle.models import Parzelle
from graphql import GraphQLError
from graphql.validation import ValidationRule

class ParzelleType(DjangoObjectType):
    class Meta:
        model = Parzelle

class CreateParzelle(graphene.Mutation):
    id = graphene.Int()
    standort = graphene.String()
    aufmassVom = graphene.Date(required=False)
    besonderheiten = graphene.String()

    class Arguments:
        standort = graphene.String()
        aufmassVom = graphene.Date(required=False)
        besonderheiten = graphene.String()

    def mutate(self, info, standort, aufmassVom, besonderheiten):

        if not aufmassVom:
            return GraphQLError('Required field date is missing')

        parzelle = Parzelle(standort=standort, aufmassVom=aufmassVom, besonderheiten=besonderheiten)
        parzelle.save()

        return CreateParzelle(
            id=parzelle.id,
            standort=parzelle.standort,
            aufmassVom=parzelle.aufmassVom,
            besonderheiten=parzelle.besonderheiten
        )
</code>```

I would expect that I get the message "Required field date is missing" as defined in my schema.py if the value for "aufmassVom" is null (empty) and not the message "Variable '$aufmassVom' got invalid value ''; Date cannot represent value: ''".

If I change the type of "aufmassVom" from date to string everything works as expected.

What I'm doing wrong?

Body:
I get the message

Variable '$aufmassVom' got invalid value ''; Date cannot represent
value: ''

when I send this graphql mutation with an empty value for "aufmassVom":

mutation {
  createParzelle(standort: "test", aufmassVom: "", besonderheiten: "test"){
    id
    standort
    aufmassVom
    besonderheiten
  }
}

My schema.py looks like that:

import graphene
from graphene_django import DjangoObjectType
from parzelle.models import Parzelle
from graphql import GraphQLError
from graphql.validation import ValidationRule

class ParzelleType(DjangoObjectType):
    class Meta:
        model = Parzelle

class CreateParzelle(graphene.Mutation):
    id = graphene.Int()
    standort = graphene.String()
    aufmassVom = graphene.Date(required=False)
    besonderheiten = graphene.String()

    class Arguments:
        standort = graphene.String()
        aufmassVom = graphene.Date(required=False)
        besonderheiten = graphene.String()

    def mutate(self, info, standort, aufmassVom, besonderheiten):

        if not aufmassVom:
            return GraphQLError('Required field date is missing')

        parzelle = Parzelle(standort=standort, aufmassVom=aufmassVom, besonderheiten=besonderheiten)
        parzelle.save()

        return CreateParzelle(
            id=parzelle.id,
            standort=parzelle.standort,
            aufmassVom=parzelle.aufmassVom,
            besonderheiten=parzelle.besonderheiten
        )

I would expect that I get the message "Required field date is missing" as defined in my schema.py if the value for "aufmassVom" is null (empty) and not the message "Variable '$aufmassVom' got invalid value ''; Date cannot represent value: ''".

If I change the type of "aufmassVom" from date to string everything works as expected.

What I'm doing wrong?


问:
Why Laravel database pictures are not being loaded on androiad emulator using my laptop Ip address.. laravel hosted 0.0.0.:9000
Error::
Connection closed while receiving data, uri = http://192.168.100.68:9000/uploads/images/42387d7db6411ce8eefff7f05f68fcbd.jpg

Error and Base Ulr Image : -

This is the Laravel Hosted CMD Interface::

```<code>PS E:\xampp\htdocs\shopping-app> php artisan serve --host 0.0.0.0 --port 9000
PHP Warning:  Module "openssl" is already loaded in Unknown on line 0

Warning: Module "openssl" is already loaded in Unknown on line 0
Starting Laravel development server: http://0.0.0.0:9000
[Mon Jan  9 11:23:36 2023] PHP Warning:  Module "openssl" is already loaded in Unknown on line 0
[Mon Jan  9 11:23:36 2023] PHP 8.1.4 Development Server (http://0.0.0.0:9000) started
[Mon Jan  9 11:29:57 2023] 192.168.100.68:50887 Accepted
[Mon Jan  9 11:30:05 2023] 192.168.100.68:50887 Closing
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50894 Accepted
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50895 Accepted
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50896 Accepted
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50894 Closing
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50895 [200]: GET /uploads/images/68a3c12eabce1ee63f20cad1a9dd2d1c.jpg
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50896 [200]: GET /uploads/images/42387d7db6411ce8eefff7f05f68fcbd.jpg
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50895 Closing
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50896 Closing
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50899 Accepted
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50899 [200]: GET /uploads/images/7375d816bf0f148b538ea934378e905b.jpg
[Mon Jan  9 11:30:07 2023] 192.168.100.68:50899 Closing
</code>```

This is the Flutter API Page::

```<code>// ignore_for_file: public_member_api_docs, sort_constructors_first, unused_field
import 'package:flutter/cupertino.dart';
import 'package:food_app/utils/app_constants.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';

class ApiClient extends GetConnect implements GetxService {
  late String token;
  final String appBaseUrl;
  late SharedPreferences sharedPreferences;

  late Map<String, String> _mainHeaders;

  ApiClient({
    required this.appBaseUrl,
    required this.sharedPreferences,
  }) {
    baseUrl = appBaseUrl;
    timeout = const Duration(seconds: 30);
    token = sharedPreferences.getString(AppConstants.TOKEN) ?? "";
    _mainHeaders = {
      'Content-type': 'application/json; charset = UTF-8',
      "Connection": "Keep-Alive",
      "Keep-Alive": "timeout=5, max=1000",
      'Authorization': 'Bearer $token',
    };
  }

  void updateHeader(String token) {
    _mainHeaders = {
      'Content-type': 'application/json; charset = UTF-8',
      'Authorization': 'Bearer $token',
    };
  }

  Future<Response> getData(String uri, {Map<String, String>? headers}) async {
    try {
      Response response = await get(uri, headers: headers ?? _mainHeaders);
      return response;
    } catch (e) {
      return Response(statusCode: 1, statusText: e.toString());
    }
  }

  Future<Response> postData(String uri, dynamic body) async {
    debugPrint(body.toString());
    try {
      Response response = await post(uri, body, headers: _mainHeaders);
      debugPrint(response.toString());
      return response;
    } catch (e) {
      debugPrint(e.toString());
      return Response(statusCode: 1, statusText: e.toString());
    }
  }
}
</code>```

While executing the flutter program back-end pictures are not loading saying connection closed while receiving data.. laravel is hosted using the laptop IP using port 9000.. it works fine on windows app using the localhost 127.0.0.1, and on android localhost ip 10.0.2.2 it is also showing the same error connection closed while receiving data

Body:
Error::
Connection closed while receiving data, uri = http://192.168.100.68:9000/uploads/images/42387d7db6411ce8eefff7f05f68fcbd.jpg

Error and Base Ulr Image : -

This is the Laravel Hosted CMD Interface::

PS E:\xampp\htdocs\shopping-app> php artisan serve --host 0.0.0.0 --port 9000
PHP Warning:  Module "openssl" is already loaded in Unknown on line 0

Warning: Module "openssl" is already loaded in Unknown on line 0
Starting Laravel development server: http://0.0.0.0:9000
[Mon Jan  9 11:23:36 2023] PHP Warning:  Module "openssl" is already loaded in Unknown on line 0
[Mon Jan  9 11:23:36 2023] PHP 8.1.4 Development Server (http://0.0.0.0:9000) started
[Mon Jan  9 11:29:57 2023] 192.168.100.68:50887 Accepted
[Mon Jan  9 11:30:05 2023] 192.168.100.68:50887 Closing
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50894 Accepted
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50895 Accepted
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50896 Accepted
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50894 Closing
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50895 [200]: GET /uploads/images/68a3c12eabce1ee63f20cad1a9dd2d1c.jpg
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50896 [200]: GET /uploads/images/42387d7db6411ce8eefff7f05f68fcbd.jpg
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50895 Closing
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50896 Closing
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50899 Accepted
[Mon Jan  9 11:30:06 2023] 192.168.100.68:50899 [200]: GET /uploads/images/7375d816bf0f148b538ea934378e905b.jpg
[Mon Jan  9 11:30:07 2023] 192.168.100.68:50899 Closing

This is the Flutter API Page::

// ignore_for_file: public_member_api_docs, sort_constructors_first, unused_field
import 'package:flutter/cupertino.dart';
import 'package:food_app/utils/app_constants.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';

class ApiClient extends GetConnect implements GetxService {
  late String token;
  final String appBaseUrl;
  late SharedPreferences sharedPreferences;

  late Map<String, String> _mainHeaders;

  ApiClient({
    required this.appBaseUrl,
    required this.sharedPreferences,
  }) {
    baseUrl = appBaseUrl;
    timeout = const Duration(seconds: 30);
    token = sharedPreferences.getString(AppConstants.TOKEN) ?? "";
    _mainHeaders = {
      'Content-type': 'application/json; charset = UTF-8',
      "Connection": "Keep-Alive",
      "Keep-Alive": "timeout=5, max=1000",
      'Authorization': 'Bearer $token',
    };
  }

  void updateHeader(String token) {
    _mainHeaders = {
      'Content-type': 'application/json; charset = UTF-8',
      'Authorization': 'Bearer $token',
    };
  }

  Future<Response> getData(String uri, {Map<String, String>? headers}) async {
    try {
      Response response = await get(uri, headers: headers ?? _mainHeaders);
      return response;
    } catch (e) {
      return Response(statusCode: 1, statusText: e.toString());
    }
  }

  Future<Response> postData(String uri, dynamic body) async {
    debugPrint(body.toString());
    try {
      Response response = await post(uri, body, headers: _mainHeaders);
      debugPrint(response.toString());
      return response;
    } catch (e) {
      debugPrint(e.toString());
      return Response(statusCode: 1, statusText: e.toString());
    }
  }
}

While executing the flutter program back-end pictures are not loading saying connection closed while receiving data.. laravel is hosted using the laptop IP using port 9000.. it works fine on windows app using the localhost 127.0.0.1, and on android localhost ip 10.0.2.2 it is also showing the same error connection closed while receiving data


问:
How to set custom values for defaultly selected options in CKEDITOR5
I limited fontFamily and fontSize options like below,

```<code>            fontFamily: {
                options: [
                    'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif',
                ],
                supportAllValues: true
            },

            fontSize: {
                options: [18],
                supportAllValues: true
            },
</code>```

But still set 'default' values when not selected any options.
I want to prevent this and set my values as defaultly set.

expected ; set this values as defaults when loading the ckeditor.

Body:
I limited fontFamily and fontSize options like below,

            fontFamily: {
                options: [
                    'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif',
                ],
                supportAllValues: true
            },

            fontSize: {
                options: [18],
                supportAllValues: true
            },

But still set 'default' values when not selected any options.
I want to prevent this and set my values as defaultly set.

expected ; set this values as defaults when loading the ckeditor.


问:
OpenQA.Selenium.WebDriverException: An element could not be located on the page using the given search parameters
here is my xpath code:"/Pane[@ClassName="#32769"][@Name="Desktop 1"]/Window[@ClassName="#32770"][@Name= "fx-580VN X Emulator"]"
....
Here is the my code C#:driver.FindElementByXPath("//Window[@ClassName="#32770"][@Name="fx-580VN X Emulator"]");
I don't know where it went wrong. help me

check error code but no result


问:
Get Encrypted Values through Custom Filter layer and decrypt it and then pass it to Controller in .net API 7.0
I am creating a .net core 7.0 APIs which are end to end encrypted. Data is first encrypted at API level and then pass it to Android application, same from android to .Net APIs.

What should be the best practice to do

Create custom filter where we can decrypt all the requests and make it as model and then pass the decrypted model to controller (If yes please suggest any help which returns modified request parameters)

Create a method at controller level that connect with Encryption/Decryption Layer and return the Model to Controller


问:
Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types
I am upgrading Expo SDK version from 44 to 47. After running expo upgrade, I am facing this error. I also tried installing Patch package, after installing patch package I got this error:
TypeError: undefined is not an object (evaluating '_reactNative.Image.propTypes.source')
Is there any solution to this problem?

I tried upgrading expo version from 44 to 47. I also tried to install patch package but still facing the issue.


问:
glog symbols different in different machines
I'm using bazel to import third-party libraries, which includes glog.
The workspace looks like

```<code>def glog_workspace():
    http_archive(
        name = "com_google_glog",
        sha256 = "8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6",
        strip_prefix = "glog-0.6.0/",
        urls = ["https://github.com/google/glog/archive/v0.6.0.tar.gz"],
    )
</code>```

I tried to use an internal function to get stacktrace in human-readable format.

```<code>google::glog_internal_namespace_::DumpStackTraceToString(std::string);
</code>```

I check the glog library in two machines, both ubuntu.
First machine

```<code>$ uname -a
Linux <hostname> 5.8.0-59-generic #66~20.04.1-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
</code>```

Second machine

```<code>$ uname -a
Linux <hostname> 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
</code>```

In the first machine, it contains the symbol I need.

```<code>$ nm -C bazel-out//k8-fastbuild/bin/external/com_google_glog/libglog.so  | grep Dump
000000000002c350 t google::(anonymous namespace)::DumpTimeInfo()
000000000002c600 t google::(anonymous namespace)::DumpSignalInfo(int, siginfo_t*)
000000000002c490 t google::(anonymous namespace)::DumpStackFrameInfo(char const*, void*)
000000000002f070 T google::glog_internal_namespace_::DumpStackTraceToString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)
000000000002f0a0 t google::DumpStackTrace(int, void (*)(char const*, void*), void*)
000000000002f670 t google::DumpPCAndSymbol(void (*)(char const*, void*), void*, void*, char const*)
000000000002f350 t google::DumpStackTraceAndExit()
000000000002f770 t google::DumpPC(void (*)(char const*, void*), void*, void*, char const*)
</code>```

But it doesn't exist in second machine, thus failing the linker.

```<code>$ nm -C bazel-out//k8-fastbuild/bin/external/com_google_glog/libglog.so  | grep Dump
0000000000022fc0 t google::(anonymous namespace)::DumpTimeInfo()
0000000000023110 t google::(anonymous namespace)::DumpStackFrameInfo(char const*, void*)
</code>```

I'm wondering, why would this happen?

Update:
I did some hacking to explicitly enable these functions.
But another thing confuses me:

```<code>ubuntu@hao:~/ghost-playground$ bazel build //base:logging_test
INFO: Writing tracer profile to '/home/ubuntu/.cache/bazel/_bazel_ubuntu/212e06aedd435bfcd4b0defa3d42f92f/command.profile.gz'
INFO: Analyzed target //base:logging_test (0 packages loaded, 5 targets configured).
INFO: Found 1 target...
ERROR: /home/ubuntu/ghost-playground/base/BUILD:28:1: Linking of rule '//base:logging_test' failed (Exit 1) clang failed: error executing command /usr/bin/clang @bazel-out/k8-fastbuild/bin/base/logging_test-2.params

Use --sandbox_debug to see verbose messages from the sandbox
bazel-out/k8-fastbuild/bin/_solib_k8/libbase_Sliblogging.so: error: undefined reference to 'google::glog_internal_namespace_::DumpStackTraceToString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //base:logging_test failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.255s, Critical Path: 0.08s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

ubuntu@hao:~/ghost-playground$ nm -C bazel-out/k8-fastbuild/bin/external/com_google_glog/libglog.so | grep DumpStackTraceToString
0000000000026230 t google::glog_internal_namespace_::DumpStackTraceToString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)
</code>```

According to the symbol displayed, DumpStackTraceToString does exist, and is valid (not 'U' which means undefined).

Body:
I'm using bazel to import third-party libraries, which includes glog.
The workspace looks like

def glog_workspace():
    http_archive(
        name = "com_google_glog",
        sha256 = "8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6",
        strip_prefix = "glog-0.6.0/",
        urls = ["https://github.com/google/glog/archive/v0.6.0.tar.gz"],
    )

I tried to use an internal function to get stacktrace in human-readable format.

google::glog_internal_namespace_::DumpStackTraceToString(std::string);

I check the glog library in two machines, both ubuntu.
First machine

$ uname -a
Linux <hostname> 5.8.0-59-generic #66~20.04.1-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Second machine

$ uname -a
Linux <hostname> 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

In the first machine, it contains the symbol I need.

$ nm -C bazel-out//k8-fastbuild/bin/external/com_google_glog/libglog.so  | grep Dump
000000000002c350 t google::(anonymous namespace)::DumpTimeInfo()
000000000002c600 t google::(anonymous namespace)::DumpSignalInfo(int, siginfo_t*)
000000000002c490 t google::(anonymous namespace)::DumpStackFrameInfo(char const*, void*)
000000000002f070 T google::glog_internal_namespace_::DumpStackTraceToString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)
000000000002f0a0 t google::DumpStackTrace(int, void (*)(char const*, void*), void*)
000000000002f670 t google::DumpPCAndSymbol(void (*)(char const*, void*), void*, void*, char const*)
000000000002f350 t google::DumpStackTraceAndExit()
000000000002f770 t google::DumpPC(void (*)(char const*, void*), void*, void*, char const*)

But it doesn't exist in second machine, thus failing the linker.

$ nm -C bazel-out//k8-fastbuild/bin/external/com_google_glog/libglog.so  | grep Dump
0000000000022fc0 t google::(anonymous namespace)::DumpTimeInfo()
0000000000023110 t google::(anonymous namespace)::DumpStackFrameInfo(char const*, void*)

I'm wondering, why would this happen?

Update:
I did some hacking to explicitly enable these functions.
But another thing confuses me:

ubuntu@hao:~/ghost-playground$ bazel build //base:logging_test
INFO: Writing tracer profile to '/home/ubuntu/.cache/bazel/_bazel_ubuntu/212e06aedd435bfcd4b0defa3d42f92f/command.profile.gz'
INFO: Analyzed target //base:logging_test (0 packages loaded, 5 targets configured).
INFO: Found 1 target...
ERROR: /home/ubuntu/ghost-playground/base/BUILD:28:1: Linking of rule '//base:logging_test' failed (Exit 1) clang failed: error executing command /usr/bin/clang @bazel-out/k8-fastbuild/bin/base/logging_test-2.params

Use --sandbox_debug to see verbose messages from the sandbox
bazel-out/k8-fastbuild/bin/_solib_k8/libbase_Sliblogging.so: error: undefined reference to 'google::glog_internal_namespace_::DumpStackTraceToString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //base:logging_test failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.255s, Critical Path: 0.08s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

ubuntu@hao:~/ghost-playground$ nm -C bazel-out/k8-fastbuild/bin/external/com_google_glog/libglog.so | grep DumpStackTraceToString
0000000000026230 t google::glog_internal_namespace_::DumpStackTraceToString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)

According to the symbol displayed, DumpStackTraceToString does exist, and is valid (not 'U' which means undefined).


问:
k8s container CPU usage reached limit cause memory to also be throttled?
I'm not sure if this is the correct behavior of k8s, so I'm asking it here

This is my helm value for CPU and memory:

```<code>resources:
      limits:
        cpu: 4000m
        memory: 8Gi
      requests:
        cpu: 2000m
        memory: 4Gi
</code>```

I checked the datadog metrics, and the container CPU usage is nearly 4s (not sure if this is related to the 4000m CPU limit) around the time the issue happened (both CPU and memory usage are reduced at that time) and it causes the loss of some data that is stored inside the memory (we are using https://github.com/orcaman/concurrent-map as a kind of in-mem cache)

The memory usage of the container is only around 3Gi before the incident happened, so it does not reach the memory limit.

Is there any documentation of k8s mentioning that behavior? And how I can fix it?
Thanks.

UPDATE:

I checked kubectl top pods and I got this result.
Pods that nearly reach the CPU limit are the pods that have a problem

Looks like there is a connection here

Body:
I'm not sure if this is the correct behavior of k8s, so I'm asking it here

This is my helm value for CPU and memory:

resources:
      limits:
        cpu: 4000m
        memory: 8Gi
      requests:
        cpu: 2000m
        memory: 4Gi

I checked the datadog metrics, and the container CPU usage is nearly 4s (not sure if this is related to the 4000m CPU limit) around the time the issue happened (both CPU and memory usage are reduced at that time) and it causes the loss of some data that is stored inside the memory (we are using https://github.com/orcaman/concurrent-map as a kind of in-mem cache)

The memory usage of the container is only around 3Gi before the incident happened, so it does not reach the memory limit.

Is there any documentation of k8s mentioning that behavior? And how I can fix it?
Thanks.

UPDATE:

I checked kubectl top pods and I got this result.
Pods that nearly reach the CPU limit are the pods that have a problem

Looks like there is a connection here


问:
AWS S3 private link not working with aws-cli or boto3
I am trying to access my S3 bucket using private link (private access point), now that I have successfully created it it shows three options to access my bucket privately

ARN format address of bucket

s3:// Uri to access bucket

Another unique address

I tried all of these in python boto3 and aws-cli to access my bucket privately so following code works without using any of the above endpoints but if I uncomment the endpoint_url in params, it simply not works, the same endpoint also not works with aws-cli s3 command

```<code>from botocore.client import Config
from boto3 import Session
import json

session = Session()
params = {
    "service_name": "s3",
    "config": Config(connect_timeout=5, retries={'max_attempts': 1}),
    #"endpoint_url": "s3://arn:aws:s3:******/s3testlink"
}

data = {
    "userId": 1,
    "status": False,
    "message": "Some thing is still pending"
}

s3 = session.resource(**params)
data = json.dumps(data, indent=4).encode('utf-8')
object = s3.Object('test', 'some/path/file.json')
result = object.put(Body=data)
</code>```

What I tried to solve this problem is following

Created a gateway endpoint in the same VPC but didn't work

Created s3 interface endpoint in same VPC but it also didn't work

Just to check I created a test VPN client in the same VPC connected my workstation to that VPN and tried but all in vain

Tried all three address types shown in private link tab in S3 section but still not worked

Body:
I am trying to access my S3 bucket using private link (private access point), now that I have successfully created it it shows three options to access my bucket privately

ARN format address of bucket

s3:// Uri to access bucket

Another unique address

I tried all of these in python boto3 and aws-cli to access my bucket privately so following code works without using any of the above endpoints but if I uncomment the endpoint_url in params, it simply not works, the same endpoint also not works with aws-cli s3 command

from botocore.client import Config
from boto3 import Session
import json

session = Session()
params = {
    "service_name": "s3",
    "config": Config(connect_timeout=5, retries={'max_attempts': 1}),
    #"endpoint_url": "s3://arn:aws:s3:******/s3testlink"
}

data = {
    "userId": 1,
    "status": False,
    "message": "Some thing is still pending"
}

s3 = session.resource(**params)
data = json.dumps(data, indent=4).encode('utf-8')
object = s3.Object('test', 'some/path/file.json')
result = object.put(Body=data)

What I tried to solve this problem is following

Created a gateway endpoint in the same VPC but didn't work

Created s3 interface endpoint in same VPC but it also didn't work

Just to check I created a test VPN client in the same VPC connected my workstation to that VPN and tried but all in vain

Tried all three address types shown in private link tab in S3 section but still not worked


问:
How can I remove the word "category" from wordpress category links
I want to remove the word category from my wordpress website

it is now like this
www.mywebsite.com/category/mycategory
I want to change like this
www.mywebsite.commycategory

I tried adding this code

```<code> function remove_category( $string, $type )  {
       if ( $type != 'single' && $type == 'category' && ( strpos( $string, 'category' ) !== false ) )          {              $url_without_category = str_replace( "/category/", "/", $string );              return trailingslashit( $url_without_category );          }      return $string;  }     add_filter( 'user_trailingslashit', 'remove_category', 100, 2);
</code>```

I tried changing permalink structure

```<code>Settings >> Permalinks.
 Custom Structure -->‘/%category%/%postname%/’.
 Category Base ----> “. “
</code>```

But this one  gives 404 error

I tried with YOAST seo plugin that one gave 404 errors

I also tried some plugins which were causing 404 errors as well

is there any way I can remove that word

Body:
I want to remove the word category from my wordpress website

it is now like this
www.mywebsite.com/category/mycategory
I want to change like this
www.mywebsite.commycategory

I tried adding this code

 function remove_category( $string, $type )  {
       if ( $type != 'single' && $type == 'category' && ( strpos( $string, 'category' ) !== false ) )          {              $url_without_category = str_replace( "/category/", "/", $string );              return trailingslashit( $url_without_category );          }      return $string;  }     add_filter( 'user_trailingslashit', 'remove_category', 100, 2);

I tried changing permalink structure

Settings >> Permalinks.
 Custom Structure -->‘/%category%/%postname%/’.
 Category Base ----> “. “

But this one  gives 404 error

I tried with YOAST seo plugin that one gave 404 errors

I also tried some plugins which were causing 404 errors as well

is there any way I can remove that word


Title: Pandas comparing cells and inserting new rows

Body:
Suppose following data frame:

Date
Time
Position

#1
2023-01-07
11:00
4

#2
2023-01-07
11:00
1

#3
2023-01-07
13:00
2

#4
2023-01-07
13:00
3

#5
2023-01-07
23:00
4

#6
2023-01-07
23:00
1

#7
2023-01-08
05:00
2

#8
2023-01-08
05:00
3

#9
2023-01-08
09:00
2

#10
2023-01-08
09:00
3

Values in 'Position' column cells are supposed to repeat in the order of 4, 1, 2, 3.

Therefore, it is an error if values do not follow this order as in the case of #9
(2, 3, 2, 3 instead of 2, 3, 4, 1)

In order to correct this error, I wish to insert new rows:

Date
Time
Position

#1
2023-01-07
11:00
4

#2
2023-01-07
11:00
1

#3
2023-01-07
13:00
2

#4
2023-01-07
13:00
3

#5
2023-01-07
23:00
4

#6
2023-01-07
23:00
1

#7
2023-01-08
05:00
2

#8
2023-01-08
05:00
3

#new

#new

#9
2023-01-08
09:00
2

#10
2023-01-08
09:00
3

How do I run the code so that the error is detected and insert new rows?