问:
Android Google Play bundle updates with new database
I have a hybrid app, ionic/capacitor, we’ve built and released via Apple App Store and Google Play.

In version 2 of the app we added a SQLite database to support new functionality.

I’ve had no problems publishing the app to Apple, but in Google Play releases, the update bundle doesn’t include the new database and the added SQLite plug-in throws errors if you try any actions with it.

What it boils down to is the way the bundles work to keep the install size down.

I can work around this by setting AllowUpdates=“false” in the android manifest, but this means the users need to uninstall and app and do a clean install.

Is there anyway to add this new database into the newer android bundle release so I can allow users to update instead of uninstalling and reinstalling?

I’ve tried many things, including attempting to copy the new database to “data/data/<package_name>/databases” using SQLite copyFromAssets() on app initialization.


来源: stackexchange

问:
Automatically assigning p-value position in ggplot loop
I am running an mapply loop on a huge set of data to graph 13 parameters for 19 groups. This is working great except the p-value position. Due to the data varying for each plot I cannot assign position using label.y = 125 for example, in some plots it is in the middle of the bar/error bar. However, I can't assign it higher without having it way to high on other graphs. Is there a way to adjust to the data and error bars?

This is my graphing function and like I said the graph is great, except p-value position. Specifically, the stat compare means anova line.

```<code>ANOVA_plotter <- function(Variable, treatment, Grouping, df){
  Inputdf <- df %>%
  filter(Media == treatment, Group == Grouping) %>%
  ggplot(aes_(x = ~ID, y = as.name(Variable))) +
    geom_bar(aes(fill = ANOVA_Status), stat = "summary", fun = "mean", width = 0.9) +
  stat_summary(geom = "errorbar", fun.data = "mean_sdl", fun.args = list(mult = 1), size = 1) +
  labs(title = paste(Variable, "in", treatment, "in Group", Grouping, sep = " ")) +
  theme(legend.position = "none",axis.title.x=element_blank(), axis.text = element_text(face="bold", size = 18 ), axis.text.x = element_text(angle = 45,  hjust = 1)) +
  stat_summary(geom = "errorbar", fun.data = "mean_sdl", fun.args = list(mult = 1), width = 0.2) +
  stat_compare_means(method = "anova", label.y = 125) +
  stat_compare_means(label = "p.signif", method = "t.test", paired = FALSE, ref.group = "Control")
}
</code>```

