问:
How do I make a proper search tag?
I am working on a craiglists type application for class. I am a bit stumped on a search bar. Now my page is showing the input bar, and when I type any word, it brings up the entire array of objects, and lists them by title.

My goal is to make it so when text is written in the input, the title of the post will display. for example I type a letter "d" and results of dog will show up. The visible const shows up correctly in my console, and gives me a false or true when a character matches. I just do not know how to make it so it constantly will change on my webpage.

I have some useStates and other things brought in, but don't know if it will be beneficial. I appreciate everyone's help! I am using react, and wondering if filter() could also help me here.

```<code><form>

              <input type="text"
                onInput={
                  async (e) => {
                    const value = e.target.value;

                    users.forEach(users => {
                      const visible = users.props.children.props.children.includes(value)
                      console.log(visible)

                    })
                    try {
                      const response = await axios.get
                        (`${BASE_URL}/api/${COHORT_NAME}/posts`, {
                          headers: {
                            'Content-Type': 'application/json',
                            Authorization: `Bearer ${token}`,
                          },
                        });
                      // console.log(response.data.data.posts);

                      setPosts(response.data.data.posts)
                    } catch (error) {
                      console.log('Failed to get posts')
                      console.error(error)
                    }
                  }
                } />
            </form>
            <ul>{
              users = posts.map((post) => {
                return (
                  <li id="displaycard" key={post._id}>
                    <h1>{post.title}</h1>
                  </li>
                );
              })
            }
            </ul>
</code>```

Title: How do I make a proper search tag?

Body:
I am working on a craiglists type application for class. I am a bit stumped on a search bar. Now my page is showing the input bar, and when I type any word, it brings up the entire array of objects, and lists them by title.

My goal is to make it so when text is written in the input, the title of the post will display. for example I type a letter "d" and results of dog will show up. The visible const shows up correctly in my console, and gives me a false or true when a character matches. I just do not know how to make it so it constantly will change on my webpage.

I have some useStates and other things brought in, but don't know if it will be beneficial. I appreciate everyone's help! I am using react, and wondering if filter() could also help me here.

<form>

              <input type="text"
                onInput={
                  async (e) => {
                    const value = e.target.value;

                    users.forEach(users => {
                      const visible = users.props.children.props.children.includes(value)
                      console.log(visible)

                    })
                    try {
                      const response = await axios.get
                        (`${BASE_URL}/api/${COHORT_NAME}/posts`, {
                          headers: {
                            'Content-Type': 'application/json',
                            Authorization: `Bearer ${token}`,
                          },
                        });
                      // console.log(response.data.data.posts);

                      setPosts(response.data.data.posts)
                    } catch (error) {
                      console.log('Failed to get posts')
                      console.error(error)
                    }
                  }
                } />
            </form>

{
              users = posts.map((post) => {
                return (

{post.title}

                );
              })
            }


来源: stackexchange

问:
When I type text inside the text field, the text appears after a while
I have created 3 to 4 projects in React JS, in all projects I have used text field Material UI with Formik.

All those text fields are displayed after some time when I write text, and after some time I delete the text.

How can I solve this problem?

```<code>// My text field inside the form
<TextField
  fullWidth
  type="number"
  size="small"
  placeholder="MobileNumber"
  label="MobileNumber"
  name="mobileNumber"
  className="col-sm-10"
  value={partyFormik.values.mobileNumber}
  onBlur={partyFormik.handleBlur}
  onChange={partyFormik.handleChange}
/>
{partyFormik.touched.mobileNumber &&
  partyFormik.errors.mobileNumber ? (
  <div className="text-danger">
    {partyFormik.errors.mobileNumber}
  </div>
  ) : null
}

// I want output like this
</code>```

I want the text to appear immediately inside the text field as I type

ContentLicense: CC BY-SA 4.0

Body:
I have created 3 to 4 projects in React JS, in all projects I have used text field Material UI with Formik.

All those text fields are displayed after some time when I write text, and after some time I delete the text.

How can I solve this problem?

// My text field inside the form
<TextField
  fullWidth
  type="number"
  size="small"
  placeholder="MobileNumber"
  label="MobileNumber"
  name="mobileNumber"
  className="col-sm-10"
  value={partyFormik.values.mobileNumber}
  onBlur={partyFormik.handleBlur}
  onChange={partyFormik.handleChange}
/>
{partyFormik.touched.mobileNumber &&
  partyFormik.errors.mobileNumber ? (

    {partyFormik.errors.mobileNumber}

  ) : null
}

// I want output like this

I want the text to appear immediately inside the text field as I type


问:
I need to make like a 2D view of a asset plant. What is the best tecnologie to do it ? Im currently using a maps API, but
So im currently using a map API to make a spacial rendering of squares representing an asset. Im wondering if i dont have a more efficient sollution because all the features on the map consumes performance. I need to render a lot of "squares" and it gets sometimes slow, what is the best aproach here ?
Can i use a game library to create like models and give them some information ? This way i only need to render some space in a "map" or space in my app.</p>


问:
msbuild configuration on Jenkins cluster installed on windows
I have jenkins installed on windows machine and trying to create pipeline for .net project.

The msbuild is not working on Jenkins pipeline and giving error msbuild not recognised internal or external command.

I tried passing as a script

```<code>Script{
def msbuild= tool name: 'ms',type:'MSBuild'
bat "\"${msbuild}\" ${workspace}//proj.sln /nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean"
}
</code>```

As well in just pipeline formats

```<code>Step{
bat "ms ${workspace}//proj.sln /nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean"

}
</code>```

In the pipeline but it is not able to find msbuild even though it is configured Global Tool and giving the same name in tool name,but not working.

However when tried as a freestyle project and tried building, i was able to list the msbuild configuration from drop-down to fetch 'ms'

Passed build file as ${workspace}//proj.sln

Command line parameters as
nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean

It was able to build correctly without any issues.

Not sure why it is not getting resolved in pipeline?

Any suggestions to fix this is helpful.

Tried giving the msbuild executable location from .Net application but it is a different system, it did not work.

Body:
I have jenkins installed on windows machine and trying to create pipeline for .net project.

The msbuild is not working on Jenkins pipeline and giving error msbuild not recognised internal or external command.

I tried passing as a script

Script{
def msbuild= tool name: 'ms',type:'MSBuild'
bat "\"${msbuild}\" ${workspace}//proj.sln /nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean"
}

As well in just pipeline formats

Step{
bat "ms ${workspace}//proj.sln /nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean"

}

In the pipeline but it is not able to find msbuild even though it is configured Global Tool and giving the same name in tool name,but not working.

However when tried as a freestyle project and tried building, i was able to list the msbuild configuration from drop-down to fetch 'ms'

Passed build file as ${workspace}//proj.sln

Command line parameters as
nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean

It was able to build correctly without any issues.

Not sure why it is not getting resolved in pipeline?

Any suggestions to fix this is helpful.

Tried giving the msbuild executable location from .Net application but it is a different system, it did not work.


