问:
Spring boot app start up hibernate exception :GenerationTarget encountered exception accepting command
I have a spring boot app. And I am connecting to postgres db.

Here is my properties file (hibernate specific props):

```<code># Hibernate specific entries
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update
hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql: true
#hibernate.format_sql=true
#hibernate.default_schema=operations
</code>```

When I am running my app it runs fine... however in the logs i can see some WARNINGS and not ERROR like below :

App Log:

```<code>GenerationTarget encountered exception accepting command :
Error executing DDL "alter table if exists <table_name> add column role_id int4 not null" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException:
Error executing DDL "alter table if exists <table_name> add column role_id int4 not null" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]

.....

Caused by: org.postgresql.util.PSQLException: ERROR: column "role_id" contains null values
</code>```

My table structure :

I am using composite PK as @Embeddable and using that id in my entity class.

```<code>@Embeddable
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@Getter
@Setter
public class IdPK implements Serializable {

    private Integer roleId;
    private String  roleName;

}

@Entity
@Table(name = "my_table")
@Getter
@Setter
@NoArgsConstructor
@ToString
public class MyTable{

    @EmbeddedId
    private IdPK idpk ;

}
</code>```

The error is logged during start up, however there is no issue with the app.

What I have tried :

I have tried using the annotation in both the composite PK class and the entity class but they dont have any effect. The error still persists.

```<code>@NonNull // lombok
@Column(name = roleid, nullable = false)
</code>```

I want to add that I am using flyway scripts to migrate the db schemas.
I am adding my relevant table create schema as well :

```<code>-- Table: public.my_table
DROP TABLE IF EXISTS public.my_table;

CREATE TABLE IF NOT EXISTS public.my_table
(
    roleid integer NOT NULL,
    rolename character varying(100) COLLATE pg_catalog."default",
)

TABLESPACE pg_default;

-- ALTER TABLE IF EXISTS public.my_table;
</code>```

And this is how table is actually created in the db :

```<code>-- Table: public.my_table
DROP TABLE IF EXISTS public.my_table;

CREATE TABLE IF NOT EXISTS public.my_table
(
    roleid integer NOT NULL,
    rolename character varying(100) COLLATE pg_catalog."default",
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.my_table OWNER to postgres;
</code>```

UPDATE:

Table entries :

```<code>roleid   |   rolename
1        |   "RM"
2        |   "SM"
3        |   "DM"
</code>```

Observation:

Also I did not understand this line in the error :

```<code>ERROR: column "role_id" contains null values
</code>```

Where the column name is actually roleid  AND NOT role_id.

I have searched for this issue, and there were different solutions in StackOverflow, however none is able to fix this one. Can anyone help me out on this error, how to fix them. I am getting these same errors for 3 other tables with similar setup. Am I missing any particular configuration.

Body:
I have a spring boot app. And I am connecting to postgres db.

Here is my properties file (hibernate specific props):

# Hibernate specific entries
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update
hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql: true
#hibernate.format_sql=true
#hibernate.default_schema=operations

When I am running my app it runs fine... however in the logs i can see some WARNINGS and not ERROR like below :

App Log:

GenerationTarget encountered exception accepting command :
Error executing DDL "alter table if exists <table_name> add column role_id int4 not null" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException:
Error executing DDL "alter table if exists <table_name> add column role_id int4 not null" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.6.10.Final.jar!/:5.6.10.Final]

.....

Caused by: org.postgresql.util.PSQLException: ERROR: column "role_id" contains null values

My table structure :

I am using composite PK as @Embeddable and using that id in my entity class.

@Embeddable
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@Getter
@Setter
public class IdPK implements Serializable {

    private Integer roleId;
    private String  roleName;

}

@Entity
@Table(name = "my_table")
@Getter
@Setter
@NoArgsConstructor
@ToString
public class MyTable{

    @EmbeddedId
    private IdPK idpk ;

}

The error is logged during start up, however there is no issue with the app.

What I have tried :

I have tried using the annotation in both the composite PK class and the entity class but they dont have any effect. The error still persists.

@NonNull // lombok
@Column(name = roleid, nullable = false)

I want to add that I am using flyway scripts to migrate the db schemas.
I am adding my relevant table create schema as well :

-- Table: public.my_table
DROP TABLE IF EXISTS public.my_table;

CREATE TABLE IF NOT EXISTS public.my_table
(
    roleid integer NOT NULL,
    rolename character varying(100) COLLATE pg_catalog."default",
)

TABLESPACE pg_default;

-- ALTER TABLE IF EXISTS public.my_table;

And this is how table is actually created in the db :

-- Table: public.my_table
DROP TABLE IF EXISTS public.my_table;

CREATE TABLE IF NOT EXISTS public.my_table
(
    roleid integer NOT NULL,
    rolename character varying(100) COLLATE pg_catalog."default",
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.my_table OWNER to postgres;

UPDATE:

Table entries :

roleid   |   rolename
1        |   "RM"
2        |   "SM"
3        |   "DM"

Observation:

Also I did not understand this line in the error :

ERROR: column "role_id" contains null values

Where the column name is actually roleid  AND NOT role_id.

I have searched for this issue, and there were different solutions in StackOverflow, however none is able to fix this one. Can anyone help me out on this error, how to fix them. I am getting these same errors for 3 other tables with similar setup. Am I missing any particular configuration.


来源: stackexchange

问:
how to split 'number' to separate columns in vaex DataFrame
In pandas we can split 'number' column to multiple columns, such as this example. Is it possible to do in vaex dataframe? In below simple example col_1 is empty!

```<code>df = vaex.from_arrays(x = [10000, 100001, 100002, 100003, 100004, 100005, 100006, 100007, 100008, 100009])
df['col'] = df['x'].astype("S")
df['col_1'] = df['col'].str.slice(3,6)
</code>```

ContentLicense: CC BY-SA 4.0

Body:
In pandas we can split 'number' column to multiple columns, such as this example. Is it possible to do in vaex dataframe? In below simple example col_1 is empty!

df = vaex.from_arrays(x = [10000, 100001, 100002, 100003, 100004, 100005, 100006, 100007, 100008, 100009])
df['col'] = df['x'].astype("S")
df['col_1'] = df['col'].str.slice(3,6)


问:
Idiomatic way to optionally add one item to an iterator?
I'd like to take an iterator from a Vec and sometimes include an additional item outside the Vec without constructing a new vector.

I figured I could combine .chain() and std::iter::once, but of course, the return types then differ.

```<code>fn a(append: &str) {
    let pieces = vec!["a", "b", "c"];
    let myiter = pieces.iter();
    if append != "" {
        myiter = myiter.chain(std::iter::once(&append));
    }
    for s in myiter {
        println!("{}", s);
    }
}
</code>```

No matter what I try, I can't seem to find a type that works for this case.

Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=52b281beade8b882be9adbc5bd2a9e4a

Body:
I'd like to take an iterator from a Vec and sometimes include an additional item outside the Vec without constructing a new vector.

I figured I could combine .chain() and std::iter::once, but of course, the return types then differ.

fn a(append: &str) {
    let pieces = vec!["a", "b", "c"];
    let myiter = pieces.iter();
    if append != "" {
        myiter = myiter.chain(std::iter::once(&append));
    }
    for s in myiter {
        println!("{}", s);
    }
}

No matter what I try, I can't seem to find a type that works for this case.

Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=52b281beade8b882be9adbc5bd2a9e4a


问:
Column shift when moving - colReorder Datatable
I am trying to implement the "colReorder" option in DataTable JS.
Here is the table declaration:
`

```<code>var dataTable = $('#table_taches').DataTable({
    "lengthChange": true, "autoWidth": true, "sScrollX": "150%",
    "sScrollXInner": "150%",
    "scrollY": 420,
    "bScrollCollapse": false,
    colReorder: {
        fixedColumnsLeft: 1,
        realtime: false
    },
    columns: [
    { data: "0" },
    { data: "1" },
    { data: "2" },
    { data: "3" },
    { data: "4" },
    { data: "5" },
    { data: "6" },
    { data: "7" },
    { data: "8" },
    { data: "9" },
    { data: "10" },
    { data: "11" },
    { data: "12" },
    { data: "13" },
    { data: "14" },
    { data: "15" },
    { data: "16" },
    { data: "17" },
    { data: "18" },
    { data: "19" },
    { data: "20" },
    { data: "21" },
    { data: "22" },
    { data: "23" },
    { data: "24" },
    { data: "25" },
    { data: "26" },
    { data: "27" },
    { data: "28" },
    { data: "29" },
    { data: "30" },
    { data: "31" },
    { data: "32" },
    { data: "33" },
    { data: "34" },
    { data: "35" },
  ],

    "stateSave": false,
    "stateSaveCallback": function(settings,data) {
      localStorage.setItem( 'DataTables_' + settings.sInstance, JSON.stringify(data) )
    },
    "stateLoadCallback": function(settings) {
    return JSON.parse( localStorage.getItem( 'DataTables_' + settings.sInstance ) )
    },
    "processing" : true,
    "serverSide" : true,
    "order" : [],
    "ajax" : {
     url: "<?php echo base_url();?>/config/taches/fetch.php",
     type:"POST"
    },
    "oLanguage": {
      "sSearch": "Recherche globale"
    },
    "pageLength" : 5,
    "lengthMenu": [ 5, 25, 50, 75, 100, 200, 500],
    "columnDefs": [ {
      "targets": 0,
      "orderable": false
    } ]
   });
</code>```

`

When I try to move one of my columns, only the header follows. The values in the table do not follow :
enter image description here
It looks like there is an offset of one column.

How can I fix this problem?
Thank you!

Search for all options available on the DataTable + StackOverFlow forum.

Body:
I am trying to implement the "colReorder" option in DataTable JS.
Here is the table declaration:
`

var dataTable = $('#table_taches').DataTable({
    "lengthChange": true, "autoWidth": true, "sScrollX": "150%",
    "sScrollXInner": "150%",
    "scrollY": 420,
    "bScrollCollapse": false,
    colReorder: {
        fixedColumnsLeft: 1,
        realtime: false
    },
    columns: [
    { data: "0" },
    { data: "1" },
    { data: "2" },
    { data: "3" },
    { data: "4" },
    { data: "5" },
    { data: "6" },
    { data: "7" },
    { data: "8" },
    { data: "9" },
    { data: "10" },
    { data: "11" },
    { data: "12" },
    { data: "13" },
    { data: "14" },
    { data: "15" },
    { data: "16" },
    { data: "17" },
    { data: "18" },
    { data: "19" },
    { data: "20" },
    { data: "21" },
    { data: "22" },
    { data: "23" },
    { data: "24" },
    { data: "25" },
    { data: "26" },
    { data: "27" },
    { data: "28" },
    { data: "29" },
    { data: "30" },
    { data: "31" },
    { data: "32" },
    { data: "33" },
    { data: "34" },
    { data: "35" },
  ],

    "stateSave": false,
    "stateSaveCallback": function(settings,data) {
      localStorage.setItem( 'DataTables_' + settings.sInstance, JSON.stringify(data) )
    },
    "stateLoadCallback": function(settings) {
    return JSON.parse( localStorage.getItem( 'DataTables_' + settings.sInstance ) )
    },
    "processing" : true,
    "serverSide" : true,
    "order" : [],
    "ajax" : {
     url: "<?php echo base_url();?>/config/taches/fetch.php",
     type:"POST"
    },
    "oLanguage": {
      "sSearch": "Recherche globale"
    },
    "pageLength" : 5,
    "lengthMenu": [ 5, 25, 50, 75, 100, 200, 500],
    "columnDefs": [ {
      "targets": 0,
      "orderable": false
    } ]
   });

`

When I try to move one of my columns, only the header follows. The values in the table do not follow :
enter image description here
It looks like there is an offset of one column.

How can I fix this problem?
Thank you!

Search for all options available on the DataTable + StackOverFlow forum.


问:
The anti-forgery token could not be decrypted. AutoGenerate cannot be used in
I have a project I'm writing in .Net 4.5.2. I have deployed 5 copies of it to windows server with different names. And I'm logging in from a project. Later, when I try to login from other projects, I get this error.

"The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NET Web Pages and that the configuration specifies explicit encryption and validation keys. AutoGenerate cannot be used in a cluster."


问:
How to specify multiple appsettings files in ASPNETCORE_ENVIRONMENT
I would like to know if it is possible to specify multiple appsettings files within the ASPNETCORE_ENVIRONMENT environment variable - which is located in launchSettings.json file? Essentially, this is what I would like to achieve:

```<code>"profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": ["Development", "AddOn"]
      }
    }
  }
</code>```

Body:
I would like to know if it is possible to specify multiple appsettings files within the ASPNETCORE_ENVIRONMENT environment variable - which is located in launchSettings.json file? Essentially, this is what I would like to achieve:

"profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": ["Development", "AddOn"]
      }
    }
  }