I get graphs that look like this
(https://i.stack.imgur.com/hV9Ad.jpg)

But I can't assign it to label.y = 200 because of plots like this
(https://i.stack.imgur.com/uStez.jpg)

ContentLicense: CC BY-SA 4.0

Body:
I am running an mapply loop on a huge set of data to graph 13 parameters for 19 groups. This is working great except the p-value position. Due to the data varying for each plot I cannot assign position using label.y = 125 for example, in some plots it is in the middle of the bar/error bar. However, I can't assign it higher without having it way to high on other graphs. Is there a way to adjust to the data and error bars?

This is my graphing function and like I said the graph is great, except p-value position. Specifically, the stat compare means anova line.

ANOVA_plotter <- function(Variable, treatment, Grouping, df){
  Inputdf <- df %>%
  filter(Media == treatment, Group == Grouping) %>%
  ggplot(aes_(x = ~ID, y = as.name(Variable))) +
    geom_bar(aes(fill = ANOVA_Status), stat = "summary", fun = "mean", width = 0.9) +
  stat_summary(geom = "errorbar", fun.data = "mean_sdl", fun.args = list(mult = 1), size = 1) +
  labs(title = paste(Variable, "in", treatment, "in Group", Grouping, sep = " ")) +
  theme(legend.position = "none",axis.title.x=element_blank(), axis.text = element_text(face="bold", size = 18 ), axis.text.x = element_text(angle = 45,  hjust = 1)) +
  stat_summary(geom = "errorbar", fun.data = "mean_sdl", fun.args = list(mult = 1), width = 0.2) +
  stat_compare_means(method = "anova", label.y = 125) +
  stat_compare_means(label = "p.signif", method = "t.test", paired = FALSE, ref.group = "Control")
}

I get graphs that look like this
(https://i.stack.imgur.com/hV9Ad.jpg)

But I can't assign it to label.y = 200 because of plots like this
(https://i.stack.imgur.com/uStez.jpg)


问:
Could not find or load main class install4j.Installer?
Hi I'm trying to install studio 3T
and when I execute the .sh file I get
Unpacking JRE ...
Starting Installer ...
Error: Could not find or load main class install4j.Installer1269427202
Caused by: java.lang.ClassNotFoundException: install4j.Installer1269427202

i am on debian and i have java installed and this is the java version
openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1deb11u1, mixed mode, sharing)

Thank you for your help


问:
PyQT5: Can't open second window again from main window
Pressing a button in the main window opens a second window. And when I turned off the second window, the first window reappeared.

The problem is:
When I press the button from the first window for the first time, the second window appears.
And then I turn off second window, and press the button again in the first window, and the second window will not appeared.

I debugged it in Pycharm and it says:
<class 'NameError'>,NameError("name 'AdSecond' is not defined"),<traceback object at 0x000001F24F8B2600>

'AdSecond' is class that defined in another file.
And I used self.close() method to close the second window.

This is my code:

```<code># Make the button that connects to second window

def groupButtons(self):
    groupbox = QGroupBox()

    startButton = QPushButton("Game Start")
    startButton.setStyleSheet(
        "QPushButton{padding:8px; color: white;background-color: rgb(58, 134, 255); border-radius: 30px;}")

    hbox = QHBoxLayout()
    hbox.addWidget(startButton)

    groupbox.setLayout(hbox)
    startButton.clicked.connect(self.buttonToSecond)

    return groupbox
</code>```
```<code># Connects to second window, the error occurred here.

def buttonToSecond(self):
        self.hide()
        self.second = AdSecond(self.itemNumer, self.myItemNumber, self.a) <- error occurred here.
        self.second.show()
</code>```

I thought there's a problem with the variable self.second(because AdSecond is included) so I initialized this variable with the code self.second = 0 (or None) before calling the second class, but it says same error message and nothing changed.

Body:
Pressing a button in the main window opens a second window. And when I turned off the second window, the first window reappeared.

The problem is:
When I press the button from the first window for the first time, the second window appears.
And then I turn off second window, and press the button again in the first window, and the second window will not appeared.

I debugged it in Pycharm and it says:
<class 'NameError'>,NameError("name 'AdSecond' is not defined"),<traceback object at 0x000001F24F8B2600>

'AdSecond' is class that defined in another file.
And I used self.close() method to close the second window.

This is my code:

# Make the button that connects to second window

def groupButtons(self):
    groupbox = QGroupBox()

    startButton = QPushButton("Game Start")
    startButton.setStyleSheet(
        "QPushButton{padding:8px; color: white;background-color: rgb(58, 134, 255); border-radius: 30px;}")

    hbox = QHBoxLayout()
    hbox.addWidget(startButton)

    groupbox.setLayout(hbox)
    startButton.clicked.connect(self.buttonToSecond)

    return groupbox

# Connects to second window, the error occurred here.

def buttonToSecond(self):
        self.hide()
        self.second = AdSecond(self.itemNumer, self.myItemNumber, self.a) <- error occurred here.
        self.second.show()

I thought there's a problem with the variable self.second(because AdSecond is included) so I initialized this variable with the code self.second = 0 (or None) before calling the second class, but it says same error message and nothing changed.


问:
Where do I store session id in vue.js
So basically I have a simple vue app that is going to make requests to an API.
As there is no authentication, I need to make sure that during the vue app's life cycle (basically while the browser is open) the app will have access to some unique identifier that can be sent to the server.

In this way, the API will understand that it is the same "user" that is making requests.

As Im totally new to vue Im not really sure how I can accomplish this.
My first idea was to add code inside some global file (for example /src/App.vue) that could look like this:

```<code>if(!window.localStorage.getItem('session_id')){
    let random = Array(5).fill().map(n=>(Math.random()*36|0).toString(36)).join('')
    window.localStorage.setItem('session_id', random)
}
</code>```

And then, when making API requests, I would attach it this way:

```<code>//pseudo code
request.header('session_id', window.localStorage.getItem('session_id')).get('endpoint1')
</code>```

Is this the way to go? Or there are better ways?

Title: Where do I store session id in vue.js

Body:
So basically I have a simple vue app that is going to make requests to an API.
As there is no authentication, I need to make sure that during the vue app's life cycle (basically while the browser is open) the app will have access to some unique identifier that can be sent to the server.

In this way, the API will understand that it is the same "user" that is making requests.

As Im totally new to vue Im not really sure how I can accomplish this.
My first idea was to add code inside some global file (for example /src/App.vue) that could look like this:

if(!window.localStorage.getItem('session_id')){
    let random = Array(5).fill().map(n=>(Math.random()*36|0).toString(36)).join('')
    window.localStorage.setItem('session_id', random)
}

And then, when making API requests, I would attach it this way:

//pseudo code
request.header('session_id', window.localStorage.getItem('session_id')).get('endpoint1')

Is this the way to go? Or there are better ways?


问:
Google Chrome Auto Suggestions hides on focus of input field
When i try to login, google chrome auto suggestions pops up and hides before i can click one of the previously used emails from the dropdown.

enter image description here

I suspected there might be a css class affecting it but that didnt seem to be the case.

Is there any way to force the autosuggestions dropdown to stay on focus of the input field?

Code:

```<code>                        <label htmlFor="email">Email Address</label>
                        <input
                            data-testid="email"
                            id="email"
                            name="email"
                            onChange={(e) => handleForm(e)}
                            placeholder="Enter your email address"
                            required
                            type="email"
                            value={data.email}
                        />
                        <label htmlFor="password">Enter your password</label>
                        <input
                            autoComplete="on"
                            data-testid="password"
                            id="password"
                            name="password"
                            onChange={(e) => handleForm(e)}
                            placeholder="Enter your password"
                            required
                            type={show ? "test" : "password"}
                            value={data.password}
                        />
                        <Icon
                            className={styles.viewPassword}
                            name="viewPassword"
                            onClick={handlePassWord}
                        />
                        <div>
                            {success && <SuccessMessage />}
                            {error && <ErrorMessage />}
                        </div>
                        <Button
                            className={styles.btnClass}
                            loading={loading}
                            type={"submit"}
                            wrapperClass={styles.btn}

                        >
                            Login
                        </Button>
                    </form>
</code>```

Body:
When i try to login, google chrome auto suggestions pops up and hides before i can click one of the previously used emails from the dropdown.

enter image description here

I suspected there might be a css class affecting it but that didnt seem to be the case.

Is there any way to force the autosuggestions dropdown to stay on focus of the input field?

Code:

                        Email Address
                        <input
                            data-testid="email"
                            id="email"
                            name="email"
                            onChange={(e) => handleForm(e)}
                            placeholder="Enter your email address"
                            required
                            type="email"
                            value={data.email}
                        />
                        Enter your password
                        <input
                            autoComplete="on"
                            data-testid="password"
                            id="password"
                            name="password"
                            onChange={(e) => handleForm(e)}
                            placeholder="Enter your password"
                            required
                            type={show ? "test" : "password"}
                            value={data.password}
                        />
                        <Icon
                            className={styles.viewPassword}
                            name="viewPassword"
                            onClick={handlePassWord}
                        />

                            {success && <SuccessMessage />}
                            {error && <ErrorMessage />}

                        <Button
                            className={styles.btnClass}
                            loading={loading}
                            type={"submit"}
                            wrapperClass={styles.btn}

                        >
                            Login
                        </Button>
                    </form>


问:
Couldn't find a valid Docker environment - Rancher Desktop
In My mac, I have rancher desktop installed. I can run docker commands from terminal without any issue.

But however, Junit test container is complaining saying Couldn't find a valid docker environment.

Can you pls help?


问:
How to get specific numbers of files from Citrix ShareFile through RESTApi?
I am trying to get Specific no of files from A Folder, But Could Not Find A Way.

I Tried the method specified in this link https://api.sharefile.com/docs/resource?name=Items (Get Children),and its provides all the filesand folders present in the folder.


问:
C# MaterialDesign PopupBox Cascading
I have a WPF application (C#) thats using a Material Designs PopUpBox for its menu navigation, as per the following:-

```<code> <materialDesign:PopupBox Margin="10,0,0,0" PlacementMode="BottomAndAlignLeftEdges" StaysOpen="false" IsEnabled="{Binding IsSystemControlsEnabled}" Style="{DynamicResource template_NavigationMenu}"  >
                        <materialDesign:PopupBox.ToggleContent>
                            <materialDesign:PackIcon Foreground="White" Height="25" Kind="Menu" Width="25"/>
                        </materialDesign:PopupBox.ToggleContent>
                        <StackPanel Width="150"   >
                            <Button Command="{Binding ScreenCommand}" CommandParameter="Dashboard" Content="Dashboard"  FontSize="12" FontWeight="Medium"  Height="20" Name="MenuDashboard" VerticalAlignment="Top" VerticalContentAlignment="Top"   />
                            <Separator/>
                            <Button Command="{Binding ScreenCommand}" CommandParameter="Encrypt" Content="Encrypt"  FontSize="12" FontWeight="Medium" Height="20" Name="MenuEncrypt" VerticalAlignment="Top" VerticalContentAlignment="Top" />
                            <Separator />
                            <Button Command="{Binding ScreenCommand}" CommandParameter="Decrypt" Content="Decrypt"  FontSize="12" FontWeight="Medium"  Height="20" Name="MenuDecrypt" VerticalAlignment="Top" VerticalContentAlignment="Top"  />
                            <Separator />
                        </StackPanel>
                    </materialDesign:PopupBox>
</code>```

Is there a way to cascade this menu and add an extra layer? So for example, if I was to select or hover over the button for Encryption, it would they give me a new popupbox, just to the right, with some new options relating to encryption?

I'm trying to find something like this https://m2.material.io/components/menus (first image) but can't find anything relating to C# / XAML, so looking for some inspiration from the experts...

Any help is greatly appreciated.

Thank you

Title: C# MaterialDesign PopupBox Cascading

Body:
I have a WPF application (C#) thats using a Material Designs PopUpBox for its menu navigation, as per the following:-

 <materialDesign:PopupBox Margin="10,0,0,0" PlacementMode="BottomAndAlignLeftEdges" StaysOpen="false" IsEnabled="{Binding IsSystemControlsEnabled}" Style="{DynamicResource template_NavigationMenu}"  >
                        <materialDesign:PopupBox.ToggleContent>
                            <materialDesign:PackIcon Foreground="White" Height="25" Kind="Menu" Width="25"/>
                        </materialDesign:PopupBox.ToggleContent>
                        <StackPanel Width="150"   >
                            <Button Command="{Binding ScreenCommand}" CommandParameter="Dashboard" Content="Dashboard"  FontSize="12" FontWeight="Medium"  Height="20" Name="MenuDashboard" VerticalAlignment="Top" VerticalContentAlignment="Top"   />
                            <Separator/>
                            <Button Command="{Binding ScreenCommand}" CommandParameter="Encrypt" Content="Encrypt"  FontSize="12" FontWeight="Medium" Height="20" Name="MenuEncrypt" VerticalAlignment="Top" VerticalContentAlignment="Top" />
                            <Separator />
                            <Button Command="{Binding ScreenCommand}" CommandParameter="Decrypt" Content="Decrypt"  FontSize="12" FontWeight="Medium"  Height="20" Name="MenuDecrypt" VerticalAlignment="Top" VerticalContentAlignment="Top"  />
                            <Separator />
                        </StackPanel>
                    </materialDesign:PopupBox>

Is there a way to cascade this menu and add an extra layer? So for example, if I was to select or hover over the button for Encryption, it would they give me a new popupbox, just to the right, with some new options relating to encryption?

I'm trying to find something like this https://m2.material.io/components/menus (first image) but can't find anything relating to C# / XAML, so looking for some inspiration from the experts...

Any help is greatly appreciated.

Thank you


问:
How to load custom EAV module's attributes dynamically in admin grid magento 2?
I have created an EAV module in Magento 2.4.5 and I am displaying admin grid using Ui Components.

I want to load the Attributes dynamically in admin grid instead of mentioning the column tags in Ui component file.

I want to load the Title column dynamically without declaring it in the Ui component xml file.


问:
I trying to install axios to my react project but there is an error
this is the error I got when I tried to install axios in my react Project</p>
```<code>

PS C:\Users\mohamud\Desktop\reactapp> npm install axios

added 3 packages, and audited 1469 packages in 2m

225 packages are looking for funding
  run `npm fund` for details

6 high severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
</code>```

Body:
this is the error I got when I tried to install axios in my react Project

PS C:\Users\mohamud\Desktop\reactapp> npm install axios

added 3 packages, and audited 1469 packages in 2m

225 packages are looking for funding
  run `npm fund` for details

6 high severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.


问:
Splitting text into lines and then splitting into characters and print into tr,td
I want to split text into lines first with jquery and then split each line into its characters(I get from the text file).
Row layout will not be broken.
I want to print each line in tr and each character in td(including spaces).
I have this text:

TANJA   NANI      A   ADEBCDECDDECDBABABABABABABABABABABABABABAZ  ADAD
HEPPO   CEPPO     BCCCCCCCCCCCCCCCCCCCCCCCCC      CCCCC  CCCCCCCCCC

MERC    DARK      A   ADEBCDECDDECDBABABABABABABABABABABABA   BAB

How should the for loop or each loop be correct?
I tried this code.

```<code>jQuery.get('AA.txt', function (data) {

   var lines = data.split("\r\n");

  for(var i = 0 ; i < lines.length; i++){
     $('#table').append('<tr></tr>');
     var lin =lines[i].split(/(?!$)/u);

      for(var k = 0 ; k < lin.length; k++){
       $('#table tr').append('<td>'+ lin[k] + '</td>');
      }
  }
});
</code>```

Body:
I want to split text into lines first with jquery and then split each line into its characters(I get from the text file).
Row layout will not be broken.
I want to print each line in tr and each character in td(including spaces).
I have this text:

TANJA   NANI      A   ADEBCDECDDECDBABABABABABABABABABABABABABAZ  ADAD
HEPPO   CEPPO     BCCCCCCCCCCCCCCCCCCCCCCCCC      CCCCC  CCCCCCCCCC

MERC    DARK      A   ADEBCDECDDECDBABABABABABABABABABABABA   BAB

How should the for loop or each loop be correct?
I tried this code.

jQuery.get('AA.txt', function (data) {

   var lines = data.split("\r\n");

  for(var i = 0 ; i < lines.length; i++){
     $('#table').append('

');
     var lin =lines[i].split(/(?!$)/u);

      for(var k = 0 ; k < lin.length; k++){
       $('#table tr').append(''+ lin[k] + '	');
      }
  }
});


问:
Error to import a controller, but I get expect function but got [object undefined]
I have authController.ts file where I import all controllers from, and everything works just fine, but if I try to import refresh controller I get this error Error: Route.get() requires a callback function but got a [object Undefined]

I'm to pass refresh controller to route '/refresh'

In authController.ts

All other controllers works just fine, but refresh controller does not!

in authRoute


问:
GraphQL Error: Query root type must be provided on Rover-generated schema
I am trying to test an Apollo Federation 2 gateway. For that purpose, I generated schema from two subgraphs using Rover.

This results in supergraph.graphql:

```<code>schema
  @link(url: "https://specs.apollo.dev/link/v1.0")
  @link(url: "https://specs.apollo.dev/join/v0.2", for: EXECUTION)
{
  query: Query
}

directive @join__field(graph: join__Graph!, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE

directive @join__type(graph: join__Graph!, key: join__FieldSet, extension: Boolean! = false, resolvable: Boolean! = true) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA

scalar DateTime
  @join__type(graph: OFFERS)

scalar join__FieldSet

enum join__Graph {
  OFFERS @join__graph(name: "offers", url: "http://offers-service.local/offer-service")
  ORDERS @join__graph(name: "orders", url: "http://orders-service.local/graphql")
}

scalar link__Import

enum link__Purpose {
  """
  `SECURITY` features provide metadata necessary to securely resolve fields.
  """
  SECURITY

  """
  `EXECUTION` features provide metadata necessary for operation execution.
  """
  EXECUTION
}

type Offer
  @join__type(graph: OFFERS)
{
  id: ID!
  title: String!
  category: String!
  created_at: DateTime!
  updated_at: DateTime!
}

type Query
  @join__type(graph: OFFERS)
  @join__type(graph: ORDERS)
{
  """List all offers."""
  getOffers: [Offer!]! @join__field(graph: OFFERS)
  me: User @join__field(graph: ORDERS)
}

type User
  @join__type(graph: ORDERS)
{
  id: ID!
  username: String
}
</code>```

My entrypoint looks like:

```<code>import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone';
import gql from 'graphql-tag';
import {readFileSync} from 'fs';

const schemaString = readFileSync('./supergraph.graphql').toString()
const supergraphSdl = gql` ${schemaString} `;

const server = new ApolloServer({
    supergraphSdl
});

const { url } = await startStandaloneServer(server, {
    listen: { port: 5001 }
});
console.log(`  Server ready at ${url}`);
</code>```

However when I try to run the server, it throws me an error Error: Query root type must be provided. with no additional info. Query is clearly defined there. What could be the issue?

Body:
I am trying to test an Apollo Federation 2 gateway. For that purpose, I generated schema from two subgraphs using Rover.

This results in supergraph.graphql:

schema
  @link(url: "https://specs.apollo.dev/link/v1.0")
  @link(url: "https://specs.apollo.dev/join/v0.2", for: EXECUTION)
{
  query: Query
}

directive @join__field(graph: join__Graph!, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE

directive @join__type(graph: join__Graph!, key: join__FieldSet, extension: Boolean! = false, resolvable: Boolean! = true) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA

scalar DateTime
  @join__type(graph: OFFERS)

scalar join__FieldSet

enum join__Graph {
  OFFERS @join__graph(name: "offers", url: "http://offers-service.local/offer-service")
  ORDERS @join__graph(name: "orders", url: "http://orders-service.local/graphql")
}

scalar link__Import

enum link__Purpose {
  """
  `SECURITY` features provide metadata necessary to securely resolve fields.
  """
  SECURITY

  """
  `EXECUTION` features provide metadata necessary for operation execution.
  """
  EXECUTION
}

type Offer
  @join__type(graph: OFFERS)
{
  id: ID!
  title: String!
  category: String!
  created_at: DateTime!
  updated_at: DateTime!
}

type Query
  @join__type(graph: OFFERS)
  @join__type(graph: ORDERS)
{
  """List all offers."""
  getOffers: [Offer!]! @join__field(graph: OFFERS)
  me: User @join__field(graph: ORDERS)
}

type User
  @join__type(graph: ORDERS)
{
  id: ID!
  username: String
}

My entrypoint looks like:

import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone';
import gql from 'graphql-tag';
import {readFileSync} from 'fs';

const schemaString = readFileSync('./supergraph.graphql').toString()
const supergraphSdl = gql` ${schemaString} `;

const server = new ApolloServer({
    supergraphSdl
});

const { url } = await startStandaloneServer(server, {
    listen: { port: 5001 }
});
console.log(`  Server ready at ${url}`);

However when I try to run the server, it throws me an error Error: Query root type must be provided. with no additional info. Query is clearly defined there. What could be the issue?


问:
Javascript function is not clicking upon running Niether Showing any error? Google Chrome Extension
`Hey I was making a function but it seems onclick function is not working in google chrome extension and showing me the error

Basically my function is used to click all the checkboxes when I click on the button through add event listener which i read in stackoverflow here is the link of that post addEventListener calls the function without me even asking it to

After building that the thing is not working not sure what to do next

HTML CODE:

```<code>!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="body.css">
    <title>Linkedin Extension</title>
</head>
<body>
<main>
    <div class="main">
        <H1 class="h1">Select All</H1>
        <p class="p1">This is to Select all the checkboxes</p>
        <button type="button" id="select-all" >Run me</button>
    </div>

</main>
<footer class="end">Made with Love</footer>
<script src="script.js"></script>
</body>
</html>
</code>```

Javascript Code

```<code>document.addEventListener('DOMContentLoaded', function() {
    document.getElementById("select-all").addEventListener("click", selectAll);
  });

  function selectAll(){
    var inputs = document.getElementsByClassName("invitee-picker-connections-result-item__checkbox");
    for(var i=0; i<inputs.length;i++)
    {
    inputs[i].click();
    }
    }
</code>```

Let me know how this will code ran when I click on the html button

Here is the screenshot attached what it will do when it will run
enter image description here

I want to run this code in an extension when I will click the button`

Body:
`Hey I was making a function but it seems onclick function is not working in google chrome extension and showing me the error

Basically my function is used to click all the checkboxes when I click on the button through add event listener which i read in stackoverflow here is the link of that post addEventListener calls the function without me even asking it to

After building that the thing is not working not sure what to do next

HTML CODE:

!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="body.css">
    <title>Linkedin Extension</title>

Select All

This is to Select all the checkboxes

        <button type="button" id="select-all" >Run me</button>

Made with Love

Javascript Code

document.addEventListener('DOMContentLoaded', function() {
    document.getElementById("select-all").addEventListener("click", selectAll);
  });

  function selectAll(){
    var inputs = document.getElementsByClassName("invitee-picker-connections-result-item__checkbox");
    for(var i=0; i<inputs.length;i++)
    {
    inputs[i].click();
    }
    }

Let me know how this will code ran when I click on the html button

Here is the screenshot attached what it will do when it will run
enter image description here

I want to run this code in an extension when I will click the button`


问:
Heremaps Infobubble CSS does not change
so I looked up every possible solution for changing the CSS style of the infoBubble for heremaps. I work with Angular v8 and thus far only setting the css of the Data has worked for me, but that does not influence the color of the marker.

```<code>const marker = new H.map.Marker(position);
marker.setData("<div style='width: 100px'>Hello world!</div>");

marker.addEventListener("tap", event => {const b = new H.ui.InfoBubble(event.target.getPosition(), {content: event.target. getData()}); this.ui.addBubble(b);}, false);

this.map.addObject(marker);

</code>```

This css code did not work for me:

```<code>background-color: yellow;
height: 275px;
}
</code>```

Anyone know as to why it is not working?

Title: Heremaps Infobubble CSS does not change

Body:
so I looked up every possible solution for changing the CSS style of the infoBubble for heremaps. I work with Angular v8 and thus far only setting the css of the Data has worked for me, but that does not influence the color of the marker.

const marker = new H.map.Marker(position);
marker.setData("
Hello world!
");

marker.addEventListener("tap", event => {const b = new H.ui.InfoBubble(event.target.getPosition(), {content: event.target. getData()}); this.ui.addBubble(b);}, false);

this.map.addObject(marker);

This css code did not work for me:

background-color: yellow;
height: 275px;
}

Anyone know as to why it is not working?


问:
Understanding TimeSeriesDataSet in Pytorch-Forecasting
I have 913000 rows data:

data image

First, Let me explain this data

this data is sales data for 10 stores and 50 item from 2013-01-01 to 2017-12-31.

i understand why this data has 913000, by leap year.

anyway, i made my training set.

```<code>training = TimeSeriesDataSet(
    train_df[train_df.apply(lambda x:x['time_idx']<=training_cutoff,axis=1)],
    time_idx = "time_idx",
    target = "sales",
    group_ids = ["store","item"], # list of column names identifying a time series
    max_encoder_length = max_encoder_length,
    max_prediction_length = max_prediction_length,
    static_categoricals = ["store","item"],
    # Categorical variables that do nat change over time (e.g. product length)
    time_varying_unknown_reals = ["sales"],

)
</code>```

Now
First Question: i have known as the TimeSeriesDataSet has data param, reflected data minus prediction horizon by training_cutoff and minus max_encoder_length for prediction. this is right? if no please tell me truth.

Second Question: Similarly, this is output of over code
output image
Why the length is 863500

i calculate the length on my knowledge.

prediction horizon by training_cutoff - 205010 =10000

max_encoder_length for prediction - 605010 = 30000

Thus 913000-40000 = 873000.

where is 9500?

i do my best in googling. please tell me truth..

Body:
I have 913000 rows data:

data image

First, Let me explain this data

this data is sales data for 10 stores and 50 item from 2013-01-01 to 2017-12-31.

i understand why this data has 913000, by leap year.

anyway, i made my training set.

training = TimeSeriesDataSet(
    train_df[train_df.apply(lambda x:x['time_idx']<=training_cutoff,axis=1)],
    time_idx = "time_idx",
    target = "sales",
    group_ids = ["store","item"], # list of column names identifying a time series
    max_encoder_length = max_encoder_length,
    max_prediction_length = max_prediction_length,
    static_categoricals = ["store","item"],
    # Categorical variables that do nat change over time (e.g. product length)
    time_varying_unknown_reals = ["sales"],

)

Now
First Question: i have known as the TimeSeriesDataSet has data param, reflected data minus prediction horizon by training_cutoff and minus max_encoder_length for prediction. this is right? if no please tell me truth.

Second Question: Similarly, this is output of over code
output image
Why the length is 863500

i calculate the length on my knowledge.

prediction horizon by training_cutoff - 205010 =10000

max_encoder_length for prediction - 605010 = 30000

Thus 913000-40000 = 873000.

where is 9500?

i do my best in googling. please tell me truth..


问:
How to Use Node SMPP to Connect to InetLab SMPP Server
I am trying to build an SMS an SMS Client using NodeJS which should connect to ``Inetlab ```` SMPP Server to send Short messages. I downloaded <code>Inetlab </code>SMPP client and Server and run them both. When I try to connect and send an SMS from the client via port 7777 (Not that it matters), The connection is bound successfully and the message is sent across.</p>
<p>My problem is when I try connect to the same local SMPP server via a client that I have bult with NodeJS using the <code>node-smpp</code> library, the connection fails even though I am using the same localhost and port 7777.</p>
<p>Below is my connection code:</p>
```
module.exports = class{

    constructor(){
       this.session = null
       this.smppConfig = {
            url:"smpp://localhost:7777",
            auto_enquire_link_period:10000,
            debug:true
       }
    }

    StartSmppSession= ()=>{
        return new Promise( async(resolve, reject)=>{
            try{
                    console.log(this.smppConfig)
                    this.session = smpp.connect(this.smppConfig,()=>{
                        this.session.bind_transceiver({
                            system_id:process.env.SMPP_SYSTEM_ID,
                            password:process.env.SMPP_PASSWORD
                        },(pdu)=>{
                            if(pdu.command_status === 0){
                                resolve({message:"Connection bound successfully!"})
                            }else{
                                reject({message:"Failed to bind!",pdu})
                            }
                        })
                })
            }catch(err){
                //reject(err.message)
            }
        })
    }

    sendSMS = (payload)=>{
        return new Promise(async (resolve, reject)=>{
            try{
                //payload = {destination_addr:"phone_number", "short_message":"The message here"}
                this.session.submit_sm(payload, async (pdu)=>{
                    pdu.command_status === 0 ? resolve("Message successfully sent!") : reject("Failed to send SMS!")
                })
            }catch(err){
                reject(err.message)
            }
        })
    }
}

```
<p>When I invoke the <code>StartSmppSession()</code> function in my controller, I get the following error log:</p>
```2022-12-06T09:30:40.973Z - cli - 315644 - socket.error - connect ECONNREFUSED ::1:7777 - {"errno":-4078,"code":"ECONNREFUSED","syscall":"connect","address":"::1","port":7777}
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED ::1:7777
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1284:16)
Emitted 'error' event on Session instance at:
    at Socket.<anonymous> (C:\Users\c.mwale\Desktop\NRB API Test\Notifications Module\SMSGateway\src\SMS_Outgoing\node_modules\smpp\lib\smpp.js:119:8)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4078,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 7777
}

```

I understand that there is a SMPP library for .NET documented on the inetlab  website, but I am of the view this the intent of using a C# example was not to dictate the framework nor language of implementation.

Body:
I am trying to build an SMS an SMS Client using NodeJS which should connect to ``Inetlab ```` SMPP Server to send Short messages. I downloaded Inetlab SMPP client and Server and run them both. When I try to connect and send an SMS from the client via port 7777 (Not that it matters), The connection is bound successfully and the message is sent across.

My problem is when I try connect to the same local SMPP server via a client that I have bult with NodeJS using the node-smpp library, the connection fails even though I am using the same localhost and port 7777.

Below is my connection code:

module.exports = class{

    constructor(){
       this.session = null
       this.smppConfig = {
            url:"smpp://localhost:7777",
            auto_enquire_link_period:10000,
            debug:true
       }
    }

    StartSmppSession= ()=>{
        return new Promise( async(resolve, reject)=>{
            try{
                    console.log(this.smppConfig)
                    this.session = smpp.connect(this.smppConfig,()=>{
                        this.session.bind_transceiver({
                            system_id:process.env.SMPP_SYSTEM_ID,
                            password:process.env.SMPP_PASSWORD
                        },(pdu)=>{
                            if(pdu.command_status === 0){
                                resolve({message:"Connection bound successfully!"})
                            }else{
                                reject({message:"Failed to bind!",pdu})
                            }
                        })
                })
            }catch(err){
                //reject(err.message)
            }
        })
    }

    sendSMS = (payload)=>{
        return new Promise(async (resolve, reject)=>{
            try{
                //payload = {destination_addr:"phone_number", "short_message":"The message here"}
                this.session.submit_sm(payload, async (pdu)=>{
                    pdu.command_status === 0 ? resolve("Message successfully sent!") : reject("Failed to send SMS!")
                })
            }catch(err){
                reject(err.message)
            }
        })
    }
}

When I invoke the StartSmppSession() function in my controller, I get the following error log:

2022-12-06T09:30:40.973Z - cli - 315644 - socket.error - connect ECONNREFUSED ::1:7777 - {"errno":-4078,"code":"ECONNREFUSED","syscall":"connect","address":"::1","port":7777}
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED ::1:7777
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1284:16)
Emitted 'error' event on Session instance at:
    at Socket.<anonymous> (C:\Users\c.mwale\Desktop\NRB API Test\Notifications Module\SMSGateway\src\SMS_Outgoing\node_modules\smpp\lib\smpp.js:119:8)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4078,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 7777
}

I understand that there is a SMPP library for .NET documented on the inetlab  website, but I am of the view this the intent of using a C# example was not to dictate the framework nor language of implementation.


问:
PyCharm debugger can't connect to Django app inside docker
I try to debug a Django app inside Docker container, the app is launched under uWSGI. Unfortunately, PyCharm debugger can't connect to the container and stops by timeout.

My run configuration:

I've added up --build to run all containers in debug mode.

docker-compose.yml:

```<code>version: "2.4"
services:
  rabbitmq:
    image: rabbitmq:3.10.7-management-alpine
    container_name: bo-rabbitmq

  rsyslog:
    build:
      context: .
      dockerfile: docker/rsyslog/Dockerfile
    image: bo/rsyslog:latest
    container_name: bo-rsyslog
    platform: linux/amd64
    env_file:
      - .env
    volumes:
      - shared:/app/mnt

  api:
    build:
      context: .
      dockerfile: docker/api/Dockerfile
    image: bo/api:latest
    container_name: bo-api
    platform: linux/amd64
    ports:
      - "8081:8081"
      - "8082:8082"
    env_file:
      - .env
    volumes:
      - shared:/app/mnt

  apigw:
    build:
      context: .
      dockerfile: docker/apigw/Dockerfile
    image: bo/apigw:latest
    container_name: bo-apigw
    platform: linux/amd64
    ports:
      - "8080:8080"
    env_file:
      - .env
    volumes:
      - shared:/app/mnt
    depends_on:
      - api

volumes:
  shared:
</code>```

Dockerfile (for api):

```<code>FROM nexus.custom.ru/base/python27:2.7.17 # CentOS 7 with Python 2.7
# Environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /app/
ENV PATH /app/:$PATH
ENV PIP_DEFAULT_TIMEOUT=100 \
    PIP_DISABLE_PIP_VERSION_CHECK=1 \
    PIP_NO_CACHE_DIR=1
# Install required software
RUN yum -y install enchant
# Working directory
WORKDIR /app
# Install and configure Poetry
RUN pip install --no-cache-dir poetry \
    && poetry config virtualenvs.create false
# Install project dependencies
COPY pyproject.toml .
COPY poetry.lock .
RUN poetry install --no-root --no-interaction
# Copy project files
COPY . .
COPY docker/api/manage.py ./
COPY docker/api/settings.py ./apps/adm/
COPY docker/api/config.py ./apps/adm/
COPY docker/api/config/development.yml ./config/
COPY docker/api/config/uwsgi/uwsgi.yml ./config/uwsgi/
COPY docker/api/entrypoint.sh ./
# Allow execution
RUN chmod +x /app/entrypoint.sh
# Entrypoint
ENTRYPOINT /app/entrypoint.sh
</code>```

entrypoint.sh:

```<code>#!/bin/sh
# Create required directories
mkdir -p /app/mnt/spooler
mkdir -p /app/mnt/logs
mkdir -p /app/mnt/run
mkdir -p /app/mnt/shared/static
mkdir -p /app/mnt/protected_media
mkdir -p /app/mnt/htdocs
# Copy static
cp -r -n /app/static /app/mnt/shared/static
# Run uWSGI
uwsgi --yml=/app/config/uwsgi/uwsgi.yml
</code>```

uwsgi.yml:

```<code>uwsgi:
  chdir: /app
  master: true
  procname-master: b::master
  procname: b::worker
  processes: 2
  threads: 4
  listen: 128
  max-requests: 1024
  buffer-size: 16384
  reload-on-exception: false
  master-fifo: /app/mnt/run/running.fifo
  vacuum: false
  lazy-apps: true
  enable-threads: true
  pythonpath: /app

  http: :8081
  env: DJANGO_SETTINGS_MODULE=apps.adm.settings
  module: apps.adm.wsgi

  stats: :8082
  stats-http: true
  memory-report: 1

  disable-logging: 0
  log-5xx: true
  log-4xx: true
  log-slow: 500
</code>```

What am I doing wrongly? Is it possible to connect PyCharm to Django app with uWSGI inside docker?

Body:
I try to debug a Django app inside Docker container, the app is launched under uWSGI. Unfortunately, PyCharm debugger can't connect to the container and stops by timeout.

My run configuration:

I've added up --build to run all containers in debug mode.

docker-compose.yml:

version: "2.4"
services:
  rabbitmq:
    image: rabbitmq:3.10.7-management-alpine
    container_name: bo-rabbitmq

  rsyslog:
    build:
      context: .
      dockerfile: docker/rsyslog/Dockerfile
    image: bo/rsyslog:latest
    container_name: bo-rsyslog
    platform: linux/amd64
    env_file:
      - .env
    volumes:
      - shared:/app/mnt

  api:
    build:
      context: .
      dockerfile: docker/api/Dockerfile
    image: bo/api:latest
    container_name: bo-api
    platform: linux/amd64
    ports:
      - "8081:8081"
      - "8082:8082"
    env_file:
      - .env
    volumes:
      - shared:/app/mnt

  apigw:
    build:
      context: .
      dockerfile: docker/apigw/Dockerfile
    image: bo/apigw:latest
    container_name: bo-apigw
    platform: linux/amd64
    ports:
      - "8080:8080"
    env_file:
      - .env
    volumes:
      - shared:/app/mnt
    depends_on:
      - api

volumes:
  shared:

Dockerfile (for api):

FROM nexus.custom.ru/base/python27:2.7.17 # CentOS 7 with Python 2.7
# Environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /app/
ENV PATH /app/:$PATH
ENV PIP_DEFAULT_TIMEOUT=100 \
    PIP_DISABLE_PIP_VERSION_CHECK=1 \
    PIP_NO_CACHE_DIR=1
# Install required software
RUN yum -y install enchant
# Working directory
WORKDIR /app
# Install and configure Poetry
RUN pip install --no-cache-dir poetry \
    && poetry config virtualenvs.create false
# Install project dependencies
COPY pyproject.toml .
COPY poetry.lock .
RUN poetry install --no-root --no-interaction
# Copy project files
COPY . .
COPY docker/api/manage.py ./
COPY docker/api/settings.py ./apps/adm/
COPY docker/api/config.py ./apps/adm/
COPY docker/api/config/development.yml ./config/
COPY docker/api/config/uwsgi/uwsgi.yml ./config/uwsgi/
COPY docker/api/entrypoint.sh ./
# Allow execution
RUN chmod +x /app/entrypoint.sh
# Entrypoint
ENTRYPOINT /app/entrypoint.sh

entrypoint.sh:

#!/bin/sh
# Create required directories
mkdir -p /app/mnt/spooler
mkdir -p /app/mnt/logs
mkdir -p /app/mnt/run
mkdir -p /app/mnt/shared/static
mkdir -p /app/mnt/protected_media
mkdir -p /app/mnt/htdocs
# Copy static
cp -r -n /app/static /app/mnt/shared/static
# Run uWSGI
uwsgi --yml=/app/config/uwsgi/uwsgi.yml

uwsgi.yml:

uwsgi:
  chdir: /app
  master: true
  procname-master: b::master
  procname: b::worker
  processes: 2
  threads: 4
  listen: 128
  max-requests: 1024
  buffer-size: 16384
  reload-on-exception: false
  master-fifo: /app/mnt/run/running.fifo
  vacuum: false
  lazy-apps: true
  enable-threads: true
  pythonpath: /app

  http: :8081
  env: DJANGO_SETTINGS_MODULE=apps.adm.settings
  module: apps.adm.wsgi

  stats: :8082
  stats-http: true
  memory-report: 1

  disable-logging: 0
  log-5xx: true
  log-4xx: true
  log-slow: 500

What am I doing wrongly? Is it possible to connect PyCharm to Django app with uWSGI inside docker?


问:
Having multiple plots with the same legend without storing the plots
I'm new to matplotlib and I am making a graph that is meant to show two sets of runs in a simulation, each set of runs have 20 lines to be plotted. I want each set of lines to have one label shared by them but I can't find anything on how to do that.

```<code>df = pandas.read_csv(url)

parameq1 = np.array_split(df.loc[(df['param'] == 1) & (df['metric'] == 'noise')],20)
parameq2 = np.array_split(df.loc[(df['param'] == 2) & (df['metric'] == 'noise')],20)

time = np.arange(100) + 5000

fig, axes = plt.subplots()
for i in range(20):
    line = plt.plot(time,parameq1[i]['value'],color='lightgreen',alpha=0.7,label="param=1")

for i in range(20):
    plt.plot(time,parameq2[i]['value'],color='orange',alpha=0.6,label='param=2')

plt.show()
</code>```

But here it shows 20 different legends rather than just one, surely there is an easy way to have the same legends for multiple plots?

Body:
I'm new to matplotlib and I am making a graph that is meant to show two sets of runs in a simulation, each set of runs have 20 lines to be plotted. I want each set of lines to have one label shared by them but I can't find anything on how to do that.

df = pandas.read_csv(url)

parameq1 = np.array_split(df.loc[(df['param'] == 1) & (df['metric'] == 'noise')],20)
parameq2 = np.array_split(df.loc[(df['param'] == 2) & (df['metric'] == 'noise')],20)

time = np.arange(100) + 5000

fig, axes = plt.subplots()
for i in range(20):
    line = plt.plot(time,parameq1[i]['value'],color='lightgreen',alpha=0.7,label="param=1")

for i in range(20):
    plt.plot(time,parameq2[i]['value'],color='orange',alpha=0.6,label='param=2')

plt.show()

But here it shows 20 different legends rather than just one, surely there is an easy way to have the same legends for multiple plots?


问:
How to make permission levels on Php Maker 2022
I want to make permission levels. Administrator give permission as Manager with Add permission level but not edit or delete and view only what he made. Then Manager can make separate levels to his crew but that must have only below permissions than manager.

But when I try to make a user as a manager level, it asks what permissions are giving. When I add all, That user get Administrator level permission. I used User ID Level to get what Manager Create.

On the Other hand as a manager level When I load select box with permission levels it shows Administrator. That mean Manager can make Administrator.

I want to Do
Administrator(give Privilege to make user) -> Manager(can make permissions for users) -> users(must have lower than manager level)

Please help me...

I used User Id Level, Advance Security Option, Dynamic Table Security. In Phpmaker 2022


问:
Error 502 Bad Gateway nginx executing request long time response
Executed request long time response arround 20 minutes , but it's return an error</p>


问:
image to text using pytesseract-OCR
```<code>import cv2
import pytesseract

pytesseract.pytesseract.tesseract_cmd
="C:\\Users\\Python_Scripts\\Image_processing\\Tesseract-OCR\\tesseract.exe"
# Grayscale, Gaussian blur, Otsu's threshold
image = cv2.imread('2.png')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (3, 3), 0)
thresh = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]

# Morph open to remove noise and invert image
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
opening = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel, iterations=1)
invert = 255 - opening

# Perform text extraction
data = pytesseract.image_to_string(invert, lang='eng', config='--psm 6')
print(data)

cv2.imshow('thresh', thresh)
cv2.imshow('opening', opening)
cv2.imshow('invert', invert)
cv2.waitKey()
</code>```

Output of the above code below:

```<code>= ***V-Tach
01-12-2022 16:1206
a **Nonsus V-Tach
@ a 01-12-2022 16:1038
|| ***Acystole
@ 01-12-2022 16:10:17
ann
01-12-2022 16:10:14
WB at rytio
ee 01-12-2022 16:09:67
a A-Fib
@ __ 01-12-2022 16:09:40
BB teniy
apna TTC TET
a Couplet
01-12-2022 16:07:03
a ““Bigeminy
</code>```

As you can see there are wrong text detection and outliers! I want to get the time and the name below it correctly!! It got first two line correctly, even though it should be Asystole not Acystole (I can accept this kind of minor error)! But in line 7 you can see it's totally misinterpret the name there! Same in line 9!

Title: image to text using pytesseract-OCR

Body:
import cv2
import pytesseract

pytesseract.pytesseract.tesseract_cmd
="C:\\Users\\Python_Scripts\\Image_processing\\Tesseract-OCR\\tesseract.exe"
# Grayscale, Gaussian blur, Otsu's threshold
image = cv2.imread('2.png')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (3, 3), 0)
thresh = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]

# Morph open to remove noise and invert image
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
opening = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel, iterations=1)
invert = 255 - opening

# Perform text extraction
data = pytesseract.image_to_string(invert, lang='eng', config='--psm 6')
print(data)

cv2.imshow('thresh', thresh)
cv2.imshow('opening', opening)
cv2.imshow('invert', invert)
cv2.waitKey()

Output of the above code below:

= ***V-Tach
01-12-2022 16:1206
a **Nonsus V-Tach
@ a 01-12-2022 16:1038
|| ***Acystole
@ 01-12-2022 16:10:17
ann
01-12-2022 16:10:14
WB at rytio
ee 01-12-2022 16:09:67
a A-Fib
@ __ 01-12-2022 16:09:40
BB teniy
apna TTC TET
a Couplet
01-12-2022 16:07:03
a ““Bigeminy

As you can see there are wrong text detection and outliers! I want to get the time and the name below it correctly!! It got first two line correctly, even though it should be Asystole not Acystole (I can accept this kind of minor error)! But in line 7 you can see it's totally misinterpret the name there! Same in line 9!


问:
making threads by timer for Qnx
In my programm I tried to create timer which made thread. But my code is not working.
I can't find out my mistake.

```<code>#include <cstdlib>
#include <iostream>
#include <sys/neutrino.h>
#include <sys/netmgr.h>
#include <errno.h>

// thread
void thread(sigval)
{
  std::cout << "Thread: I am here!" << std::endl;
}

// timer
void timer(void)
{

  timer_t timerid;
  struct sigevent event;
  struct itimerspec timer;
  pthread_attr_t attr;
  int value = 0;

  SIGEV_THREAD_INIT(&event, thread, value, &attr);

  if ((timer_create(CLOCK_REALTIME, &event, &timerid)) == -1)
    {
    std::cout <<  errno << "  " << sys_errlist[errno] << std::endl;
    }

  timer.it_value.tv_sec = 1;
  timer.it_value.tv_nsec = 0;
  timer.it_interval.tv_sec = 0; // если 0 - однократный таймер
  timer.it_interval.tv_nsec = 0;

  timer_settime(timerid, 0, &timer, NULL);
}

int main(int argc, char *argv[])
{
   timer();
}
</code>```

I expecting that timer will create a thread and string "Thread: I am here!" will appear in console.
But there is nothing.

Title: making threads by timer for Qnx

Body:
In my programm I tried to create timer which made thread. But my code is not working.
I can't find out my mistake.

#include <cstdlib>
#include <iostream>
#include <sys/neutrino.h>
#include <sys/netmgr.h>
#include <errno.h>

// thread
void thread(sigval)
{
  std::cout << "Thread: I am here!" << std::endl;
}

// timer
void timer(void)
{

  timer_t timerid;
  struct sigevent event;
  struct itimerspec timer;
  pthread_attr_t attr;
  int value = 0;

  SIGEV_THREAD_INIT(&event, thread, value, &attr);

  if ((timer_create(CLOCK_REALTIME, &event, &timerid)) == -1)
    {
    std::cout <<  errno << "  " << sys_errlist[errno] << std::endl;
    }

  timer.it_value.tv_sec = 1;
  timer.it_value.tv_nsec = 0;
  timer.it_interval.tv_sec = 0; // если 0 - однократный таймер
  timer.it_interval.tv_nsec = 0;

  timer_settime(timerid, 0, &timer, NULL);
}

int main(int argc, char *argv[])
{
   timer();
}

I expecting that timer will create a thread and string "Thread: I am here!" will appear in console.
But there is nothing.


问:
Dataflow really slow, wordcount can't process over 2k msg/second
Im trying to benchmark some stream processing engines, flink, spark, etc for research purposes.

Description

On GKE i can deploy Kafka/Flink with about 1 vcpu and 1GB mem for all pod instances a can process comfortably about 50k messages/second per instance.

In Dataflow with 2vcpus and 7.5GB mem per instance, im getting about 2k messages/second per instance..

Context

Im using as generic jobs as possible, wordcount in particular. In the Dataflow pipeline I even migrated to PubSub instead of Kafka bc i was considering that to be a potential issue.

The workload going into PubSub is about 70k messages/second. The data is lines of text from huckleberry fin, probably <1mb per msg.

Question

I cant seem to find any reasonable explanations or information as to why the performance is so different between these systems. Can anyone here help me?

What for instance would be the expected performance for the generic wordcount example reading from pubsub ?

I can post code on request


问:
how can I convert wikipedia dump to plaintext efficiently
this is my first post here on stack exchange. I need to do some language analysis on wikipedia, so i downloaded one of their database dumps, in particular the italian wikipedia dump.

I need to extract the page data to plain text, i don't care about any tables or formatting or similar things, actually i would very much prefer to exclude those.

I tried some stuff, like using a couple programs i found on github and then i tried writing my own c++ program to extract the wikitext from the xml and then pass the wikitext to pandoc but all the solutions either didn't work, they gave too many tranlsation errors or they were simply too slow to convert multiple gigabites of text.
I could not find better solutions here on stack exchange and the parsers suggested on Mediawiki either don't completely support the wikipedia formats or don't offer plain text output.


问:
Integration tests are working fine on eclipse when ran as junit test but throwing exception on server while gradle build
Integration tests are working fine on eclipse when ran as junit test but throwing exception on server while gradle build.

The Error is coming in all the test cases written,  while all of them are successfully passing in eclipse. The error is as shown below.

```<code>ModelCatalogControllerIntegrationTest > addTemplateTypeOptions() FAILED
    java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
        Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1804
            Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
                Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100

</code>```

Integration tests are working fine on eclipse when ran as junit test but throwing exception on server while gradle build.

UPDATE: now the test cases are running fine and building successfully on the VM using ./gradlew clean build command But throwing the same above mentioned error for all the test cases while building via Jenkins Pipeline.

ModelCatalogControllerIntegrationTest > getMaturityOptions() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1804
Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100

ModelCatalogControllerIntegrationTest > updateTemplateDetails() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1804
Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100
<==========---> 78% EXECUTING [3m 27s]

IDLE
:test > 15 tests completed, 15 failed

Body:
Integration tests are working fine on eclipse when ran as junit test but throwing exception on server while gradle build.

The Error is coming in all the test cases written,  while all of them are successfully passing in eclipse. The error is as shown below.

ModelCatalogControllerIntegrationTest > addTemplateTypeOptions() FAILED
    java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
        Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1804
            Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
                Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100

Integration tests are working fine on eclipse when ran as junit test but throwing exception on server while gradle build.

UPDATE: now the test cases are running fine and building successfully on the VM using ./gradlew clean build command But throwing the same above mentioned error for all the test cases while building via Jenkins Pipeline.

ModelCatalogControllerIntegrationTest > getMaturityOptions() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1804
Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100

ModelCatalogControllerIntegrationTest > updateTemplateDetails() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1804
Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100
<==========---> 78% EXECUTING [3m 27s]

IDLE
:test > 15 tests completed, 15 failed


问:
Styling Checked state in QListWidget?
In my QListWidget, if i try to add a StyleSheet for the indicator, it appears twice. Like in the image, there is a default checked element and the custom element which cuts the text of the items.

My desired output is to remove the add style to the default checkbox in the listitem or to remove it.

```<code># For every item in the client list widget
for i in range(self.clientListWidget.count()):
    item = self.clientListWidget.item(i)
    # Use the checkbox flag to differentiate between active and inactive clients with a tick mark
    if con.isActiveClient(item.text()):
        item.setCheckState(Qt.Checked)
    else:
        item.setCheckState(Qt.Unchecked)
</code>```

And in the StyleSheet :

```<code>OPTION_CLIENT_MAIN = (
                      "QListWidget"
                      "{"
                      f"border : 3px solid {Palette.PRIMARY_COLOR.value};"
                      f" color : {Palette.SECONDARY_COLOR.value};\n"
                      "  border-radius : 15%;"
                      "outline : 0px;"
                      "padding : 5px;"
                      "}"
                      "QListView::item"
                      "{"
                      "padding : 15px;"
                      "outline : 0px;"
                      "}"
                      "QListView::item:selected"
                      "{"
                      f"border : 3px dashed {Palette.SECONDARY_COLOR.value};"
                      f"background : {Palette.PRIMARY_COLOR.value};"
                      "  border-radius : 15%;"
                      f"color : {Palette.COMMON_COLOR_W.value};"
                      "}"
                      "QListView::item:hover"
                      "{"
                      f"background : {Palette.PRIMARY_COLOR.value};"
                      f"color : {Palette.COMMON_COLOR_W.value};"
                      "}"
                      "QListView::indicator:checked\n"
                      "{\n"
                      f" background-color : {Palette.COMMON_COLOR_G.value};\n"
                      "}\n"
                      "QListView::indicator:unchecked\n"
                      "{\n"
                      f" background-color : {Palette.COMMON_COLOR_R.value};\n"
                      "}\n"
                      )
</code>```

Title: Styling Checked state in QListWidget?

Body:
In my QListWidget, if i try to add a StyleSheet for the indicator, it appears twice. Like in the image, there is a default checked element and the custom element which cuts the text of the items.

My desired output is to remove the add style to the default checkbox in the listitem or to remove it.

# For every item in the client list widget
for i in range(self.clientListWidget.count()):
    item = self.clientListWidget.item(i)
    # Use the checkbox flag to differentiate between active and inactive clients with a tick mark
    if con.isActiveClient(item.text()):
        item.setCheckState(Qt.Checked)
    else:
        item.setCheckState(Qt.Unchecked)

And in the StyleSheet :

OPTION_CLIENT_MAIN = (
                      "QListWidget"
                      "{"
                      f"border : 3px solid {Palette.PRIMARY_COLOR.value};"
                      f" color : {Palette.SECONDARY_COLOR.value};\n"
                      "  border-radius : 15%;"
                      "outline : 0px;"
                      "padding : 5px;"
                      "}"
                      "QListView::item"
                      "{"
                      "padding : 15px;"
                      "outline : 0px;"
                      "}"
                      "QListView::item:selected"
                      "{"
                      f"border : 3px dashed {Palette.SECONDARY_COLOR.value};"
                      f"background : {Palette.PRIMARY_COLOR.value};"
                      "  border-radius : 15%;"
                      f"color : {Palette.COMMON_COLOR_W.value};"
                      "}"
                      "QListView::item:hover"
                      "{"
                      f"background : {Palette.PRIMARY_COLOR.value};"
                      f"color : {Palette.COMMON_COLOR_W.value};"
                      "}"
                      "QListView::indicator:checked\n"
                      "{\n"
                      f" background-color : {Palette.COMMON_COLOR_G.value};\n"
                      "}\n"
                      "QListView::indicator:unchecked\n"
                      "{\n"
                      f" background-color : {Palette.COMMON_COLOR_R.value};\n"
                      "}\n"
                      )


问:
STM32: Is it possible to change the name of the project based on the firmware I load, so that the project takes the name of the loaded firmware
I have a project that contains two firmwares and based on a define I load one firmware or another on the prototype.
My question is this: is it possible to change the name of the project based on the firmware I load, so that the project takes the name of the loaded firmware. If this is possible, what is the way to set up CubeIDE to do it


问:
Is there any missing code to get the output?
I'm developing a python's mini project using random module. I also added tkinter as GUI.

So, the script is The task is to create a script that generates a random number between a fixed range, and if the
user guesses the number right in three chances, then user wins otherwise user lose.
This game user can play as many numbers of times and whenever user wins a score is to be given
to the user.

```<code>global ranNum global chance usr_ip = var.get() if chance > 0:
    if usr_ip == ranNum:
       msg = f'CONRATULATIONS!.'
    elif usr_ip > ranNum: chance -= 1
       msg = f'{usr_ip} too high. You have {chance} attempt left.' elif usr_ip < ranNum:
           chance -= 1
       msg = f'{usr_ip} too small. You have {chance} attempt left.' else:
          msg = 'Something went wrong!'
    else:
          msg = f'BETTER LUCK NEXT TIME!!
</code>```

I tried this code but could not get the output.

Body:
I'm developing a python's mini project using random module. I also added tkinter as GUI.

So, the script is The task is to create a script that generates a random number between a fixed range, and if the
user guesses the number right in three chances, then user wins otherwise user lose.
This game user can play as many numbers of times and whenever user wins a score is to be given
to the user.

global ranNum global chance usr_ip = var.get() if chance > 0:
    if usr_ip == ranNum:
       msg = f'CONRATULATIONS!.'
    elif usr_ip > ranNum: chance -= 1
       msg = f'{usr_ip} too high. You have {chance} attempt left.' elif usr_ip < ranNum:
           chance -= 1
       msg = f'{usr_ip} too small. You have {chance} attempt left.' else:
          msg = 'Something went wrong!'
    else:
          msg = f'BETTER LUCK NEXT TIME!!

I tried this code but could not get the output.


问:
Trigger event when user highlights text
I'm trying to figure out a problem that I recently saw on an e-shop website.

When a user highlights the name of a product, it pops up a little window asking about customer satisfaction and s on, like this:

Is there a way to use a pseudo class line :active or :focus to enable this?

Or is there perhaps a custom solution using javascript event listener?

Title: Trigger event when user highlights text


问:
How to change background on Pycharm (Mac)?
I am facing an issue when running my code on Pycharm 2022.2.2 (Community edition) on my Mac. When running the code, the window that opens (using Tkinter) and has a black background so I can't see any of my text boxes etc. only the buttons. Even though I have set the background to Blue and the text boxes to white. When running this on Windows it works perfectly fine, is there a setting that I need to change on my Mac to fix this issue?

I have changed the background to blue (#0DF7F7) and my text boxes are white (#FFFFFF) and work perfectly fine on Windows but not on Mac.

No matter how I change the background colour it still seems to load a black background.

My python interpreter is Python 3.9 with 3 packages: pip 21.3.1, setuptools 60.2.0 and wheel 0.37.1.

```<code>from tkinter import *
import sqlite3

root = Tk()
root.assignment("Assignment - Customer Login Page")
root.geometry("1100x600")
root.configure(bg="#0DF7F7")
</code>```
```<code># create text boxes
id = Entry(root, width=40, fg="#FFFFFF")
id.grid(row=1, column=1, padx=20)
name = Entry(root, width=40, fg="#FFFFFF")
name.grid(row=2, column=1, padx=20)
email = Entry(root, width=40, fg="#FFFFFF")
email.grid(row=3, column=1, padx=20)
password = Entry(root, width=40, fg="#FFFFFF")
password.grid(row=4, column=1, padx=20)
</code>```

Body:
I am facing an issue when running my code on Pycharm 2022.2.2 (Community edition) on my Mac. When running the code, the window that opens (using Tkinter) and has a black background so I can't see any of my text boxes etc. only the buttons. Even though I have set the background to Blue and the text boxes to white. When running this on Windows it works perfectly fine, is there a setting that I need to change on my Mac to fix this issue?

I have changed the background to blue (#0DF7F7) and my text boxes are white (#FFFFFF) and work perfectly fine on Windows but not on Mac.

No matter how I change the background colour it still seems to load a black background.

My python interpreter is Python 3.9 with 3 packages: pip 21.3.1, setuptools 60.2.0 and wheel 0.37.1.

from tkinter import *
import sqlite3

root = Tk()
root.assignment("Assignment - Customer Login Page")
root.geometry("1100x600")
root.configure(bg="#0DF7F7")

# create text boxes
id = Entry(root, width=40, fg="#FFFFFF")
id.grid(row=1, column=1, padx=20)
name = Entry(root, width=40, fg="#FFFFFF")
name.grid(row=2, column=1, padx=20)
email = Entry(root, width=40, fg="#FFFFFF")
email.grid(row=3, column=1, padx=20)
password = Entry(root, width=40, fg="#FFFFFF")
password.grid(row=4, column=1, padx=20)


问:
Mockito cannot mock/spy because of final class in Kotlin
I am trying to mock my Viewmodel class in the Android test. When I try to run the test cases with the MockitoException error.

This is the Test class:

```<code>class LoginFragmentTest : BaseAndroidHiltTest(){
    @Mock
    lateinit var loginViewModel: LoginViewModel

    @Test
    fun testMock(){
        launchFragmentInHiltContainer<LoginFragment>()
        loginViewModel.primaryDeviceValue.set("Primary device")
    }
}
</code>```

And these are the gradle dependencies used:

```<code>testImplementation "org.mockito:mockito-core:$mockito_version"
testImplementation "org.mockito:mockito-inline:$mockito_version"
androidTestImplementation "org.mockito:mockito-android:$mockito_version"
</code>```

Tried a lot solutions for this. It still isn't working. Please let me know how to mock the viewmodel class?

Body:
I am trying to mock my Viewmodel class in the Android test. When I try to run the test cases with the MockitoException error.

This is the Test class:

class LoginFragmentTest : BaseAndroidHiltTest(){
    @Mock
    lateinit var loginViewModel: LoginViewModel

    @Test
    fun testMock(){
        launchFragmentInHiltContainer<LoginFragment>()
        loginViewModel.primaryDeviceValue.set("Primary device")
    }
}

And these are the gradle dependencies used:

testImplementation "org.mockito:mockito-core:$mockito_version"
testImplementation "org.mockito:mockito-inline:$mockito_version"
androidTestImplementation "org.mockito:mockito-android:$mockito_version"

Tried a lot solutions for this. It still isn't working. Please let me know how to mock the viewmodel class?


问:
Using ggplot to create different line types depending on point type
I am attempting to use ggplot to create a timeline describing the process of submitting ethics applications - each point is a date and has an associated "order" (an integer which corresponds to what the event type is, i.e. application submission, application acceptance etc). I've succeeded so far in creating the plot with points that are color- and shape-coded to correspond to the event type, and now I am attempting to create solid lines between the circle points (demonstrating work done) and dashed lines from the last circle to the triangle for each Institution. I've tried using geom_path, geom_line and geom_point line so far, and this is the closest I've gotten:

```<code>timeline<-ethics %>%
  ggplot(aes(x=Date,y=Institution,color=type,shape=ord_fin)) +
  geom_point(size=3,show.legend=TRUE) +
  labs(y="") +
  scale_shape_discrete(solid=T) +
  scale_color_manual(values = c("Submit to Sponsor" = "pink",
                                "Submission"="red",
                                "Amendment"="orange",
                                "Approval"="green")) +
  scale_x_date(date_breaks = "1 week", date_minor_breaks = "1 week",
               date_labels = "%d/%m/%y") +
  geom_path(aes(group=Institution,color="grey"))+
  theme_bw() +
  labs(color="Event",shape="Actual/Target") +
  theme(axis.text.x = element_text(angle=90))
</code>```

This is close to what I need, except that I'd like the line to be solid between circle points and dashed between circle and triangle points.

Any ideas? Thanks!

enter image description here

I tried using geom_line, geom_path and geom_pointline, and have gotten the closest with geom_path and grouping by Institution.

Body:
I am attempting to use ggplot to create a timeline describing the process of submitting ethics applications - each point is a date and has an associated "order" (an integer which corresponds to what the event type is, i.e. application submission, application acceptance etc). I've succeeded so far in creating the plot with points that are color- and shape-coded to correspond to the event type, and now I am attempting to create solid lines between the circle points (demonstrating work done) and dashed lines from the last circle to the triangle for each Institution. I've tried using geom_path, geom_line and geom_point line so far, and this is the closest I've gotten:

timeline<-ethics %>%
  ggplot(aes(x=Date,y=Institution,color=type,shape=ord_fin)) +
  geom_point(size=3,show.legend=TRUE) +
  labs(y="") +
  scale_shape_discrete(solid=T) +
  scale_color_manual(values = c("Submit to Sponsor" = "pink",
                                "Submission"="red",
                                "Amendment"="orange",
                                "Approval"="green")) +
  scale_x_date(date_breaks = "1 week", date_minor_breaks = "1 week",
               date_labels = "%d/%m/%y") +
  geom_path(aes(group=Institution,color="grey"))+
  theme_bw() +
  labs(color="Event",shape="Actual/Target") +
  theme(axis.text.x = element_text(angle=90))

This is close to what I need, except that I'd like the line to be solid between circle points and dashed between circle and triangle points.

Any ideas? Thanks!

enter image description here

I tried using geom_line, geom_path and geom_pointline, and have gotten the closest with geom_path and grouping by Institution.


问:
XML file rendering as plain text over the aws websphere deployment while accessing over edge and chrome?
We are dealing with an issue where our JSP triggers out the XML file which further creates the html file over that jsp, but while accessing these aws deployed jsp's using chrome or edge web browsers we are getting that html rendered web page as plain text, apart from that it seems to be working fine on internet explorer8 and 11. The server which we are using to host our application is IBM WebSphere. More to that this is making the whole page filled with plain html code on the whole screen.

We are thinking to have some meta tags like

```<code>X-UA-Compatible tag
</code>```

more to that have been described below, as it maybe issue with the browser technology
https://stackoverflow.com/questions/6771258/what-does-meta-http-equiv-x-ua-compatible-content-ie-edge-do#:~:text=The%20X-UA-Compatible%20meta%20tag%20allows%20web%20authors%20to,honors%20the%20X-UA-Compatible%20meta%20tag%20in%20certain%20circumstances.

Body:
We are dealing with an issue where our JSP triggers out the XML file which further creates the html file over that jsp, but while accessing these aws deployed jsp's using chrome or edge web browsers we are getting that html rendered web page as plain text, apart from that it seems to be working fine on internet explorer8 and 11. The server which we are using to host our application is IBM WebSphere. More to that this is making the whole page filled with plain html code on the whole screen.

We are thinking to have some meta tags like

X-UA-Compatible tag

more to that have been described below, as it maybe issue with the browser technology
https://stackoverflow.com/questions/6771258/what-does-meta-http-equiv-x-ua-compatible-content-ie-edge-do#:~:text=The%20X-UA-Compatible%20meta%20tag%20allows%20web%20authors%20to,honors%20the%20X-UA-Compatible%20meta%20tag%20in%20certain%20circumstances.


问:
MySQL in Node.js returning incorrect values
I'm trying to write a bot for Discord which I host with Node.js. When I try to get a user id from a database by searching for the person's name I do get a result, however the id is always a bit off. For example the code

sql.query('SELECT userID FROM users WHERE name="Max"', function(error, result, fields){
    console.log(result);
});
```

returns
[ RowDataPacket { userID: 434776574123048960 } ]
while the actual userID should be 434776574123048990.

I've also tried other users and found that the difference between the returned and the actual value does vary between the different users but is consistent for each user.
Inputting the SQL code directly into the mysql application does return the correct values.

Edit: Apparently js integers are a bit inaccurate after a certain length. Changing the userID type to varchar solved the issue.

Body:
I'm trying to write a bot for Discord which I host with Node.js. When I try to get a user id from a database by searching for the person's name I do get a result, however the id is always a bit off. For example the code

sql.query('SELECT userID FROM users WHERE name="Max"', function(error, result, fields){
    console.log(result);
});

returns
[ RowDataPacket { userID: 434776574123048960 } ]
while the actual userID should be 434776574123048990.

I've also tried other users and found that the difference between the returned and the actual value does vary between the different users but is consistent for each user.
Inputting the SQL code directly into the mysql application does return the correct values.

Edit: Apparently js integers are a bit inaccurate after a certain length. Changing the userID type to varchar solved the issue.


问:
Bootstrap variables don't work in storybook
I am trying to install a storybook for my Next application. The installation of Next-Image, font-awsome and the bootstrap itself was successful. However, I encountered another problem. For some reason storybook is not loading my scss variables which overwrite the default ones from bootstrap. By in storybook I have the default bootstrap colors. I tried installing post-css, importing my theme into preview.js file however, these did not work. Storybook either throws node_module error or just any kind of installation has no effect. How can I remedy this?

preview.js

```<code>import 'bootstrap/dist/css/bootstrap.css';
import { MockedProvider } from '@apollo/client/testing';
import { RouterContext } from 'next/dist/shared/lib/router-context';

import * as NextImage from 'next/image';

const OriginalNextImage = NextImage.default;

Object.defineProperty(NextImage, 'default', {
    configurable: true,
    value: (props) => (
        <OriginalNextImage
            {...props}
            unoptimized
        />
    ),
});

export const parameters = {
    apolloClient: {
        MockedProvider,
    },
    nextRouter: {
        Provider: RouterContext.Provider,
    },
};

</code>```

main.js

```<code>const path = require('path');

module.exports = {
    stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
    addons: [
        '@storybook/addon-links',
        '@storybook/addon-essentials',
        '@storybook/addon-interactions',
        'storybook-addon-apollo-client',
        '@tomfreudenberg/next-auth-mock/storybook',
        'storybook-addon-next-router',
        {
            name: '@storybook/preset-scss',
            options: {
                cssLoaderOptions: {
                    modules: true,
                    localIdentName: '[name]__[local]--[hash:base64:5]',
                },
            },
        },
    ],
    framework: '@storybook/react',
    core: {
        builder: '@storybook/builder-webpack5',
    },
    webpackFinal: async (config, { configType }) => {
        config.module.rules.map((rule) => {
            if (rule.oneOf) {
                rule.oneOf = rule.oneOf.slice().map((subRule) => {
                    if (subRule.test instanceof RegExp && subRule.test.test('.scss')) {
                        return {
                            ...subRule,
                            use: [
                                ...subRule.use,
                                {
                                    loader: require.resolve('sass-resources-loader'),
                                    options: {
                                        resources: [path.resolve(__dirname, '../styles/theme/_variables.scss')],
                                    },
                                },
                            ],
                        };
                    }
                    return subRule;
                });
            }
            return rule;
        });
        return config;
    },
};
</code>```

preview-head.html

```<code><link rel=‘stylesheet’ href=‘https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css’ />
<script
    src="https://kit.fontawesome.com/d8b6fab10d.js"
    crossorigin="anonymous"
></script>
<script>
    import 'bootstrap/dist/css/bootstrap.css';
</script>

</code>```

My root style folder

The bootstrap itself works fine the problem is with custom css varibles. My varibles file is in the theme folder.

Body:
I am trying to install a storybook for my Next application. The installation of Next-Image, font-awsome and the bootstrap itself was successful. However, I encountered another problem. For some reason storybook is not loading my scss variables which overwrite the default ones from bootstrap. By in storybook I have the default bootstrap colors. I tried installing post-css, importing my theme into preview.js file however, these did not work. Storybook either throws node_module error or just any kind of installation has no effect. How can I remedy this?

preview.js

import 'bootstrap/dist/css/bootstrap.css';
import { MockedProvider } from '@apollo/client/testing';
import { RouterContext } from 'next/dist/shared/lib/router-context';

import * as NextImage from 'next/image';

const OriginalNextImage = NextImage.default;

Object.defineProperty(NextImage, 'default', {
    configurable: true,
    value: (props) => (
        <OriginalNextImage
            {...props}
            unoptimized
        />
    ),
});

export const parameters = {
    apolloClient: {
        MockedProvider,
    },
    nextRouter: {
        Provider: RouterContext.Provider,
    },
};

main.js

const path = require('path');

module.exports = {
    stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
    addons: [
        '@storybook/addon-links',
        '@storybook/addon-essentials',
        '@storybook/addon-interactions',
        'storybook-addon-apollo-client',
        '@tomfreudenberg/next-auth-mock/storybook',
        'storybook-addon-next-router',
        {
            name: '@storybook/preset-scss',
            options: {
                cssLoaderOptions: {
                    modules: true,
                    localIdentName: '[name]__[local]--[hash:base64:5]',
                },
            },
        },
    ],
    framework: '@storybook/react',
    core: {
        builder: '@storybook/builder-webpack5',
    },
    webpackFinal: async (config, { configType }) => {
        config.module.rules.map((rule) => {
            if (rule.oneOf) {
                rule.oneOf = rule.oneOf.slice().map((subRule) => {
                    if (subRule.test instanceof RegExp && subRule.test.test('.scss')) {
                        return {
                            ...subRule,
                            use: [
                                ...subRule.use,
                                {
                                    loader: require.resolve('sass-resources-loader'),
                                    options: {
                                        resources: [path.resolve(__dirname, '../styles/theme/_variables.scss')],
                                    },
                                },
                            ],
                        };
                    }
                    return subRule;
                });
            }
            return rule;
        });
        return config;
    },
};

preview-head.html

<link rel=‘stylesheet’ href=‘https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css’ />

My root style folder

The bootstrap itself works fine the problem is with custom css varibles. My varibles file is in the theme folder.


问:
Websocket is not working when config is cleared
Project on Laravel 9 + tenancyforlaravel + beyondcode/laravel-websockets + vue2. It uses **Multi-database tenancy. **Tenancy feature is working well and I can login to subdomains from the correct database.

Recently I noticed something is configured incorrectly, I don't know what.

When I initialize tenant (bp.localhost) like this:

```<code>$tenant = \App\Models\Tenant::find('bp');
tenancy()->initialize($tenant);
</code>```

then run command php artisan config:cache  websocket works on this tenant (bp.localhost), but on others don't.

But when I clear the config, websocket doesn't work at all. Auth request from Laravel Echo is not sending.

How to configure websocket correctly to make it work at different subdomains bp.localhost, admin.localhost, etc. ? There will be dynamic subdomains names

Body:
Project on Laravel 9 + tenancyforlaravel + beyondcode/laravel-websockets + vue2. It uses **Multi-database tenancy. **Tenancy feature is working well and I can login to subdomains from the correct database.

Recently I noticed something is configured incorrectly, I don't know what.

When I initialize tenant (bp.localhost) like this:

$tenant = \App\Models\Tenant::find('bp');
tenancy()->initialize($tenant);

then run command php artisan config:cache  websocket works on this tenant (bp.localhost), but on others don't.

But when I clear the config, websocket doesn't work at all. Auth request from Laravel Echo is not sending.

How to configure websocket correctly to make it work at different subdomains bp.localhost, admin.localhost, etc. ? There will be dynamic subdomains names