问:
Support for the experimental syntax 'jsx' isn't currently enabled in Next - next.config.js doesn't work well
So I've got a next app (based on React Native Web) with package.json in several locations as well as tsconfig.json in several places.

I am trying to solve an error I am getting:

```<code>Support for the experimental syntax 'jsx' isn't currently enabled (21:5):

  19 | const GeneralStatusBarColor = ({ backgroundColor, height, ...props }) => {
  20 |   return (
> 21 |     <SafeAreaView style={{ height: height, backgroundColor: backgroundColor }}>
     |     ^
  22 |       <StatusBar
  23 |         {...props}
  24 |         backgroundColor={backgroundColor}
</code>```

But in my next folder, I have a .babelrc:

```<code>{
  "presets": [
    "next/babel",
    ["babel-preset-expo", { "jsxRuntime": "automatic" }]
  ],
  "plugins": [
    ["@babel/plugin-proposal-class-properties", { "loose": true }],
    ["@babel/plugin-proposal-private-methods", { "loose": true }],
    ["@babel/plugin-proposal-private-property-in-object", { "loose": true }],
    "react-native-reanimated/plugin",
    [
      "module-resolver",
      {
        "root": "../../packages",
        "alias": {
          "app": "../../packages/app",
          "components": "../../packages/app/components",
          "config": "../../packages/app/config",
          "controllers": "../../packages/app/controllers",
          "pages": "../../packages/app/pages",
          "features": "../../packages/app/features",
          "reducers": "../../packages/app/redux",
          "resources": "../../packages/app/resources",
          "revenuecat": "../../packages/app/revenuecat",
          "routing": "../../packages/app/routing",
          "utils": "../../packages/app/utils",
          "interfaces": "../../packages/app/interfaces",
          "root": "./"
        }
      }
    ]
  ]
}
</code>```

This works perfectly fine in another similarly structured app of mine.

But here, I need to have a next.config.js, and I think that's messing up other parts of my app.

Here's what the webpack part of my next.config.js looks like:

```<code>  config.module.rules.push({
    test: /.(js|ts|tsx)$/,
    exclude: /node_modules/,
    loader: 'babel-loader',
    options: {
      presets: [
        'next/babel',
        ['babel-preset-expo', { jsxRuntime: 'automatic' }],
        '@babel/react',
      ],
      plugins: [
        [
          'module-resolver',
          {
            root: '../../packages',
            alias: {
              app: '../../packages/app',
              components: '../../packages/app/components',
              config: '../../packages/app/config',
              controllers: '../../packages/app/controllers',
              pages: '../../packages/app/pages',
              features: '../../packages/app/features',
              reducers: '../../packages/app/redux',
              resources: '../../packages/app/resources',
              revenuecat: '../../packages/app/revenuecat',
              routing: '../../packages/app/routing',
              utils: '../../packages/app/utils',
              interfaces: '../../packages/app/interfaces',
            },
          },
        ],
      ],
    },
  });
</code>```

This works to get rid of the error, but seems a bunch extra on top of the .babelrc elsewhere?

However, when I add this code, I get the following error:

```<code>ReferenceError: __DEV__ is not defined
</code>```

The fix for this... remove .babelrc.

Which if I do so, causes this error (likely due to SWC):