问:
QtCharts: How to unify the size of QChart when some of them has axes labels

I want to plot multiple QChart like this. And I only want the first column to have axes labels. But the green parts (lines) are having different size. What can I do?

Here is what I did:

Create a lot of QChart. And put them inside QChartView then put QChartView in QVBoxLayout. Set minimal size to QChartView.

Create QValueAxis for each QChart

Except for the axes in the first column, the label is not displayed

```<code>if index != 0:
   axes.setLabelFormat(" ")
</code>```

The labels in the first column take space and make green parts narrower than others.That is not wanted

Body:
I want to plot multiple QChart like this. And I only want the first column to have axes labels. But the green parts (lines) are having different size. What can I do?

Here is what I did:

Create a lot of QChart. And put them inside QChartView then put QChartView in QVBoxLayout. Set minimal size to QChartView.

Create QValueAxis for each QChart

Except for the axes in the first column, the label is not displayed

if index != 0:
   axes.setLabelFormat(" ")

The labels in the first column take space and make green parts narrower than others.That is not wanted


问:
nginx: redirect when accept language is other than english
I have a multi-lingual website and want the URL schema to work like

```<code>https://example.com/            -> Load english version
https://example.com/path        -> Load english version
https://example.com/es/         -> Load spanish version
https://example.com/es/path     -> Load spanish version
</code>```

and using the nginx configuration

```<code>map $http_accept_language $accept_language {
    ~*^es es;
    ~*^en en;
}

server {
    server_name                  example.com;

    location /docs {
      alias                       /var/www/html/app-frontend/documentation/;
      try_files                   $uri$args $uri$args/ /docs/index.html;
    }

    # Fallback to default language if no preference defined by browser
    if ($accept_language ~ "^$") {
        set $accept_language "en";
    }

    # Redirect "/" to Angular application in the preferred language of the browser
    rewrite ^/$ /$accept_language/ permanent;

    # Everything under the Angular application is always redirected to Angular in the
    # correct language
    location / {
        alias /var/www/html/app-frontend/en-US/;
        index                     index.html;
        try_files                 $uri $uri/ /index.html = 404;
    }

    location /es/ {
        alias /var/www/html/app-frontend/es/;
        index                     index.html;
        try_files                 $uri $uri/ /index.html = 404;
    }
}
</code>```

I want the nginx to redirect to language code if the detected language is not english. But the above configuration, redirects to /en/ when the language detected is english.

How can I point the root path (without language code) to the english version?

Tried moving rewrite statement inside if check as follows

```<code>if ($accept_language !~ "en") {
        rewrite ^/$ /$accept_language/ permanent;
}

# rewrite ^/$ /$accept_language/ permanent;
</code>```

It works fine. But it looks like the configuration can be more optimized.

Body:
I have a multi-lingual website and want the URL schema to work like

https://example.com/            -> Load english version
https://example.com/path        -> Load english version
https://example.com/es/         -> Load spanish version
https://example.com/es/path     -> Load spanish version

and using the nginx configuration

map $http_accept_language $accept_language {
    ~*^es es;
    ~*^en en;
}

server {
    server_name                  example.com;

    location /docs {
      alias                       /var/www/html/app-frontend/documentation/;
      try_files                   $uri$args $uri$args/ /docs/index.html;
    }

    # Fallback to default language if no preference defined by browser
    if ($accept_language ~ "^$") {
        set $accept_language "en";
    }

    # Redirect "/" to Angular application in the preferred language of the browser
    rewrite ^/$ /$accept_language/ permanent;

    # Everything under the Angular application is always redirected to Angular in the
    # correct language
    location / {
        alias /var/www/html/app-frontend/en-US/;
        index                     index.html;
        try_files                 $uri $uri/ /index.html = 404;
    }

    location /es/ {
        alias /var/www/html/app-frontend/es/;
        index                     index.html;
        try_files                 $uri $uri/ /index.html = 404;
    }
}

I want the nginx to redirect to language code if the detected language is not english. But the above configuration, redirects to /en/ when the language detected is english.

How can I point the root path (without language code) to the english version?

Tried moving rewrite statement inside if check as follows

if ($accept_language !~ "en") {
        rewrite ^/$ /$accept_language/ permanent;
}

# rewrite ^/$ /$accept_language/ permanent;

It works fine. But it looks like the configuration can be more optimized.


问:
Redis Object Cache plugin not connecting on my wordpress site, WP version 6.1.1
I installed Redis Object cache plugin on my site and although it is giving page load times etc., in the menu bar it is in red and says not connected. The diagnostic logs is below. Is there a fix for this I can do as a lay person? Just wanted to speed up my site but if it needs a lot of knowledge of setting things up on my hostinger server, etc., I might abandon it. Thanks in advance.

Just wanted page load and query stats to make sure my site is loading fast. So I installed query monitor and it told me that there is no object caching happening. Then I installed Redis object cache but it is saying not connected.