问:
Deploying to Google Firebase with Python
Using Python is it possible to run firebase deploy for a firebase app? I’ve tried doing
firebase deploy --token [token
but it returns

Authenticating with --token is deprecated and will be removed in a future major version of firebase-tools. Instead, use a service account key with GOOGLE_APPLICATION_CREDENTIALS: Authenticate to Cloud services using client libraries

Is there a working method of doing the firebase deploy equivalent through the google cloud API?


问:
error: the following arguments are required: -i/--image
I have installed opencv on my windows machine using python 3.10 without any issues, using:

pip install opencv-python
but when I try to import cv2 I get the following error:
usage: [-h] -i IMAGE
: error: the following arguments are required: -i/--image

I tried to import cv2 but got error


问:
How to config moduleNameMapper for monorepo react apps?
I am trying to configure jest for my monorepo react app.
This is my file structure.

```<code>├── Dockerfile
├── Procfile
├── README.md
├── VERSIONLOG.md
├── apps
│   ├── admin
│   ├── business
│   └── consumer
├── config
│   ├── env.js
│   ├── getHttpsConfig.js
│   ├── grp-config.js
│   ├── jest
│   ├── modules.js
│   ├── paths.js
│   ├── utils
│   ├── webpack.config.js
│   └── webpackDevServer.config.js
├── core
│   ├── components
│   ├── constants
│   ├── external-scripts
│   ├── services
│   ├── static
│   └── utils
├── docker-compose.yml
├── jest.config.js
├── package-lock.json
├── package.json
├── public
│   ├── favicon.ico
│   ├── index.html
│   ├── logo.png
│   ├── manifest.json
│   └── robots.txt
├── pull_request_template.md
├── scripts
│   ├── build.js
│   ├── build_parametrized
│   ├── lint.js
│   ├── server.js
│   ├── start.js
│   └── test.js
├── shared
│   ├── components
│   ├── constants
│   ├── helpers
│   ├── hooks
│   ├── redux
│   ├── selectors
│   ├── services
│   └── types
├── static.json
├── tests
│   ├── admin
│   ├── business
│   ├── consumer
│   ├── core
│   ├── mocks.ts
│   ├── setupTests.ts
│   ├── shared
│   └── utils.tsx
├── tools
│   └── git-hooks
├── tsconfig.json
└── version.json
</code>```

Every separate app has its own tsconfig.json which is merged with the one on the root.
For example Admin app has this tsconfig.json.

```<code>{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "components/*": [
        "src/components/*"
      ],
      "constants/*": [
        "src/constants/*"
      ],
      "helpers/*": [
        "src/helpers/*"
      ],
      "pages/*": [
        "src/pages/*"
      ],
      "reducers/*": [
        "src/reducers/*"
      ],
      "selectors/*": [
        "src/selectors/*"
      ],
      "types/*": [
        "src/types/*"
      ],
      "hooks/*": [
        "src/hooks/*"
      ],
      "styles/*": [
        "../../core/static/styles/*"
      ],
      "core/*": [
        "../../core/*"
      ],
      "shared/*": [
        "../../shared/*"
      ],
    }
  },
  "include": [
    "../../shared",
    "../../core",
    "../../apps/admin"
  ],
  "extends": "../../tsconfig.json"
}
</code>```

When I am running my tests, jest throws an error

Cannot find module 'pages/root' from 'apps/admin/src/routes.ts'

```<code>moduleNameMapper: {
      "^core(.*)$": "<rootDir>/core$1",
      "^apps(.*)$": "<rootDir>/apps$1",
      "^shared(.*)$": "<rootDir>/shared$1",
      "^styles(.*)$": "<rootDir>/core/static/styles$1",
      "styles.ts": "identity-obj-proxy"
    },
</code>```

I have managed to add shared and core path mappers for jest, but can't do it for the separate apps.

```<code>"^apps/admin/src/pages(.*)$": "<rootDir>/apps/admin/src/pages$1",
</code>```

Have tried this one and others, nothing helped me

Body:
I am trying to configure jest for my monorepo react app.
This is my file structure.

├── Dockerfile
├── Procfile
├── README.md
├── VERSIONLOG.md
├── apps
│   ├── admin
│   ├── business
│   └── consumer
├── config
│   ├── env.js
│   ├── getHttpsConfig.js
│   ├── grp-config.js
│   ├── jest
│   ├── modules.js
│   ├── paths.js
│   ├── utils
│   ├── webpack.config.js
│   └── webpackDevServer.config.js
├── core
│   ├── components
│   ├── constants
│   ├── external-scripts
│   ├── services
│   ├── static
│   └── utils
├── docker-compose.yml
├── jest.config.js
├── package-lock.json
├── package.json
├── public
│   ├── favicon.ico
│   ├── index.html
│   ├── logo.png
│   ├── manifest.json
│   └── robots.txt
├── pull_request_template.md
├── scripts
│   ├── build.js
│   ├── build_parametrized
│   ├── lint.js
│   ├── server.js
│   ├── start.js
│   └── test.js
├── shared
│   ├── components
│   ├── constants
│   ├── helpers
│   ├── hooks
│   ├── redux
│   ├── selectors
│   ├── services
│   └── types
├── static.json
├── tests
│   ├── admin
│   ├── business
│   ├── consumer
│   ├── core
│   ├── mocks.ts
│   ├── setupTests.ts
│   ├── shared
│   └── utils.tsx
├── tools
│   └── git-hooks
├── tsconfig.json
└── version.json

Every separate app has its own tsconfig.json which is merged with the one on the root.
For example Admin app has this tsconfig.json.

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "components/*": [
        "src/components/*"
      ],
      "constants/*": [
        "src/constants/*"
      ],
      "helpers/*": [
        "src/helpers/*"
      ],
      "pages/*": [
        "src/pages/*"
      ],
      "reducers/*": [
        "src/reducers/*"
      ],
      "selectors/*": [
        "src/selectors/*"
      ],
      "types/*": [
        "src/types/*"
      ],
      "hooks/*": [
        "src/hooks/*"
      ],
      "styles/*": [
        "../../core/static/styles/*"
      ],
      "core/*": [
        "../../core/*"
      ],
      "shared/*": [
        "../../shared/*"
      ],
    }
  },
  "include": [
    "../../shared",
    "../../core",
    "../../apps/admin"
  ],
  "extends": "../../tsconfig.json"
}

When I am running my tests, jest throws an error

Cannot find module 'pages/root' from 'apps/admin/src/routes.ts'

moduleNameMapper: {
      "^core(.*)$": "<rootDir>/core$1",
      "^apps(.*)$": "<rootDir>/apps$1",
      "^shared(.*)$": "<rootDir>/shared$1",
      "^styles(.*)$": "<rootDir>/core/static/styles$1",
      "styles.ts": "identity-obj-proxy"
    },

I have managed to add shared and core path mappers for jest, but can't do it for the separate apps.

"^apps/admin/src/pages(.*)$": "<rootDir>/apps/admin/src/pages$1",

Have tried this one and others, nothing helped me


问:
Fyers, API Failed - Could not authenticate the user
"message": "Could not authenticate the user"

I was trying to get user details from fyers.


问:
Tmi.js moderator
im getting an error. It looks like the moderators method is not a function that is part of the tmi.js library.
I already using the lates version.

Here is my code and what im trying to do.

```<code> client.on("message", async (channel, user, message, self) => {
    // Check if the user's account is less than one week old
    if (user["created-at"] > Date.now() - 7 * 24 * 60 * 60 * 1000) {
      // Check if the user is in the whitelist
      if (!whitelist.includes(user.username)) {
        // Get a list of the moderators for the channel
        const moderators = await client.moderators(channel);
        // Check if the user being banned is a moderator
        if (!moderators.length || !moderators.includes(user.username))

</code>```

im getting this error

```<code> at client.EventEmitter.emit (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\events.js:94:44)
    at client.emits (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\client.js:90:13)
    at client.handleMessage (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\client.js:1117:13)
    at C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\client.js:1228:9
    at Array.forEach (<anonymous>)
    at client._onMessage (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\client.js:1225:8)
    at callListener (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\ws\lib\event-target.js:209:9)
    at WebSocket.emit (node:events:527:28)
</code>```

A Simple solution would be great.

Title: Tmi.js moderator

Body:
im getting an error. It looks like the moderators method is not a function that is part of the tmi.js library.
I already using the lates version.