```<code>error - ../../node_modules/react-native-web/src/modules/normalizeColor/index.js
Error:
  x Unexpected token `:`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, `
  | for template literal, (, or an identifier
    ,----
 13 | const normalizeColor = (color?: number | string, opacity?: number = 1): void | string => {
</code>```

But I am also trying to solve that in my next.config.js with this:

```<code>  config.resolve.alias = {
    ...(config.resolve.alias || {}),
    'react-native$': 'react-native-web',
    '@expo/vector-icons': 'react-native-vector-icons',
  };
</code>```

So I am just totally lost - I have a site with a similar config, but for some reason every time I am trying to get this site to work, there's some other error that's causing the whole app to not work, and there seems to be no consistency. I have been trying to fight this collection of errors for four days now.

Body:
So I've got a next app (based on React Native Web) with package.json in several locations as well as tsconfig.json in several places.

I am trying to solve an error I am getting:

Support for the experimental syntax 'jsx' isn't currently enabled (21:5):

  19 | const GeneralStatusBarColor = ({ backgroundColor, height, ...props }) => {
  20 |   return (
> 21 |     <SafeAreaView style={{ height: height, backgroundColor: backgroundColor }}>
     |     ^
  22 |       <StatusBar
  23 |         {...props}
  24 |         backgroundColor={backgroundColor}

But in my next folder, I have a .babelrc:

{
  "presets": [
    "next/babel",
    ["babel-preset-expo", { "jsxRuntime": "automatic" }]
  ],
  "plugins": [
    ["@babel/plugin-proposal-class-properties", { "loose": true }],
    ["@babel/plugin-proposal-private-methods", { "loose": true }],
    ["@babel/plugin-proposal-private-property-in-object", { "loose": true }],
    "react-native-reanimated/plugin",
    [
      "module-resolver",
      {
        "root": "../../packages",
        "alias": {
          "app": "../../packages/app",
          "components": "../../packages/app/components",
          "config": "../../packages/app/config",
          "controllers": "../../packages/app/controllers",
          "pages": "../../packages/app/pages",
          "features": "../../packages/app/features",
          "reducers": "../../packages/app/redux",
          "resources": "../../packages/app/resources",
          "revenuecat": "../../packages/app/revenuecat",
          "routing": "../../packages/app/routing",
          "utils": "../../packages/app/utils",
          "interfaces": "../../packages/app/interfaces",
          "root": "./"
        }
      }
    ]
  ]
}

This works perfectly fine in another similarly structured app of mine.

But here, I need to have a next.config.js, and I think that's messing up other parts of my app.

Here's what the webpack part of my next.config.js looks like:

  config.module.rules.push({
    test: /.(js|ts|tsx)$/,
    exclude: /node_modules/,
    loader: 'babel-loader',
    options: {
      presets: [
        'next/babel',
        ['babel-preset-expo', { jsxRuntime: 'automatic' }],
        '@babel/react',
      ],
      plugins: [
        [
          'module-resolver',
          {
            root: '../../packages',
            alias: {
              app: '../../packages/app',
              components: '../../packages/app/components',
              config: '../../packages/app/config',
              controllers: '../../packages/app/controllers',
              pages: '../../packages/app/pages',
              features: '../../packages/app/features',
              reducers: '../../packages/app/redux',
              resources: '../../packages/app/resources',
              revenuecat: '../../packages/app/revenuecat',
              routing: '../../packages/app/routing',
              utils: '../../packages/app/utils',
              interfaces: '../../packages/app/interfaces',
            },
          },
        ],
      ],
    },
  });

This works to get rid of the error, but seems a bunch extra on top of the .babelrc elsewhere?

However, when I add this code, I get the following error:

ReferenceError: __DEV__ is not defined

The fix for this... remove .babelrc.

Which if I do so, causes this error (likely due to SWC):

error - ../../node_modules/react-native-web/src/modules/normalizeColor/index.js
Error:
  x Unexpected token `:`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, `
  | for template literal, (, or an identifier
    ,----
 13 | const normalizeColor = (color?: number | string, opacity?: number = 1): void | string => {

But I am also trying to solve that in my next.config.js with this:

  config.resolve.alias = {
    ...(config.resolve.alias || {}),
    'react-native$': 'react-native-web',
    '@expo/vector-icons': 'react-native-vector-icons',
  };

So I am just totally lost - I have a site with a similar config, but for some reason every time I am trying to get this site to work, there's some other error that's causing the whole app to not work, and there seems to be no consistency. I have been trying to fight this collection of errors for four days now.


来源: stackexchange

ContentLicense: CC BY-SA 4.0

Title: An error occurred while query data from TDengine-client-3.0.2.0-Windows-x64

Body:
My SQL: select * from meters order by ts;

Here's the retult from TDengine-server-3.0.2.0-Linux-x64

ts
tv
cs
th
report_time
device_no

2022-12-02 09:22:22.249
30
1
50
2022-12-02 09:22:22.249
d001

2022-12-02 09:59:54.664
27
2
20
2022-12-02 09:59:54.664
d001

2022-12-02 15:55:01.473
29
3
33
2022-12-02 15:55:01.473
d001

2022-12-02 18:25:01.494
15
4
44
2022-12-02 18:25:01.494
d001

2022-12-02 18:25:01.559
15
4
44
2022-12-02 18:25:01.559
d002

2022-12-03 14:36:37.775
15
4
44
2022-12-03 14:36:37.775
d002

but the result from TDengine-client-3.0.2.0-Windows-x64 is different.

ts
tv
cs
th
report_time
device_no

2022-12-01 17:22:22.249
30
1
50
2022-12-01 17:22:22.249
d001

2022-12-01 17:59:54.664
27
2
20
2022-12-01 17:59:54.664
d001

2022-12-01 23:55:01.473
29
3
33
2022-12-01 23:55:01.473
d001

2022-12-02 02:25:01.494
15
4
44
2022-12-02 02:25:01.494
d001

2022-12-02 02:25:01.559
15
4
44
2022-12-02 02:25:01.559
d002

2022-12-02 22:36:37.775
15
4
44
2022-12-02 22:36:37.775
d002

The problem of upgrading to the latest 3.0.2.1 version still exists.

This is init data SQL:

CREATE STABLE meters(
ts timestamp,
tv SMALLINT UNSIGNED,
cs TINYINT UNSIGNED,
th SMALLINT UNSIGNED,
report_time timestamp
) TAGS(
device_no BINARY(60)
);

INSERT INTO d001 USING meters TAGS('d001') VALUES('2022-12-02 09:22:22.249',30,1,50,'2022-12-02 09:22:22.249');
INSERT INTO d001 USING meters TAGS('d001') VALUES('2022-12-02 09:59:54.664',27,2,20,'2022-12-02 09:59:54.664');

INSERT INTO d001 USING meters TAGS('d001') VALUES('2022-12-02 15:55:01.473',29,3,33,'2022-12-02 15:55:01.473');
INSERT INTO d001 USING meters TAGS('d001') VALUES('2022-12-02 18:25:01.494',15,4,44,'2022-12-02 18:25:01.494');

INSERT INTO d002 USING meters TAGS('d002') VALUES('2022-12-02 18:25:01.559',15,4,44,'2022-12-02 18:25:01.559');

INSERT INTO d002 USING meters TAGS('d002') VALUES('2022-12-03 14:36:37.775',15,4,44,'2022-12-03 14:36:37.775');


问:
JS Library performace exporting and importing
My question revolves around javascript/typescript libraries and performance related to library size and size of exports/imports.

I have created a rather large Angular application that uses an Nx monorepo. I dedicate a full library to house some models. Some of these models are nested. I have some factory classes to new-up some objects with default values.

I only want to export some of the models (the top level) and some of the factories (also top level) from my library. Does limiting the number of exports improve the performance of importing? Say I have 100 interfaces and I only export 5 of these, would this be better than exporting the entire 100? What if the 5 interfaces that I export reference 50 other interfaces that aren't exported?

Also, does the size of the library impact import performance if only a small number of items are exported? Say the library has some code that processes a complex object and then just returns a result. From my understanding a larger bundle size will impact page loading and slow down the page, but I would like to optimize how my code runs.


问:
How to have generics to specify a complex dynamic tree structure in TypeScript?
I am working on trying to model scope (see my last few questions if curious), but I mostly had it modelled wrong I think. So I am trying again.

Basically, scope is like lexical scope. You can have these sorts of complex situations (not to mention the obvious situations like simple class, function, and module scope, etc.):

functions within functions within functions, arbitrarily deep

classes within functions within classes within functions, etc.

conditional/if blocks within blocks, within functions, etc.

loops within loops (with the others mixed in too)

manual scope creation (like in javascript how you can simply add { ... } to fork a new local scope).

So we have these types of scope (at least).

module

class

function

condition

loop

fork

The problem I am having is how to specify the type when the "parent" scope on some scope (which is of one of these scope types) can be of different types. For example, you might have this sort of parent tree structure (assume scope has a data property, which is a record with keys and values, and an optional parent property, pointing to the parent). I'll just show one possible parent hierarchy here:

```<code>loop
  loop
    condition
      condition
        loop
          function
            class
              module
</code>```

As I try to model this, I do this:

```<code>type ScopeModuleType<T> = {
  // somehow this should accept arbitrary record structures
  // but we should be able to harden the type when necessary
  data: <T>
  parent?: undefined
}

type ScopeClassType<T> = {
  data: T
  // we can define classes in functions, like in JavaScript
  parent: ScopeModuleType | ScopeFuncionType
}

type ScopeFunctionType<T> = {
  // the local variables for the function
  data: T
  // now, how do I pass the generic types `T` to these parents???
  parent: ScopeFunctionType | ScopeLoopType | ScopeConditionType | ScopeClassType | ScopeModuleType
}

type ScopeLoopType<T> = {
  // the loop data is like index, item, key perhaps, etc.
  data: T
  // again, how to pass the generic types to these?
  parent: ScopeFunctionType | ScopeLoopType | ScopeConditionType
}

type ScopeConditionType<T> = {
  // the local variables in the if block
  data: T
  parent: ScopeFunctionType | ScopeLoopType | ScopeConditionType
}
</code>```

So you see one glaring problem there, how do I specify the parent data structure? How do I pass in the generic types for the parent?

You might try optional generics, like this:

```<code>type ScopeConditionType<T, F = unknown, L = unknown, Condition = unknown> = {
  // the local variables in the if block
  data: T
  parent: ScopeFunctionType<F> | ScopeLoopType<L> | ScopeConditionType<C>
}
</code>```

And then try and use it like this:

```<code>const conditionScope: ScopeConditionType<
  { foo: string },
  unknown,
  ScopeLoopType<{ index: number }>
> = {
  data: {
    foo: 'bar'
  },
  parent: {
    data: {
      index: 123
    }
  }
}
</code>```

But that seems ugly and like a hack, number one. And number two, I want to type it so it captures the full possible tree of types in the chain:

```<code>loop
  loop
    condition
      condition
        loop
          function
            class
              module
</code>```

So then, if I wanted to have access to scope.parent.parent.parent.index, I would have to do something like this:

```<code>const x: ScopeLoopType<
  ScopeLoopType<
    undefined,
    ScopeConditionType<
      undefined,
      undefined,
      ScopeConditionType<
        undefined
        ScopeLoopType<...>
      >
    >
  >
>
</code>```

Am I going about this the right way? Is there a way to accomplish this sort of thing differently? Or is there a cleaner API so I don't have to have undefined/unknown generics skipped over in the generics' arguments? Like perhaps I can do something like this:

```<code>const x: ScopeLoopType<{ j: number }, {
  Loop: ScopeLoopType<{ i: number }>, {
    Condition: ScopeConditionType<{}, {
      Condition: ScopeConditionType<{ foo: string }, {
        Loop: ScopeLoopType<...>
      }>
    }>
  }>
}>
</code>```

Basically at least with that, you could define the entire tree structure with optional generics and it would make somewhat a bit of sense. You only have to define the parents up as far as you wanted to.

How should I go about structuring/implementing this sort of type system? (recursive type generics)

Body:
I am working on trying to model scope (see my last few questions if curious), but I mostly had it modelled wrong I think. So I am trying again.

Basically, scope is like lexical scope. You can have these sorts of complex situations (not to mention the obvious situations like simple class, function, and module scope, etc.):

functions within functions within functions, arbitrarily deep

classes within functions within classes within functions, etc.

conditional/if blocks within blocks, within functions, etc.

loops within loops (with the others mixed in too)

manual scope creation (like in javascript how you can simply add { ... } to fork a new local scope).

So we have these types of scope (at least).

module

class

function

condition

loop

fork

The problem I am having is how to specify the type when the "parent" scope on some scope (which is of one of these scope types) can be of different types. For example, you might have this sort of parent tree structure (assume scope has a data property, which is a record with keys and values, and an optional parent property, pointing to the parent). I'll just show one possible parent hierarchy here:

loop
  loop
    condition
      condition
        loop
          function
            class
              module

As I try to model this, I do this:

type ScopeModuleType<T> = {
  // somehow this should accept arbitrary record structures
  // but we should be able to harden the type when necessary
  data: <T>
  parent?: undefined
}

type ScopeClassType<T> = {
  data: T
  // we can define classes in functions, like in JavaScript
  parent: ScopeModuleType | ScopeFuncionType
}

type ScopeFunctionType<T> = {
  // the local variables for the function
  data: T
  // now, how do I pass the generic types `T` to these parents???
  parent: ScopeFunctionType | ScopeLoopType | ScopeConditionType | ScopeClassType | ScopeModuleType
}

type ScopeLoopType<T> = {
  // the loop data is like index, item, key perhaps, etc.
  data: T
  // again, how to pass the generic types to these?
  parent: ScopeFunctionType | ScopeLoopType | ScopeConditionType
}

type ScopeConditionType<T> = {
  // the local variables in the if block
  data: T
  parent: ScopeFunctionType | ScopeLoopType | ScopeConditionType
}

So you see one glaring problem there, how do I specify the parent data structure? How do I pass in the generic types for the parent?

You might try optional generics, like this:

type ScopeConditionType<T, F = unknown, L = unknown, Condition = unknown> = {
  // the local variables in the if block
  data: T
  parent: ScopeFunctionType<F> | ScopeLoopType<L> | ScopeConditionType<C>
}

And then try and use it like this:

const conditionScope: ScopeConditionType<
  { foo: string },
  unknown,
  ScopeLoopType<{ index: number }>
> = {
  data: {
    foo: 'bar'
  },
  parent: {
    data: {
      index: 123
    }
  }
}

But that seems ugly and like a hack, number one. And number two, I want to type it so it captures the full possible tree of types in the chain:

loop
  loop
    condition
      condition
        loop
          function
            class
              module

So then, if I wanted to have access to scope.parent.parent.parent.index, I would have to do something like this:

const x: ScopeLoopType<
  ScopeLoopType<
    undefined,
    ScopeConditionType<
      undefined,
      undefined,
      ScopeConditionType<
        undefined
        ScopeLoopType<...>
      >
    >
  >
>

Am I going about this the right way? Is there a way to accomplish this sort of thing differently? Or is there a cleaner API so I don't have to have undefined/unknown generics skipped over in the generics' arguments? Like perhaps I can do something like this:

const x: ScopeLoopType<{ j: number }, {
  Loop: ScopeLoopType<{ i: number }>, {
    Condition: ScopeConditionType<{}, {
      Condition: ScopeConditionType<{ foo: string }, {
        Loop: ScopeLoopType<...>
      }>
    }>
  }>
}>

Basically at least with that, you could define the entire tree structure with optional generics and it would make somewhat a bit of sense. You only have to define the parents up as far as you wanted to.

How should I go about structuring/implementing this sort of type system? (recursive type generics)


问:
MYSQL LOCAL INFILE command server wants to read - ExpressJS, Mysql2
I am trying to import a CSV programmatically into my web app, and when I make an SQL request I am met with this error

Error: As a result of LOCAL INFILE command server wants to read path/to/myfile.csv file, but as of v2.0 you must provide streamFactory option returning ReadStream.

I have tried adding things to the config however I cannot seem to get this working
Code:

async function query(sql){
    console.log("querying")
    const conn = await mysql.createConnection(config.db)
    conn.on("error", (err)=>console.log(err))
    const [results, ] = await conn.query({
        sql:sql,
        values:[],
    })
    return results
}
```
<pre class="lang-js prettyprint-override"><code>            query("LOAD DATA LOCAL INFILE '" +
                 req.file.path +
                "' INTO TABLE jr " +
                " FIELDS TERMINATED BY ','" +
                " LINES TERMINATED BY  '\n'" +
                " IGNORE 1 ROWS;").then(r =>
                console.log("Inserted")
            )`=
</code>```

Body:
I am trying to import a CSV programmatically into my web app, and when I make an SQL request I am met with this error

Error: As a result of LOCAL INFILE command server wants to read path/to/myfile.csv file, but as of v2.0 you must provide streamFactory option returning ReadStream.

I have tried adding things to the config however I cannot seem to get this working
Code:

async function query(sql){
    console.log("querying")
    const conn = await mysql.createConnection(config.db)
    conn.on("error", (err)=>console.log(err))
    const [results, ] = await conn.query({
        sql:sql,
        values:[],
    })
    return results
}

            query("LOAD DATA LOCAL INFILE '" +
                 req.file.path +
                "' INTO TABLE jr " +
                " FIELDS TERMINATED BY ','" +
                " LINES TERMINATED BY  '\n'" +
                " IGNORE 1 ROWS;").then(r =>
                console.log("Inserted")
            )`=


问:
How to export all tables in hive to rdbms in sqoop?
just like in inmport command we can import all tables from rdbms to hdfs like in this way I want to export all tables from hive to rdbms or hdfs to rdbms is there any solution for this? and I tried all ready that export single table from hive to rdbms or hdfs to rdbms.

just i want to what is the command


问:
Access denied for user 'root'@'172.19.0.2' (using password: YES) (Docker for windows)
I'm trying to run a docker container but I get this error:

```<code>2022-12-21 22:49:28 Running Rboxlo on port 80
2022-12-21 22:49:28 SqlError: (conn=6, no: 1045, SQLState: 28000) Access denied for user 'root'@'172.19.0.2' (using password: YES)
2022-12-21 22:49:28   text: "(conn=6, no: 1045, SQLState: 28000) Access denied for user 'root'@'172.19.0.2' (using password: YES)",
2022-12-21 22:49:28   sql: null,
2022-12-21 22:49:28   fatal: true,
2022-12-21 22:49:28   errno: 1045,
2022-12-21 22:49:28   sqlState: '28000',
2022-12-21 22:49:28   code: 'ER_ACCESS_DENIED_ERROR'
2022-12-21 22:49:28 }
</code>```

I searched a lot for this error, but all the answers I could find do not fix the error

.env file:

# Database  DB_PASSWORD=passhere DB_USERNAME=root DB_NAME=rboxlo

i already created database in phpmyadmin

What did you try and what did you expect?

this app has a registration website but as docker cannot enter the database, the registration page would be infinite loading

docker containers

Body:
I'm trying to run a docker container but I get this error:

2022-12-21 22:49:28 Running Rboxlo on port 80
2022-12-21 22:49:28 SqlError: (conn=6, no: 1045, SQLState: 28000) Access denied for user 'root'@'172.19.0.2' (using password: YES)
2022-12-21 22:49:28   text: "(conn=6, no: 1045, SQLState: 28000) Access denied for user 'root'@'172.19.0.2' (using password: YES)",
2022-12-21 22:49:28   sql: null,
2022-12-21 22:49:28   fatal: true,
2022-12-21 22:49:28   errno: 1045,
2022-12-21 22:49:28   sqlState: '28000',
2022-12-21 22:49:28   code: 'ER_ACCESS_DENIED_ERROR'
2022-12-21 22:49:28 }

I searched a lot for this error, but all the answers I could find do not fix the error

.env file:

# Database  DB_PASSWORD=passhere DB_USERNAME=root DB_NAME=rboxlo

i already created database in phpmyadmin

What did you try and what did you expect?

this app has a registration website but as docker cannot enter the database, the registration page would be infinite loading

docker containers


问:
std::condition_variable between processes using shared memory
I am trying to use std::condition_variable (with std::mutex) to do some inter process synchronization.
I am putting both the cv and mutex in the shared memory to achieve this, which should be possible.
All is good with a number of processes locking the mutex and calling wait on the cv.
When another process finally calls cv.notify_one/notify_all it ends up crashing with a SIGSEV.

I have tried the same with pthread_cond_t as well with the same result.
Is this absolutely not possible?

I am able to achieve the synchronization using Named Semaphores ( sem_t ), which underneath does very similar thing by using a shared memory.

Kindly Advice.

4 processes share CV, Mutex an integer and a bool via shared memory.
I have 3 processes each calling wait on the CV, and a fourth process that calls notify_all.
I expect the first 3 process to come out of wait.
I am seeing the 4th process crash the moment notify_all is called.


问:
Print to pdf with bookmarks
How to use brave to automate printing html to pdf?

Using the above method, no bookmarks can be generated. Is there an HTML tag that can be used to instruct the browser to insert bookmarks into the output PDF?

Given that CSS can be used to instruct the browser with page breaks in the output PDF, it seems that it is not absolutely unlikely bookmarks may be added to the output PDF by instructing the browser with some HTML tags.

Title: Print to pdf with bookmarks


问:
How to convert module from AOSP to Android Studio compatible project?
Is there any way to convert the Android Open Source Project module (specifically the Messaging app, link below) in such a way that I can debug it using Android Studio? I'm guessing that the topic is complex, so I would be grateful for even the most general tips.

https://android.googlesource.com/platform/packages/apps/Messaging/+/refs/heads/master


问:
Duplicate Key on Reactr Js Component
So i have Autocomplete Material UI Component That render Data, the data from BE will be consume and grouped based on the first Letter, but when its being render on the Autocomplete component its become duplicate key error like this:

As you all can see, there is no duplicate at all but i keeps getting error message as below, here is my code:

```<code>const [dataSKU, setDataSKU] = React.useState([]);
  React.useEffect(() => {
    dataService.getAllSKU().then((response) => {
      setDataSKU(response.data.data);
    });
  }, []);

  const handleKeyDown = (event) => {
    switch (event.key) {
      case ",":
      case " ": {
        event.preventDefault();
        event.stopPropagation();
        if (event.target.value.length > 0) {
          setValue([...value, event.target.value]);
        }
        break;
      }
      default:
    }
  };
  const [value, setValue] = React.useState("1");
  const [sku, setSku] = React.useState(" ");

  const handleChange = (event, newValue) => {
    setValue(newValue);
  };

  const useStyles = makeStyles((theme) => ({
    root: {
      padding: "0px",
    },
  }));

  const options = dataSKU.map((option) => {
    const firstLetter = option.sku_name[0].toUpperCase();

    return {
      firstLetter: /[0-9]/.test(firstLetter) ? "0-9" : firstLetter,
      ...option,
    };
  });

  return (
    <div className=" m-2 p-2 mr-2 bg-white h-screen ">
      <div className="text-left pl-2 pb-4 font-bold text-3xl">
        <h2>Find Material</h2>
      </div>
      <div className="p-2 align-left">
        <form
          className="flex items-center"
          onSubmit={(e) => {
            e.preventDefault();
            console.log(sku.sku);
          }}
        >
          <Autocomplete
            isOptionEqualToValue={(option, value) =>
              option.value === value.value
            }
            style={{ width: "100%", color: "#ffffff" }}
            onChange={(event, newValue) => {
              setSku(newValue);
            }}
            id="grouped-demo"
            options={options.sort(
              (a, b) => -b.firstLetter.localeCompare(a.firstLetter)
            )}
            groupBy={(option) => option.firstLetter}
            getOptionLabel={(option) => option.sku_name}
            sx={{ width: 300 }}
            renderInput={(params) => {
              params.inputProps.onKeyDown = handleKeyDown;
              return <TextField {...params} label="Search by SKU" required />;
            }}
            renderGroup={(params) => (
              <ul key={params.key}>
                <li>
                  {console.log("params", params)}
                  <GroupHeader>{params.group}</GroupHeader>
                  <GroupItems>{params.children}</GroupItems>
                </li>
              </ul>
            )}
          />
          <div>
            <Button
              type="submit"
              color="success"
              variant="contained"
              style={{
                marginLeft: 10,
                width: "100%",
                height: 54,
              }}
              startIcon={<ContentPasteSearchIcon />}
            >
              Search
            </Button>
          </div>
        </form>
      </div>
     </div>
    </div>
</code>```

is there a way to fix it?

Title: Duplicate Key on Reactr Js Component

Body:
So i have Autocomplete Material UI Component That render Data, the data from BE will be consume and grouped based on the first Letter, but when its being render on the Autocomplete component its become duplicate key error like this:

As you all can see, there is no duplicate at all but i keeps getting error message as below, here is my code:

const [dataSKU, setDataSKU] = React.useState([]);
  React.useEffect(() => {
    dataService.getAllSKU().then((response) => {
      setDataSKU(response.data.data);
    });
  }, []);

  const handleKeyDown = (event) => {
    switch (event.key) {
      case ",":
      case " ": {
        event.preventDefault();
        event.stopPropagation();
        if (event.target.value.length > 0) {
          setValue([...value, event.target.value]);
        }
        break;
      }
      default:
    }
  };
  const [value, setValue] = React.useState("1");
  const [sku, setSku] = React.useState(" ");

  const handleChange = (event, newValue) => {
    setValue(newValue);
  };

  const useStyles = makeStyles((theme) => ({
    root: {
      padding: "0px",
    },
  }));

  const options = dataSKU.map((option) => {
    const firstLetter = option.sku_name[0].toUpperCase();

    return {
      firstLetter: /[0-9]/.test(firstLetter) ? "0-9" : firstLetter,
      ...option,
    };
  });

  return (

Find Material

        <form
          className="flex items-center"
          onSubmit={(e) => {
            e.preventDefault();
            console.log(sku.sku);
          }}
        >
          <Autocomplete
            isOptionEqualToValue={(option, value) =>
              option.value === value.value
            }
            style={{ width: "100%", color: "#ffffff" }}
            onChange={(event, newValue) => {
              setSku(newValue);
            }}
            id="grouped-demo"
            options={options.sort(
              (a, b) => -b.firstLetter.localeCompare(a.firstLetter)
            )}
            groupBy={(option) => option.firstLetter}
            getOptionLabel={(option) => option.sku_name}
            sx={{ width: 300 }}
            renderInput={(params) => {
              params.inputProps.onKeyDown = handleKeyDown;
              return <TextField {...params} label="Search by SKU" required />;
            }}
            renderGroup={(params) => (

                  {console.log("params", params)}
                  <GroupHeader>{params.group}</GroupHeader>
                  <GroupItems>{params.children}</GroupItems>

            )}
          />

            <Button
              type="submit"
              color="success"
              variant="contained"
              style={{
                marginLeft: 10,
                width: "100%",
                height: 54,
              }}
              startIcon={<ContentPasteSearchIcon />}
            >
              Search
            </Button>

        </form>

is there a way to fix it?


问:
Odata filter for child
I have to read invoice line items.
To Read all invoices
• projection/v1/InvoiceHandling.svc
This would list all the invoices in all company registered in cloud(Only Header Info)
To Read exact invoice
• projection/v1/InvoiceHandling.svc/SuppInvoiceSet?$filter=Company eq '10' and InvoiceId eq 202646
This would list InvoiceId-202646(Only Header Info)

To Read Item Lines
•projection/v1/InvoiceHandling.svc/SuppInvoiceSet(Company='{Company}',InvoiceId={InvoiceId})/SuppInvoiceItems
This would list item lines (Need to pass Company Id and InvoiceId)

What I need to do is filter Item line based on some condition.Eg: List all Item Lines that Line Part Description "Delivery" .

I have tried expand option before applying filter in child. But it didn't work.

projection/v1/InvoiceHandling.svc/SuppInvoiceSet?$expand=SuppInvoiceItems

Title: Odata filter for child


问:
How to add additional permissions to custom steps in GitHub Actions
I have two steps in GitHub Actions:

The first uploads a zipped artifact:

```<code>- name: Upload artifact
  uses: actions/upload-artifact@master
  with:
    name: artifacts
    path: target/*.jar
</code>```

The second uses a custom java command to read the uploaded artifact:

```<code>name: Read artifact
runs: java -jar pipeline-scan.jar -- "artifacts.zip"
</code>```

I've redacted the java command, but it's supposed to scan my zip file using Veracode. GitHub Actions returns the following error:

```<code>java  -jar  pipeline-scan.jar:  error:   argument  -f/--file:  Insufficient
permissions to read file: 'artifacts.zip'
</code>```

I've tried changing the permissions of the GITHUB_TOKEN, but apparently you can only pass in the $GITHUB_TOKEN secret with a "uses" parameter and not a "runs" parameter. I've also made sure that my default workflow permissions are set to "read and write permissions."

Does anyone know how to resolve this permissions issue?

Body:
I have two steps in GitHub Actions:

The first uploads a zipped artifact:

- name: Upload artifact
  uses: actions/upload-artifact@master
  with:
    name: artifacts
    path: target/*.jar

The second uses a custom java command to read the uploaded artifact:

name: Read artifact
runs: java -jar pipeline-scan.jar -- "artifacts.zip"

I've redacted the java command, but it's supposed to scan my zip file using Veracode. GitHub Actions returns the following error:

java  -jar  pipeline-scan.jar:  error:   argument  -f/--file:  Insufficient
permissions to read file: 'artifacts.zip'

I've tried changing the permissions of the GITHUB_TOKEN, but apparently you can only pass in the $GITHUB_TOKEN secret with a "uses" parameter and not a "runs" parameter. I've also made sure that my default workflow permissions are set to "read and write permissions."

Does anyone know how to resolve this permissions issue?


问:
Customer Reservations - <nameprefix>, does it exist in the Amadas API?
I troubleshooting an issue downstream of the GDS and I wanted to confirm if Amadas has an <namePrefix> XML object for customer reservation.

When that data is being ingested into its destination, this is what I would like to be seeing:

```<code><IndividualName>
<namePrefix>Mr</namePrefix>
<nameFirst>FIRST</nameFirst>
<nameSur>SUR</nameSur>
</code>```

But I'm seeing

```<code><IndividualName>
          <nameFirst>JOHN MR</nameFirst>
          <nameSur>DOE</nameSur>
</IndividualName>
</code>```

If they do, then I'll engage with the party between the GDS and our PMS to resolve the issue but I need to be sure if this XML object exists.

Regards

At this stage, I've traced the missing XML Object back to the stage before the GDS.
If the XML object is not present as an XML object, I'll engage the destination vendor to work on a solution.

Our Current Flow
GDS - Does <nameprefix> exist?
Parent Hotel Company - NamePrefix does not exist when it flows downstream.
Site Minder - Is only a passthrough. Nothing is changed
Destination (Opera Cloud) - NamePrefix XML Does not exist when ingested

Body:
I troubleshooting an issue downstream of the GDS and I wanted to confirm if Amadas has an <namePrefix> XML object for customer reservation.

When that data is being ingested into its destination, this is what I would like to be seeing:

<IndividualName>
<namePrefix>Mr</namePrefix>
<nameFirst>FIRST</nameFirst>
<nameSur>SUR</nameSur>

But I'm seeing

<IndividualName>
          <nameFirst>JOHN MR</nameFirst>
          <nameSur>DOE</nameSur>
</IndividualName>

If they do, then I'll engage with the party between the GDS and our PMS to resolve the issue but I need to be sure if this XML object exists.

Regards

At this stage, I've traced the missing XML Object back to the stage before the GDS.
If the XML object is not present as an XML object, I'll engage the destination vendor to work on a solution.

Our Current Flow
GDS - Does <nameprefix> exist?
Parent Hotel Company - NamePrefix does not exist when it flows downstream.
Site Minder - Is only a passthrough. Nothing is changed
Destination (Opera Cloud) - NamePrefix XML Does not exist when ingested


问:
¿How can I use IMaskInput for email validation?
I'm traying to validate an email using ImaskInput, with the below code:

```<code>const Email = forwardRef(function Email(props, ref) {
  const { onChange, ...other } = props;
  return (
    <IMaskInput {...other}
                mask={/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/}
                definitions={{ }}
                inputRef={ref}
                onAccept={(value) => onChange({ target: { name: props.name, value } })}
                overwrite />
  )
})
</code>```

But the MUI TextField is not responding at all. I'm already using similar classes for phon nomber and they are working nice.

Cheer / Juan

Any help is welcome and thanks in advance

NOTE: using MUI 5

Body:
I'm traying to validate an email using ImaskInput, with the below code:

const Email = forwardRef(function Email(props, ref) {
  const { onChange, ...other } = props;
  return (
    <IMaskInput {...other}
                mask={/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/}
                definitions={{ }}
                inputRef={ref}
                onAccept={(value) => onChange({ target: { name: props.name, value } })}
                overwrite />
  )
})

But the MUI TextField is not responding at all. I'm already using similar classes for phon nomber and they are working nice.

Cheer / Juan

Any help is welcome and thanks in advance

NOTE: using MUI 5


问:
How split window to a fixed size on refresh in nvim?
If I split a window with an specific size, after writing/saving a file, the window is resized to the default proportion set by nvim.

I split :26 split

I go back to the first window

run :w

Both windows now take 50% of the viewport

How do I keep the 26height when saving?

I have read this about the option winminheight, but I am very new to this and have no idea on how to set this!

Thanks!


问:
Is there a way of turning flow chart code into an Javascript code without using if statements or looping statements?
Is there a way of turning flow chart logic into Javascript code without using if statements or looping statements?

I am curious to learn different ways of turning flow chart logic into code so that I can choose the best depending on the situation.

```<code>Step 1. START
Step 2. Input x
Step 3. In case A go to Step 2 if case B go to step 4 if case C go to step 5
Step 4. Output x
Step 5. Output y
Step 6. END
</code>```

Are there better/different ways of turning the logic above into code without using if statements or looping statements?

Body:
Is there a way of turning flow chart logic into Javascript code without using if statements or looping statements?

I am curious to learn different ways of turning flow chart logic into code so that I can choose the best depending on the situation.

Step 1. START
Step 2. Input x
Step 3. In case A go to Step 2 if case B go to step 4 if case C go to step 5
Step 4. Output x
Step 5. Output y
Step 6. END

Are there better/different ways of turning the logic above into code without using if statements or looping statements?


问:
convert markdown to html safe and without loss of content
I perform the conversion from markdown to html using remark-rehype. I know about "fenced code blocks" and use it.

I expect to get

 escaped html

from a string that for some reason may contain jsx or other code passed to markdown due to inattention, for example (next I will call it "code 1")

```<code>... marrkdown ...
<button
className="codecopy"
onClick={handlerCopy}
ref={refBtnCopy}
>
{textBthCopy}
</button>
... marrkdown ...
</code>```

I started using plugin "rehype-sanitize" so that "ref" would not be passed to rehype-react. And now if pass the  (code 1) get

```<code><p><button
className="codecopy"
onClick={handlerCopy}
ref={refBtnCopy}</p>
</code>```

How to get code like this

```<code><p>
<button
className="codecopy"
onClick={handlerCopy}
ref={refBtnCopy}
&gt
{textBthCopy}
</butto&gt
</p>
</code>```

I'm making a client server application. server side convert markdown to html

```<code>unified()
    .use(remarkParse)
    .use(remarkRehype, { allowDangerousHtml: true })
    .use(rehypePrismCustom ) // highlight with prismjs
    .use(rehypeCodeBlock) // make custom markup for block code and add html tag section
    .use(rehypeAhref) // change attributes a[href] html tag
    .use(rehypeStringify, { allowDangerousHtml: true })
</code>```

on client side compile html to React components

```<code>unified()
    .use(rehypeParse, { fragment: true })
    .use(rehypeSanitize, {
        ...defaultSchema,
        tagNames: [
            ...(defaultSchema.tagNames || []),
            "section",
            "iframe",
        ],

        attributes: {
            ...defaultSchema.attributes,
            "*": ["className"],
            iframe: [
                "width",
                "height",
                "src",
                "title",
                "allow",
                "allowfullscreen",
            ],
        },
    })
    .use(rehypeReact, {
        createElement: React.createElement,
        Fragment: React.Fragment,
        components: {
            section: CodeSection,
        },
    })
</code>```

Body:
I perform the conversion from markdown to html using remark-rehype. I know about "fenced code blocks" and use it.

I expect to get

 escaped html

from a string that for some reason may contain jsx or other code passed to markdown due to inattention, for example (next I will call it "code 1")

... marrkdown ...
<button
className="codecopy"
onClick={handlerCopy}
ref={refBtnCopy}
>
{textBthCopy}
</button>
... marrkdown ...

I started using plugin "rehype-sanitize" so that "ref" would not be passed to rehype-react. And now if pass the  (code 1) get

<button
className="codecopy"
onClick={handlerCopy}
ref={refBtnCopy}

How to get code like this

<button
className="codecopy"
onClick={handlerCopy}
ref={refBtnCopy}
&gt
{textBthCopy}
</butto&gt

I'm making a client server application. server side convert markdown to html

unified()
    .use(remarkParse)
    .use(remarkRehype, { allowDangerousHtml: true })
    .use(rehypePrismCustom ) // highlight with prismjs
    .use(rehypeCodeBlock) // make custom markup for block code and add html tag section
    .use(rehypeAhref) // change attributes a[href] html tag
    .use(rehypeStringify, { allowDangerousHtml: true })

on client side compile html to React components

unified()
    .use(rehypeParse, { fragment: true })
    .use(rehypeSanitize, {
        ...defaultSchema,
        tagNames: [
            ...(defaultSchema.tagNames || []),
            "section",
            "iframe",
        ],

        attributes: {
            ...defaultSchema.attributes,
            "*": ["className"],
            iframe: [
                "width",
                "height",
                "src",
                "title",
                "allow",
                "allowfullscreen",
            ],
        },
    })
    .use(rehypeReact, {
        createElement: React.createElement,
        Fragment: React.Fragment,
        components: {
            section: CodeSection,
        },
    })


问:
RocksDB fail to set bloom filter
I am trying to open an existing RocksDB that does not have bloom filter enabled.
I passed in:

```<code>  rocksdb::BlockBasedTableOptions table_options;
  table_options.filter_policy.reset(
      rocksdb::NewBloomFilterPolicy(10));
  db_options_->table_factory.reset(rocksdb::NewBlockBasedTableFactory(table_options));
</code>```

when I open the db.

However when I check OPTIONS file, I see filter_policy=nullptr. Is this the correct way to enable RocksDB bloom filter on an existing db instance? How can I verify it is actually working?

Title: RocksDB fail to set bloom filter

Body:
I am trying to open an existing RocksDB that does not have bloom filter enabled.
I passed in:

  rocksdb::BlockBasedTableOptions table_options;
  table_options.filter_policy.reset(
      rocksdb::NewBloomFilterPolicy(10));
  db_options_->table_factory.reset(rocksdb::NewBlockBasedTableFactory(table_options));

when I open the db.

However when I check OPTIONS file, I see filter_policy=nullptr. Is this the correct way to enable RocksDB bloom filter on an existing db instance? How can I verify it is actually working?


问:
Is there a way to dynamically insert the repo name at the end of the URL for "homepage" in react when deploying on github-pages?
I am trying to deploy my react app on GitHub Pages, but I want to make the "homepage" route in package.json dynamic based on the repo name instead of hardcoding the URL to host on GitHub Pages.

So instead of hardcoding it like "homepage": "http://exampleusername.github.io/examplerepo"

I am trying to achieve something like "homepage": "http://exampleusername.github.io/{repo_name}" or "homepage": {gh_pages_url}

Any help regarding this is appreciated.


问:
Function pointer with a template argument?
Is it possible to pass a function that takes a function pointer with a template argument?
So for example I would like to have a function that may look something like this:

```<code>template<template<int I> typename Func>
void funcCaller(Func<I> func)
{
   func<1>();
   func<2>();
   func<10>();
}
</code>```

and ideally could be used like this

```<code>template<int I>
void test()
{
   std::cout << I << std::endl;
}
</code>```
```<code>funcCaller(test);
</code>```

Now this doesn't compile, and a realize I am not using the templates in funcCaller correctly. Honestly I'm not even sure if what I am going for is possible, and it sure seems like a streach for the compiler to figure this out. I also don't want to specify the function signature, and the use case I have in mind would use this with a variadic-template, where funcCall acts as a loop of sorts  that could operate a variety of functions.

Any thoughts on how to approach something like this? Any direction is much appreciated :)

If this is answered elsewhere I would love to know, and figure out what terminology I am missing.

Body:
Is it possible to pass a function that takes a function pointer with a template argument?
So for example I would like to have a function that may look something like this:

template<template<int I> typename Func>
void funcCaller(Func func)
{
   func<1>();
   func<2>();
   func<10>();
}

and ideally could be used like this

template<int I>
void test()
{
   std::cout << I << std::endl;
}

funcCaller(test);

Now this doesn't compile, and a realize I am not using the templates in funcCaller correctly. Honestly I'm not even sure if what I am going for is possible, and it sure seems like a streach for the compiler to figure this out. I also don't want to specify the function signature, and the use case I have in mind would use this with a variadic-template, where funcCall acts as a loop of sorts  that could operate a variety of functions.

Any thoughts on how to approach something like this? Any direction is much appreciated :)

If this is answered elsewhere I would love to know, and figure out what terminology I am missing.


问:
How to filter and convert array to object javascript?
I have an array which contains several objects.

this is my array:

```<code>    const data =
    [
      {
        name: 'Asep',
        score: 90,
        class: 'adonis'
      },
      {
        name: 'Ahmad',
        score: 85,
        class: 'vuejs'
      },
      {
        name: 'Regi',
        score: 74,
        class: 'adonis'
      },
      {
        name: 'Afrida',
        score: 78,
        class: 'reactjs'
      }
    ]
</code>```

the result like this

```<code>{
   adonis: { name: 'Asep', score: 90 },
   vuejs: { name: 'Ahmad', score: 85 },
   reactjs: { name: 'Afrida', score: 78}
}
</code>```

so, I want to create an object whose content is an object.

Body:
I have an array which contains several objects.

this is my array:

    const data =
    [
      {
        name: 'Asep',
        score: 90,
        class: 'adonis'
      },
      {
        name: 'Ahmad',
        score: 85,
        class: 'vuejs'
      },
      {
        name: 'Regi',
        score: 74,
        class: 'adonis'
      },
      {
        name: 'Afrida',
        score: 78,
        class: 'reactjs'
      }
    ]

the result like this

{
   adonis: { name: 'Asep', score: 90 },
   vuejs: { name: 'Ahmad', score: 85 },
   reactjs: { name: 'Afrida', score: 78}
}

so, I want to create an object whose content is an object.


问:
'Service' object has no attribute 'process'
I was trying Jupyter on Android, but when I try chromedriver, it gives me an error.

First, I tried this script.

```<code>from selenium import webdriver
driver = webdriver.Chrome("/sdcard/abc/chromedriver.exe")
driver.get('https://www.google.com/')
</code>```

The code says this error.
"AttributeError: 'Service' object has no attribute 'process'"

I searched on the Internet, and I found a code.

```<code>from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager(path="/sdcard/abc/").install())
driver.get("https://www.google.com")
</code>```

I tried it too, but it gave me the same error.
"AttributeError: 'Service' object has no attribute 'process'"

How can I fix it?

Body:
I was trying Jupyter on Android, but when I try chromedriver, it gives me an error.

First, I tried this script.

from selenium import webdriver
driver = webdriver.Chrome("/sdcard/abc/chromedriver.exe")
driver.get('https://www.google.com/')

The code says this error.
"AttributeError: 'Service' object has no attribute 'process'"

I searched on the Internet, and I found a code.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager(path="/sdcard/abc/").install())
driver.get("https://www.google.com")

I tried it too, but it gave me the same error.
"AttributeError: 'Service' object has no attribute 'process'"

How can I fix it?


问:
No deployment-state.json in S3 bucket
I am currently working with AWS Amplify.
I am trying to run amplify push command but it fails with a message:
AWS Amplify: Resource is not in the state stackUpdateComplete

I've tried all the solutions here except for the deleting deployment-state.json because I cannot find it anywhere. (I cannot delete or reset the project. It's under production.)

Here's the capture image of S3 bucket for the project:
S3 Capture

Where can I find the file?
Or how can I fix the issue safely?

Title: No deployment-state.json in S3 bucket


问:
Bootstrap 5 navbar is not working on mobile
I have a vertical navbar, but it transforms to a horizontal one with a dropdown that doesn't work.

Hello! I'm pretty new to using bootstrap and such, but I need to use it for a project. I wanted to do a vertical sidebar for my website so I followed a tutorial I've found online, and so far it worked great with all its items working perfectly. The problem comes when I try to simulate a mobile/low resolution version of the website.

The vertical navbar transforms to a horizontal one. I don't have a problem with that. The thing is that it also transforms all my links to a dropdown menu, and when I try to click on it it just doesn't work. Also, this navbar I want it's an icons-only navbar, so I guess that also is going to be a problem with a dropdown menu.

I don't have a problem with a horizontal navbar in the mobile version, but I would like if it has the icons instead of a dropdown menu. How can I achieve this? Thanks!

.navbar svg {
  width: 50px;
  height: 50px;
  margin: 20px;
}

.nav-item svg {
  width: 35px;
  height: 35px;
  margin: 15px;
}

.nav-item svg:hover {
  color: #e99e8d;
  transition: all .4s ease;
  -webkit-transition: all .8s ease;
}

.dropdown svg {
  width: 35px;
  height: 35px;
  margin: 20px;
  margin-left: 0px;
}

@media (min-width: 992px) {
  .navbar,
  .navbar-collapse {
    flex-direction: column;
  }
  .navbar-expand-lg .navbar-nav {
    flex-direction: column;
  }
  .navbar {
    width: 8%;
    height: 100vh;
    align-items: flex-start;
  }
  .navbar-brand {
    margin-left: 0.5em;
    padding-bottom: 0;
    border-bottom: 4px solid #464646;
  }
  form input {
    margin-bottom: 0.7em;
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">

<nav class="navbar navbar-expand-lg navbar-light bs-side-navbar" style="background-color:#333;">

    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star-half" viewBox="0 0 16 16">
    <path d="M5.354 5.119 7.538.792A.516.516 0 0 1 8 .5c.183 0 .366.097.465.292l2.184 4.327 4.898.696A.537.537 0 0 1 16 6.32a.548.548 0 0 1-.17.445l-3.523 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256a.52.52 0 0 1-.146.05c-.342.06-.668-.254-.6-.642l.83-4.73L.173 6.765a.55.55 0 0 1-.172-.403.58.58 0 0 1 .085-.302.513.513 0 0 1 .37-.245l4.898-.696zM8 12.027a.5.5 0 0 1 .232.056l3.686 1.894-.694-3.957a.565.565 0 0 1 .162-.505l2.907-2.77-4.052-.576a.525.525 0 0 1-.393-.288L8.001 2.223 8 2.226v9.8z"/>
    </svg>

  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item">
         <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house" viewBox="0 0 16 16">
          <path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.707 1.5ZM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5 5 5Z"/>
        </svg>
      </li>
      <li class="nav-item">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pass" viewBox="0 0 16 16">
          <path d="M5.5 5a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1h-5Zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3Z"/>
          <path d="M8 2a2 2 0 0 0 2-2h2.5A1.5 1.5 0 0 1 14 1.5v13a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 14.5v-13A1.5 1.5 0 0 1 3.5 0H6a2 2 0 0 0 2 2Zm0 1a3.001 3.001 0 0 1-2.83-2H3.5a.5.5 0 0 0-.5.5v13a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5v-13a.5.5 0 0 0-.5-.5h-1.67A3.001 3.001 0 0 1 8 3Z"/>
        </svg>
      </li>
      <li class="nav-item">

          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-briefcase" viewBox="0 0 16 16">
            <path d="M6.5 1A1.5 1.5 0 0 0 5 2.5V3H1.5A1.5 1.5 0 0 0 0 4.5v8A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-8A1.5 1.5 0 0 0 14.5 3H11v-.5A1.5 1.5 0 0 0 9.5 1h-3zm0 1h3a.5.5 0 0 1 .5.5V3H6v-.5a.5.5 0 0 1 .5-.5zm1.886 6.914L15 7.151V12.5a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5V7.15l6.614 1.764a1.5 1.5 0 0 0 .772 0zM1.5 4h13a.5.5 0 0 1 .5.5v1.616L8.129 7.948a.5.5 0 0 1-.258 0L1 6.116V4.5a.5.5 0 0 1 .5-.5z"/>
          </svg>

      </li>
      <li class="nav-item">

          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-code-slash" viewBox="0 0 16 16">
            <path d="M10.478 1.647a.5.5 0 1 0-.956-.294l-4 13a.5.5 0 0 0 .956.294l4-13zM4.854 4.146a.5.5 0 0 1 0 .708L1.707 8l3.147 3.146a.5.5 0 0 1-.708.708l-3.5-3.5a.5.5 0 0 1 0-.708l3.5-3.5a.5.5 0 0 1 .708 0zm6.292 0a.5.5 0 0 0 0 .708L14.293 8l-3.147 3.146a.5.5 0 0 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 0 0-.708 0z"/>
          </svg>

      </li>
      <li class="nav-item">

          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-window-sidebar" viewBox="0 0 16 16">
            <path d="M2.5 4a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zm2-.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm1 .5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1z"/>
            <path d="M2 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2H2zm12 1a1 1 0 0 1 1 1v2H1V3a1 1 0 0 1 1-1h12zM1 13V6h4v8H2a1 1 0 0 1-1-1zm5 1V6h9v7a1 1 0 0 1-1 1H6z"/>
          </svg>

      </li>
    </ul>
    <div class="dropdown">

        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
          <path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
          <path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
        </svg>

      <ul class="dropdown-menu text-small shadow" aria-labelledby="dropdownUser3">
        <li>New project...</li>
        <li>Settings</li>
        <li>Profile</li>
      </ul>
    </div>
  </div>
</nav>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script></code>```

Body:
I have a vertical navbar, but it transforms to a horizontal one with a dropdown that doesn't work.

Hello! I'm pretty new to using bootstrap and such, but I need to use it for a project. I wanted to do a vertical sidebar for my website so I followed a tutorial I've found online, and so far it worked great with all its items working perfectly. The problem comes when I try to simulate a mobile/low resolution version of the website.

The vertical navbar transforms to a horizontal one. I don't have a problem with that. The thing is that it also transforms all my links to a dropdown menu, and when I try to click on it it just doesn't work. Also, this navbar I want it's an icons-only navbar, so I guess that also is going to be a problem with a dropdown menu.

I don't have a problem with a horizontal navbar in the mobile version, but I would like if it has the icons instead of a dropdown menu. How can I achieve this? Thanks!

.navbar svg {
  width: 50px;
  height: 50px;
  margin: 20px;
}

.nav-item svg {
  width: 35px;
  height: 35px;
  margin: 15px;
}

.nav-item svg:hover {
  color: #e99e8d;
  transition: all .4s ease;
  -webkit-transition: all .8s ease;
}

.dropdown svg {
  width: 35px;
  height: 35px;
  margin: 20px;
  margin-left: 0px;
}

@media (min-width: 992px) {
  .navbar,
  .navbar-collapse {
    flex-direction: column;
  }
  .navbar-expand-lg .navbar-nav {
    flex-direction: column;
  }
  .navbar {
    width: 8%;
    height: 100vh;
    align-items: flex-start;
  }
  .navbar-brand {
    margin-left: 0.5em;
    padding-bottom: 0;
    border-bottom: 4px solid #464646;
  }
  form input {
    margin-bottom: 0.7em;
  }
}

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">

    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star-half" viewBox="0 0 16 16">
    <path d="M5.354 5.119 7.538.792A.516.516 0 0 1 8 .5c.183 0 .366.097.465.292l2.184 4.327 4.898.696A.537.537 0 0 1 16 6.32a.548.548 0 0 1-.17.445l-3.523 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256a.52.52 0 0 1-.146.05c-.342.06-.668-.254-.6-.642l.83-4.73L.173 6.765a.55.55 0 0 1-.172-.403.58.58 0 0 1 .085-.302.513.513 0 0 1 .37-.245l4.898-.696zM8 12.027a.5.5 0 0 1 .232.056l3.686 1.894-.694-3.957a.565.565 0 0 1 .162-.505l2.907-2.77-4.052-.576a.525.525 0 0 1-.393-.288L8.001 2.223 8 2.226v9.8z"/>
    </svg>

  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

  </button>

         <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house" viewBox="0 0 16 16">
          <path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.707 1.5ZM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5 5 5Z"/>
        </svg>

        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pass" viewBox="0 0 16 16">
          <path d="M5.5 5a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1h-5Zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3Z"/>
          <path d="M8 2a2 2 0 0 0 2-2h2.5A1.5 1.5 0 0 1 14 1.5v13a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 14.5v-13A1.5 1.5 0 0 1 3.5 0H6a2 2 0 0 0 2 2Zm0 1a3.001 3.001 0 0 1-2.83-2H3.5a.5.5 0 0 0-.5.5v13a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5v-13a.5.5 0 0 0-.5-.5h-1.67A3.001 3.001 0 0 1 8 3Z"/>
        </svg>

          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-briefcase" viewBox="0 0 16 16">
            <path d="M6.5 1A1.5 1.5 0 0 0 5 2.5V3H1.5A1.5 1.5 0 0 0 0 4.5v8A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-8A1.5 1.5 0 0 0 14.5 3H11v-.5A1.5 1.5 0 0 0 9.5 1h-3zm0 1h3a.5.5 0 0 1 .5.5V3H6v-.5a.5.5 0 0 1 .5-.5zm1.886 6.914L15 7.151V12.5a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5V7.15l6.614 1.764a1.5 1.5 0 0 0 .772 0zM1.5 4h13a.5.5 0 0 1 .5.5v1.616L8.129 7.948a.5.5 0 0 1-.258 0L1 6.116V4.5a.5.5 0 0 1 .5-.5z"/>
          </svg>

          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-code-slash" viewBox="0 0 16 16">
            <path d="M10.478 1.647a.5.5 0 1 0-.956-.294l-4 13a.5.5 0 0 0 .956.294l4-13zM4.854 4.146a.5.5 0 0 1 0 .708L1.707 8l3.147 3.146a.5.5 0 0 1-.708.708l-3.5-3.5a.5.5 0 0 1 0-.708l3.5-3.5a.5.5 0 0 1 .708 0zm6.292 0a.5.5 0 0 0 0 .708L14.293 8l-3.147 3.146a.5.5 0 0 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 0 0-.708 0z"/>
          </svg>

          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-window-sidebar" viewBox="0 0 16 16">
            <path d="M2.5 4a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zm2-.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm1 .5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1z"/>
            <path d="M2 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2H2zm12 1a1 1 0 0 1 1 1v2H1V3a1 1 0 0 1 1-1h12zM1 13V6h4v8H2a1 1 0 0 1-1-1zm5 1V6h9v7a1 1 0 0 1-1 1H6z"/>
          </svg>

        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
          <path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
          <path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
        </svg>

New project...

Settings

Profile


问:
How to count number of times volume is below average within the past x number of bars?
Noob here. Like the title states, I'm trying to count the number of times with volume below average within the past x number of bars.

I have already created an indicator to show which bars are below average, but unable to figure out how to count.

Thanks in advance.


问:
I can't get user input from the test class in main
```<code>import java.util.Scanner;
public class Main {
    public static void main(String[] args)
    {

        Scanner sc = new Scanner(System.in);

        test[] t = new test[3];
        for (int i = 0;i<t.length;i++)
        {

            System.out.println("\nEnter name "+(i+1)+" : ");
            t[i].setName(sc.next());
            System.out.println("Enter studentID : ");
            t[i].setStudenid(sc.next());
            System.out.println("Enter phone number : ");
            t[i].setPhonenumber(sc.nextInt());
        }

        for (int i = 0;i<t.length;i++)
        {
            System.out.println("Name "+(i+1)+" : "+t[i].getName());
            System.out.println("Student ID  : "+t[i].getStudenid());
            System.out.println("Phone number : "+t[i].getStudenid());
        }

    }
}
</code>```
```<code>public class test {

    private String name ;
    private String studenid;
    private int phonenumber;

    public test(String name, String studenid, int phonenumber) {
        this.name = name;
        this.studenid = studenid;
        this.phonenumber = phonenumber;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStudenid() {
        return studenid;
    }

    public void setStudenid(String studenid) {
        this.studenid = studenid;
    }

    public int getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(int phonenumber) {
        this.phonenumber = phonenumber;
    }
}
</code>```

when i run, it says
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "trying.test.setName(String)" because "t[i]" is null
at trying.Main.main(Main.java:14)
i want to get user input for test class and it is array.
I already try many solution but still the same

Body:
import java.util.Scanner;
public class Main {
    public static void main(String[] args)
    {

        Scanner sc = new Scanner(System.in);

        test[] t = new test[3];
        for (int i = 0;i<t.length;i++)
        {

            System.out.println("\nEnter name "+(i+1)+" : ");
            t[i].setName(sc.next());
            System.out.println("Enter studentID : ");
            t[i].setStudenid(sc.next());
            System.out.println("Enter phone number : ");
            t[i].setPhonenumber(sc.nextInt());
        }

        for (int i = 0;i<t.length;i++)
        {
            System.out.println("Name "+(i+1)+" : "+t[i].getName());
            System.out.println("Student ID  : "+t[i].getStudenid());
            System.out.println("Phone number : "+t[i].getStudenid());
        }

    }
}

public class test {

    private String name ;
    private String studenid;
    private int phonenumber;

    public test(String name, String studenid, int phonenumber) {
        this.name = name;
        this.studenid = studenid;
        this.phonenumber = phonenumber;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStudenid() {
        return studenid;
    }

    public void setStudenid(String studenid) {
        this.studenid = studenid;
    }

    public int getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(int phonenumber) {
        this.phonenumber = phonenumber;
    }
}

when i run, it says
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "trying.test.setName(String)" because "t[i]" is null
at trying.Main.main(Main.java:14)
i want to get user input for test class and it is array.
I already try many solution but still the same


问:
what different edge color in tez-ui's DAG means？gray，yellow。

In the above pic, you can see two different edge color, yellow(map11 to reduce4) and gray(map9 to gray reduce4), what the difference betweent these two.


问:
Find the index of elements calssified in each bin of histogram
I want to create a histogram using one column of my data and then find what is the index of elements classified in each bin.

The sample table is as follows:

name
n_7
n_6

a
20
11

b
14
50

c
18
21

d
11
4

I want to make a histogram based on column n_7 and then find which names are included in each bin of my histogram. For example, the first bin will include 280 elements of the n_7 column and I want to know what is the name of those elements based on the name column.

The following code creates the histogram:

counts, binEdges = np.histogram(df2.n_7,bins=6)
```


问:
Flutter: Null check operator used on a null value
Am a bit stuck and confused, I have this definition,

```<code> Map<int, num> totalPerSection = new Map<int, int>();
</code>```

and a call to it like

```<code>String getPercentage(int section) {
    log("getPercentage($section) called");

    num percent = 0;

    try {
      var secCurr = section;
      var total = totalPerSection[secCurr]!;
      log("getTotalPerSection($total) called");
      percent = (scores[secCurr] ?? 0 / total) * 100;
    } on NoSuchMethodError catch (_) { }
</code>```

the strange thing am facing is that var secCurr = section; has a value but whenever I try to access the secCurr value on this line  var total = totalPerSection[secCurr]!;, this value returns back null. What am I missing it, or what am I doing wrong? Any help is appreciated

Body:
Am a bit stuck and confused, I have this definition,

 Map<int, num> totalPerSection = new Map<int, int>();

and a call to it like

String getPercentage(int section) {
    log("getPercentage($section) called");

    num percent = 0;

    try {
      var secCurr = section;
      var total = totalPerSection[secCurr]!;
      log("getTotalPerSection($total) called");
      percent = (scores[secCurr] ?? 0 / total) * 100;
    } on NoSuchMethodError catch (_) { }

the strange thing am facing is that var secCurr = section; has a value but whenever I try to access the secCurr value on this line  var total = totalPerSection[secCurr]!;, this value returns back null. What am I missing it, or what am I doing wrong? Any help is appreciated


问:
MongoDB Atlas What is the latency in ms?
I'm considering using MongoDB Atlas with GCP, is the Latency of this published?

If it is publicly available, I would like to know.

Best regard!!

I looked at the official website and Whitepaper.


问:
Memory Leak in Robot Framework?
I am working with RF.
When I have 2 resource files with same name of Variables (but different in value). Each resource file has Method to log the current variable.
My problem is with the test cases, this test case import 2 resource files. When this test case do the method of the 2nd resource. It takes the data of the 1st resource. How this happen?

Code:

Resource1.resource

```<code>*** Variables ***
${VAR1}     Test 1
${VAR2}     Test 2

*** Keywords ***
Log The Var 1 1
    Log To Console    ${VAR1}

Log The Var 2 1
    Log To Console    ${VAR2}
</code>```

Resource2.resource

```<code>*** Variables ***
${VAR1}     Test 3
${VAR2}     Test 3

*** Keywords ***
Log The Var 1 2
    Log To Console    ${VAR1}

Log The Var 2 2
    Log To Console    ${VAR2}
</code>```

Test.robot

```<code>*** Settings ***
Resource    ../resources/Resource1.resource
Resource    ../resources/Resource2.resource

*** Test Cases ***
Test The Dup Thing

    Log The Var 1 1
    Log The Var 2 1

    Log The Var 1 2
    Log The Var 2 2
</code>```

=> Output:
Test 1
Test 2
Test 1
Test 2

I don't know how this happen, seem like memory leak.

Title: Memory Leak in Robot Framework?

Body:
I am working with RF.
When I have 2 resource files with same name of Variables (but different in value). Each resource file has Method to log the current variable.
My problem is with the test cases, this test case import 2 resource files. When this test case do the method of the 2nd resource. It takes the data of the 1st resource. How this happen?

Code:

Resource1.resource

*** Variables ***
${VAR1}     Test 1
${VAR2}     Test 2

*** Keywords ***
Log The Var 1 1
    Log To Console    ${VAR1}

Log The Var 2 1
    Log To Console    ${VAR2}

Resource2.resource

*** Variables ***
${VAR1}     Test 3
${VAR2}     Test 3

*** Keywords ***
Log The Var 1 2
    Log To Console    ${VAR1}

Log The Var 2 2
    Log To Console    ${VAR2}

Test.robot

*** Settings ***
Resource    ../resources/Resource1.resource
Resource    ../resources/Resource2.resource

*** Test Cases ***
Test The Dup Thing

    Log The Var 1 1
    Log The Var 2 1

    Log The Var 1 2
    Log The Var 2 2

=> Output:
Test 1
Test 2
Test 1
Test 2

I don't know how this happen, seem like memory leak.


问:
Ubuntu, dotnet run works, but executing the output binary says you must install .NET
Ubuntu 22.04. I installed .NET 7 SDK from MS repository. I created a project using dotnet new console, and dotnet run outputs Hello, world!, but if I navigate to the output directory and run the app directly, it says install .NET. What is wrong?

PS: After posting this, I have noticed that DOTNET_ROOT is /usr/lib/dotnet, and dotnet is in /usr/share/dotnet. Is that the cause? But I did not set the variable manually, so I do not know where the variable DOTNET_ROOT is defined. I have searched all the relevant profile files in my home directory or under /etc, but I could not find DOTNET_ROOT.

```<code>~/dottest/bin/Debug/net7.0$ ./dottest
You must install .NET to run this application.

App: /home/test/dottest/bin/Debug/net7.0/dottest
Architecture: x64
App host version: 7.0.1
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=7.0.1
</code>```

Output of dotnet --info

```<code>.NET SDK:
 Version:   7.0.101
 Commit:    bb24aafa11

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         ubuntu.22.04-x64
 Base Path:   /usr/share/dotnet/sdk/7.0.101/

Host:
  Version:      7.0.1
  Architecture: x64
  Commit:       97203d38ba

.NET SDKs installed:
  7.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/lib/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
</code>```

Body:
Ubuntu 22.04. I installed .NET 7 SDK from MS repository. I created a project using dotnet new console, and dotnet run outputs Hello, world!, but if I navigate to the output directory and run the app directly, it says install .NET. What is wrong?

PS: After posting this, I have noticed that DOTNET_ROOT is /usr/lib/dotnet, and dotnet is in /usr/share/dotnet. Is that the cause? But I did not set the variable manually, so I do not know where the variable DOTNET_ROOT is defined. I have searched all the relevant profile files in my home directory or under /etc, but I could not find DOTNET_ROOT.

~/dottest/bin/Debug/net7.0$ ./dottest
You must install .NET to run this application.

App: /home/test/dottest/bin/Debug/net7.0/dottest
Architecture: x64
App host version: 7.0.1
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=7.0.1

Output of dotnet --info

.NET SDK:
 Version:   7.0.101
 Commit:    bb24aafa11

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         ubuntu.22.04-x64
 Base Path:   /usr/share/dotnet/sdk/7.0.101/

Host:
  Version:      7.0.1
  Architecture: x64
  Commit:       97203d38ba

.NET SDKs installed:
  7.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/lib/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download


问:
How to fix ObjectMapper can't response well when get error response from other API
With Swagger and Spring Boot.

```<code>// Here are dependency of Swagger
<dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.2.32</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0</version>
        </dependency>
</code>```

I meet a problem when I want to use objectMapper to make my response order by models and show upper-letter not default camel-style.

For example,

The Response is designed as below

```<code>public class XXXXResponse {
    private BigDecimal FOBBB; #1
    private BigDecimal FOAAA; #2

    public BigDecimal getFOBBB() {
    }
    .
    .
    .
}
</code>```

AND response in Swagger with default configuration shows:

```<code>{
"foaaa":0,
"fobbb":0
}
</code>```

So, I use ObjectMapper to turn them to below, which order by my model design and names  same as declared in Response.java:

```<code>{
"FOBBB":0,
"FOAAA":0
}
</code>```

Cause there are so many API need to use this style as response, I tend to use Global Configuration to figure out it.

As below is my code when I execute API initial.

```<code>@SpringBootApplication
@RestController
@EnableAutoConfiguration(exclude = { XXXX.class })
@OpenAPIDefinition(info = @Info(title = "XXXXX", version = "1.0", description = "XXX service api"))
public class Launcher {
 @Bean
    public ObjectMapper objectMapper() {
        ObjectMapper settingResponse = new ObjectMapper();
        settingResponse.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
        settingResponse.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
        return settingResponse;

    }
</code>```

It works well in common situation.

BUT I find there is a problem when I use API A, which needs to use some result from API B, i.g. API A need to use the username list from the result of API B to do more search. If API B gets the null response, it cannot put  error message from API B back to API A.

And API A will return

```<code>{
    "status": {
        "statusCode": "50001",
        "severity": "FAILED",
        "statusDesc": "System Error",
        "statusTime": null
    }
}
</code>```

And There is an error from Spring boot.

```<code>Cannot invoke "String.equals(Object)" because the return value of "APIBResponse.getERRMSG()" is null
</code>```

I would like to know how I can fix this issue when I meet the API needs to work with other APIs and needs to return the error message back.

Thank you.

Body:
With Swagger and Spring Boot.

// Here are dependency of Swagger
<dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.2.32</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0</version>
        </dependency>

I meet a problem when I want to use objectMapper to make my response order by models and show upper-letter not default camel-style.

For example,

The Response is designed as below

public class XXXXResponse {
    private BigDecimal FOBBB; #1
    private BigDecimal FOAAA; #2

    public BigDecimal getFOBBB() {
    }
    .
    .
    .
}

AND response in Swagger with default configuration shows:

{
"foaaa":0,
"fobbb":0
}

So, I use ObjectMapper to turn them to below, which order by my model design and names  same as declared in Response.java:

{
"FOBBB":0,
"FOAAA":0
}

Cause there are so many API need to use this style as response, I tend to use Global Configuration to figure out it.

As below is my code when I execute API initial.

@SpringBootApplication
@RestController
@EnableAutoConfiguration(exclude = { XXXX.class })
@OpenAPIDefinition(info = @Info(title = "XXXXX", version = "1.0", description = "XXX service api"))
public class Launcher {
 @Bean
    public ObjectMapper objectMapper() {
        ObjectMapper settingResponse = new ObjectMapper();
        settingResponse.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
        settingResponse.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
        return settingResponse;

    }

It works well in common situation.

BUT I find there is a problem when I use API A, which needs to use some result from API B, i.g. API A need to use the username list from the result of API B to do more search. If API B gets the null response, it cannot put  error message from API B back to API A.

And API A will return

{
    "status": {
        "statusCode": "50001",
        "severity": "FAILED",
        "statusDesc": "System Error",
        "statusTime": null
    }
}

And There is an error from Spring boot.

Cannot invoke "String.equals(Object)" because the return value of "APIBResponse.getERRMSG()" is null

I would like to know how I can fix this issue when I meet the API needs to work with other APIs and needs to return the error message back.

Thank you.


问:
Trying to build My UE5 C++ Project in Visual Studio Code - it doesn't build in Visual Studio Code but builds in Visual Studio 2019 and UE Live Code
The project I'm working on in Visual Studio Code builds fine when you use the Live Code from The Unreal Editor but if you try to build from Visual Studio you get this in the terminal...

'C:\Program' is not recognized as an internal or external command,

operable program or batch file.

I'm assuming it is choking on the space in C:\Program Files    (however that is a standard space in that Windows created directory so I can't change it without breaking links for countless other files in that directory). As well when you build from Unreal it doesn't choke on that space - so I'm wondering if anyone knows how to "ignore" the spaces. And since Visual Studio 2019 has no issues building that project - it must have some setting that is also ignoring the spaces. Thanks in advance.

(it doesn't seem to fail - it just seems to soft lock? the "thinking spinner" just keeps spinning and it never seems to complete the build task).

I brought the same project into Visual Studio 2019 and it builds fine, however I can't get Unreal's Live Code to link with 2019 so I'm just trying to get this working in Visual Studio Code since Live Code works great with it.


问:
Gradle task to add new line at end of JSON files in a Kotlin Spring project?
In my team we are working with a Kotlin Spring project and we have a few json resources. We are using detekt and ktlint to validate and format our code, but those do not assert rules for json files.

Is there any task or plugin that automatically assert styles for json, so we can use it as a pre commit hook?

Thanks in advance.


问:
Getting error while using defer in countdown timer
I am making a timer which goes 5:00, 4:59...0:00.

Getting many errors while using defer,

Property 'pipe' does not exist on type 'void' at pipe(switchMap...

Expected 1 arguments, but got 2. at takeWhile

, expected in few places in ngOnInit

A 'this' parameter must be the first parameter at !this.duration

No overload matches this call.
The last overload gave the following error.
Argument of type '{ throw: Error; }' is not assignable to parameter of type 'OperatorFunction<unknown, unknown>'.
Object literal may only specify known properties, and 'throw' does not exist in type 'OperatorFunction<unknown, unknown>'.

```<code>time$ = timer(0, 1000).pipe(
  defer(of(this.duration)).pipe(switchMap(duration => timer(0, 1000).pipe(map(n => duration - n)),
  takeWhile(n => n >0),
  ),
  ngOnInit(): void {
    if (!this.duration) {
      throw new Error('duration is required')
    }
  }
}
</code>```

Body:
I am making a timer which goes 5:00, 4:59...0:00.

Getting many errors while using defer,

Property 'pipe' does not exist on type 'void' at pipe(switchMap...

Expected 1 arguments, but got 2. at takeWhile

, expected in few places in ngOnInit

A 'this' parameter must be the first parameter at !this.duration

No overload matches this call.
The last overload gave the following error.
Argument of type '{ throw: Error; }' is not assignable to parameter of type 'OperatorFunction<unknown, unknown>'.
Object literal may only specify known properties, and 'throw' does not exist in type 'OperatorFunction<unknown, unknown>'.

time$ = timer(0, 1000).pipe(
  defer(of(this.duration)).pipe(switchMap(duration => timer(0, 1000).pipe(map(n => duration - n)),
  takeWhile(n => n >0),
  ),
  ngOnInit(): void {
    if (!this.duration) {
      throw new Error('duration is required')
    }
  }
}


问:
In a Python Plotly bar chart with two y-axes, how do I add horizontal lines using values from both y-axes?
I created a graph object bar chart that has two different y-axes so that I can chart two different of different units for each category. However, now I'd like to add two horizontal lines. They won't be using values from the same y-axis though.

```<code>fig = go.Figure(
    data=[
        go.Bar(name='Bar 1',
               x=category_x,
               y=measure_1,
               yaxis='y',
               offsetgroup=1),
        go.Bar(name='Bar 2',
               x=category_x,
               y=measure_2,
               yaxis='y2',
               offsetgroup=2)
    ]
)
</code>```

Things look fine up to here.

Now, I'd like to add one horizontal line based off values from the first y-axis and another horizontal line based off values from the second y-axis. I tried using fig.add_hline() for this, but then both horizontal lines are displayed using values from the first y-axis. What should I be doing instead?

Body:
I created a graph object bar chart that has two different y-axes so that I can chart two different of different units for each category. However, now I'd like to add two horizontal lines. They won't be using values from the same y-axis though.

fig = go.Figure(
    data=[
        go.Bar(name='Bar 1',
               x=category_x,
               y=measure_1,
               yaxis='y',
               offsetgroup=1),
        go.Bar(name='Bar 2',
               x=category_x,
               y=measure_2,
               yaxis='y2',
               offsetgroup=2)
    ]
)

Things look fine up to here.

Now, I'd like to add one horizontal line based off values from the first y-axis and another horizontal line based off values from the second y-axis. I tried using fig.add_hline() for this, but then both horizontal lines are displayed using values from the first y-axis. What should I be doing instead?


问:
How can you find the maximum nth integer in a list in python?
From a random list I created through a function, how can I create a function that checks the list for an nth maximum which is an input from the user? I have my first function that creates the list and everything completed. But I can't find a way to write a program that finds the nth maximum, I asked this question before but it is always mistaken as find the first three maximums or create a function just to find the max or second max, etc. But it can be any maximum in the list. I tried the method of sorting it in a list and pulling out the nth max from there but it didn't go through...

For Example:

If the list has the values 1 3 7 2 15 20 5 18 11 and the user wanted the:

1st Maximum (n = 1)  -> It would return 20 (the highest number)

2nd Maximum (n = 2) -> It would return 18 (the second highest number)

3rd Maximum (n = 3) -> It would return 15 (the third highest number)