`

```<code>
</code>```

Status: Not connected
Client:
Drop-in: Valid
Disabled: No
Ping:
Connection Exception: Connection refused [tcp://127.0.0.1:6379] (Predis\Connection\ConnectionException)
Errors: [
"Connection refused [tcp://127.0.0.1:6379]"
]
PhpRedis: Not loaded
Relay: Not loaded
Predis: 2.0.3
Credis: Not loaded
PHP Version: 7.4.32
Plugin Version: 2.2.2
Redis Version: Unknown
Multisite: No
Metrics: Disabled
Metrics recorded: 0
Filesystem: Working
Global Prefix: "wp_"
Blog Prefix: "wp_"
WP_REDIS_PREFIX: ")XSrcW>du$jnVN)Pg<Tlt4@840+:V(Q@2U#=n=<Z^c}JuA!<jh<hAp0/SJr1Y<"
WP_CACHE_KEY_SALT: ")XSrcW>du$jnVN)Pg<Tlt4@840+:V(Q@2U#=n=<Z^c}JuA!<jh<hAp0/SJr1Y<"
Global Groups: [
"blog-details",
"blog-id-cache",
"blog-lookup",
"global-posts",
"networks",
"rss",
"sites",
"site-details",
"site-lookup",
"site-options",
"site-transient",
"users",
"useremail",
"userlogins",
"usermeta",
"user_meta",
"userslugs",
"redis-cache"
]
Ignored Groups: [
"counts",
"plugins",
"themes",
"blog-details",
"blog-id-cache",
"blog-lookup",
"global-posts",
"networks",
"rss",
"sites",
"site-details",
"site-lookup",
"site-options",
"site-transient",
"users",
"useremail",
"userlogins",
"usermeta",
"user_meta",
"userslugs",
"redis-cache",
"blog_meta",
"wordfence",
"wordfence-ls"
]
Unflushable Groups: []
Groups Types: {
"blog-details": "ignored",
"blog-id-cache": "ignored",
"blog-lookup": "ignored",
"global-posts": "ignored",
"networks": "ignored",
"rss": "ignored",
"sites": "ignored",
"site-details": "ignored",
"site-lookup": "ignored",
"site-options": "ignored",
"site-transient": "ignored",
"users": "ignored",
"useremail": "ignored",
"userlogins": "ignored",
"usermeta": "ignored",
"user_meta": "ignored",
"userslugs": "ignored",
"redis-cache": "ignored",
"counts": "ignored",
"plugins": "ignored",
"themes": "ignored",
"blog_meta": "ignored",
"wordfence": "ignored",
"wordfence-ls": "ignored"
}
Drop-ins: [
"Query Monitor Database Class (Drop-in) v3.10.1 by John Blackbourn",
"Redis Object Cache Drop-In v2.2.2 by Till Krüss"
]

```<code>
</code>```

`

Body:
I installed Redis Object cache plugin on my site and although it is giving page load times etc., in the menu bar it is in red and says not connected. The diagnostic logs is below. Is there a fix for this I can do as a lay person? Just wanted to speed up my site but if it needs a lot of knowledge of setting things up on my hostinger server, etc., I might abandon it. Thanks in advance.

Just wanted page load and query stats to make sure my site is loading fast. So I installed query monitor and it told me that there is no object caching happening. Then I installed Redis object cache but it is saying not connected.

`

Status: Not connected
Client:
Drop-in: Valid
Disabled: No
Ping:
Connection Exception: Connection refused [tcp://127.0.0.1:6379] (Predis\Connection\ConnectionException)
Errors: [
"Connection refused [tcp://127.0.0.1:6379]"
]
PhpRedis: Not loaded
Relay: Not loaded
Predis: 2.0.3
Credis: Not loaded
PHP Version: 7.4.32
Plugin Version: 2.2.2
Redis Version: Unknown
Multisite: No
Metrics: Disabled
Metrics recorded: 0
Filesystem: Working
Global Prefix: "wp_"
Blog Prefix: "wp_"
WP_REDIS_PREFIX: ")XSrcW>du$jnVN)Pg<Tlt4@840+:V(Q@2U#=n=<Z^c}JuA!<jh<hAp0/SJr1Y<"
WP_CACHE_KEY_SALT: ")XSrcW>du$jnVN)Pg<Tlt4@840+:V(Q@2U#=n=<Z^c}JuA!<jh<hAp0/SJr1Y<"
Global Groups: [
"blog-details",
"blog-id-cache",
"blog-lookup",
"global-posts",
"networks",
"rss",
"sites",
"site-details",
"site-lookup",
"site-options",
"site-transient",
"users",
"useremail",
"userlogins",
"usermeta",
"user_meta",
"userslugs",
"redis-cache"
]
Ignored Groups: [
"counts",
"plugins",
"themes",
"blog-details",
"blog-id-cache",
"blog-lookup",
"global-posts",
"networks",
"rss",
"sites",
"site-details",
"site-lookup",
"site-options",
"site-transient",
"users",
"useremail",
"userlogins",
"usermeta",
"user_meta",
"userslugs",
"redis-cache",
"blog_meta",
"wordfence",
"wordfence-ls"
]
Unflushable Groups: []
Groups Types: {
"blog-details": "ignored",
"blog-id-cache": "ignored",
"blog-lookup": "ignored",
"global-posts": "ignored",
"networks": "ignored",
"rss": "ignored",
"sites": "ignored",
"site-details": "ignored",
"site-lookup": "ignored",
"site-options": "ignored",
"site-transient": "ignored",
"users": "ignored",
"useremail": "ignored",
"userlogins": "ignored",
"usermeta": "ignored",
"user_meta": "ignored",
"userslugs": "ignored",
"redis-cache": "ignored",
"counts": "ignored",
"plugins": "ignored",
"themes": "ignored",
"blog_meta": "ignored",
"wordfence": "ignored",
"wordfence-ls": "ignored"
}
Drop-ins: [
"Query Monitor Database Class (Drop-in) v3.10.1 by John Blackbourn",
"Redis Object Cache Drop-In v2.2.2 by Till Krüss"
]

`


问:
how to separated swagger spec to smaller?
I tried to separated swagger spec to smaller files because my NodeJS have too many APIs.

If I write all document to 1 file, it will very large.

So I want to break the swagger spec to smaller files.

let see my code above, root file and separated file in the same folder. When I access to apidoc, it show an error:

Resolver error at paths./login.$ref Could not resolve reference: Tried to resolve a relative URL, without having a basePath. path: 'login.json' basePath: 'undefined'

Example

My root swagger spec:

```<code>{
  "openapi": "3.0.3",
  "info": {
    "title": "Swagger Petstore - OpenAPI 3.0",
    "description": "This is a sample Pet Store Server based on the OpenAPI 3.0 specification.  You can find out more about\nSwagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!\nYou can now help us improve the API whether it's by making changes to the definition itself or to the code.\nThat way, with time, we can improve the API in general, and expose some of the new features in OAS3.\n\n_If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then click [here](https://editor.swagger.io/?url=https://petstore.swagger.io/v2/swagger.yaml). Alternatively, you can load via the `Edit > Load Petstore OAS 2.0` menu option!_\n\nSome useful links:\n- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)\n- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)",
    "termsOfService": "http://swagger.io/terms/",
    "contact": {
      "email": "apiteam@swagger.io"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.11"
  },
  "paths": {
    "/login": {
      "$ref": "login.json#/paths/~1login"
    }
  }
}
</code>```

My separated spec:

```<code>{
  "openapi": "3.0.3",
  "info": {
    "title": "Swagger Petstore - OpenAPI 3.0",
    "description": "This is a sample Pet Store Server based on the OpenAPI 3.0 specification.  You can find out more about\nSwagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!\nYou can now help us improve the API whether it's by making changes to the definition itself or to the code.\nThat way, with time, we can improve the API in general, and expose some of the new features in OAS3.\n\n_If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then click [here](https://editor.swagger.io/?url=https://petstore.swagger.io/v2/swagger.yaml). Alternatively, you can load via the `Edit > Load Petstore OAS 2.0` menu option!_\n\nSome useful links:\n- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)\n- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)",
    "termsOfService": "http://swagger.io/terms/",
    "contact": {
      "email": "apiteam@swagger.io"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.11"
  },
  "paths": {
    "/login": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
</code>```

Body:
I tried to separated swagger spec to smaller files because my NodeJS have too many APIs.

If I write all document to 1 file, it will very large.

So I want to break the swagger spec to smaller files.

let see my code above, root file and separated file in the same folder. When I access to apidoc, it show an error:

Resolver error at paths./login.$ref Could not resolve reference: Tried to resolve a relative URL, without having a basePath. path: 'login.json' basePath: 'undefined'

Example

My root swagger spec:

{
  "openapi": "3.0.3",
  "info": {
    "title": "Swagger Petstore - OpenAPI 3.0",
    "description": "This is a sample Pet Store Server based on the OpenAPI 3.0 specification.  You can find out more about\nSwagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!\nYou can now help us improve the API whether it's by making changes to the definition itself or to the code.\nThat way, with time, we can improve the API in general, and expose some of the new features in OAS3.\n\n_If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then click [here](https://editor.swagger.io/?url=https://petstore.swagger.io/v2/swagger.yaml). Alternatively, you can load via the `Edit > Load Petstore OAS 2.0` menu option!_\n\nSome useful links:\n- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)\n- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)",
    "termsOfService": "http://swagger.io/terms/",
    "contact": {
      "email": "apiteam@swagger.io"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.11"
  },
  "paths": {
    "/login": {
      "$ref": "login.json#/paths/~1login"
    }
  }
}

My separated spec:

{
  "openapi": "3.0.3",
  "info": {
    "title": "Swagger Petstore - OpenAPI 3.0",
    "description": "This is a sample Pet Store Server based on the OpenAPI 3.0 specification.  You can find out more about\nSwagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!\nYou can now help us improve the API whether it's by making changes to the definition itself or to the code.\nThat way, with time, we can improve the API in general, and expose some of the new features in OAS3.\n\n_If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then click [here](https://editor.swagger.io/?url=https://petstore.swagger.io/v2/swagger.yaml). Alternatively, you can load via the `Edit > Load Petstore OAS 2.0` menu option!_\n\nSome useful links:\n- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)\n- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)",
    "termsOfService": "http://swagger.io/terms/",
    "contact": {
      "email": "apiteam@swagger.io"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.11"
  },
  "paths": {
    "/login": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}


问:
training accuracy highprediction of the training set is low
I am using keras 2.2.4 to train a text-based emotion recognition model, which is three categories classification.
I put accuracy in the model compile metric. While training, the accuracy showed in the result bar was normal, around 86%，and the loss is around 0.35, which i believed it was working properly.

After training, I found that the prediction with the testing set was pretty bad, acc was only around 0.44. with my instinct, it might be overfitting issue with the model. However, with my random curiosity, I put the training set into the model prediction, the accuracy was also pretty bad, same as the testing set.

The result showed that it might not be an overfitting issue with the model, and I cannot come up with any possible reason why this happen. Also, the difference between the accuracy output while training with the training set and the accuracy with the training set after training is even more confusing.

Does anyone ever encounter the same situation, and what problem it may be?


问:
How can filtered count() operation in PostgreSQL be turned into criteria builder?
I have the tables below;

batch table: id, name, description, create_timestamp, created_by ...

batch_run table: id, batch_id, ...

journey table: id, batch_id, ...

booking table: id, journey_id, status, ...

segment table: id, journey_id, departure_time, ...

item table: id, booking_id, passenger_uuid

How can I use filtered count() operation in java criteria builder? Because in the end, I will convert this query into criteria builder.

```<code>select
    batch.id,
    batch."name",
    batch.description,
    batch.create_timestamp,
    batch.created_by,
    COUNT(distinct b.id) as bookingCount,
    COUNT(distinct j.id) as distinctJourneyCount,
    COUNT(distinct b.status) FILTER(WHERE b.status = 'succeeded') as succeedBookingCount,
    COUNT(distinct b.status) FILTER(WHERE b.status = 'failed') as failedBookingCount,
    COUNT(distinct b.status) FILTER(WHERE b.status = 'skipped') as skippedBookingCount,
    COUNT(distinct b.status) FILTER(WHERE b.status = 'unprocessed') as unprocessedBookingCount,
    COUNT(distinct i.passenger_uuid) as distinctPassengerCount,
    MIN(s.departure_time) as minimumDepartureTime,
    MAX(s.departure_time) as mmaximumDepartureTime,
    batch.status
from
    batch
left join journey j on
    batch.id = j.batch_id
left join segment s on
    j.id = s.journey_id
left join booking b on
    j.id = b.journey_id
left join item i on
    b.id = i.booking_id
left join batch_run br on
    batch.id = br.batch_id
group by
    batch.id;
</code>```

Body:
I have the tables below;

batch table: id, name, description, create_timestamp, created_by ...

batch_run table: id, batch_id, ...

journey table: id, batch_id, ...

booking table: id, journey_id, status, ...

segment table: id, journey_id, departure_time, ...

item table: id, booking_id, passenger_uuid

How can I use filtered count() operation in java criteria builder? Because in the end, I will convert this query into criteria builder.

select
    batch.id,
    batch."name",
    batch.description,
    batch.create_timestamp,
    batch.created_by,
    COUNT(distinct b.id) as bookingCount,
    COUNT(distinct j.id) as distinctJourneyCount,
    COUNT(distinct b.status) FILTER(WHERE b.status = 'succeeded') as succeedBookingCount,
    COUNT(distinct b.status) FILTER(WHERE b.status = 'failed') as failedBookingCount,
    COUNT(distinct b.status) FILTER(WHERE b.status = 'skipped') as skippedBookingCount,
    COUNT(distinct b.status) FILTER(WHERE b.status = 'unprocessed') as unprocessedBookingCount,
    COUNT(distinct i.passenger_uuid) as distinctPassengerCount,
    MIN(s.departure_time) as minimumDepartureTime,
    MAX(s.departure_time) as mmaximumDepartureTime,
    batch.status
from
    batch
left join journey j on
    batch.id = j.batch_id
left join segment s on
    j.id = s.journey_id
left join booking b on
    j.id = b.journey_id
left join item i on
    b.id = i.booking_id
left join batch_run br on
    batch.id = br.batch_id
group by
    batch.id;


问:
Display custom product field in the admin E-Mail
i add the following php code with the tool "snippet" to my website. The field which was created by the code is showing but the field will not be visible at the Admin-New-Order-E-Mail.</p>
```<code>
add_action( 'woocommerce_product_after_variable_attributes', 'custom_add_custom_field', 10, 3 );
function custom_add_custom_field( $loop, $variation_data, $variation ) {
    woocommerce_wp_text_input( array(
        'id'            => 'custom_field[' . $variation->ID . ']',
        'label'         => __( 'Custom Field', 'woocommerce' ),
        'placeholder'   => 'Enter custom field value',
        'value'         => get_post_meta( $variation->ID, 'custom_field', true ),
        'wrapper_class' => 'form-row form-row-full',
    ) );
}

add_action( 'woocommerce_save_product_variation', 'custom_save_custom_field', 10, 2 );
function custom_save_custom_field( $variation_id, $i ) {
    if ( isset( $_POST['custom_field'][ $variation_id ] ) ) {
        $custom_field = sanitize_text_field( $_POST['custom_field'][ $variation_id ] );
        update_post_meta( $variation_id, 'custom_field', $custom_field );
    }
}

add_filter( 'woocommerce_email_variation_attributes', 'custom_add_custom_field_to_email', 10, 3 );
function custom_add_custom_field_to_email( $variation_attributes, $item, $order ) {
    $variation_id = $item->get_variation_id();
    if ( $variation_id ) {
        $custom_field = get_post_meta( $variation_id, 'custom_field', true );
        if ( ! empty( $custom_field ) ) {
            $variation_attributes .= sprintf( __( 'Custom Field: %s', 'woocommerce' ), $custom_field );
        }
    }
    return $variation_attributes;
}
</code>```

Body:
i add the following php code with the tool "snippet" to my website. The field which was created by the code is showing but the field will not be visible at the Admin-New-Order-E-Mail.

add_action( 'woocommerce_product_after_variable_attributes', 'custom_add_custom_field', 10, 3 );
function custom_add_custom_field( $loop, $variation_data, $variation ) {
    woocommerce_wp_text_input( array(
        'id'            => 'custom_field[' . $variation->ID . ']',
        'label'         => __( 'Custom Field', 'woocommerce' ),
        'placeholder'   => 'Enter custom field value',
        'value'         => get_post_meta( $variation->ID, 'custom_field', true ),
        'wrapper_class' => 'form-row form-row-full',
    ) );
}

add_action( 'woocommerce_save_product_variation', 'custom_save_custom_field', 10, 2 );
function custom_save_custom_field( $variation_id, $i ) {
    if ( isset( $_POST['custom_field'][ $variation_id ] ) ) {
        $custom_field = sanitize_text_field( $_POST['custom_field'][ $variation_id ] );
        update_post_meta( $variation_id, 'custom_field', $custom_field );
    }
}

add_filter( 'woocommerce_email_variation_attributes', 'custom_add_custom_field_to_email', 10, 3 );
function custom_add_custom_field_to_email( $variation_attributes, $item, $order ) {
    $variation_id = $item->get_variation_id();
    if ( $variation_id ) {
        $custom_field = get_post_meta( $variation_id, 'custom_field', true );
        if ( ! empty( $custom_field ) ) {
            $variation_attributes .= sprintf( __( 'Custom Field: %s', 'woocommerce' ), $custom_field );
        }
    }
    return $variation_attributes;
}


问:
Flutter Web orderBy is not working, but works on cloud Firestore query builder
I have been trying to order my documents by unix timestamp, everytime i order it by the timestamp field, it keeps giving me an error,
here is an image of my cloud firestore database structure

Cloud Firestore Database structure

```<code>profileBookings(userID) {
    Stream<QuerySnapshot<Map<String, dynamic>>> bookings = FirebaseFirestore
        .instance
        .collection('bookings')
        .where('user_id', isEqualTo: userID)
        .orderBy('timestamp', descending: true)
        .snapshots();
    return bookings;
  }
</code>```

Body:
I have been trying to order my documents by unix timestamp, everytime i order it by the timestamp field, it keeps giving me an error,
here is an image of my cloud firestore database structure

Cloud Firestore Database structure

profileBookings(userID) {
    Stream<QuerySnapshot<Map<String, dynamic>>> bookings = FirebaseFirestore
        .instance
        .collection('bookings')
        .where('user_id', isEqualTo: userID)
        .orderBy('timestamp', descending: true)
        .snapshots();
    return bookings;
  }


问:
node neo4j-driver dosen't allow proxy setting when neo4j-desktop does
I would like to connect to neo4j instance hosted in aws through my node server running in local. I can connect to it using neo4j desktop using proxy settings. I couldent find similar settings in driver though...
Am i missing something?

Tried setting proxy at system level, bash level using export/set nothing works....

Tried using library 'global-tunnel' but this only supports 'request' library and I guess relies on http and https. I am using bolt and that seems to be problem...


问:
fatal error when trying to calculate string distance
I try to add a column with string distance of two columns of a tibble (70k rows) using adist (from util), but I keep getting "R encountered a fatal error".

This is the line giving me the error:

```<code>my_tibble <- my_tibble %>%
  mutate(dist = adist(column1, column2))
</code>```

How can I solve it?

Body:
I try to add a column with string distance of two columns of a tibble (70k rows) using adist (from util), but I keep getting "R encountered a fatal error".

This is the line giving me the error:

my_tibble <- my_tibble %>%
  mutate(dist = adist(column1, column2))

How can I solve it?


问:
trying to group by artist using Sequelize and NodeJs
I have a simple Mysql table like the following fields:

```<code>Id, songName, ArtistName, siglosID
</code>```

example data:

```<code>    1   My Way       Frank Sinatra  1
    2   Big Balls    ACDC           2
    3   New York     Frank Sinatra  3
    4   Highway To Hell  ACDC           4
</code>```

I want to return an object to return to graphql where data is grouped by artistName
something like the following:

```<code>     [  artistName: 'ACDC':[
      { id: 2, songName: 'Big Balls', artistName: 'ACDC', siglosId: '2' },
      { id: 4, songName: 'Highway To Hell', artistName: 'ACDC', siglosId: '4' },],

</code>```
```<code>[  artistName: 'Frank Sinatra':[
  { id: 3, songName: 'New York', artistName: 'Frank Sinatra', siglosId: '3' },
  { id: 1, songName: 'My Way', artistName: 'Frank Sinatra', siglosId: '1' },],

]
</code>```
```<code>What I actually get back:

</code>```
```<code> [
  { id: 2, songName: 'Big Balls', artistName: 'ACDC', siglosId: '2' },
  {
    id: 1,
    songName: 'My Way',
    artistName: 'Frank Sinatra',
    siglosId: '1'
  }
</code>```
```<code>
Not sure how to use group properly or do I need to use a join?
</code>```

My code:

```<code>     getAllSongs: {
          type: new GraphQLList(SongType),
          async resolve() {
            const mytest = await dbSong.findAll({
              order: ["artistName"],
              group: ["artistName"],
              raw: true,
            });
            console.log("test Songs grouped by artist: ", mytest);
            // return dbSong.findAll({ raw: true });
            return dbSong.findAll({
              order: ["artistName"],
              group: ["artistName"],
              raw: true,
            });
          },
        },
      },
    });`
</code>```
```<code>

</code>```

Body:
I have a simple Mysql table like the following fields:

Id, songName, ArtistName, siglosID

example data:

    1   My Way       Frank Sinatra  1
    2   Big Balls    ACDC           2
    3   New York     Frank Sinatra  3
    4   Highway To Hell  ACDC           4

I want to return an object to return to graphql where data is grouped by artistName
something like the following:

     [  artistName: 'ACDC':[
      { id: 2, songName: 'Big Balls', artistName: 'ACDC', siglosId: '2' },
      { id: 4, songName: 'Highway To Hell', artistName: 'ACDC', siglosId: '4' },],

[  artistName: 'Frank Sinatra':[
  { id: 3, songName: 'New York', artistName: 'Frank Sinatra', siglosId: '3' },
  { id: 1, songName: 'My Way', artistName: 'Frank Sinatra', siglosId: '1' },],

]

What I actually get back:

 [
  { id: 2, songName: 'Big Balls', artistName: 'ACDC', siglosId: '2' },
  {
    id: 1,
    songName: 'My Way',
    artistName: 'Frank Sinatra',
    siglosId: '1'
  }

Not sure how to use group properly or do I need to use a join?

My code:

     getAllSongs: {
          type: new GraphQLList(SongType),
          async resolve() {
            const mytest = await dbSong.findAll({
              order: ["artistName"],
              group: ["artistName"],
              raw: true,
            });
            console.log("test Songs grouped by artist: ", mytest);
            // return dbSong.findAll({ raw: true });
            return dbSong.findAll({
              order: ["artistName"],
              group: ["artistName"],
              raw: true,
            });
          },
        },
      },
    });`


问:
Do I need a lock when updating references in Python
I'm using Python to write a multi-threaded application. In my application, one thread will update a reference variable periodically, and multiple threads will access that variable. To update the reference, the update thread will create a new local variable, then make it visible by pointing the global reference to the new one. Other threads will only access this shared reference once per request. The pseudo-code is as follows:

```<code>ALL_DATA = load_all_data()

lock = Lock()

# Thread 1
while 1:
  sleep(500)
  new_all_data = load_all_data()
  with lock:
     ALL_DATA = new_all_data

# Other theads
def predict(image_url: str):
  with lock:
    _data = ALL_DATA

  # Using _data to process request

</code>```

My question is do I need to use the lock as above when updating, and accessing the shared reference variable?

Body:
I'm using Python to write a multi-threaded application. In my application, one thread will update a reference variable periodically, and multiple threads will access that variable. To update the reference, the update thread will create a new local variable, then make it visible by pointing the global reference to the new one. Other threads will only access this shared reference once per request. The pseudo-code is as follows:

ALL_DATA = load_all_data()

lock = Lock()

# Thread 1
while 1:
  sleep(500)
  new_all_data = load_all_data()
  with lock:
     ALL_DATA = new_all_data

# Other theads
def predict(image_url: str):
  with lock:
    _data = ALL_DATA

  # Using _data to process request

My question is do I need to use the lock as above when updating, and accessing the shared reference variable?


问:
How to get rid of Null Pointer Exception when I'm trying to change value that I received after Mockito.doReturn?
I'm writing tests for my pet-project. Right now, I'm stuck with unit testing. I have a big method called "check-ownership", that returns an enum value.

During a run, this method changes numerous amount of objects.

Part of my method:

```<code>if(aruCalls.size() == 0) {
    aruCallDtoRequest.setDopFlag(0);
}
</code>```

Take a look at aruCallDtoRequest.setDopFlag(0); line

Here is my test:

```<code>@ExtendWith(MockitoExtension.class)
class ReRegistrationServiceImplTest {

    @InjectMocks
    private ReRegistrationServiceImpl reRegistrationServiceImpl;

    @Mock
    private IntegrationClient integrationClient;
    @Mock
    private AruCallsService aruCallsService;
    @Mock
    private AruRequestService aruRequestService;
    @Mock
    private DealerService dealerService;

    private Dealer dealer;
    private Location location;
    private LocalDateTime currentTime;
    private CheckRegistrationDtoRequest checkRegistrationDtoRequest;
    private AruCallDtoRequest aruCallDtoRequest;
    private AruRequest aruRequest;
    private AruRequestDtoRequest aruRequestDtoRequest;
    private ResponseEntity<List<UsageDetailDtoResponse>> outgoingCalls;

    @BeforeEach
    public void init() throws H1NotAllowed, H1NotFound {
        aruCallDtoRequest = AruCallDtoRequest.builder()
                .customerMsisdn(TEST_NUMBER)
                .aruRequestsId(null).build();
    }

    @Test
    @DisplayName("Test for checking of Aru Request Creating at the initialization of the checkOwnership method")
    public void test_aruCallsSizeIsEqualToZeroAndAruRequestHasBeenCreated() throws H1NotAllowed, H1NotFound {
        verify(dealerService).findMe();
        verify(integrationClient).getLocation(TEST_NUMBER);
        verify(aruCallsService).findAllByOnRegisteredBetween(currentTime.minusHours(24),TEST_NUMBER);
        verify(aruRequestService).create(new AruRequestDtoRequest());
        assertEquals(result,CheckOwnershipDtoResponse.MORE_NUMBERS_NEEDED);
    }
</code>```

Every time I run it, I receive a NPE at the line with the "aruCallDtoRequest.setDopFlag(0)". Any ideas how to get rid of this exception?

Body:
I'm writing tests for my pet-project. Right now, I'm stuck with unit testing. I have a big method called "check-ownership", that returns an enum value.

During a run, this method changes numerous amount of objects.

Part of my method:

if(aruCalls.size() == 0) {
    aruCallDtoRequest.setDopFlag(0);
}

Take a look at aruCallDtoRequest.setDopFlag(0); line

Here is my test:

@ExtendWith(MockitoExtension.class)
class ReRegistrationServiceImplTest {

    @InjectMocks
    private ReRegistrationServiceImpl reRegistrationServiceImpl;

    @Mock
    private IntegrationClient integrationClient;
    @Mock
    private AruCallsService aruCallsService;
    @Mock
    private AruRequestService aruRequestService;
    @Mock
    private DealerService dealerService;

    private Dealer dealer;
    private Location location;
    private LocalDateTime currentTime;
    private CheckRegistrationDtoRequest checkRegistrationDtoRequest;
    private AruCallDtoRequest aruCallDtoRequest;
    private AruRequest aruRequest;
    private AruRequestDtoRequest aruRequestDtoRequest;
    private ResponseEntity<List<UsageDetailDtoResponse>> outgoingCalls;

    @BeforeEach
    public void init() throws H1NotAllowed, H1NotFound {
        aruCallDtoRequest = AruCallDtoRequest.builder()
                .customerMsisdn(TEST_NUMBER)
                .aruRequestsId(null).build();
    }

    @Test
    @DisplayName("Test for checking of Aru Request Creating at the initialization of the checkOwnership method")
    public void test_aruCallsSizeIsEqualToZeroAndAruRequestHasBeenCreated() throws H1NotAllowed, H1NotFound {
        verify(dealerService).findMe();
        verify(integrationClient).getLocation(TEST_NUMBER);
        verify(aruCallsService).findAllByOnRegisteredBetween(currentTime.minusHours(24),TEST_NUMBER);
        verify(aruRequestService).create(new AruRequestDtoRequest());
        assertEquals(result,CheckOwnershipDtoResponse.MORE_NUMBERS_NEEDED);
    }

Every time I run it, I receive a NPE at the line with the "aruCallDtoRequest.setDopFlag(0)". Any ideas how to get rid of this exception?


问:
How to ignore local imports
In clean-css-cli, How do I ignore local imports?

I have these two files:

nord.css, (module)

index.css (main file)

I don't want @import "nord.css"; to get replaced with the optimized version of nord.css but keep it as it is.

I've tried using the option --inline '' as a hack, but it didn't work as expected. Instead, it gave me a warning:

WARNING: Skipping local @import of "nord.css" as resource is not allowed.

A minimal reproducible example:
a.css

@import "b.css";
```
<p><code>b.css</code></p>
<pre class="lang-css prettyprint-override"><code>/*!
 * Licenses about their module
 */
#hello{
  opacity: 0%;
}
</code>```

Title: How to ignore local imports

Body:
In clean-css-cli, How do I ignore local imports?

I have these two files:

nord.css, (module)

index.css (main file)

I don't want @import "nord.css"; to get replaced with the optimized version of nord.css but keep it as it is.

I've tried using the option --inline '' as a hack, but it didn't work as expected. Instead, it gave me a warning:

WARNING: Skipping local @import of "nord.css" as resource is not allowed.

A minimal reproducible example:
a.css

@import "b.css";

b.css

/*!
 * Licenses about their module
 */
#hello{
  opacity: 0%;
}


问:
AWS S3 storage does not give a valid URL after uploading file
I am new to AWS. I use Amplify to upload a video file to S3 storage using Flutter. I want to get the URL after uploading a video to use it elsewhere. I use Amplify.Storage.getUrl(key)).url to get the URL. But when I want to go to the link via the browser, it shows the following error there:

```<code>This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
    <Code>AccessDenied</Code>
    <Message>No AWSAccessKey was presented.</Message>
    <RequestId>AK49EW70AR8N1NVC</RequestId>
    <HostId>Z6FBLU/GABRvJKFX827m3HoIKfVIpU0iXmH3gwSpcu04nNiqqEFjHZGGLn3VyyVNMY7ndK541ro=
    </HostId>
</Error>
</code>```

And also this link doesn't work when I want to play a video using VideoPlayerController.network(videoUrl).
So what is the solution to get a general URL for the video file uploaded that can be used elsewhere? Thanks in advance.

Body:
I am new to AWS. I use Amplify to upload a video file to S3 storage using Flutter. I want to get the URL after uploading a video to use it elsewhere. I use Amplify.Storage.getUrl(key)).url to get the URL. But when I want to go to the link via the browser, it shows the following error there:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
    AccessDenied
    <Message>No AWSAccessKey was presented.</Message>
    <RequestId>AK49EW70AR8N1NVC</RequestId>
    <HostId>Z6FBLU/GABRvJKFX827m3HoIKfVIpU0iXmH3gwSpcu04nNiqqEFjHZGGLn3VyyVNMY7ndK541ro=
    </HostId>
</Error>

And also this link doesn't work when I want to play a video using VideoPlayerController.network(videoUrl).
So what is the solution to get a general URL for the video file uploaded that can be used elsewhere? Thanks in advance.


问:
Running gradle commands fail with javax.annotation does not exist
Running tests and building from Intelij works fine. But, when I try to build or test an application from the command line I'm getting this error

```<code>error: package javax.annotation does not exist
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2019-06-27T18:20:07.986+03:00")
</code>```

I'm using the gradle v 6.8 wrapper. JDK is AdoptOpenJDK 1.8

Body:
Running tests and building from Intelij works fine. But, when I try to build or test an application from the command line I'm getting this error

error: package javax.annotation does not exist
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2019-06-27T18:20:07.986+03:00")

I'm using the gradle v 6.8 wrapper. JDK is AdoptOpenJDK 1.8


问:
Find-in-files keyboard shortcut to switch between files and Edit box
In Intellij idea, in Find-in-files is there a keyboard shortcut to switch between files and Edit box.  1 and 2 in screenshot?


问:
Set Multi-Select Custom Field via Pardot API
does anyone know if (and how)it is possible to set the value of a custom field when it´s type is "Multi-Select"? I cannot find any information about it in the official Pardot API documentation.
I hope that this is possible... if not, do you know a workaround?

Thanks for your help!

I already tried to set the value of the multi-select custom field as an normal string, but it didn´t work.


问:
MYSQL Two queries (one with if statement) in a single query line?
I'm quite new to PHP and MYSQL.

I'm looking for the right way to write the code for a query on which I want to UPDATE a couple of values on a table, and then UPDATE another value on another table with an if statement.

Here is what I've tried:

```<code>public function updateSubmission($data){

            $this->db->query('UPDATE submissions S, requests R
                                SET S.submission_title = :submission_title,
                                    S.submission_area = :submission_area,
                                    S.submission_link = :submission_link,
                                    S.submission_citations = :submission_citations,
                                    S.submission_status = :submission_status,
                                    S.submission_updatedby = :submission_updatedby
                                WHERE S.submission_id = :submission_id;
                                UPDATE requests R
                                SET R.request_status = IF(R.request_status = "review2" AND :submission_status = "cancelled", "submission" )
                                WHERE R.request_id = :submission_requestid;
                                ');

            $this->db->bind(':submission_title', $data['submission_title']);
            $this->db->bind(':submission_area', $data['submission_area']);
            $this->db->bind(':submission_link', $data['submission_link']);
            $this->db->bind(':submission_citations', $data['submission_citations']);
            $this->db->bind(':submission_status', $data['submission_status']);
            $this->db->bind(':submission_updatedby', $_SESSION['user_id']);
            $this->db->bind(':submission_id', $data['submission_id']);
            $this->db->bind(':submission_requestid', $data['submission_requestid']);

            if($this->db->execute()){
                return true;
            } else {
                return false;
            }
        }
</code>```

First UPDATE part works, but second UPDATE part doesn't make any changes.
I thought using UPDATE twice in a single query is not working. So I've tried another way:

```<code>            $this->db->query('UPDATE submissions S, requests R
                                SET S.submission_title = :submission_title,
                                    S.submission_area = :submission_area,
                                    S.submission_link = :submission_link,
                                    S.submission_citations = :submission_citations,
                                    S.submission_status = :submission_status,
                                    S.submission_updatedby = :submission_updatedby
                                    R.request_status = IF(R.request_status = "review2" AND :submission_status = "cancelled", "submission")
                                WHERE S.submission_id = :submission_id AND R.request_id = :submission_requestid
                                ');
</code>```

This also didn't work.

I basically want to update a table and depending on this update, if the new S.submission_status = "cancelled" and at the same time if the R.request_status is "review2", I want to change the R.request_status to "submission".

I have a solution of using two separate queries but I just wanted to know if it is possible on one query because I wanted to get only one feedback from the function and avoid the database writing error possibility of one of the queries.

I'm using a framework and below is the database.php

```<code>    <?php

    /*
    PDO Database Class
    Connect to database
    Create prepared statements
    Bind values
    Return rows and results
    */

    class Database{
        private $host = DB_HOST;
        private $user = DB_USER;
        private $pass = DB_PASS;
        private $dbname = DB_NAME;
        //private $dbport = DB_PORT;

        private $dbh;
        private $stmt;
        private $error;

        public function __construct(){
            // Set DSN
            $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->dbname . ';charset=utf8';
            $options = array(
                PDO::ATTR_PERSISTENT => true,
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
            );

            // Create PDO instance
            try{
                $this->dbh = new PDO($dsn, $this->user, $this->pass, $options);
            } catch(PDOException $e){
                $this->error = $e->getMessage();
                echo $this->error;
            }
        }

        // Prepare statement with query
        public function query($sql){
            $this->stmt = $this->dbh->prepare($sql);
        }

        // Bind values
        public function bind($param, $value, $type = null){
            if(is_null($type)){
                switch(true){
                    case is_int($value):
                        $type = PDO::PARAM_INT;
                        break;
                    case is_bool($value):
                        $type = PDO::PARAM_BOOL;
                        break;
                    case is_null($value):
                        $type = PDO::PARAM_NULL;
                        break;
                    default:
                        $type = PDO::PARAM_STR;
                }
            }

        $this->stmt->bindValue($param, $value, $type);
        }

        // Execute the prepared statement
        public function execute(){
            return $this->stmt->execute();
        }

        // Get result set as array of objects
        public function resultSet(){
            $this->execute();
            return $this->stmt->fetchAll(PDO::FETCH_OBJ);
        }

        // Get single record as object
        public function single(){
            $this->execute();
            return $this->stmt->fetch(PDO::FETCH_OBJ);
        }

        // Get row count
        public function rowCount(){
            return $this->stmt->rowCount();
        }

        // Returns the last inserted ID
        public function lastInsertId(){
            return $this->dbh->lastInsertId();
        }
    }

?>
</code>```

Any help is appreciated.
Thanks

Body:
I'm quite new to PHP and MYSQL.

I'm looking for the right way to write the code for a query on which I want to UPDATE a couple of values on a table, and then UPDATE another value on another table with an if statement.

Here is what I've tried:

public function updateSubmission($data){

            $this->db->query('UPDATE submissions S, requests R
                                SET S.submission_title = :submission_title,
                                    S.submission_area = :submission_area,
                                    S.submission_link = :submission_link,
                                    S.submission_citations = :submission_citations,
                                    S.submission_status = :submission_status,
                                    S.submission_updatedby = :submission_updatedby
                                WHERE S.submission_id = :submission_id;
                                UPDATE requests R
                                SET R.request_status = IF(R.request_status = "review2" AND :submission_status = "cancelled", "submission" )
                                WHERE R.request_id = :submission_requestid;
                                ');

            $this->db->bind(':submission_title', $data['submission_title']);
            $this->db->bind(':submission_area', $data['submission_area']);
            $this->db->bind(':submission_link', $data['submission_link']);
            $this->db->bind(':submission_citations', $data['submission_citations']);
            $this->db->bind(':submission_status', $data['submission_status']);
            $this->db->bind(':submission_updatedby', $_SESSION['user_id']);
            $this->db->bind(':submission_id', $data['submission_id']);
            $this->db->bind(':submission_requestid', $data['submission_requestid']);

            if($this->db->execute()){
                return true;
            } else {
                return false;
            }
        }

First UPDATE part works, but second UPDATE part doesn't make any changes.
I thought using UPDATE twice in a single query is not working. So I've tried another way:

            $this->db->query('UPDATE submissions S, requests R
                                SET S.submission_title = :submission_title,
                                    S.submission_area = :submission_area,
                                    S.submission_link = :submission_link,
                                    S.submission_citations = :submission_citations,
                                    S.submission_status = :submission_status,
                                    S.submission_updatedby = :submission_updatedby
                                    R.request_status = IF(R.request_status = "review2" AND :submission_status = "cancelled", "submission")
                                WHERE S.submission_id = :submission_id AND R.request_id = :submission_requestid
                                ');

This also didn't work.

I basically want to update a table and depending on this update, if the new S.submission_status = "cancelled" and at the same time if the R.request_status is "review2", I want to change the R.request_status to "submission".

I have a solution of using two separate queries but I just wanted to know if it is possible on one query because I wanted to get only one feedback from the function and avoid the database writing error possibility of one of the queries.

I'm using a framework and below is the database.php

    <?php

    /*
    PDO Database Class
    Connect to database
    Create prepared statements
    Bind values
    Return rows and results
    */

    class Database{
        private $host = DB_HOST;
        private $user = DB_USER;
        private $pass = DB_PASS;
        private $dbname = DB_NAME;
        //private $dbport = DB_PORT;

        private $dbh;
        private $stmt;
        private $error;

        public function __construct(){
            // Set DSN
            $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->dbname . ';charset=utf8';
            $options = array(
                PDO::ATTR_PERSISTENT => true,
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
            );

            // Create PDO instance
            try{
                $this->dbh = new PDO($dsn, $this->user, $this->pass, $options);
            } catch(PDOException $e){
                $this->error = $e->getMessage();
                echo $this->error;
            }
        }

        // Prepare statement with query
        public function query($sql){
            $this->stmt = $this->dbh->prepare($sql);
        }

        // Bind values
        public function bind($param, $value, $type = null){
            if(is_null($type)){
                switch(true){
                    case is_int($value):
                        $type = PDO::PARAM_INT;
                        break;
                    case is_bool($value):
                        $type = PDO::PARAM_BOOL;
                        break;
                    case is_null($value):
                        $type = PDO::PARAM_NULL;
                        break;
                    default:
                        $type = PDO::PARAM_STR;
                }
            }

        $this->stmt->bindValue($param, $value, $type);
        }

        // Execute the prepared statement
        public function execute(){
            return $this->stmt->execute();
        }

        // Get result set as array of objects
        public function resultSet(){
            $this->execute();
            return $this->stmt->fetchAll(PDO::FETCH_OBJ);
        }

        // Get single record as object
        public function single(){
            $this->execute();
            return $this->stmt->fetch(PDO::FETCH_OBJ);
        }

        // Get row count
        public function rowCount(){
            return $this->stmt->rowCount();
        }

        // Returns the last inserted ID
        public function lastInsertId(){
            return $this->dbh->lastInsertId();
        }
    }

?>

Any help is appreciated.
Thanks


问:
Setting NameFormat of SAML attribute using Identity Server and SAML2P
I am using https://www.identityserver.com/products/saml2p library for Identity Server.

I want to send SAML attribute using different NameFormat:

```<code><saml2:Attribute xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="eduPersonAffiliation" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
</code>```

I want to change :

```<code>urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified
</code>```

To:

```<code>urn:oasis:names:tc:SAML:2.0:attrname-format:uri
</code>```

How this can be done?

Saml2p providers class for Service Provider:

```<code>    public class ServiceProvider
    {
        public string EntityId { get; set; }

        public List<X509Certificate2> SigningCertificates { get; set; } = new List<X509Certificate2>();

        public X509Certificate2 EncryptionCertificate { get; set; }

        public List<Service> SingleLogoutServices { get; set; } = new List<Service>();

        public List<Service> AssertionConsumerServices { get; set; } = new List<Service>();

        public IDictionary<string, string> ClaimsMapping { get; set; }

        public bool SignAssertions { get; set; } = true;

        public bool EncryptAssertions { get; set; }

        public bool RequireSamlRequestDestination { get; set; } = true;

    }
</code>```

I can change ClaimsMapping which represents mappings of Name for attribute, but I am unable to change NameFormat.

I see that XML file with Service Providers has attributes with NameFormat:

```<code>urn:oasis:names:tc:SAML:2.0:attrname-format:uri
</code>```

But I am not sure how to use it in SAML response.

Body:
I am using https://www.identityserver.com/products/saml2p library for Identity Server.

I want to send SAML attribute using different NameFormat:

<saml2:Attribute xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="eduPersonAffiliation" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">

I want to change :

urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified

To:

urn:oasis:names:tc:SAML:2.0:attrname-format:uri

How this can be done?

Saml2p providers class for Service Provider:

    public class ServiceProvider
    {
        public string EntityId { get; set; }

        public List<X509Certificate2> SigningCertificates { get; set; } = new List<X509Certificate2>();

        public X509Certificate2 EncryptionCertificate { get; set; }

        public List<Service> SingleLogoutServices { get; set; } = new List<Service>();

        public List<Service> AssertionConsumerServices { get; set; } = new List<Service>();

        public IDictionary<string, string> ClaimsMapping { get; set; }

        public bool SignAssertions { get; set; } = true;

        public bool EncryptAssertions { get; set; }

        public bool RequireSamlRequestDestination { get; set; } = true;

    }

I can change ClaimsMapping which represents mappings of Name for attribute, but I am unable to change NameFormat.

I see that XML file with Service Providers has attributes with NameFormat:

urn:oasis:names:tc:SAML:2.0:attrname-format:uri

But I am not sure how to use it in SAML response.


问:
Mt5 language translation - Language in parameters
I'm trying to train a Arabic to English language translation model, and want to know if there is any option where I can mention the input and target language in the code.

I'm using the below code, where df1 is the dataframe with columns (prefix,input_text,target_text)

```<code>from simpletransformers.t5 import T5Model, T5Args
model = T5Model("mt5", "google/mt5-small", args=model_args, use_cuda=False)
model.train_model(df1,eval_data=df2)
results = model.eval_model(df2, verbose=True)
</code>```

Body:
I'm trying to train a Arabic to English language translation model, and want to know if there is any option where I can mention the input and target language in the code.

I'm using the below code, where df1 is the dataframe with columns (prefix,input_text,target_text)

from simpletransformers.t5 import T5Model, T5Args
model = T5Model("mt5", "google/mt5-small", args=model_args, use_cuda=False)
model.train_model(df1,eval_data=df2)
results = model.eval_model(df2, verbose=True)


问:
SQL recursive query to find all records in table with two ID columns, where ID can exist in either column
I have a table that basically looks like:

pkid
origLegCallIdentifier
destLegIdentifier

1
A
B

2
A
C

3
B
D

4
E
A

5
F
G

6
D
H

7
I
J

I want to be able to select a PKID, and then find all associated rows based on whether origLegCallIdentifier or destLegIdentifier recursively, so the end result if I selected PKID 6 would be:

pkid
origLegCallIdentifier
destLegIdentifier

1
A
B

2
A
C

3
B
D

4
E
A

6
D
H

I've written this following query which achieves what I want, but its very slow to run:

```<code>select pkid, origLegCallIdentifier, destLegIdentifier
into #tempA
from RawCDR2
where pkid = '185b76e8-f8b2-4fde-a393-24cad6800bc6'

select distinct id
into #tempB
from
    (select origLegCallIdentifier as id from #tempA
     union
     select destLegIdentifier as id from #tempA) as t

while exists (select pkid, origLegCallIdentifier, destLegIdentifier
              from rawcdr2 r
              where (origLegCallIdentifier in (select id as origLegCallIdentifier from #tempB)
                     or destLegIdentifier in (select id as destLegIdentifier from #tempB))
                and pkid not in (select pkid from #tempA)
             )
begin
    insert into #tempA (pkid, origLegCallIdentifier, destLegIdentifier)
        select pkid, origLegCallIdentifier, destLegIdentifier
        from rawcdr2 r
        where (origLegCallIdentifier in (select id as origLegCallIdentifier from #tempB)
               or destLegIdentifier in (select id as destLegIdentifier from #tempB))

    insert into #tempB (id)
        select distinct id
        from
            (select origLegCallIdentifier as id from #tempA
             union
             select destLegIdentifier as id from #tempA) as t
end

select distinct pkid
into #tempC
from RawCDR2
where origLegCallIdentifier in (select distinct id from #tempB)
   or destLegIdentifier in (select id from #tempB)

select
    rawcdr2.pkid,
    origLegCallIdentifier,
    destLegIdentifier,
from
    #tempC
left join
    RawCDR2 on rawcdr2.pkid = #tempC.pkid

drop table #tempA
drop table #tempB
drop table #tempC
</code>```

I'm sure the performance can be increased using DTE but don't know how.
Any idea how to speed this query up?

Body:
I have a table that basically looks like:

pkid
origLegCallIdentifier
destLegIdentifier

1
A
B

2
A
C

3
B
D

4
E
A

5
F
G

6
D
H

7
I
J

I want to be able to select a PKID, and then find all associated rows based on whether origLegCallIdentifier or destLegIdentifier recursively, so the end result if I selected PKID 6 would be:

pkid
origLegCallIdentifier
destLegIdentifier

1
A
B

2
A
C

3
B
D

4
E
A

6
D
H

I've written this following query which achieves what I want, but its very slow to run:

select pkid, origLegCallIdentifier, destLegIdentifier
into #tempA
from RawCDR2
where pkid = '185b76e8-f8b2-4fde-a393-24cad6800bc6'

select distinct id
into #tempB
from
    (select origLegCallIdentifier as id from #tempA
     union
     select destLegIdentifier as id from #tempA) as t

while exists (select pkid, origLegCallIdentifier, destLegIdentifier
              from rawcdr2 r
              where (origLegCallIdentifier in (select id as origLegCallIdentifier from #tempB)
                     or destLegIdentifier in (select id as destLegIdentifier from #tempB))
                and pkid not in (select pkid from #tempA)
             )
begin
    insert into #tempA (pkid, origLegCallIdentifier, destLegIdentifier)
        select pkid, origLegCallIdentifier, destLegIdentifier
        from rawcdr2 r
        where (origLegCallIdentifier in (select id as origLegCallIdentifier from #tempB)
               or destLegIdentifier in (select id as destLegIdentifier from #tempB))

    insert into #tempB (id)
        select distinct id
        from
            (select origLegCallIdentifier as id from #tempA
             union
             select destLegIdentifier as id from #tempA) as t
end

select distinct pkid
into #tempC
from RawCDR2
where origLegCallIdentifier in (select distinct id from #tempB)
   or destLegIdentifier in (select id from #tempB)

select
    rawcdr2.pkid,
    origLegCallIdentifier,
    destLegIdentifier,
from
    #tempC
left join
    RawCDR2 on rawcdr2.pkid = #tempC.pkid

drop table #tempA
drop table #tempB
drop table #tempC

I'm sure the performance can be increased using DTE but don't know how.
Any idea how to speed this query up?


问:
Unable to push files to Github using Rest API
I am using the below mentioned code to commit a file to github.

```<code>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class GitHubRestClient {

    public static void main(String[] args) {

        try {

            URL url = new URL("https://api.github.com/repos/userid/test/contents/test/");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("PUT");
            conn.setRequestProperty("Accept", "application/vnd.github+json");
            conn.setRequestProperty("Authorization", "Bearer ");
            conn.setRequestProperty("X-GitHub-Api-Version", "2022-11-28");
            conn.setRequestProperty("User-Agent", "Request");

            String input = "{\"message\":\"my commit message\",\"committer\":{\"name\":\"Nithin\",\"email\":\"nithin@mail.com\"},\"content\":\"bXkgbmV3IGZpbGUgY29udGVudHM=\"}";

            OutputStream os = conn.getOutputStream();
            os.write(input.getBytes());
            os.flush();

            if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
                throw new RuntimeException("Failed : HTTP error code : "
                        + conn.getResponseMessage());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader(
                    (conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }

            conn.disconnect();

        } catch (MalformedURLException e) {

            e.printStackTrace();

        } catch (IOException e) {

            e.printStackTrace();

        }

    }

}
</code>```

I am getting ** 422 HTTP error code: Unprocessable Entity** error.
Using the same values in the curl command I was able to upload the files

Body:
I am using the below mentioned code to commit a file to github.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class GitHubRestClient {

    public static void main(String[] args) {

        try {

            URL url = new URL("https://api.github.com/repos/userid/test/contents/test/");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("PUT");
            conn.setRequestProperty("Accept", "application/vnd.github+json");
            conn.setRequestProperty("Authorization", "Bearer ");
            conn.setRequestProperty("X-GitHub-Api-Version", "2022-11-28");
            conn.setRequestProperty("User-Agent", "Request");

            String input = "{\"message\":\"my commit message\",\"committer\":{\"name\":\"Nithin\",\"email\":\"nithin@mail.com\"},\"content\":\"bXkgbmV3IGZpbGUgY29udGVudHM=\"}";

            OutputStream os = conn.getOutputStream();
            os.write(input.getBytes());
            os.flush();

            if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
                throw new RuntimeException("Failed : HTTP error code : "
                        + conn.getResponseMessage());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader(
                    (conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }

            conn.disconnect();

        } catch (MalformedURLException e) {

            e.printStackTrace();

        } catch (IOException e) {

            e.printStackTrace();

        }

    }

}

I am getting ** 422 HTTP error code: Unprocessable Entity** error.
Using the same values in the curl command I was able to upload the files