Here is my code and what im trying to do.

 client.on("message", async (channel, user, message, self) => {
    // Check if the user's account is less than one week old
    if (user["created-at"] > Date.now() - 7 * 24 * 60 * 60 * 1000) {
      // Check if the user is in the whitelist
      if (!whitelist.includes(user.username)) {
        // Get a list of the moderators for the channel
        const moderators = await client.moderators(channel);
        // Check if the user being banned is a moderator
        if (!moderators.length || !moderators.includes(user.username))

im getting this error

 at client.EventEmitter.emit (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\events.js:94:44)
    at client.emits (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\client.js:90:13)
    at client.handleMessage (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\client.js:1117:13)
    at C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\client.js:1228:9
    at Array.forEach (<anonymous>)
    at client._onMessage (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\tmi.js\lib\client.js:1225:8)
    at callListener (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\xavie\OneDrive\Desktop\Leo_anti\node_modules\ws\lib\event-target.js:209:9)
    at WebSocket.emit (node:events:527:28)

A Simple solution would be great.


问:
How do I display a custom view with Spring MVC in IntelliJ?
I am trying to create a simple Jakarta EE demo application in IntelliJ using Maven as my build system, Spring's MVC framework, and Tomcat 9.0.70.0 as my local deployment server.

The application comes with the default index.jsp file within the webapp folder, which is displayed properly when I launch my app in Tomcat.

I have created an additional spring-config file, spring-mvc-demo-servlet.xml, in addition to altering the default web.xml file inside the webapp/WEB-INF/ folder. The code for each is displayed below.

spring-mvc-demo-servlet.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
         version="5.0">
    <display-name>spring-mvc-demo</display-name>

    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring-mvc-demo-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>
</code>```

web.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <!-- Step 3: Add support for component scanning -->
    <context:component-scan base-package="com.luv2code.mvc" />

    <!-- Step 4: Add support for conversion, formatting and validation support -->
    <mvc:annotation-driven/>

    <!-- Step 5: Define Spring MVC view resolver -->
    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/view/" />
        <property name="suffix" value=".jsp" />
    </bean>

</beans>
</code>```

I wanted to create a new Controller called HomeController that would display a custom view, main-menu.jsp, stored in folder that would hold all of my views within the webapp directory.

Project directory

HomeController

```<code>package com.luv2code.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController {
    @RequestMapping("/")
    public String showHomePage() { return "main-menu"; }
}
</code>```

main-menu.jsp

```<code><%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <h2>Spring MVC Demo - Home Page</h2>
</body>
</html>

</code>```

Unfortunately, adding these two new files resulted in no change when I ran the application again with Tomcat. I have since tried the following with no success:

Deleting the index.jsp file altogether

Moving main-menu.jsp to the root webapp folder

Changing the @RequestMapping annotation to use "/home" instead of just "/" and appending home to my app URL.

Appending a  tag to the  element of index.jsp and providing the name of my custom view for its href attribute, and then try to navigate to my view by clicking the link.

All I end up getting is Tomcat's custom 404 error page.

Body:
I am trying to create a simple Jakarta EE demo application in IntelliJ using Maven as my build system, Spring's MVC framework, and Tomcat 9.0.70.0 as my local deployment server.

The application comes with the default index.jsp file within the webapp folder, which is displayed properly when I launch my app in Tomcat.

I have created an additional spring-config file, spring-mvc-demo-servlet.xml, in addition to altering the default web.xml file inside the webapp/WEB-INF/ folder. The code for each is displayed below.

spring-mvc-demo-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
         version="5.0">
    <display-name>spring-mvc-demo</display-name>

    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring-mvc-demo-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <context:component-scan base-package="com.luv2code.mvc" />

    <mvc:annotation-driven/>

    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/view/" />
        <property name="suffix" value=".jsp" />
    </bean>

</beans>

I wanted to create a new Controller called HomeController that would display a custom view, main-menu.jsp, stored in folder that would hold all of my views within the webapp directory.

Project directory

HomeController

package com.luv2code.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController {
    @RequestMapping("/")
    public String showHomePage() { return "main-menu"; }
}

main-menu.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

    <title>Title</title>

Spring MVC Demo - Home Page

Unfortunately, adding these two new files resulted in no change when I ran the application again with Tomcat. I have since tried the following with no success:

Deleting the index.jsp file altogether

Moving main-menu.jsp to the root webapp folder

Changing the @RequestMapping annotation to use "/home" instead of just "/" and appending home to my app URL.

Appending a  tag to the  element of index.jsp and providing the name of my custom view for its href attribute, and then try to navigate to my view by clicking the link.

All I end up getting is Tomcat's custom 404 error page.


问:
dataframes join depending on one column string
I have two dataframes, I want the main one (vehicle_data_all) to have a new column with the vehicle type. I have this in another dataframe
vehicle_data_all
vehicle type

both dataframes have the column "Manufacturer"

I would like to do it with a join

Manufacturer model    year  price transmission  mileage fuelType    tax

VW                Eos  2020.0   5990       Manual    74000   Diesel  125.0

VW                Fox  2020.0   1799       Manual    88102   Petrol  145.0

VW                Fox  2020.0   1590       Manual    70000   Petrol  200.0

VW                Fox  2020.0   1250       Manual    82704   Petrol  150.0

VW                Fox  2017.0   2295       Manual    74000   Petrol  145.0


问:
Autocomplete field for email subscribe form
Good evening,

I'm creating a subscribe form and cannot custom it so that all the browsers have the same autocomplete effect. I precise: I want to have an email address autocompletion after typing one letter in the field.
If I put this:

<input class="tnp-email" type="email" autocomplete="on" min="1" id="tnp-1" value placeholder="Email" style placeholder="color:#B9B9B9" required>

<input class="tnp-submit" type="submit" value="S’abonner" >

</form>

```

…then, it's OK with Safari, but with Chrome, there is no autocompletion. When I change autocomplete="on" by autocomplete"email", then, Safari complete my name instead of my email address without typing one letter, but Chrome suggest my email addresses before typing one letter in the field.

Thank you for your help.

Body:
Good evening,

I'm creating a subscribe form and cannot custom it so that all the browsers have the same autocomplete effect. I precise: I want to have an email address autocompletion after typing one letter in the field.
If I put this:

<input class="tnp-email" type="email" autocomplete="on" min="1" id="tnp-1" value placeholder="Email" style placeholder="color:#B9B9B9" required>

<input class="tnp-submit" type="submit" value="S’abonner" >

</form>

…then, it's OK with Safari, but with Chrome, there is no autocompletion. When I change autocomplete="on" by autocomplete"email", then, Safari complete my name instead of my email address without typing one letter, but Chrome suggest my email addresses before typing one letter in the field.

Thank you for your help.


问:
Write to left and right display
I have a Lily58 Pro, this is a split keyboard with two displays. I am looking for a way to display text and images on both displays.

To create my custom firmware I have done the following:

Copy default Lily58 firmware

Alter the layers in keymap.c file.

As far as I understand I need to alter the oled_task_user() method to write to the secondary (right hand side) display. The QMK Documentation provides some kind of example but I don't understand it.

Should I be importing something from the split_commom package?

Question
How do I display text/image on the secondary display? A small example would be much appreciated.

Title: Write to left and right display


问:
Persist Wallet instance between sessions using Alchemy
We have an all frontend app built in react-native that is supposed to allow users to view their balances, NFTs, and send transactions. This all works when the client first imports their wallet as an instance of the Wallet is saved. However, I noticed that if they stop using the app and then open it again the Wallet instance turns into a plain Object with just _isSigner, address, and provider keys and that built in functions like "signTransaction" are now undefined.

When user imports wallet

```<code>Wallet {
    "_isSigner": true,
    "_mnemonic": [Function anonymous],
    "_signingKey": [Function anonymous],
    "address": "<address-here>",
    "provider": null,
  }
</code>```

When user signs back in

```<code>Object {
  "_isSigner": true,
  "address": "<address-here>",
  "provider": null,
}
</code>```

Since our app is all frontend is there a safe way to renew the wallet instance? I don't want to save their privateKey in a variable since it is all done on the frontend but right now that's the only way that I can figure out to re-create the wallet each time so that they can send transactions.

What is the suggested method for a persisting all-frontend app to keep a wallet instance active?

Body:
We have an all frontend app built in react-native that is supposed to allow users to view their balances, NFTs, and send transactions. This all works when the client first imports their wallet as an instance of the Wallet is saved. However, I noticed that if they stop using the app and then open it again the Wallet instance turns into a plain Object with just _isSigner, address, and provider keys and that built in functions like "signTransaction" are now undefined.

When user imports wallet

Wallet {
    "_isSigner": true,
    "_mnemonic": [Function anonymous],
    "_signingKey": [Function anonymous],
    "address": "<address-here>",
    "provider": null,
  }

When user signs back in

Object {
  "_isSigner": true,
  "address": "<address-here>",
  "provider": null,
}

Since our app is all frontend is there a safe way to renew the wallet instance? I don't want to save their privateKey in a variable since it is all done on the frontend but right now that's the only way that I can figure out to re-create the wallet each time so that they can send transactions.

What is the suggested method for a persisting all-frontend app to keep a wallet instance active?


问:
creation and last modified date of and system.drawing.image
I'm working on a project and I need to create a hash for and image and I did it, with the image propertyItems, but if I copy paste the image I get the same hash, I thought on get the hash based on the creation and last modified date.

I did some research and I found that I get use File.GetCreationTime(@"C:\Users\image.png");
and File.GetLastWriteTime(@"C:\Users\image.png");  but that implies that i have a path to the files, and my file is being download from a blob storage, is there any better way to do it? instead of needing to downloading and saving every image in a folder to get the path.

Sorry for my bad english :)


问:
Python: How to write a list of dataframes to a tkinter treeview
I am working on a program that will connect to a database so that the user can execute a stored procedure by providing the username that they are searching for. Once they hit the run button it will then run the stored procedure. The stored procedure runs a search on multiple tables within the database looking for any username that contains the string(username) that the user provided (it does not need to be the exact username, it just needs the string/username the user provided to be a substring of the username in the database tables). The output will be all the users with that substring in their username, their emails, and their id. I currently have the results going into a list of dataframes as I know dataframes usually work well with treeviews.

What I am wondering is how do I make it so that I can output each result from each table into the single treeview so that the user can see the output? Each table searched creates a new dataframe within the a list (creating the list of dataframes). I apologize if this is hard to understand (it is very difficult to word this in a way that makes sense).

Below is the code that calls the stored procedure and then stores it to the list of dataframes.

```<code>def username_query(user, conn, tv1):
    global username
    username_results = []
    username = user.get()
    #rows = []

    cursor = conn.cursor()
    get_user_stored_proc = "EXEC [dbo].[getUser] @username = ?"

    rows = cursor.execute(get_user_stored_proc, username).fetchall()
    columns = [column[0] for column in cursor.description]
    #print(columns)
    username_results.append(pd.DataFrame.from_records(rows, columns=columns))

    while True:
        rows = cursor.fetchall()
        columns = [column[0] for column in cursor.description]
        username_results.append(pd.DataFrame.from_records(rows, columns=columns))
        if cursor.nextset() == False:
            break
print_results(username_results, tv1)
</code>```

Below is the print_results method, which should print the results in a clean, user friendly way into the treeview. The parameter tv1 is the treeview that has been passed. I am unsure if it is best to pass this through functions or if there is a better way to do this, but I went with the method as I am new to tkinter.

```<code>def print_results(output, tv1):
    #This should be used to populate the treeview, with columns from the first
    #dataframe in the list and then with the data from all of the dataframes found in the list.
    #The first dataframe will always contain the same columns that the rest of the dataframes will
    #per stored procedure. That is why the columns cant be written in,
    #but will only need taken from the first dataframe

</code>```

The print_results method currently does not work, this was another attempt that I found elsewhere. I am open to any recommendations for this method

I apologize again if this is an odd or confusing question. If you require any clarification do not hesitate to ask.

TLDR; How do I put a list of dataframes into a singular treeview, where the columns of the treeview will be the columns of the first dataframe in the list of dataframes.

Body:
I am working on a program that will connect to a database so that the user can execute a stored procedure by providing the username that they are searching for. Once they hit the run button it will then run the stored procedure. The stored procedure runs a search on multiple tables within the database looking for any username that contains the string(username) that the user provided (it does not need to be the exact username, it just needs the string/username the user provided to be a substring of the username in the database tables). The output will be all the users with that substring in their username, their emails, and their id. I currently have the results going into a list of dataframes as I know dataframes usually work well with treeviews.

What I am wondering is how do I make it so that I can output each result from each table into the single treeview so that the user can see the output? Each table searched creates a new dataframe within the a list (creating the list of dataframes). I apologize if this is hard to understand (it is very difficult to word this in a way that makes sense).

Below is the code that calls the stored procedure and then stores it to the list of dataframes.

def username_query(user, conn, tv1):
    global username
    username_results = []
    username = user.get()
    #rows = []

    cursor = conn.cursor()
    get_user_stored_proc = "EXEC [dbo].[getUser] @username = ?"

    rows = cursor.execute(get_user_stored_proc, username).fetchall()
    columns = [column[0] for column in cursor.description]
    #print(columns)
    username_results.append(pd.DataFrame.from_records(rows, columns=columns))

    while True:
        rows = cursor.fetchall()
        columns = [column[0] for column in cursor.description]
        username_results.append(pd.DataFrame.from_records(rows, columns=columns))
        if cursor.nextset() == False:
            break
print_results(username_results, tv1)

Below is the print_results method, which should print the results in a clean, user friendly way into the treeview. The parameter tv1 is the treeview that has been passed. I am unsure if it is best to pass this through functions or if there is a better way to do this, but I went with the method as I am new to tkinter.

def print_results(output, tv1):
    #This should be used to populate the treeview, with columns from the first
    #dataframe in the list and then with the data from all of the dataframes found in the list.
    #The first dataframe will always contain the same columns that the rest of the dataframes will
    #per stored procedure. That is why the columns cant be written in,
    #but will only need taken from the first dataframe

The print_results method currently does not work, this was another attempt that I found elsewhere. I am open to any recommendations for this method

I apologize again if this is an odd or confusing question. If you require any clarification do not hesitate to ask.

TLDR; How do I put a list of dataframes into a singular treeview, where the columns of the treeview will be the columns of the first dataframe in the list of dataframes.


问:
Why Thymeleaf th:if skip condition
Why does not th:if work? It looks like th:if no do anything. I tried to changed it to cwitch-case, unless. I have rread all questions about it and tried.

What I get everytime:

return 1
return 2

```<code>                                            <div class="spacer spacer_mobile" style="font-size: 10px; line-height: 10px;">
                                                <div style="display: none; mso-hide: all; overflow: hidden; max-height: 0; font-size: 0; width: 0; line-height: 1px;"> </div>
                                            </div>
                                            <h4
                                                    style="
                                                                    padding: 0;
                                                                    margin: 0;
                                                                    margin: 0;
                                                                    color: inherit;
                                                                    word-wrap: normal;
                                                                    font-family: 'Lab Grotesque', sans-serif;
                                                                    font-size: 20px;
                                                                    line-height: 28px;
                                                                    font-weight: 400;
                                                                    margin-bottom: 15px;
                                                                    margin-bottom: 15px;
                                                                    text-align: center;
                                                                    margin-top: 0;
                                                                    margin-top: 0;
                                                                "
                                            >
                                                Some text
                                                <div th:if="${condition == null}">return 1,</div>
                                                <div th:if="${condition != null}">return 2,</div>
                                                Some text
                                            </h4>
</code>```

Title: Why Thymeleaf th:if skip condition

Body:
Why does not th:if work? It looks like th:if no do anything. I tried to changed it to cwitch-case, unless. I have rread all questions about it and tried.

What I get everytime:

return 1
return 2

                                            <h4
                                                    style="
                                                                    padding: 0;
                                                                    margin: 0;
                                                                    margin: 0;
                                                                    color: inherit;
                                                                    word-wrap: normal;
                                                                    font-family: 'Lab Grotesque', sans-serif;
                                                                    font-size: 20px;
                                                                    line-height: 28px;
                                                                    font-weight: 400;
                                                                    margin-bottom: 15px;
                                                                    margin-bottom: 15px;
                                                                    text-align: center;
                                                                    margin-top: 0;
                                                                    margin-top: 0;
                                                                "
                                            >
                                                Some text

return 1,

return 2,

                                                Some text


问:
Hardware Information Android 11+
I know that starting with Android 11, access to this information has been banned, but you still need to get it.

told me that it is possible to do this with the help of ndk on c++, but I have already looked through the entire Internet and did not find anything meaningful. Ideally, you should get the processor ID or at least the serial number of the device

Title: Hardware Information Android 11+


问:
How to manually set Visit Source - Referrer Source

How can set visitor source or referrer source manually

How can I send a visit to my site and be the source of the visit,

{ Facebook.com - Google.com - YouTube.com - Twitter.com }

for example: I sent article link on my site to one of my Facebook friends, Inside the article there is a redirect code to a video on YouTube, directly the article will redirect my friend to video on YouTube automatically

Now the traffic source or referrer source will be coming from my site

to video on YouTube

I just want to change the referrer source to youtube video coming from { Facebook.com - Google.com -  Twitter.com }

I think the code will be something like this::

```<code><!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="0; url=http://example.com">
        <script type="text/javascript">
            window.location.href = "http://example.com"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
    </body>
</html>
</code>```

I just want to change the referrer source

Body:
How can set visitor source or referrer source manually

How can I send a visit to my site and be the source of the visit,

{ Facebook.com - Google.com - YouTube.com - Twitter.com }

for example: I sent article link on my site to one of my Facebook friends, Inside the article there is a redirect code to a video on YouTube, directly the article will redirect my friend to video on YouTube automatically

Now the traffic source or referrer source will be coming from my site

to video on YouTube

I just want to change the referrer source to youtube video coming from { Facebook.com - Google.com -  Twitter.com }

I think the code will be something like this::

<!DOCTYPE HTML>

        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="0; url=http://example.com">

        <title>Page Redirection</title>

I just want to change the referrer source


问:
How to handle i18n flow in nodejs
We have a project, which primary users are from Asian country, but our business side decided to expand to other regions and countries. For this reason, we need to implement an API that will return localized response, depend on language that was sent from FE.
We have some restrictions:

Make translation for BE entities (eg. Post) and their corresponding fields (eg. Post.name, Post.title)in 4 languages: English, Japanese, Korean, Chinese.

Make a system that can translate most of the fields automatically, but also have an option where we can change text manually.

For now, we think about these implementations option:

Auto translate libraries

Use Google cloud translate API (our infrastructure base on GCP) or DeepL library as a base for a new service which will translate text that we will send to it automatically to specific language

i18next

Use i18next library with it's connected service locize which will be managed manually and also add auto translation

DB implementation

Save translation for specific entity alongside with base entity, or save translations in other service from which we will call it

If you have some suggestions (or articles) that can help to manage such problems, i'll grateful, thanks!

Title: How to handle i18n flow in nodejs


问:
Files uploaded to Amazon S3 through WinSCP batch/script aren't public
WinSCP Version 5.21.6 (Build 12913 2022-11-28)

I am connect to our Amazon S3 account using an Access key ID and Secret access key.

I use a simple batch file to upload a couple files through WinSCP to our Amazon S3 account with a winscp script text file

Batch Command

```<code>winscp.com /script="C:\Users\W\Desktop\Image\UploadFiles.txt"
</code>```

WinSCP Script Text File

```<code>open s3
put "R:\Ak\qImport.csv" /publicfolder/
put "R:\Ak\qSB.csv" /publicfolder/
exit
</code>```

Everything works great except my files aren't public after being uploaded.  What can I change here to make them upload as public?  When I change them to public through S3 and then reupload them they revert back to private again.

Thanks for the help,

Body:
WinSCP Version 5.21.6 (Build 12913 2022-11-28)

I am connect to our Amazon S3 account using an Access key ID and Secret access key.

I use a simple batch file to upload a couple files through WinSCP to our Amazon S3 account with a winscp script text file

Batch Command

winscp.com /script="C:\Users\W\Desktop\Image\UploadFiles.txt"

WinSCP Script Text File

open s3
put "R:\Ak\qImport.csv" /publicfolder/
put "R:\Ak\qSB.csv" /publicfolder/
exit

Everything works great except my files aren't public after being uploaded.  What can I change here to make them upload as public?  When I change them to public through S3 and then reupload them they revert back to private again.

Thanks for the help,


问:
Debug Go tests executed by Makefile
I'm developing in VS Code. We have a makefile that we use to run our end2end tests. It executes a couple docker commands, an export, the go test command (

```<code>go test -p=1 -count=1 -tags=e2etests ./app_end2end_tests/./...
</code>```

), and cleanup. I tried creating a launch.json and putting the "make e2e" command in a task.json, but the only options for executing the task from launch.json are preLaunchTask and postLaunchTask which don't utilize the debugger. Therefore, I'm wondering how to go about debugging this test suite in its correct environment. Thanks!

Tried: launch.json and task.json. Created a task and set it as preLauchTask in launch.json. The make e2e command was executed but not debugged.

Title: Debug Go tests executed by Makefile

Body:
I'm developing in VS Code. We have a makefile that we use to run our end2end tests. It executes a couple docker commands, an export, the go test command (

go test -p=1 -count=1 -tags=e2etests ./app_end2end_tests/./...

), and cleanup. I tried creating a launch.json and putting the "make e2e" command in a task.json, but the only options for executing the task from launch.json are preLaunchTask and postLaunchTask which don't utilize the debugger. Therefore, I'm wondering how to go about debugging this test suite in its correct environment. Thanks!

Tried: launch.json and task.json. Created a task and set it as preLauchTask in launch.json. The make e2e command was executed but not debugged.


问:
GCP Gateway API Not Getting Authenticated with Oauth access token
Need to authenticate the GCP Gateway API with Oauth When testing with Postman sending the get request to the API returning the response that JWT is in wrong format.
"Jwt is not in the form of Header.Payload.Signature with two dots and 3 sections"

But same thing when tried with the url like - https://firebase.googleapis.com/v1beta1/availableProjects, its seems to be working

Below is the config file for the GCP Gateway -

```<code># openapi2-functions.yaml
swagger: '2.0'
info:
  title: my-api3
  description: Sample API on API Gateway with a Google Cloud Functions backend
  version: 1.0.0
schemes:
  - https
produces:
  - application/json
paths:
  /hello:
    get:
      summary: Greet a user
      operationId: hello
      x-google-backend:
        address: #Function url here
      security:
      - google_id_token: []
      responses:
        '200':
          description: A successful response
          schema:
            type: string
securityDefinitions:
  # This section configures authentication with an Oauth
  google_id_token:
      authorizationUrl: ""
      flow: "implicit"
      type: "oauth2"
      x-google-issuer: "https://accounts.google.com"
      x-google-jwks_uri: "https://www.googleapis.com/oauth2/v3/certs"
      # Optional. Replace YOUR-CLIENT-ID with your client ID
      x-google-audiences: #client-id
</code>```

Scopes used - https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/cloudfunctions
Cloud function has been made public as well as IAM authenticated and tested in both the scenario but the result seems to be same.

Currently the Oauth ID is in test mode and not published.

For resolving looked for the relevant stackoverflow article - Authenticating with Google access token on GCP API Gateway, there its seems to be mentioned that we can fetch an identity token but not sure what the identity token is there.

My confusion here is that why GCP Gateway does not authenticates and authorizes the request whereas for the call happening to firebase url, https://firebase.googleapis.com/v1beta1/availableProjects seems to be getting authenticated and its sending back the response.

In case if this architecture not seems to be fit, what is the alternate secure architecture that we can try to overcome this problem, currently this architecture is making call to API Gateway which in return making call to Cloud function.

Alternatively shall I go for the signin of google account or service account and then get the id token for the oauth access and make the Gateway API call or any other option? In case of alternate architecture what could be the process flow and services involved.

Body:
Need to authenticate the GCP Gateway API with Oauth When testing with Postman sending the get request to the API returning the response that JWT is in wrong format.
"Jwt is not in the form of Header.Payload.Signature with two dots and 3 sections"

But same thing when tried with the url like - https://firebase.googleapis.com/v1beta1/availableProjects, its seems to be working

Below is the config file for the GCP Gateway -

# openapi2-functions.yaml
swagger: '2.0'
info:
  title: my-api3
  description: Sample API on API Gateway with a Google Cloud Functions backend
  version: 1.0.0
schemes:
  - https
produces:
  - application/json
paths:
  /hello:
    get:
      summary: Greet a user
      operationId: hello
      x-google-backend:
        address: #Function url here
      security:
      - google_id_token: []
      responses:
        '200':
          description: A successful response
          schema:
            type: string
securityDefinitions:
  # This section configures authentication with an Oauth
  google_id_token:
      authorizationUrl: ""
      flow: "implicit"
      type: "oauth2"
      x-google-issuer: "https://accounts.google.com"
      x-google-jwks_uri: "https://www.googleapis.com/oauth2/v3/certs"
      # Optional. Replace YOUR-CLIENT-ID with your client ID
      x-google-audiences: #client-id

Scopes used - https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/cloudfunctions
Cloud function has been made public as well as IAM authenticated and tested in both the scenario but the result seems to be same.

Currently the Oauth ID is in test mode and not published.

For resolving looked for the relevant stackoverflow article - Authenticating with Google access token on GCP API Gateway, there its seems to be mentioned that we can fetch an identity token but not sure what the identity token is there.

My confusion here is that why GCP Gateway does not authenticates and authorizes the request whereas for the call happening to firebase url, https://firebase.googleapis.com/v1beta1/availableProjects seems to be getting authenticated and its sending back the response.

In case if this architecture not seems to be fit, what is the alternate secure architecture that we can try to overcome this problem, currently this architecture is making call to API Gateway which in return making call to Cloud function.

Alternatively shall I go for the signin of google account or service account and then get the id token for the oauth access and make the Gateway API call or any other option? In case of alternate architecture what could be the process flow and services involved.


问:
Couldn't open my raw code from github repo (ERR_SSL_PROTOCOL_ERROR)
I tried to open the raw code from my GitHub repo but its either showing "CONNECTION NOT SECURE" or "Hmmm, Cant reach this page".

ERR_SSL_PROTOCOL_ERROR

ERR_CONNECTION_RESET

This happens when I am trying to open when I am connected to my house Wi-Fi. When I change the connectivity to my mobile hotspot this just works as usual.


问:
Can't get Days of Week to display correctly on graph in R
I'm having issues getting my plot in R to display the days of week. Whenever I attempt to plot the data, it just comes up as one big blob but it doesn't differentiate in the days of the week. I believe its caused by the ordered data type it is in however it doesn't have an order to the data. How would I go about putting the data in an order so I can display any days of the week?

   - what the graph looks like for me.

The code I'm using for the graph

```<code>ggplot(data = daily_activity_cleaned) + aes(x = day_of_week, y = total_steps) +
    geom_col(fill = 'blue') +
    labs(x = 'Day of week', y = 'Total Steps', title = 'Total steps taken in a week')
</code>```

What data type it is

```<code>str(daily_activity_cleaned$day_of_week)
 Ord.factor w/ 7 levels "Sun"<"Mon"<"Tue"<..: NA NA NA NA NA NA NA NA NA NA ...
</code>```

One of many options that I have tried to fix this problem.

```<code>daily_activity_cleaned$day_of_week <- wday(x, week_start ="lubridate.week.start", 7)
</code>```

Thanks for all the help again and please let me know if I need to include anything else

Body:
I'm having issues getting my plot in R to display the days of week. Whenever I attempt to plot the data, it just comes up as one big blob but it doesn't differentiate in the days of the week. I believe its caused by the ordered data type it is in however it doesn't have an order to the data. How would I go about putting the data in an order so I can display any days of the week?

   - what the graph looks like for me.

The code I'm using for the graph

ggplot(data = daily_activity_cleaned) + aes(x = day_of_week, y = total_steps) +
    geom_col(fill = 'blue') +
    labs(x = 'Day of week', y = 'Total Steps', title = 'Total steps taken in a week')

What data type it is

str(daily_activity_cleaned$day_of_week)
 Ord.factor w/ 7 levels "Sun"<"Mon"<"Tue"<..: NA NA NA NA NA NA NA NA NA NA ...

One of many options that I have tried to fix this problem.

daily_activity_cleaned$day_of_week <- wday(x, week_start ="lubridate.week.start", 7)

Thanks for all the help again and please let me know if I need to include anything else


问:
NestJS Socket.io upload files
So i have a socket.io server set up in NestJS, but i dont know how to upload files.

Can you help me? Thanks!

Heres the code:

```<code>    this.server.on("connection", async (socket) => {
      socket.on("newMessage", (data) => {
        this.server.emit("onMessage", {
          author: data.userid,
          username: data.username,
          pfp: process.env.CDN_URL + "pfp/" + data.pfp,
          message: data.message,
          sent_at: new Date(),
          chatid: data.chatid,
          frid: data.frid,
        });

        let messageData = new this.messagesModel({
          message: this.encrypt(data.message),
          chatid: new mongoose.Types.ObjectId(data.chatid),
          author: new mongoose.Types.ObjectId(data.userid),
          isEdited: false,
          sent_at: new Date(),
        });

        if(data.image !== ""){
          console.log("HAS IMAGE", data.image)
            console.log("upload")
        }

        messageData.save();
      });
})
</code>```

Title: NestJS Socket.io upload files

Body:
So i have a socket.io server set up in NestJS, but i dont know how to upload files.

Can you help me? Thanks!

Heres the code:

    this.server.on("connection", async (socket) => {
      socket.on("newMessage", (data) => {
        this.server.emit("onMessage", {
          author: data.userid,
          username: data.username,
          pfp: process.env.CDN_URL + "pfp/" + data.pfp,
          message: data.message,
          sent_at: new Date(),
          chatid: data.chatid,
          frid: data.frid,
        });

        let messageData = new this.messagesModel({
          message: this.encrypt(data.message),
          chatid: new mongoose.Types.ObjectId(data.chatid),
          author: new mongoose.Types.ObjectId(data.userid),
          isEdited: false,
          sent_at: new Date(),
        });

        if(data.image !== ""){
          console.log("HAS IMAGE", data.image)
            console.log("upload")
        }

        messageData.save();
      });
})


问:
Updating a counter without reloading the entire page in Scala Play
I'm building an app in Scala Play MVC that has posts. These posts have an upvote counter and can be upvoted and downvoted.
The posts are just kept in memory.
I want the visual counter on the page to update when a vote happens, and the count on the post object simultaniously.

I only know how to do this with rerendering the entire page, sending a request and receiving the same view.
Is this possible with twirl parameters in Play, preferably without Ajax or Javascript?


问:
How to check the internet connectivity?
```<code>setInterval(function(){
    if(!isOnline && navigator.onLine){
        isOnline = true;
        console.log("Back online!");
    }
    else if(isOnline && !navigator.onLine){
        isOnline = false;
        console.log("Lost connection!");
}}, 100);
</code>```

Is it possible to subscribe to data from 'navigator.online'?

The above method seems to be working fine in developer options, when comes to real-time it only checks whether my device is connected to a network or not.

What I want is how to check the status of the internet connectivity.

Title: How to check the internet connectivity?

Body:
setInterval(function(){
    if(!isOnline && navigator.onLine){
        isOnline = true;
        console.log("Back online!");
    }
    else if(isOnline && !navigator.onLine){
        isOnline = false;
        console.log("Lost connection!");
}}, 100);

Is it possible to subscribe to data from 'navigator.online'?

The above method seems to be working fine in developer options, when comes to real-time it only checks whether my device is connected to a network or not.

What I want is how to check the status of the internet connectivity.


问:
How to deliver our application as a single package
I did a POC regarding delivering our application as a Docker image, where we were able to install the backend application on our local machine using Docker Desktop and Minikube.
Now we want to know if we can deliver our application as a single package where the package will contain all the necessary files and scripts to install and configure front end,  backend, and database.
It will also have the scripts to install all the pre-requisites e.g. JAVA, ANGULAR CLI, POSTGRESQL etc.

Please give us insights, if this is possible?
If not, then up-to what extent we can go with this approach?

Thanks

Any suggestion on this


问:
Issue with BizTalk ESB Itinerary Calling Web Service
I have an BizTalk+ESB itinerary with a Itinerary Service to route the data to a web service, using a static resolver.

When I make the request I get this error:

"The document type "http://schemas.xmlsoap.org/soap/envelope/Envelope" does not match any of the given schemas."

I added Envelope.xsd to my itinerary and set the Document schema in the XmlDisassembler

and set the Envelope schema also

I have the itinerary call to the service set up as:

The service is running, and I restart the hosts every time I update the pipeline.

I'm using the schema from http://schemas.xmlsoap.org/soap/envelope/Envelope

I've been checking online and it looks as though I need to modify the schema to include the structure of the incoming message. Is that correct? I assumed that ESB would create the correct message envelope. It looks as though this is not the case.

Anyone have any advice on how I should proceed with this?


问:
python scikit learn random forest classifier individual tree node elements command
I know that I can get an individual tree (for example tree 0) of a random forest object rf using
rf.estimators[0]

is the a way to get the list of events each terminal node of a specific tree and it classification?

using python 3, scikit learn,sciketlearn.ensemble.RandomForestClassifier

```<code>from sklearn.datasets import load_wine

wine = load_wine()
X = wine.data
y = wine.target

from sklearn.ensemble import RandomForestClassifier

rf = RandomForestClassifier(n_estimators=100,
                            max_depth=3,
                            max_features='auto',
                            min_samples_leaf=4,
                            bootstrap=True,
                            n_jobs=-1,
                            random_state=0)
rf.fit(X, y)

import matplotlib.pyplot as plt
from sklearn.tree import plot_tree

fig = plt.figure(figsize=(15, 10))
plot_tree(rf.estimators_[0],
          feature_names=wine.feature_names,
          class_names=wine.target_names,
          filled=True, impurity=True,
          rounded=True)

*rf.treenodeelements[0,1]*
</code>```

Body:
I know that I can get an individual tree (for example tree 0) of a random forest object rf using
rf.estimators[0]

is the a way to get the list of events each terminal node of a specific tree and it classification?

using python 3, scikit learn,sciketlearn.ensemble.RandomForestClassifier

from sklearn.datasets import load_wine

wine = load_wine()
X = wine.data
y = wine.target

from sklearn.ensemble import RandomForestClassifier

rf = RandomForestClassifier(n_estimators=100,
                            max_depth=3,
                            max_features='auto',
                            min_samples_leaf=4,
                            bootstrap=True,
                            n_jobs=-1,
                            random_state=0)
rf.fit(X, y)

import matplotlib.pyplot as plt
from sklearn.tree import plot_tree

fig = plt.figure(figsize=(15, 10))
plot_tree(rf.estimators_[0],
          feature_names=wine.feature_names,
          class_names=wine.target_names,
          filled=True, impurity=True,
          rounded=True)

*rf.treenodeelements[0,1]*


问:
How to store filepath of file, drag-n-dropped into terminal in Python
I have a TUI (textual user interface) application for which I'm trying to write an input manager that is able to discern whether a single keypress was provided or a file was drag-n-dropped into the application. I should then be able to save the key or the filepath into a variable. The user won't need to confirm her input with ENTER.

Single keypresses

Reading single keypresses is easy using, for example, readchar library.

Drag-n-dropped files

For reading filepaths of drag-n-dropped files I use:

import msvcrt

buf = ""

while True:
    c = msvcrt.getwch()

    if msvcrt.kbhit():
        buf+=c
    elif buf:
        buf+=c
        print(buf)
        buf = ""
```

From msvcrt's documentation I know that msvcrt.getwch() gets last keypress as a string and msvcrt.kbhit() returns True if a keypress is waiting to be read.

When run, this script will print filepaths of drag-n-dropped files and nothing else (prove me wrong).

However, I achieved this code mostly by trial and error. It's messy, hard for me to explain and not OS-agnostic. I couldn't find a library doing the same thing.

Can someone simplify this code or guide me to a library that already handles my usecase?

Body:
I have a TUI (textual user interface) application for which I'm trying to write an input manager that is able to discern whether a single keypress was provided or a file was drag-n-dropped into the application. I should then be able to save the key or the filepath into a variable. The user won't need to confirm her input with ENTER.

Single keypresses

Reading single keypresses is easy using, for example, readchar library.

Drag-n-dropped files

For reading filepaths of drag-n-dropped files I use:

import msvcrt

buf = ""

while True:
    c = msvcrt.getwch()

    if msvcrt.kbhit():
        buf+=c
    elif buf:
        buf+=c
        print(buf)
        buf = ""

From msvcrt's documentation I know that msvcrt.getwch() gets last keypress as a string and msvcrt.kbhit() returns True if a keypress is waiting to be read.

When run, this script will print filepaths of drag-n-dropped files and nothing else (prove me wrong).

However, I achieved this code mostly by trial and error. It's messy, hard for me to explain and not OS-agnostic. I couldn't find a library doing the same thing.

Can someone simplify this code or guide me to a library that already handles my usecase?


问:
IncludeOnline=true option doesn't work when uploading attachment to Xero via API
IncludeOnline=true option doesn't work when uploading invoice attachment to Xero via API.

This is the doc:
https://developer.xero.com/documentation/api/accounting/attachments/#post-attachments

And this the option I need to be turned on after I upload the file and it is still turned off even with IncludeOnline=true:
option to be enabled after upload

Tried: Attach file to the invoice with IncludeOnline=true

Expecting: Send with invoice option to be turned on


问:
CONVERT Date column to %m-%d-%y
I want to convert the date column in my dataframe which is in the format of Dec. 01, 2022 to 12-01-2022

I tried using map function and by importing calender as well

Title: CONVERT Date column to %m-%d-%y


问:
Class not found when using dynamic import
I am trying to dynamically import a module using the following:

```<code>def import_plugin(plugin_name):
    src = f'plugins.{plugin_name}.plugin'
    module = __import__(src)
    return getattr(module, 'Plugin')

import_plugin('core')
</code>```

This is the project structure:

main.py

plugins

core

plugin.py - This file contains a class named Plugin

I'm getting the error: module 'plugins' has no attribute 'Plugin'

Body:
I am trying to dynamically import a module using the following:

def import_plugin(plugin_name):
    src = f'plugins.{plugin_name}.plugin'
    module = __import__(src)
    return getattr(module, 'Plugin')

import_plugin('core')

This is the project structure:

main.py

plugins

core

plugin.py - This file contains a class named Plugin

I'm getting the error: module 'plugins' has no attribute 'Plugin'


问:
Transition reversed after active
When I click on div , active Event fired but transition reversed after unclick. my code is:

```<code> .switch {
    top: 25%;
    transition: all 0.4s;
  }
  .switch:active {
    transition: all 0;
    top: 75%;
  }
</code>```

Why ? I am confused!

Title: Transition reversed after active

Body:
When I click on div , active Event fired but transition reversed after unclick. my code is:

 .switch {
    top: 25%;
    transition: all 0.4s;
  }
  .switch:active {
    transition: all 0;
    top: 75%;
  }

Why ? I am confused!


问:
Why does git keeping setting my submodules to (HEAD) when I alter my main repo?
I have a repo with 2 submods inside of it. When in the main repo and switching branches, or pulling changes, seemingly at random, the submods will leave the branch I told them to be on and switch to "HEAD (string of numbers and letters)". I know this is the version of the submodule I last pushed to my main repo, but that's not what I want.

This is demolishing my workflow, and making me lose submod changes sometimes. I need git to never, ever, under any circumstances, change the branch I set my two submods to be on, no matter what I do to the main repo. How do I make that possible?


问:
Flexible filter with OR
I am using AG-GRID with Vue 3. I have filters in a sidebar. It all works fine. Each row has an id. What I want to change is the logic in the filter - I want to add logic so that all id's within a supplied list pass. So the filter pass logic is:

(filter1 passes AND filter2 passes AND filter3 passes etc.) OR id is in list.

[The background is that I am using filters on a table, but also selecting rows on a leaflet map, and I want the map selected rows plus the table filtered rows to be seen in the table].

I guess I could do this with multiple custom filters and adapt the filterpass code, but this seems very tedious.

Is there an easier way?

If I could generate 95% of a custom filter from an inbuilt filter, it would help, but I fear that is not easy either.

This article does not describe what I want, as it descibes OR filtering followed by AND filtering, if I understand correctly.

https://blog.ag-grid.com/advanced-filtering-in-ag-grid-using-or-filtering-conditions/

Title: Flexible filter with OR


问:
Add List Partitions to un-partitioned Oracle Table
Am I able to add list partitions to an un-partitioned oracle table? I have seen range partitions added in other examples online, but not list partitions. If I am able to add list partitions to an existing non-partitioned oracle table, are there some requirements that must be met to do so?

I tried

```<code>alter table t1 MODIFY
PARTITION  BY LIST (c1)
( PARTITION c1a VALUES ('c1a'),
       PARTITION c1b VALUES ('c1b'),
       PARTITION c1c VALUES ('c1c'))
</code>```

But get:
ORA-14006;invalid partition name

Body:
Am I able to add list partitions to an un-partitioned oracle table? I have seen range partitions added in other examples online, but not list partitions. If I am able to add list partitions to an existing non-partitioned oracle table, are there some requirements that must be met to do so?

I tried

alter table t1 MODIFY
PARTITION  BY LIST (c1)
( PARTITION c1a VALUES ('c1a'),
       PARTITION c1b VALUES ('c1b'),
       PARTITION c1c VALUES ('c1c'))

But get:
ORA-14006;invalid partition name


问:
MVVM WPF - Changing Views creates new Instances of View
I've decided to move away from WinForms as I wanted to be more flexible in creating my UIs. That said I'm just starting with WPF and the MVVM structure. I'm having a blast learning all the new stuff and trying to learn the "best practices" right away.

One thing I'm wondering is that with my current implementation of MVVM and navigation through my views it would always create a new instance of the View when changing my CurrentView of my MainViewModel of my MainWindow.

Is that the intended way? As I notice quite a bit of lagging when changing them which feels ... wrong? As a sidenote I'm currently not on my normal workstation but on a older surface which is getting stressed easily with VS running etc

A pretty 'standard' MainViewModel

```<code>    public class MainViewModel : ObservableObject
    {

        public MainViewModel()
        {
            this.PageViewModels.Add(new EventsViewModel());
            this.PageViewModels.Add(new SettingsViewModel());
            this.PageViewModels.Add(new AnotherViewModel());

            this.CurrentView = this.PageViewModels[0];
        }

        public ViewModelBase CurrentView
        {
            get
            {
                return this._currentVIew;
            }

            set
            {
                this._currentVIew = value;
                this.OnPropertyChanged("CurrentView");
            }
        }

        public ICommand ChangePageCommand
        {
            get
            {
                if (this.changePageCommand == null)
                {
                    this.changePageCommand = new RelayCommand(
                        p => this.ChangeViewModel(p),
                        p => true);
                }

                return this.changePageCommand;
            }
        }

        private void ChangeViewModel(object viewModel)
        {
            var t = (Type)viewModel;
            foreach (var v in this.PageViewModels)
            {
                if (v.GetType() == t)
                {
                    this.CurrentView = v;
                    return;
                }
            }
        }
}
</code>```

'Normal' View Data Templating

```<code>            <DataTemplate DataType="{x:Type viewModel:EventsViewModel}">
                <view:EventView/>
            </DataTemplate>

            <DataTemplate DataType="{x:Type viewModel:SettingsViewModel}">
                <view:SettingsView/>
            </DataTemplate>

            <DataTemplate DataType="{x:Type viewModel:AnotherViewModel}">
                <view:AnotherView/>
            </DataTemplate>
</code>```

The way the Command is beeing called, just with different x:Type parameter

```<code>Command="{Binding DataContext.ChangePageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
CommandParameter="{x:Type viewModel:SettingsViewModel}"
</code>```
```<code></code>```

Body:
I've decided to move away from WinForms as I wanted to be more flexible in creating my UIs. That said I'm just starting with WPF and the MVVM structure. I'm having a blast learning all the new stuff and trying to learn the "best practices" right away.

One thing I'm wondering is that with my current implementation of MVVM and navigation through my views it would always create a new instance of the View when changing my CurrentView of my MainViewModel of my MainWindow.

Is that the intended way? As I notice quite a bit of lagging when changing them which feels ... wrong? As a sidenote I'm currently not on my normal workstation but on a older surface which is getting stressed easily with VS running etc

A pretty 'standard' MainViewModel

    public class MainViewModel : ObservableObject
    {

        public MainViewModel()
        {
            this.PageViewModels.Add(new EventsViewModel());
            this.PageViewModels.Add(new SettingsViewModel());
            this.PageViewModels.Add(new AnotherViewModel());

            this.CurrentView = this.PageViewModels[0];
        }

        public ViewModelBase CurrentView
        {
            get
            {
                return this._currentVIew;
            }

            set
            {
                this._currentVIew = value;
                this.OnPropertyChanged("CurrentView");
            }
        }

        public ICommand ChangePageCommand
        {
            get
            {
                if (this.changePageCommand == null)
                {
                    this.changePageCommand = new RelayCommand(
                        p => this.ChangeViewModel(p),
                        p => true);
                }

                return this.changePageCommand;
            }
        }

        private void ChangeViewModel(object viewModel)
        {
            var t = (Type)viewModel;
            foreach (var v in this.PageViewModels)
            {
                if (v.GetType() == t)
                {
                    this.CurrentView = v;
                    return;
                }
            }
        }
}

'Normal' View Data Templating

            <DataTemplate DataType="{x:Type viewModel:EventsViewModel}">
                <view:EventView/>
            </DataTemplate>

            <DataTemplate DataType="{x:Type viewModel:SettingsViewModel}">
                <view:SettingsView/>
            </DataTemplate>

            <DataTemplate DataType="{x:Type viewModel:AnotherViewModel}">
                <view:AnotherView/>
            </DataTemplate>

The way the Command is beeing called, just with different x:Type parameter

Command="{Binding DataContext.ChangePageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
CommandParameter="{x:Type viewModel:SettingsViewModel}"


问:
how to fix net::ERR_CERT_AUTHORITY_INVALID in react using axios?
Hello I have a problem with net::ERR_CERT_AUTHORITY_INVALID
I tried to solve it with the help of httpsAgent but it doesn't work, what else can be done?

```<code>const httpsAgent = new https.Agent({
  rejectUnauthorized: false
});

export const loginFormAction = (data) => async dispatch => {
    dispatch({ type : 'AUTH_LOGIN' , payload : true })
    await axios.post(`${api}/auth/login` , { httpsAgent } , data).then(resp => {
        console.log(resp);
    }).catch(err => {
        console.log(err);
    })
    dispatch({ type : 'AUTH_LOGIN' , payload : false })
}
</code>```

Body:
Hello I have a problem with net::ERR_CERT_AUTHORITY_INVALID
I tried to solve it with the help of httpsAgent but it doesn't work, what else can be done?

const httpsAgent = new https.Agent({
  rejectUnauthorized: false
});

export const loginFormAction = (data) => async dispatch => {
    dispatch({ type : 'AUTH_LOGIN' , payload : true })
    await axios.post(`${api}/auth/login` , { httpsAgent } , data).then(resp => {
        console.log(resp);
    }).catch(err => {
        console.log(err);
    })
    dispatch({ type : 'AUTH_LOGIN' , payload : false })
}


问:
How to add keyboard event to an element in svelte?
I am trying to get keyup event on a specific element in svelte but it seems it is not possible.
I checked this REPL and also I tried by adding the event to the document and it worked fine. But I don't want to add it to the document and I just want to have it on my element.

```<code><script>
    const key = () => {
        console.log('key')
    }
</script>

<div
    on:keyup={key}
     style="width:100%; height:200px; border:2px solid #ff0000;"></div>
</code>```


问:
Mobile Hotspot connected device
Since last week got the problem with mobile hotspot on samsung android phone
the mobile internet is there and working fine but on mobile hotspot device connected to mobile hotspot is having issue, it is loosing internet connection from time to time and is again working if turned off mobile hotspot and turn on again
any idea what can be problem?

no idea how to fix

Title: Mobile Hotspot connected device


问:
A-frame 1.3.0 issue with aframe-environment-component
Having an interesting issue using aframe-environment-component in A-frame 1.3.0 where the geometry in at least 'forest' appears fractured.

I haven't tried all of the presets and have been using 'arches' for my demo which does appear darker than expect. It looks like some geometry matrices have been updated recently and may have something to do with it.