问:
Why is my nginx not serving my API location via the proxy server
I have a NGINX configration that is supposed to serve a proxied server on the location /api/ but it does not do so.

This is the piece of the config that is not working:

```<code>location /api/ {
    include uwsgi_params;
    uwsgi_pass 127.0.0.1:8037;
    uwsgi_read_timeout 18000;
}
</code>```

I know the proxy server is working:

uwsgi_curl 127.0.0.1:8037 /api/statistic/single/?filter=build%20eq%20GRCh37

Gives me the correct response (Abbreviated below)

```<code>HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 3208
Access-Control-Allow-Origin: *

{"data":{"analysis":["GCST90012877","GCST90012
...
</code>```

and the log file show this when I try to access vit http/curl

```<code>curl http://10.112.80.172:16888/api/statistic/single/?filter=build%20eq%20GRCh37
</code>```

LOG:

```<code>023/01/03 00:32:54 [error] 310869#310869: *387057 "/usr/share/nginx/html/api/statistic/single/index.html" is not found (2: No such file or directory), client: 10.112.80.172, server: , request: "GET /api/statistic/single/
?filter=build%20eq%20GRCh37 HTTP/1.1", host: "10.112.80.172:16888"
</code>```

It seems to want to serve the default index.html which is not actually there, and I have been successfull with other proxied uwsgi servers, so at a loss of what I am doing wrong....

Full config below:

```<code>tdeboer@fc-node152:~/gre/itapbass$ nginx -T
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:
worker_processes 1;
daemon on;
pid /data/.nginx/run/nginx.pid;
error_log  /data/.nginx/log/error.log;
events {
  worker_connections  1024;
}

http {
  include             /etc/nginx/mime.types;
  default_type        application/octet-stream;
  client_max_body_size 2500M;
  client_body_temp_path /data/.nginx/tmp/client_body;
  fastcgi_temp_path /data/.nginx/tmp/fastcgi_temp;
  proxy_temp_path /data/.nginx/tmp/proxy_temp;
  scgi_temp_path /data/.nginx/tmp/scgi_temp;
  uwsgi_temp_path /data/.nginx/tmp/uwsgi_temp;

  ##
  # Basic Settings
  ##

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;
  # server_tokens off;

  log_format   main '$remote_addr - $remote_user [$time_local]  $status '
                  '"$request" $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for" '
                  '$gzip_ratio $request_time' ;

  ##
  # Gzip Settings
  ##

  gzip on;
  gzip_disable "msie6";

  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

  access_log off;

  #####
  #
  # Added for shiny apps
  #
  map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
  }

  server {
    listen 16888 default_server;
    access_log /data/.nginx/log/access.log;
    include /etc/ica/.nginx/conf.d/*.conf;
    include /data/.nginx/conf.d/*.conf;

    error_page 502 504 /page.html;
    location /page.html {
        root /data/.nginx/html;
    }

    add_header Access-Control-Allow-Origin *;
}
}

# configuration file /etc/nginx/mime.types:

types {
    text/html                             html htm shtml;
    text/css                              css;
    text/xml                              xml;
    image/gif                             gif;
    image/jpeg                            jpeg jpg;
    application/javascript                js;
    application/atom+xml                  atom;
    application/rss+xml                   rss;

    text/mathml                           mml;
    text/plain                            txt;
    text/vnd.sun.j2me.app-descriptor      jad;
    text/vnd.wap.wml                      wml;
    text/x-component                      htc;

    image/png                             png;
    image/tiff                            tif tiff;
    image/vnd.wap.wbmp                    wbmp;
    image/x-icon                          ico;
    image/x-jng                           jng;
    image/x-ms-bmp                        bmp;
    image/svg+xml                         svg svgz;
    image/webp                            webp;

    application/font-woff                 woff;
    application/java-archive              jar war ear;
    application/json                      json;
    application/mac-binhex40              hqx;
    application/msword                    doc;
    application/pdf                       pdf;
    application/postscript                ps eps ai;
    application/rtf                       rtf;
    application/vnd.apple.mpegurl         m3u8;
    application/vnd.ms-excel              xls;
    application/vnd.ms-fontobject         eot;
    application/vnd.ms-powerpoint         ppt;
    application/vnd.wap.wmlc              wmlc;
    application/vnd.google-earth.kml+xml  kml;
    application/vnd.google-earth.kmz      kmz;
    application/x-7z-compressed           7z;
    application/x-cocoa                   cco;
    application/x-java-archive-diff       jardiff;
    application/x-java-jnlp-file          jnlp;
    application/x-makeself                run;
    application/x-perl                    pl pm;
    application/x-pilot                   prc pdb;
    application/x-rar-compressed          rar;
    application/x-redhat-package-manager  rpm;
    application/x-sea                     sea;
    application/x-shockwave-flash         swf;
    application/x-stuffit                 sit;
    application/x-tcl                     tcl tk;
    application/x-x509-ca-cert            der pem crt;
    application/x-xpinstall               xpi;
    application/xhtml+xml                 xhtml;
    application/xspf+xml                  xspf;
    application/zip                       zip;

    application/octet-stream              bin exe dll;
    application/octet-stream              deb;
    application/octet-stream              dmg;
    application/octet-stream              iso img;
    application/octet-stream              msi msp msm;

    application/vnd.openxmlformats-officedocument.wordprocessingml.document    docx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet          xlsx;
    application/vnd.openxmlformats-officedocument.presentationml.presentation  pptx;

    audio/midi                            mid midi kar;
    audio/mpeg                            mp3;
    audio/ogg                             ogg;
    audio/x-m4a                           m4a;
    audio/x-realaudio                     ra;

    video/3gpp                            3gpp 3gp;
    video/mp2t                            ts;
    video/mp4                             mp4;
    video/mpeg                            mpeg mpg;
    video/quicktime                       mov;
    video/webm                            webm;
    video/x-flv                           flv;
    video/x-m4v                           m4v;
    video/x-mng                           mng;
    video/x-ms-asf                        asx asf;
    video/x-ms-wmv                        wmv;
    video/x-msvideo                       avi;
}

# configuration file /data/.nginx/conf.d/default.conf:
    location /app-jupyter {
      proxy_pass http://127.0.0.1:8000;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      # websocket headers
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_http_version 1.1;
    }

# configuration file /data/.nginx/conf.d/file_server.conf:
    location /files/ {

      root /data/.gre/cache;
    }

# configuration file /data/.nginx/conf.d/itapbass.conf:
client_body_timeout 600s;
location = /itapbass { rewrite ^ /itapbass/; }
location /itapbass { try_files $uri @itapbass; }
location @itapbass {

    include uwsgi_params;
    uwsgi_pass 127.0.0.1:8031;
    uwsgi_read_timeout 18000;

}
# configuration file /etc/nginx/uwsgi_params:

uwsgi_param  QUERY_STRING       $query_string;
uwsgi_param  REQUEST_METHOD     $request_method;
uwsgi_param  CONTENT_TYPE       $content_type;
uwsgi_param  CONTENT_LENGTH     $content_length;

uwsgi_param  REQUEST_URI        $request_uri;
uwsgi_param  PATH_INFO          $document_uri;
uwsgi_param  DOCUMENT_ROOT      $document_root;
uwsgi_param  SERVER_PROTOCOL    $server_protocol;
uwsgi_param  REQUEST_SCHEME     $scheme;
uwsgi_param  HTTPS              $https if_not_empty;

uwsgi_param  REMOTE_ADDR        $remote_addr;
uwsgi_param  REMOTE_PORT        $remote_port;
uwsgi_param  SERVER_PORT        $server_port;
uwsgi_param  SERVER_NAME        $server_name;

# configuration file /data/.nginx/conf.d/itapgenetics.conf:
    location ^~ /itapgenetics {

      alias /illumina/scratch/deep_learning/target_discovery/DATA/OPEN_TARGETS/itaptarget-ui/apps/genetics/itapgenetics;
      try_files $uri $uri/ /itapgenetics/index.html;

    }

# configuration file /data/.nginx/conf.d/itapserver.conf:
location /api/statistic/single/ {

    add_header X-debug-message "I do get here" always;
    include uwsgi_params;
    uwsgi_pass 127.0.0.1:8037;
    uwsgi_read_timeout 18000;

}
# configuration file /data/.nginx/conf.d/itaptargets.conf:
    location ^~ /itaptargets {

      alias /illumina/scratch/deep_learning/target_discovery/DATA/OPEN_TARGETS/itaptarget-ui/apps/platform/itaptargets;
      try_files $uri $uri/ /itaptargets/index.html;

    }
</code>```

Body:
I have a NGINX configration that is supposed to serve a proxied server on the location /api/ but it does not do so.

This is the piece of the config that is not working:

location /api/ {
    include uwsgi_params;
    uwsgi_pass 127.0.0.1:8037;
    uwsgi_read_timeout 18000;
}

I know the proxy server is working:

uwsgi_curl 127.0.0.1:8037 /api/statistic/single/?filter=build%20eq%20GRCh37

Gives me the correct response (Abbreviated below)

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 3208
Access-Control-Allow-Origin: *

{"data":{"analysis":["GCST90012877","GCST90012
...

and the log file show this when I try to access vit http/curl

curl http://10.112.80.172:16888/api/statistic/single/?filter=build%20eq%20GRCh37

LOG:

023/01/03 00:32:54 [error] 310869#310869: *387057 "/usr/share/nginx/html/api/statistic/single/index.html" is not found (2: No such file or directory), client: 10.112.80.172, server: , request: "GET /api/statistic/single/
?filter=build%20eq%20GRCh37 HTTP/1.1", host: "10.112.80.172:16888"

It seems to want to serve the default index.html which is not actually there, and I have been successfull with other proxied uwsgi servers, so at a loss of what I am doing wrong....

Full config below:

tdeboer@fc-node152:~/gre/itapbass$ nginx -T
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:
worker_processes 1;
daemon on;
pid /data/.nginx/run/nginx.pid;
error_log  /data/.nginx/log/error.log;
events {
  worker_connections  1024;
}

http {
  include             /etc/nginx/mime.types;
  default_type        application/octet-stream;
  client_max_body_size 2500M;
  client_body_temp_path /data/.nginx/tmp/client_body;
  fastcgi_temp_path /data/.nginx/tmp/fastcgi_temp;
  proxy_temp_path /data/.nginx/tmp/proxy_temp;
  scgi_temp_path /data/.nginx/tmp/scgi_temp;
  uwsgi_temp_path /data/.nginx/tmp/uwsgi_temp;

  ##
  # Basic Settings
  ##

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;
  # server_tokens off;

  log_format   main '$remote_addr - $remote_user [$time_local]  $status '
                  '"$request" $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for" '
                  '$gzip_ratio $request_time' ;

  ##
  # Gzip Settings
  ##

  gzip on;
  gzip_disable "msie6";

  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

  access_log off;

  #####
  #
  # Added for shiny apps
  #
  map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
  }

  server {
    listen 16888 default_server;
    access_log /data/.nginx/log/access.log;
    include /etc/ica/.nginx/conf.d/*.conf;
    include /data/.nginx/conf.d/*.conf;

    error_page 502 504 /page.html;
    location /page.html {
        root /data/.nginx/html;
    }

    add_header Access-Control-Allow-Origin *;
}
}

# configuration file /etc/nginx/mime.types:

types {
    text/html                             html htm shtml;
    text/css                              css;
    text/xml                              xml;
    image/gif                             gif;
    image/jpeg                            jpeg jpg;
    application/javascript                js;
    application/atom+xml                  atom;
    application/rss+xml                   rss;

    text/mathml                           mml;
    text/plain                            txt;
    text/vnd.sun.j2me.app-descriptor      jad;
    text/vnd.wap.wml                      wml;
    text/x-component                      htc;

    image/png                             png;
    image/tiff                            tif tiff;
    image/vnd.wap.wbmp                    wbmp;
    image/x-icon                          ico;
    image/x-jng                           jng;
    image/x-ms-bmp                        bmp;
    image/svg+xml                         svg svgz;
    image/webp                            webp;

    application/font-woff                 woff;
    application/java-archive              jar war ear;
    application/json                      json;
    application/mac-binhex40              hqx;
    application/msword                    doc;
    application/pdf                       pdf;
    application/postscript                ps eps ai;
    application/rtf                       rtf;
    application/vnd.apple.mpegurl         m3u8;
    application/vnd.ms-excel              xls;
    application/vnd.ms-fontobject         eot;
    application/vnd.ms-powerpoint         ppt;
    application/vnd.wap.wmlc              wmlc;
    application/vnd.google-earth.kml+xml  kml;
    application/vnd.google-earth.kmz      kmz;
    application/x-7z-compressed           7z;
    application/x-cocoa                   cco;
    application/x-java-archive-diff       jardiff;
    application/x-java-jnlp-file          jnlp;
    application/x-makeself                run;
    application/x-perl                    pl pm;
    application/x-pilot                   prc pdb;
    application/x-rar-compressed          rar;
    application/x-redhat-package-manager  rpm;
    application/x-sea                     sea;
    application/x-shockwave-flash         swf;
    application/x-stuffit                 sit;
    application/x-tcl                     tcl tk;
    application/x-x509-ca-cert            der pem crt;
    application/x-xpinstall               xpi;
    application/xhtml+xml                 xhtml;
    application/xspf+xml                  xspf;
    application/zip                       zip;

    application/octet-stream              bin exe dll;
    application/octet-stream              deb;
    application/octet-stream              dmg;
    application/octet-stream              iso img;
    application/octet-stream              msi msp msm;

    application/vnd.openxmlformats-officedocument.wordprocessingml.document    docx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet          xlsx;
    application/vnd.openxmlformats-officedocument.presentationml.presentation  pptx;

    audio/midi                            mid midi kar;
    audio/mpeg                            mp3;
    audio/ogg                             ogg;
    audio/x-m4a                           m4a;
    audio/x-realaudio                     ra;

    video/3gpp                            3gpp 3gp;
    video/mp2t                            ts;
    video/mp4                             mp4;
    video/mpeg                            mpeg mpg;
    video/quicktime                       mov;
    video/webm                            webm;
    video/x-flv                           flv;
    video/x-m4v                           m4v;
    video/x-mng                           mng;
    video/x-ms-asf                        asx asf;
    video/x-ms-wmv                        wmv;
    video/x-msvideo                       avi;
}

# configuration file /data/.nginx/conf.d/default.conf:
    location /app-jupyter {
      proxy_pass http://127.0.0.1:8000;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      # websocket headers
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_http_version 1.1;
    }

# configuration file /data/.nginx/conf.d/file_server.conf:
    location /files/ {

      root /data/.gre/cache;
    }

# configuration file /data/.nginx/conf.d/itapbass.conf:
client_body_timeout 600s;
location = /itapbass { rewrite ^ /itapbass/; }
location /itapbass { try_files $uri @itapbass; }
location @itapbass {

    include uwsgi_params;
    uwsgi_pass 127.0.0.1:8031;
    uwsgi_read_timeout 18000;

}
# configuration file /etc/nginx/uwsgi_params:

uwsgi_param  QUERY_STRING       $query_string;
uwsgi_param  REQUEST_METHOD     $request_method;
uwsgi_param  CONTENT_TYPE       $content_type;
uwsgi_param  CONTENT_LENGTH     $content_length;

uwsgi_param  REQUEST_URI        $request_uri;
uwsgi_param  PATH_INFO          $document_uri;
uwsgi_param  DOCUMENT_ROOT      $document_root;
uwsgi_param  SERVER_PROTOCOL    $server_protocol;
uwsgi_param  REQUEST_SCHEME     $scheme;
uwsgi_param  HTTPS              $https if_not_empty;

uwsgi_param  REMOTE_ADDR        $remote_addr;
uwsgi_param  REMOTE_PORT        $remote_port;
uwsgi_param  SERVER_PORT        $server_port;
uwsgi_param  SERVER_NAME        $server_name;

# configuration file /data/.nginx/conf.d/itapgenetics.conf:
    location ^~ /itapgenetics {

      alias /illumina/scratch/deep_learning/target_discovery/DATA/OPEN_TARGETS/itaptarget-ui/apps/genetics/itapgenetics;
      try_files $uri $uri/ /itapgenetics/index.html;

    }

# configuration file /data/.nginx/conf.d/itapserver.conf:
location /api/statistic/single/ {

    add_header X-debug-message "I do get here" always;
    include uwsgi_params;
    uwsgi_pass 127.0.0.1:8037;
    uwsgi_read_timeout 18000;

}
# configuration file /data/.nginx/conf.d/itaptargets.conf:
    location ^~ /itaptargets {

      alias /illumina/scratch/deep_learning/target_discovery/DATA/OPEN_TARGETS/itaptarget-ui/apps/platform/itaptargets;
      try_files $uri $uri/ /itaptargets/index.html;

    }


来源: stackexchange

问:
How to handle status codes at the middleware level?
I receive negative status codes (500 code) from the backend on the client side,

I want to handle it on the middleware side.

How will it work?

If the status code == 500, then I redirect to the main page

But I can't figure out how to implement it.

I need a response

```<code>// middleware.ts
import { NextResponse, type NextRequest } from "next/server";

export function middleware(req: NextRequest, res: NextResponse) {
  const { pathname } = req.nextUrl;

  if (pathname.startsWith(`/company/`)) {
    res.redirect([500], "/"); // incorrect variant, cause res haven't redirect
  }
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I receive negative status codes (500 code) from the backend on the client side,

I want to handle it on the middleware side.

How will it work?

If the status code == 500, then I redirect to the main page

But I can't figure out how to implement it.

I need a response

// middleware.ts
import { NextResponse, type NextRequest } from "next/server";

export function middleware(req: NextRequest, res: NextResponse) {
  const { pathname } = req.nextUrl;

  if (pathname.startsWith(`/company/`)) {
    res.redirect([500], "/"); // incorrect variant, cause res haven't redirect
  }
}


问:
hidesBottomBarWhenPushed = false is not working when push from viewcontroller
My app UI heirarchy look like UItabbarcontroller -> navigation-controllers -> Dashoard view-controllers ->second controller(button tapped) -> third controller.
UI app heirarchy image

The problem am facing is hidesBottomBarWhenPushed = false is not working when i try to push a third controller from second controller on button click

```<code> @IBAction func buttonAction(_ sender: UIButton) {
 guard let controller  = UIStoryboard(name:StoryBoardSegueStrings.storyBoardNameiPhone.rawValue, bundle: nil).instantiateViewController(withIdentifier: "ThirdViewController") as? ThirdViewController else {return}
        controller.hidesBottomBarWhenPushed = false
        self.navigationController?.pushViewController(controller, animated: true)
}
</code>```

The Tabbar is not showing in the ThirdViewController.

Body:
My app UI heirarchy look like UItabbarcontroller -> navigation-controllers -> Dashoard view-controllers ->second controller(button tapped) -> third controller.
UI app heirarchy image

The problem am facing is hidesBottomBarWhenPushed = false is not working when i try to push a third controller from second controller on button click

 @IBAction func buttonAction(_ sender: UIButton) {
 guard let controller  = UIStoryboard(name:StoryBoardSegueStrings.storyBoardNameiPhone.rawValue, bundle: nil).instantiateViewController(withIdentifier: "ThirdViewController") as? ThirdViewController else {return}
        controller.hidesBottomBarWhenPushed = false
        self.navigationController?.pushViewController(controller, animated: true)
}

The Tabbar is not showing in the ThirdViewController.


问:
donot work groupAll and force together in highcharts
I had to remove the gap between the data, so I used the following code

```<code>xAxis: {
        type: 'datetime',
        ordinal: true,
}

series: [
        {

            dataGrouping: {
                groupAll: true,
                units: [[
                    '', []
                ]],
 }}]
</code>```

I also used the following code to use the time frame

```<code>    series: [
            {
            type: 'candlestick',

            data: ohlc.value,
            yAxis: 0,
            zIndex: 2,
            useOhlcData: true,

            dataGrouping: {
                groupAll: true,
                forced: true,
                units: [[
                    '', []
                ]],
            },
        },
        {
            type: 'column',
            id: 'volume',
            name: 'Volume',
            data: volume.value,
            yAxis: 1,
            zIndex: 1,
            opacity: 0.7,
            dataGrouping: {

                forced: true,

                units: [[
                    '', []
                ]],
            },

        }
</code>```

But the problem is that the following codes do not work together

dataGrouping: {
groupAll: true,
forced: true,}

Body:
I had to remove the gap between the data, so I used the following code

xAxis: {
        type: 'datetime',
        ordinal: true,
}

series: [
        {

            dataGrouping: {
                groupAll: true,
                units: [[
                    '', []
                ]],
 }}]

I also used the following code to use the time frame

    series: [
            {
            type: 'candlestick',

            data: ohlc.value,
            yAxis: 0,
            zIndex: 2,
            useOhlcData: true,

            dataGrouping: {
                groupAll: true,
                forced: true,
                units: [[
                    '', []
                ]],
            },
        },
        {
            type: 'column',
            id: 'volume',
            name: 'Volume',
            data: volume.value,
            yAxis: 1,
            zIndex: 1,
            opacity: 0.7,
            dataGrouping: {

                forced: true,

                units: [[
                    '', []
                ]],
            },

        }

But the problem is that the following codes do not work together

dataGrouping: {
groupAll: true,
forced: true,}


问:
Ida patch program Failed
I tried to create a segment using ida, and when I tried to save it as a new file, it never worked

I created a segment and set all its contents to 0.

Then I do the following：Edit -> Patch Program -> Apply patches to input file

And the output message as follow

```<code>6010F8: has no file mapping (original: FF patched: 00)...skipping...
6010F9: has no file mapping (original: FF patched: 00)...skipping...
6010FA: has no file mapping (original: FF patched: 00)...skipping...
6010FB: has no file mapping (original: FF patched: 00)...skipping...
6010FC: has no file mapping (original: FF patched: 00)...skipping...
6010FD: has no file mapping (original: FF patched: 00)...skipping...
6010FE: has no file mapping (original: FF patched: 00)...skipping...
6010FF: has no file mapping (original: FF patched: 00)...skipping...
Applied 0/160 patch(es)
</code>```

None of them seem to have succeeded

What should I do to save it successfully?

Title: Ida patch program Failed

Body:
I tried to create a segment using ida, and when I tried to save it as a new file, it never worked

I created a segment and set all its contents to 0.

Then I do the following：Edit -> Patch Program -> Apply patches to input file

And the output message as follow

6010F8: has no file mapping (original: FF patched: 00)...skipping...
6010F9: has no file mapping (original: FF patched: 00)...skipping...
6010FA: has no file mapping (original: FF patched: 00)...skipping...
6010FB: has no file mapping (original: FF patched: 00)...skipping...
6010FC: has no file mapping (original: FF patched: 00)...skipping...
6010FD: has no file mapping (original: FF patched: 00)...skipping...
6010FE: has no file mapping (original: FF patched: 00)...skipping...
6010FF: has no file mapping (original: FF patched: 00)...skipping...
Applied 0/160 patch(es)

None of them seem to have succeeded

What should I do to save it successfully?


问:
Chrome extension violates the following Content Security Policy directive: "default-src 'self' blob: filesystem: chrome-extension-resource"
I'm doing currency converter chrome extension and so far I've done almost everything but the math. It ain't mathing. I have popup.js javascript file inside folder with popup.html in which I call popup.js for the math. When I try to use my program on chrome, it gives me error that sounds like this:

Refused to execute inline event handler because it violates the following Content Security Policy directive: "default-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.

I would get this message when I click the button "Calculate". Even stranger now, I changed something and deleted changes afterwards and now I don't get that error message, but it still wouldn't display the converter value. Here's my code:

So this is the body part of popup.html

```<code><div class="modal-content">
            <p>Pretvorite eure u kune i obrnuto bez problema!</p>
        </p>
        <form>
            <p>
                <label for="amount">Količina:</label>
                <input type="text" id="amount" value="">
                <select id="select">
                    <option value="HRK">HRK </option>
                    <option value="EUR">EUR </option>
                </select>
                <select id="select1">
                    <option value="HRK">HRK </option>
                    <option value="EUR">EUR </option>
                </select>
                <input type="text" id="result" value="">
            </p>
            <p>
                <input type="button" value="Calculate" onclick="calculate();">
                <input type="reset" value="Resetiraj">
            </p>
        </form>
</code>```

This is whole popup.js

```<code>function calculate() {
    var amount = parseFloat(document.getElementById("amount").value);
    var select = document.getElementById("select");
    var select1 = document.getElementById("select1");
    var result = document.getElementById("result");

    if (select.value === "HRK" && select1.value === "HRK")  {
      result.value = (amount * 1);
    }
    if (select.value === "HRK" && select1.value === "EUR")  {
      result.value = (amount * 0.13272);
    }
    if (select.value === "EUR" && select1.value === "HRK")  {
      result.value = (amount * 7.53450);
    }
  }
</code>```

I call .js in body of html with

```<code><script type = "text/javascript" src = "popup. js"></script>
</code>```

Also, this is not relevant to this problem, I'd like to display the tiktok icon at the very bottom of extension window. The font I'm using should support icons (fontawesome), but they don't display. It only shows rectangular window and that's all. Here's the code part in the body of html for that

```<code><div class="modal-icons">
            <div class="flex-container">
                <div class="flex">
                    <a href="here's my TT link" target="_blank"> #This works
                        <i class="fab fa-tiktok"></i> #This for sure won't work
                    </a>
                </div>
            </div>
        </div>
</code>```

I saw some article here on stackoverflow about the same issue I mentioned (that error message) and tried fixing it by following the resolution on that article, but it didn't help. The error message was gone when I removed that resolution from my original code, but the conversion still wouldn't work.

I found out spelling mistake in the src="popup.js" and now the error message is back!

Body:
I'm doing currency converter chrome extension and so far I've done almost everything but the math. It ain't mathing. I have popup.js javascript file inside folder with popup.html in which I call popup.js for the math. When I try to use my program on chrome, it gives me error that sounds like this:

Refused to execute inline event handler because it violates the following Content Security Policy directive: "default-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.

I would get this message when I click the button "Calculate". Even stranger now, I changed something and deleted changes afterwards and now I don't get that error message, but it still wouldn't display the converter value. Here's my code:

So this is the body part of popup.html

Pretvorite eure u kune i obrnuto bez problema!

        <form>

                Količina:
                <input type="text" id="amount" value="">
                <select id="select">
                    <option value="HRK">HRK </option>
                    <option value="EUR">EUR </option>
                </select>
                <select id="select1">
                    <option value="HRK">HRK </option>
                    <option value="EUR">EUR </option>
                </select>
                <input type="text" id="result" value="">

                <input type="button" value="Calculate" onclick="calculate();">
                <input type="reset" value="Resetiraj">

        </form>

This is whole popup.js

function calculate() {
    var amount = parseFloat(document.getElementById("amount").value);
    var select = document.getElementById("select");
    var select1 = document.getElementById("select1");
    var result = document.getElementById("result");

    if (select.value === "HRK" && select1.value === "HRK")  {
      result.value = (amount * 1);
    }
    if (select.value === "HRK" && select1.value === "EUR")  {
      result.value = (amount * 0.13272);
    }
    if (select.value === "EUR" && select1.value === "HRK")  {
      result.value = (amount * 7.53450);
    }
  }

I call .js in body of html with

Also, this is not relevant to this problem, I'd like to display the tiktok icon at the very bottom of extension window. The font I'm using should support icons (fontawesome), but they don't display. It only shows rectangular window and that's all. Here's the code part in the body of html for that

                     #This works
                         #This for sure won't work

I saw some article here on stackoverflow about the same issue I mentioned (that error message) and tried fixing it by following the resolution on that article, but it didn't help. The error message was gone when I removed that resolution from my original code, but the conversion still wouldn't work.

I found out spelling mistake in the src="popup.js" and now the error message is back!


问:
Powershell search and replace bold text in excel
I have an excel file which contains some text in bold. I need to find that bold text with Powershell, wrap it with some HTML code, save and close that xlsx file.

For example there's string in Excel file (which contains a lot of text): My name is Marek. The result should be: My name  is Marek.

I have the code below which identifies bold text but I don't know how to save the bold text into variable and add HTML code mentioned above.

```<code>$xlsx  = Open-ExcelPackage path\to\my.xlsx
$sheet = $xlsx.Workbook.Worksheets['mySheetName']
foreach($cell in $sheet.Cells) {
    foreach($richText in $cell.RichText) {
        if($richText.Bold) {
            [pscustomobject]@{
                Address = $cell.Address
                Value   = $richText.Text
            }
        }
    }
}
</code>```

Thanks a lot for any help.

Body:
I have an excel file which contains some text in bold. I need to find that bold text with Powershell, wrap it with some HTML code, save and close that xlsx file.

For example there's string in Excel file (which contains a lot of text): My name is Marek. The result should be: My name  is Marek.

I have the code below which identifies bold text but I don't know how to save the bold text into variable and add HTML code mentioned above.

$xlsx  = Open-ExcelPackage path\to\my.xlsx
$sheet = $xlsx.Workbook.Worksheets['mySheetName']
foreach($cell in $sheet.Cells) {
    foreach($richText in $cell.RichText) {
        if($richText.Bold) {
            [pscustomobject]@{
                Address = $cell.Address
                Value   = $richText.Text
            }
        }
    }
}

Thanks a lot for any help.


问:
How to change the labelling of the intersection size and set size?
How can I display the intersection size as percentage of total rows? How can I change the set size as percentage of total rows? The set size should display the marginals, i.e., the total TRUEs returned by one member (column)?</p>
```<code>{
  library(ggplot2)
  library(ComplexUpset)
}

set_size(8, 3)

upset(
  head(M1_BinaryMatrix, 1000),
  colnames(M1_BinaryMatrix),
  base_annotations = list('Size'=(intersection_size(counts=TRUE, mode='inclusive_intersection'))
    + ylab("")
    + theme(axis.text.y=element_blank())
    ),
  sort_intersections_by='ratio',
  name = "",
  annotations = list(),
  themes = upset_themes,
  stripes=c(alpha('grey90', 0.45), alpha('white', 0.3)),
  labeller = identity,
  height_ratio = 0.5,
  width_ratio = 0.3,
  sort_sets='ascending',
  wrap = FALSE,
  set_sizes=(
    upset_set_size(position='right')
    + geom_text(aes(label=!!aes_percentage(relative_to='all')), hjust=1.1, stat='count', color='white')
    + ylab("")
    + theme(axis.text.x = element_blank())
  ),
  mode = "inclusive_intersection",
  queries = list(),
  guides = NULL,
  encode_sets = TRUE,
  matrix = intersection_matrix(
    geom=geom_point(
    shape='square',
    size=4
  ),
  segment=geom_segment(
    linetype='solid'
  ),
  outline_color=list(
    active='darkorange3',
    inactive='grey70'
  )
  ),
  n_intersections='all'
  ) +
  labs(title = "",
       caption = "")
</code>```

Body:
How can I display the intersection size as percentage of total rows? How can I change the set size as percentage of total rows? The set size should display the marginals, i.e., the total TRUEs returned by one member (column)?

{
  library(ggplot2)
  library(ComplexUpset)
}

set_size(8, 3)

upset(
  head(M1_BinaryMatrix, 1000),
  colnames(M1_BinaryMatrix),
  base_annotations = list('Size'=(intersection_size(counts=TRUE, mode='inclusive_intersection'))
    + ylab("")
    + theme(axis.text.y=element_blank())
    ),
  sort_intersections_by='ratio',
  name = "",
  annotations = list(),
  themes = upset_themes,
  stripes=c(alpha('grey90', 0.45), alpha('white', 0.3)),
  labeller = identity,
  height_ratio = 0.5,
  width_ratio = 0.3,
  sort_sets='ascending',
  wrap = FALSE,
  set_sizes=(
    upset_set_size(position='right')
    + geom_text(aes(label=!!aes_percentage(relative_to='all')), hjust=1.1, stat='count', color='white')
    + ylab("")
    + theme(axis.text.x = element_blank())
  ),
  mode = "inclusive_intersection",
  queries = list(),
  guides = NULL,
  encode_sets = TRUE,
  matrix = intersection_matrix(
    geom=geom_point(
    shape='square',
    size=4
  ),
  segment=geom_segment(
    linetype='solid'
  ),
  outline_color=list(
    active='darkorange3',
    inactive='grey70'
  )
  ),
  n_intersections='all'
  ) +
  labs(title = "",
       caption = "")


问:
How to replace external-content.duckduckgo.com in Apache proxy?
I'm trying to setup a reverse proxy for DuckDuckGo on Apache(ddg.example.com). Now I can visit DuckDuckGo home page and search something through my Apache server. But I found that the images in the search page are not shown. I tried to setup a reverse proxy for external-content.duckduckgo.com(The domain of the images) and use Substitute command to replace it by ddgec.example.com(My image reverse proxy URL). But it didn't work. What should I do?
Here are some contents of my configuration file(ddg.example.com):

```<code>ProxyVia On
SSLProxyEngine On
RequestHeader set Front-End-Https "On"
RequestHeader set Accept-Encoding ""
Header unset Content-Security-Policy
ProxyPass "/" "https://duckduckgo.com/"
ProxyPassReverse "/" "https://duckduckgo.com/"
ProxyPassReverseCookieDomain "duckduckgo.com" "ddg.example.com"
AddOutputFilterByType SUBSTITUTE text/html text/css text/javascript application/javascript
SetEnv filter-errordocs
Substitute "s|external-content.duckduckgo.com|ddgec.example.com|ni"
Substitute "s|duckduckgo.com|ddg.example.com|ni"
</code>```

Sorry for my broken English.

Body:
I'm trying to setup a reverse proxy for DuckDuckGo on Apache(ddg.example.com). Now I can visit DuckDuckGo home page and search something through my Apache server. But I found that the images in the search page are not shown. I tried to setup a reverse proxy for external-content.duckduckgo.com(The domain of the images) and use Substitute command to replace it by ddgec.example.com(My image reverse proxy URL). But it didn't work. What should I do?
Here are some contents of my configuration file(ddg.example.com):

ProxyVia On
SSLProxyEngine On
RequestHeader set Front-End-Https "On"
RequestHeader set Accept-Encoding ""
Header unset Content-Security-Policy
ProxyPass "/" "https://duckduckgo.com/"
ProxyPassReverse "/" "https://duckduckgo.com/"
ProxyPassReverseCookieDomain "duckduckgo.com" "ddg.example.com"
AddOutputFilterByType SUBSTITUTE text/html text/css text/javascript application/javascript
SetEnv filter-errordocs
Substitute "s|external-content.duckduckgo.com|ddgec.example.com|ni"
Substitute "s|duckduckgo.com|ddg.example.com|ni"

Sorry for my broken English.


问:
Reuse ViewPager fragment in Another Activity
I have a heavy fragment which I don't want to recreate again. I have inflated it as the second element of ViewPager, now on opening a new activity I want to use that same fragment without recreating it from scratch.

Thing I have Tried:

```<code> var fragment1 =
            fm.findFragmentByTag("android:switcher:" + R.id.viewPager.toString() + ":1")
</code>```

But the problem is this as soon as I leave my current activity which contains the ViewPager the findFragmentByTag starts getting null as ultimately I need this fragment in a new activity.

I even tried passing the same supportFragmentManager used to create ViewPager but then I started getting issues like Fragment needs to have the same container id.

Have anyone tried anything in this context?

Body:
I have a heavy fragment which I don't want to recreate again. I have inflated it as the second element of ViewPager, now on opening a new activity I want to use that same fragment without recreating it from scratch.

Thing I have Tried:

 var fragment1 =
            fm.findFragmentByTag("android:switcher:" + R.id.viewPager.toString() + ":1")

But the problem is this as soon as I leave my current activity which contains the ViewPager the findFragmentByTag starts getting null as ultimately I need this fragment in a new activity.

I even tried passing the same supportFragmentManager used to create ViewPager but then I started getting issues like Fragment needs to have the same container id.

Have anyone tried anything in this context?


问:
How to send files from one android device to another through bluetooth in android studio ? Only the SENDING device installs my app
I want to send a file But without showing any activity or intent. when user click on the send button, the specific file send to target. Its not a chat application.

```<code>//enable bluetooth
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);

   //get list of bonded devices
    Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
    if (pairedDevices.size() > 0) {
    for (BluetoothDevice device : pairedDevices) {
      //  arrayAdapter1.add(device.getName() + "\n" + device.getAddress());
        arrayList2.add(device);
        Toast.makeText(getActivity(), "" + arrayList2, Toast.LENGTH_SHORT).show();
        mDevices1.add(device.getName());

    }
    arrayAdapter1 = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, mDevices1);
    devicelist.setAdapter(arrayAdapter1);

    //create bond with selected device
 boolean paired = bluetoothDevice.createBond();
</code>```

`

`

Am I doing right?

Body:
I want to send a file But without showing any activity or intent. when user click on the send button, the specific file send to target. Its not a chat application.

//enable bluetooth
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);

   //get list of bonded devices
    Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
    if (pairedDevices.size() > 0) {
    for (BluetoothDevice device : pairedDevices) {
      //  arrayAdapter1.add(device.getName() + "\n" + device.getAddress());
        arrayList2.add(device);
        Toast.makeText(getActivity(), "" + arrayList2, Toast.LENGTH_SHORT).show();
        mDevices1.add(device.getName());

    }
    arrayAdapter1 = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, mDevices1);
    devicelist.setAdapter(arrayAdapter1);

    //create bond with selected device
 boolean paired = bluetoothDevice.createBond();

`

`

Am I doing right?


问:
Cypress hangs on CI
Ive noticed that cypress build started to hang from time to time on CI and now it happens all the time, it just stops logging.
Im using the following stack:

github actions + 2 ubuntu runners

cypress 9.6.1+cypress-cucumber-preprocessor 4.3.1, node 14

cypress dashboard for keeping test results

headless chrome

I thought that it was related to disk space or RAM but there should be enough space(I added   free and df commands before each test). The last thing I tried - enabling debug logs, I noticed that in the end of each failed run it contains a lot of 'cypress:server:request aborting { requestId: 'request161' } +0ms' records and then starts to print cpu/mem stats every 10 second. Has someone seen this?

Can it happen due to problems with cypress dashboard(cypress dashboard manages parallel execution)? It's strange that 2 VMs hangs at the same time...

I tried changing browser, using VMs with more RAM. Im going to try "parallel: false" and disable recording test result to cypress cloud

Title: Cypress hangs on CI


问:
Stop device camera using javascript
I am using ngx-webcam package in angular to display webcam. They have not provided any way to stop the camera it just stop when component is destroyed. I have hidden webcam component so that user can't see the webcam. I have tried to stop the webcam using javascript with following code

```<code>if (this.mediaStream && this.mediaStream.getTracks) {
  this.mediaStream.getTracks().forEach((track: MediaStreamTrack) => {
    track.stop()
  })
}
</code>```

But the indicator light for the webcam does not switch off.

The ngx-webcam package code is as follow

```<code>component.html

<div class="hidden">
  <webcam [height]="400" [width]="400" [trigger]="triggerObservable" (imageCapture)="handleImage($event)"
    *ngIf="showWebcam" [allowCameraSwitch]="allowCameraSwitch"
    [switchCamera]="nextWebcamObservable" [imageQuality]="1"
    (initError)="handleInitError($event)" mirrorImage="never">
  </webcam>
</div>
</code>```
```<code>component.css

.hidden {
  display: none;
}

</code>```

I have used showWebcam flag to destroy the component.

I am not able to understand if I have done something wrong in the code.

Thank you!

The ngx-webcam package does not have anything specified to stop the webcam. It stops when the component is destroyed. I have used showWebCam flag to destroy the component but it doesn't work. I have also tried by not hidding the component but got same result. I have also tried using javascript and even that didn't work for me.

Title: Stop device camera using javascript

Body:
I am using ngx-webcam package in angular to display webcam. They have not provided any way to stop the camera it just stop when component is destroyed. I have hidden webcam component so that user can't see the webcam. I have tried to stop the webcam using javascript with following code

if (this.mediaStream && this.mediaStream.getTracks) {
  this.mediaStream.getTracks().forEach((track: MediaStreamTrack) => {
    track.stop()
  })
}

But the indicator light for the webcam does not switch off.

The ngx-webcam package code is as follow

component.html

  <webcam [height]="400" [width]="400" [trigger]="triggerObservable" (imageCapture)="handleImage($event)"
    *ngIf="showWebcam" [allowCameraSwitch]="allowCameraSwitch"
    [switchCamera]="nextWebcamObservable" [imageQuality]="1"
    (initError)="handleInitError($event)" mirrorImage="never">
  </webcam>

component.css

.hidden {
  display: none;
}

I have used showWebcam flag to destroy the component.

I am not able to understand if I have done something wrong in the code.

Thank you!

The ngx-webcam package does not have anything specified to stop the webcam. It stops when the component is destroyed. I have used showWebCam flag to destroy the component but it doesn't work. I have also tried by not hidding the component but got same result. I have also tried using javascript and even that didn't work for me.


问:
How to import module without warning
My file system is like this:

/project
  └─Scripts
     └─src
        ├─main.py
        └─mylibrary
           ├─__init__.py
           ├─analyzer.py
           └─evaluator.py
```
<p>My <code>__init__.py</code> is like this:</p>
```from .analyzer import *
from .evaluator import *
```
<p>and when I try to import the module I do either line of this in main.py:</p>
```from ..src import mylibrary as ml
from .mylibrary import *
from . import mylibrary as ml
```
<p>which gives me an error like:</p>
```Traceback (most recent call last):
  File "g:\My Drive\codes\project\Scripts\src\main.py", line 1, in <module>
    {either line of the code above}
ImportError: attempted relative import with no known parent package
```
<p>and after all I've decided to code like this:</p>
```import mylibrary as ml
```
<p>This works fine, but the IDE is giving me a warning that says:</p>
<pre class="lang-none prettyprint-override"><code>Import "mylibrary" could not be resolvedPylance
</code>```

For some time I've continued coding ignoring the warning, but the useful features that VS Code offers are disabled in a situation like this and I decided to ask for your advice.

I also tried to import the module I do either line of this in main.py:

```<code>import sys
sys.path.append('./mylibrary')
from . import mylibrary as ml
</code>```

and the IDE throws the third line above the second line and I'm not sure if this can solve my problem.

Title: How to import module without warning

Body:
My file system is like this:

/project
  └─Scripts
     └─src
        ├─main.py
        └─mylibrary
           ├─__init__.py
           ├─analyzer.py
           └─evaluator.py

My __init__.py is like this:

from .analyzer import *
from .evaluator import *

and when I try to import the module I do either line of this in main.py:

from ..src import mylibrary as ml
from .mylibrary import *
from . import mylibrary as ml

which gives me an error like:

Traceback (most recent call last):
  File "g:\My Drive\codes\project\Scripts\src\main.py", line 1, in <module>
    {either line of the code above}
ImportError: attempted relative import with no known parent package

and after all I've decided to code like this:

import mylibrary as ml

This works fine, but the IDE is giving me a warning that says:

Import "mylibrary" could not be resolvedPylance

For some time I've continued coding ignoring the warning, but the useful features that VS Code offers are disabled in a situation like this and I decided to ask for your advice.

I also tried to import the module I do either line of this in main.py:

import sys
sys.path.append('./mylibrary')
from . import mylibrary as ml

and the IDE throws the third line above the second line and I'm not sure if this can solve my problem.


问:
javax.net.ssl.SSLHandshakeException getting thrown in Eclipse but not once the project is exported
So I am trying to make a Minecraft client and I happen to need to download some content (A JSON file) off of a repl. It always worked in the past but now I get this error:

```<code>14:27:22.722
game
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1497)
14:27:22.722
game
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212)
14:27:22.722
game
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
14:27:22.722
game
at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
14:27:22.722
game
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
14:27:22.722
game
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
14:27:22.722
game
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
14:27:22.722
game
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
14:27:22.722
game
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
14:27:22.722
game
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
14:27:22.722
game
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)
14:27:22.722
game
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
14:27:22.722
game
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
14:27:22.723
game
at java.net.URL.openStream(URL.java:1038)
14:27:22.723
game
at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1460)
14:27:22.723
game
at orangeclient.cosmetics.CapeChecker$1.run(CapeChecker.java:125)
</code>```

This, however, is only happening when I launch the game from the launcher and not when debugging with eclipse IDE.

I've tried making it request to http instead of https but replit just gives me a permanent redirect, and that's not a JSON.

Oh, and also, don't tell me to use keypairs and stuff I don't want to have to do it for every single person that wants to use my client.

Thanks.

Body:
So I am trying to make a Minecraft client and I happen to need to download some content (A JSON file) off of a repl. It always worked in the past but now I get this error:

14:27:22.722
game
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1497)
14:27:22.722
game
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212)
14:27:22.722
game
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
14:27:22.722
game
at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
14:27:22.722
game
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
14:27:22.722
game
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
14:27:22.722
game
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
14:27:22.722
game
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
14:27:22.722
game
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
14:27:22.722
game
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
14:27:22.722
game
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)
14:27:22.722
game
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
14:27:22.722
game
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
14:27:22.723
game
at java.net.URL.openStream(URL.java:1038)
14:27:22.723
game
at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1460)
14:27:22.723
game
at orangeclient.cosmetics.CapeChecker$1.run(CapeChecker.java:125)

This, however, is only happening when I launch the game from the launcher and not when debugging with eclipse IDE.

I've tried making it request to http instead of https but replit just gives me a permanent redirect, and that's not a JSON.

Oh, and also, don't tell me to use keypairs and stuff I don't want to have to do it for every single person that wants to use my client.

Thanks.


问:
Elasticsearch: order posts by numder of friends liked
I'm working on a social network project and stuck with this particular task.

When I do text search for posts, I need to first show the ones that the user's friends liked. I considered a few ways to deal with it:

Store the likes as an array of user ids and pass the user's friends list as a query parameter.

Store the likes as nested objects with user id and list of friends in it.

Denormalize the data even further, replace posts index with likes index and store the post text in each like document.

Combine #2 and #3, so, each like document contains the list of friends.

All of them look fine with small number of likes and friends, but, if we scale up to potential millions of likes and thousands of friends, they all have issues:

I don't want to send thousands of user ids as a query parameter for every single search request.

It would be a huge pain to keep the data consistent, I'd have to update all the posts liked by the user when they friend/unfriend somebody.

I'd have to store the same post text millions of times, and update millions of likes in case of an edit.

#2 and #3 combined.

Is there a better way to solve this kind of problems with Elasticsearch?

Or, maybe, there's a better tool for the job? For now, I decided to use ES for the text-search capabilities.


问:
Mongodb Server issue MongooseError: The `uri` parameter to `openUri()meter to `mo()` i
```<code>const express=require("express");
const colors= require('colors');
const morgan = require('morgan');
const dotenv=require('dotenv');
const connectDB= require( "./config/db");
const { json } = require("express");
dotenv.config()

connectDB();
const app=express()

app.use(json())
app.use(morgan('dev'))

app.get('/',(req,res)=>{
    res.status(200).send({
        message:"server running ",
    })
})

const port =process.env.PORT ||8080
app.listen(port,(err)=>{
    console.log('server started on port: '+port);
})
</code>```

Mongodb Server issue MongooseError: The uri parameter to openUri() must be a string, got "undefined". Make sure the first parameter to mongoose.connect() or mongoose.createConnection() is a string.

Body:
const express=require("express");
const colors= require('colors');
const morgan = require('morgan');
const dotenv=require('dotenv');
const connectDB= require( "./config/db");
const { json } = require("express");
dotenv.config()

connectDB();
const app=express()

app.use(json())
app.use(morgan('dev'))

app.get('/',(req,res)=>{
    res.status(200).send({
        message:"server running ",
    })
})

const port =process.env.PORT ||8080
app.listen(port,(err)=>{
    console.log('server started on port: '+port);
})

Mongodb Server issue MongooseError: The uri parameter to openUri() must be a string, got "undefined". Make sure the first parameter to mongoose.connect() or mongoose.createConnection() is a string.


问:
Keycloak:Ip is visible in cookie auth_session_id and auth_session_id_legacy
I have keycloak 17 running in aws ec2 instance and that is integrated with my application. I’m using nginx as reverse proxy for keycloak and my application.
If i login to my application in the network tab of browser i can able to see one api .

```<code>authenticate?session_code=Wdb3Yvw-3wGFk0&execution=-9b6d-9a71fbhdg7faab9&client_id=realm&tab_id=dijir0ddr
</code>```

In the headers tab of above api, if i navigate to request header there cookie attribute is present with some value as:

```<code>Cookie: AUTH_SESSION_ID=cd3-445-82b8.ip-19-16-0-***-***; AUTH_SESSION_ID_LEGACY=cd3-445-82b8.ip-19-16-0-***-***;
</code>```

In the above cookie my instance private ip is visible. Is there any way to configure this. And why this auth_session_id is taking instance private ip.

How to disable this ip disclosure in browser ?

Thanks in advance for the help.

Body:
I have keycloak 17 running in aws ec2 instance and that is integrated with my application. I’m using nginx as reverse proxy for keycloak and my application.
If i login to my application in the network tab of browser i can able to see one api .

authenticate?session_code=Wdb3Yvw-3wGFk0&execution=-9b6d-9a71fbhdg7faab9&client_id=realm&tab_id=dijir0ddr

In the headers tab of above api, if i navigate to request header there cookie attribute is present with some value as:

Cookie: AUTH_SESSION_ID=cd3-445-82b8.ip-19-16-0-***-***; AUTH_SESSION_ID_LEGACY=cd3-445-82b8.ip-19-16-0-***-***;

In the above cookie my instance private ip is visible. Is there any way to configure this. And why this auth_session_id is taking instance private ip.

How to disable this ip disclosure in browser ?

Thanks in advance for the help.


问:
Laravel 8 redis: key is set but can't list keys via redis-client
I started using redis with Laravel 8 for caching and implement it the easy way

In .env I set redis server host and password

```<code>CACHE_DRIVER=redis
REDIS_HOST=xxxxxx
REDIS_PASSWORD=xxxxxxx
</code>```

Then I run config:clear and to double check I run optimize:clear also. In my code:

```<code>\Cache::put($keyName, $value, 3600*24); // lifetime 24 hours
</code>```

In another request:

```<code>if (\Cache::has($keyName)) {
    logger('cache exists');
}
else {
    logger('cache does not exist');
}
</code>```

And I get cache exists in the log but when in redis cli when I run KEYS * I get nothing at all it's empty.

I tried to set the key using a sample node express app and when I run the same command KEYS * I got it.

I'm not sure if there's anything wrong with my code in Laravel but it's working though I can't list any key I set. Why is this happening if you had this problem before and how to fi it?

Body:
I started using redis with Laravel 8 for caching and implement it the easy way

In .env I set redis server host and password

CACHE_DRIVER=redis
REDIS_HOST=xxxxxx
REDIS_PASSWORD=xxxxxxx

Then I run config:clear and to double check I run optimize:clear also. In my code:

\Cache::put($keyName, $value, 3600*24); // lifetime 24 hours

In another request:

if (\Cache::has($keyName)) {
    logger('cache exists');
}
else {
    logger('cache does not exist');
}

And I get cache exists in the log but when in redis cli when I run KEYS * I get nothing at all it's empty.

I tried to set the key using a sample node express app and when I run the same command KEYS * I got it.

I'm not sure if there's anything wrong with my code in Laravel but it's working though I can't list any key I set. Why is this happening if you had this problem before and how to fi it?


问:
Create a linked database in SQL Server as a local database
I would like to make a linked server like it is part of the main server (like the secondary/linked server does not exist).

I have two database servers A & B. I can create a linked server in A to B, as I can't reach B directly.

But to access or execute request I have to specify the name of the linked server :

```<code>select *
from [B].database.dbo.table
</code>```

I would like to be able to write statements like if the database on  server B is on the server A

```<code>select *
from database.dbo.table
</code>```

I managed to link the server but cannot make a linked database as part of the principal server.

Servers are not in the same version.

Body:
I would like to make a linked server like it is part of the main server (like the secondary/linked server does not exist).

I have two database servers A & B. I can create a linked server in A to B, as I can't reach B directly.

But to access or execute request I have to specify the name of the linked server :

select *
from [B].database.dbo.table

I would like to be able to write statements like if the database on  server B is on the server A

select *
from database.dbo.table

I managed to link the server but cannot make a linked database as part of the principal server.

Servers are not in the same version.


问:
Delete subcollection of document in firebase (javascript)
How to delete subcolletion of document in firebase?

This is my code where I am getting subcollection "tieredRewards" and company id's which has tiered rewards. I want to delete tieredReward subcollection in every company.

```<code>let _query1 = query(collection(db, "companies"));

const companiesSnapshot = await getDocs(_query3);
companiesSnapshot.docs.map(async (doc) => {
  let _query2 = query(
    collection(db, `companies/${doc.id}/tieredRewards`)
  );
  const tieredRewardsSnapShot = await getDocs(_query4);
  if (!tieredRewardsSnapShot.empty) {
    console.log(doc.id);
  }
});
</code>```

I tried deleteDoc method, but it did not work.

Body:
How to delete subcolletion of document in firebase?

This is my code where I am getting subcollection "tieredRewards" and company id's which has tiered rewards. I want to delete tieredReward subcollection in every company.

let _query1 = query(collection(db, "companies"));

const companiesSnapshot = await getDocs(_query3);
companiesSnapshot.docs.map(async (doc) => {
  let _query2 = query(
    collection(db, `companies/${doc.id}/tieredRewards`)
  );
  const tieredRewardsSnapShot = await getDocs(_query4);
  if (!tieredRewardsSnapShot.empty) {
    console.log(doc.id);
  }
});

I tried deleteDoc method, but it did not work.


问:
C# Microsoft.Office.Interop.Word - complaint about unsaved documents on Windows shutdown
I am using Microsoft.Office.Interop.Word for spell checking of strings in a C# application.
This works fine, but after running my application, I cannot shut down Windows because it always complains about unsaved documents.
My class has a static Microsoft.Office.Interop.Word.Application instance, which I initialize as follows:

```<code>public static void InitializeTheWordApplicationInstance()
{
    if (theWordApplicationInstance == null)
    {
        theWordApplicationInstance = new Microsoft.Office.Interop.Word.Application();
        theWordApplicationInstance.Visible = false;

        theWordApplicationInstance.Documents.Add(); // this probably causes a document to be opened and not saved.
    }
}
</code>```

After spell checking, I release the Microsoft.Office.Interop.Word.Application instance as follows:

```<code>public static void ReleaseTheWordApplicationInstance()
{
    if (theWordApplicationInstance != null)
    {
        object? nullArgmnt = null;
        theWordApplicationInstance.Visible = false;
        theWordApplicationInstance.Documents.Close(WdSaveOptions.wdDoNotSaveChanges);
        theWordApplicationInstance.Visible = false;
        theWordApplicationInstance.Quit(ref nullArgmnt, ref nullArgmnt, ref nullArgmnt);
        theWordApplicationInstance = null;
    }
}
</code>```

Nevertheless, when I shut down Windows I always get this complaint about an application preventing shutdown, and when I look for the culprit it is Word, which requires a decision on what to do with unsaved documents.

How can I close all open, supposedly unsaved documents?

Thanks a lot in advance!

I tried to use Word.Interop for a spell check of single strings and quit the application cleanly afterward. However, when I shut down Windows, I get the request how to proceed with the unsaved Word documents.

Body:
I am using Microsoft.Office.Interop.Word for spell checking of strings in a C# application.
This works fine, but after running my application, I cannot shut down Windows because it always complains about unsaved documents.
My class has a static Microsoft.Office.Interop.Word.Application instance, which I initialize as follows:

public static void InitializeTheWordApplicationInstance()
{
    if (theWordApplicationInstance == null)
    {
        theWordApplicationInstance = new Microsoft.Office.Interop.Word.Application();
        theWordApplicationInstance.Visible = false;

        theWordApplicationInstance.Documents.Add(); // this probably causes a document to be opened and not saved.
    }
}

After spell checking, I release the Microsoft.Office.Interop.Word.Application instance as follows:

public static void ReleaseTheWordApplicationInstance()
{
    if (theWordApplicationInstance != null)
    {
        object? nullArgmnt = null;
        theWordApplicationInstance.Visible = false;
        theWordApplicationInstance.Documents.Close(WdSaveOptions.wdDoNotSaveChanges);
        theWordApplicationInstance.Visible = false;
        theWordApplicationInstance.Quit(ref nullArgmnt, ref nullArgmnt, ref nullArgmnt);
        theWordApplicationInstance = null;
    }
}

Nevertheless, when I shut down Windows I always get this complaint about an application preventing shutdown, and when I look for the culprit it is Word, which requires a decision on what to do with unsaved documents.

How can I close all open, supposedly unsaved documents?

Thanks a lot in advance!

I tried to use Word.Interop for a spell check of single strings and quit the application cleanly afterward. However, when I shut down Windows, I get the request how to proceed with the unsaved Word documents.


问:
How to run Puppeteer with PM2 cluster mode
On VPS I have installed chromium browser and given executable path like this:

```<code>const browser = await puppeteer.launch({
  executablePath: '/usr/bin/chromium-browser'
})
</code>```

But it is mentioned here: https://stackoverflow.com/a/57663436 that path should be different for each cluster in PM2. With PM2 5 instance cluster how can I give different executable paths so that load gets shared among each cluster?

Body:
On VPS I have installed chromium browser and given executable path like this:

const browser = await puppeteer.launch({
  executablePath: '/usr/bin/chromium-browser'
})

But it is mentioned here: https://stackoverflow.com/a/57663436 that path should be different for each cluster in PM2. With PM2 5 instance cluster how can I give different executable paths so that load gets shared among each cluster?


问:
Post type as radio elements for a featured function
How can I display a post type as radio elements in the frontend of my website, so that a user can select one of the posts to be displayed on another page? I want to implement a "featured" function, where the selected post will be displayed on another page.</p>
```<code><?php
$attachments = get_posts( array(
    'post_type'      => 'post',
    'posts_per_page' => 500,
    'post_status'    => 'any',
'post_parent'    => null,
    'author'        =>  $current_user->ID
) );

if ( $attachments ) {

    echo "<form>";
    foreach ( $attachments as $post ) {
        setup_postdata( $post );
        echo "<div>";
        echo "<input type='radio' name='fav_language' value=''>";
        echo "<img src='";
        echo esc_html( get_the_content() );
        echo "'></div>";
    }
    wp_reset_postdata();
    echo "</form>";
}
?>`
</code>```

Body:
How can I display a post type as radio elements in the frontend of my website, so that a user can select one of the posts to be displayed on another page? I want to implement a "featured" function, where the selected post will be displayed on another page.

<?php
$attachments = get_posts( array(
    'post_type'      => 'post',
    'posts_per_page' => 500,
    'post_status'    => 'any',
'post_parent'    => null,
    'author'        =>  $current_user->ID
) );

if ( $attachments ) {

    echo "<form>";
    foreach ( $attachments as $post ) {
        setup_postdata( $post );
        echo "
";
        echo "<input type='radio' name='fav_language' value=''>";
        echo "
";
    }
    wp_reset_postdata();
    echo "</form>";
}
?>`


问:
How to request for individual user's outlook calendar authorization on a click in React js
I want to fetch an user's outlook calendar events. The flow is like this: I require to send a request to user's outlook account on a button click and then the user will grant me authorization which returns required credentials through that button onclick function.

I have gone through many docs but didn't found any proper solution


问:
identityServer - can't work with 2 tabs of 2 clients because of regeneration of token
i'm having the following issue: I have 2 clients with one identity server connected. User is logged in.
when client 1 is opened on tab 1. and from client 1 i open a link in new tab to client 2. In this moment the client 2 sends a request to identity Server to ask about the token and it responses successfully. now i have client 1 opened in tab 1 and client 2 opened in tab 2.

now i go back to tab 1 and try to make a fetch request, the request fails, because the token is old. i have to reload the page in order to renew the token.

following error i can find in the logs:

```<code>2022-12-15 13:57:33.6372|1|INFO|Microsoft.AspNetCore.Hosting.Diagnostics|Request starting HTTP/2.0 POST https://srv/administration/details?handler=ChecktName application/json; charset=UTF-8 74
2022-12-15 13:57:33.6372|7|INFO|Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler|Cookies was not authenticated. Failure message: Unprotect ticket failed
2022-12-15 13:57:33.6372|2|INFO|Microsoft.AspNetCore.Authorization.DefaultAuthorizationService|Authorization failed.
2022-12-15 13:57:33.6372|12|INFO|Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler|AuthenticationScheme: oidc was challenged.
2022-12-15 13:57:33.6372|2|INFO|Microsoft.AspNetCore.Hosting.Diagnostics|Request finished in 1.6358ms 302
</code>```

I thought it could be a problem with data protection. so added following code in startup configuration:

```<code>  public void ConfigureServices(IServiceCollection services)
  {
     ....
     services.AddDataProtection();
     ....
  }

</code>```

But it didn't work. Any idea how can i solve this?

############# Edit#########
IdentityServer and all clients are running on same server with different ports wit same domain name.

############ Edit 2 ########
I have checked the refresh token and i found out, that it was regenerated in the new tab. That's why the first tab has an expired refresh-Token.

Configuration of IdentityServer:

```<code>services
        .AddIdentityServer(IdentityServerOptions)
        .AddInMemoryApiResources(Config.GetApis())
        .AddInMemoryApiScopes(Config.GetScoops())
        .AddInMemoryIdentityResources(Config.GetIdentityResources())
        .AddInMemoryClients(Config.GetClients()))

public static IEnumerable<Client> GetClients(IConfigurationSection section)
      {
     var clients = new List<Client>();

     var eClients = new List<PlugIn>();

     section.Bind(eClients);

     foreach (PlugIn plugIn in eClients)
     {
        string lUrl = plugIn.Url;

        if (!string.IsNullOrEmpty(lUrl) && lUrl.EndsWith("/"))
        {
           lUrl = lUrl.Substring(0, lUrl.Length - 1);
        }

        if (plugIn.ClientConfig != null)
        {
           var client = plugIn.ClientConfig;

           client.AllowedGrantTypes = GrantTypes.CodeAndClientCredentials;

           if (!client.AllowedScopes.Contains(IdentityServerConstants.StandardScopes.OpenId))
           {
              client.AllowedScopes.Add(IdentityServerConstants.StandardScopes.OpenId);
           }

           if (!client.AllowedScopes.Contains(IdentityServerConstants.StandardScopes.Profile))
           {
              client.AllowedScopes.Add(IdentityServerConstants.StandardScopes.Profile);
           }

           if (!client.AllowedScopes.Contains("roles"))
           {
              client.AllowedScopes.Add("roles");
           }

           client.AllowedScopes.Add(IdentityServerConstants.LocalApi.ScopeName);

           client.AllowedScopes.Add(IdentityServerConstants.StandardScopes.OfflineAccess);

           client.AllowOfflineAccess = true;
           client.FrontChannelLogoutSessionRequired = false;
           client.UpdateAccessTokenClaimsOnRefresh = true;
           AddOidcSignInUrl(lUrl, client);
           client.RedirectUris.Add(lUrl + "/swagger/oauth2-redirect.html");
           client.PostLogoutRedirectUris.Add(lUrl + "/signout-callback-oidc");
           client.FrontChannelLogoutUri = lUrl + "/Clientlogout";
           client.AlwaysIncludeUserClaimsInIdToken = true;
           client.AlwaysSendClientClaims = true;
           client.AbsoluteRefreshTokenLifetime = 86400;
           client.SlidingRefreshTokenLifetime = 43200;

           if (client.AccessTokenLifetime < 3600)
           {
              client.AccessTokenLifetime = 3600;
           }

           client.RefreshTokenUsage = TokenUsage.ReUse;
           client.RefreshTokenExpiration = TokenExpiration.Absolute;
           clients.Add(client);
        }
     }

     return clients;
  }

</code>```

configuration of client:

```<code>....
  services.AddAuthentication(options =>
        {
           options.DefaultScheme = "Cookies";
           options.DefaultChallengeScheme = "oidc";
        })
        .AddCookie("Cookies", options =>
        {
           options.ExpireTimeSpan = TimeSpan.FromDays(14);
           options.SlidingExpiration = true;
           options.SessionStore = new DictionaryTicketStore(services);

           options.Cookie.Path = "/";
        })
        .AddOpenIdConnect("oidc", options =>
        {
           options.Authority = this.CentralHubAdresse;
           options.ClientId = Assembly.GetEntryAssembly().GetName().Name;
           options.ClientSecret ="####";
           options.ResponseType = "code";
           options.GetClaimsFromUserInfoEndpoint = true;

           options.RequireHttpsMetadata = true;
           options.BackchannelHttpHandler = GetHandler();
           options.Scope.Add("roles");
           options.Scope.Add("offline_access");
           options.Scope.Add("IdentityServerApi");

           options.ClaimActions.MapJsonKey("role", "role", "role");
           options.TokenValidationParameters.RoleClaimType = "role";
           options.SaveTokens = true;
           options.UseTokenLifetime = false;
        });
</code>```

Body:
i'm having the following issue: I have 2 clients with one identity server connected. User is logged in.
when client 1 is opened on tab 1. and from client 1 i open a link in new tab to client 2. In this moment the client 2 sends a request to identity Server to ask about the token and it responses successfully. now i have client 1 opened in tab 1 and client 2 opened in tab 2.

now i go back to tab 1 and try to make a fetch request, the request fails, because the token is old. i have to reload the page in order to renew the token.

following error i can find in the logs:

2022-12-15 13:57:33.6372|1|INFO|Microsoft.AspNetCore.Hosting.Diagnostics|Request starting HTTP/2.0 POST https://srv/administration/details?handler=ChecktName application/json; charset=UTF-8 74
2022-12-15 13:57:33.6372|7|INFO|Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler|Cookies was not authenticated. Failure message: Unprotect ticket failed
2022-12-15 13:57:33.6372|2|INFO|Microsoft.AspNetCore.Authorization.DefaultAuthorizationService|Authorization failed.
2022-12-15 13:57:33.6372|12|INFO|Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler|AuthenticationScheme: oidc was challenged.
2022-12-15 13:57:33.6372|2|INFO|Microsoft.AspNetCore.Hosting.Diagnostics|Request finished in 1.6358ms 302

I thought it could be a problem with data protection. so added following code in startup configuration:

  public void ConfigureServices(IServiceCollection services)
  {
     ....
     services.AddDataProtection();
     ....
  }

But it didn't work. Any idea how can i solve this?

############# Edit#########
IdentityServer and all clients are running on same server with different ports wit same domain name.

############ Edit 2 ########
I have checked the refresh token and i found out, that it was regenerated in the new tab. That's why the first tab has an expired refresh-Token.

Configuration of IdentityServer:

services
        .AddIdentityServer(IdentityServerOptions)
        .AddInMemoryApiResources(Config.GetApis())
        .AddInMemoryApiScopes(Config.GetScoops())
        .AddInMemoryIdentityResources(Config.GetIdentityResources())
        .AddInMemoryClients(Config.GetClients()))

public static IEnumerable<Client> GetClients(IConfigurationSection section)
      {
     var clients = new List<Client>();

     var eClients = new List<PlugIn>();

     section.Bind(eClients);

     foreach (PlugIn plugIn in eClients)
     {
        string lUrl = plugIn.Url;

        if (!string.IsNullOrEmpty(lUrl) && lUrl.EndsWith("/"))
        {
           lUrl = lUrl.Substring(0, lUrl.Length - 1);
        }

        if (plugIn.ClientConfig != null)
        {
           var client = plugIn.ClientConfig;

           client.AllowedGrantTypes = GrantTypes.CodeAndClientCredentials;

           if (!client.AllowedScopes.Contains(IdentityServerConstants.StandardScopes.OpenId))
           {
              client.AllowedScopes.Add(IdentityServerConstants.StandardScopes.OpenId);
           }

           if (!client.AllowedScopes.Contains(IdentityServerConstants.StandardScopes.Profile))
           {
              client.AllowedScopes.Add(IdentityServerConstants.StandardScopes.Profile);
           }

           if (!client.AllowedScopes.Contains("roles"))
           {
              client.AllowedScopes.Add("roles");
           }

           client.AllowedScopes.Add(IdentityServerConstants.LocalApi.ScopeName);

           client.AllowedScopes.Add(IdentityServerConstants.StandardScopes.OfflineAccess);

           client.AllowOfflineAccess = true;
           client.FrontChannelLogoutSessionRequired = false;
           client.UpdateAccessTokenClaimsOnRefresh = true;
           AddOidcSignInUrl(lUrl, client);
           client.RedirectUris.Add(lUrl + "/swagger/oauth2-redirect.html");
           client.PostLogoutRedirectUris.Add(lUrl + "/signout-callback-oidc");
           client.FrontChannelLogoutUri = lUrl + "/Clientlogout";
           client.AlwaysIncludeUserClaimsInIdToken = true;
           client.AlwaysSendClientClaims = true;
           client.AbsoluteRefreshTokenLifetime = 86400;
           client.SlidingRefreshTokenLifetime = 43200;

           if (client.AccessTokenLifetime < 3600)
           {
              client.AccessTokenLifetime = 3600;
           }

           client.RefreshTokenUsage = TokenUsage.ReUse;
           client.RefreshTokenExpiration = TokenExpiration.Absolute;
           clients.Add(client);
        }
     }

     return clients;
  }

configuration of client:

....
  services.AddAuthentication(options =>
        {
           options.DefaultScheme = "Cookies";
           options.DefaultChallengeScheme = "oidc";
        })
        .AddCookie("Cookies", options =>
        {
           options.ExpireTimeSpan = TimeSpan.FromDays(14);
           options.SlidingExpiration = true;
           options.SessionStore = new DictionaryTicketStore(services);

           options.Cookie.Path = "/";
        })
        .AddOpenIdConnect("oidc", options =>
        {
           options.Authority = this.CentralHubAdresse;
           options.ClientId = Assembly.GetEntryAssembly().GetName().Name;
           options.ClientSecret ="####";
           options.ResponseType = "code";
           options.GetClaimsFromUserInfoEndpoint = true;

           options.RequireHttpsMetadata = true;
           options.BackchannelHttpHandler = GetHandler();
           options.Scope.Add("roles");
           options.Scope.Add("offline_access");
           options.Scope.Add("IdentityServerApi");

           options.ClaimActions.MapJsonKey("role", "role", "role");
           options.TokenValidationParameters.RoleClaimType = "role";
           options.SaveTokens = true;
           options.UseTokenLifetime = false;
        });


问:
How to plot high variance feature importance values generated after using logistic regression
I want to plot feature importances generated from logistic regression using seaborn/matplotlib but the problem is that the values of features importances vary a lot.

Example- In my logistic regression model which has been build for a classification problem, the highest feature importance value is 132 whereas the feature with 2nd highest importance has a value of only 17, similarly the feature with 3rd highest importance has a value of 4.

Request you to check the code which I have used to generate feature importance & also please suggest me how can I plot feature importance values as the graph which I tried to generate is not showing the desired result.

```<code>code:
import math
feature_importance=pd.DataFrame(xtest.columns, columns=['feature'])
feature_importance['importance']=pow(math.e,np.array(w))
feature_importance.sort_values(by=['importance'],ascending=False).reset_index()
</code>```

```<code>code for generating plot:
plt.figure(figsize=(25,10))

sns.barplot(data=feature_importance.iloc[:7,:])
</code>```

Body:
I want to plot feature importances generated from logistic regression using seaborn/matplotlib but the problem is that the values of features importances vary a lot.

Example- In my logistic regression model which has been build for a classification problem, the highest feature importance value is 132 whereas the feature with 2nd highest importance has a value of only 17, similarly the feature with 3rd highest importance has a value of 4.

Request you to check the code which I have used to generate feature importance & also please suggest me how can I plot feature importance values as the graph which I tried to generate is not showing the desired result.

code:
import math
feature_importance=pd.DataFrame(xtest.columns, columns=['feature'])
feature_importance['importance']=pow(math.e,np.array(w))
feature_importance.sort_values(by=['importance'],ascending=False).reset_index()

code for generating plot:
plt.figure(figsize=(25,10))

sns.barplot(data=feature_importance.iloc[:7,:])


问:
Am I misunderstanding C# classes?
I have a class that is designed to pull together various bits of data, and run some logic tests, and finally builds some output.

My application is student and hospital based (students create patient reports). Every time a student finishes a patient report, a class is called, which performs the above (basically builds the "credits" they've earned).

My understanding of instantiating a class and running a method, is that all the internals of the class, any data accrued and logic etc... is isolated to that class only?

ie. if a few students finish reports at the same time, and for each one, the class is instantiated and the method to rebuild their credits is called... one class's data would/should not 'leak' into another. Right??

Sorry if this is a bit vague, but for brevity, I've excluded any logic code that is working.

My issue is that the output is becoming 'mixed'.. ie. students have results from patient reports that aren't theirs.

```<code>public class Attainment
{
    public int StudentID { get; set; }
    public int PatientID { get; set; }

    static DataTable dtAttainmentList;
    static DataTable dtClassroomData;

    public Attainment()
    {
        dtAttainmentList = new DataTable();
        dtAttainmentList.Columns.Add("boxUID", typeof(string));
        dtAttainmentList.Columns.Add("type", typeof(int));
        dtAttainmentList.Columns.Add("patientID", typeof(int));
    }

    public static void Rebuild(int thisStudentID, int thisPatientID)
    {
        Attainment test = new Attainment();
        test.StudentID = thisStudentID;
        test.PatientID = thisPatientID;
        test.GenerateAttainments();
    }

    public void GenerateAttainments()
    {
        // I've ommitted other methods here for brevity, but basically:

        dtClassroomData = GetClassroomData();

        // delete old records from database

        // run new logic

        // insert new records into database
    }

    DataTable GetClassroomData()
    {
        // creates new datatable
        // populates from the database
        // returns the datatable
    }

}
</code>```

Title: Am I misunderstanding C# classes?

Body:
I have a class that is designed to pull together various bits of data, and run some logic tests, and finally builds some output.

My application is student and hospital based (students create patient reports). Every time a student finishes a patient report, a class is called, which performs the above (basically builds the "credits" they've earned).

My understanding of instantiating a class and running a method, is that all the internals of the class, any data accrued and logic etc... is isolated to that class only?

ie. if a few students finish reports at the same time, and for each one, the class is instantiated and the method to rebuild their credits is called... one class's data would/should not 'leak' into another. Right??

Sorry if this is a bit vague, but for brevity, I've excluded any logic code that is working.

My issue is that the output is becoming 'mixed'.. ie. students have results from patient reports that aren't theirs.

public class Attainment
{
    public int StudentID { get; set; }
    public int PatientID { get; set; }

    static DataTable dtAttainmentList;
    static DataTable dtClassroomData;

    public Attainment()
    {
        dtAttainmentList = new DataTable();
        dtAttainmentList.Columns.Add("boxUID", typeof(string));
        dtAttainmentList.Columns.Add("type", typeof(int));
        dtAttainmentList.Columns.Add("patientID", typeof(int));
    }

    public static void Rebuild(int thisStudentID, int thisPatientID)
    {
        Attainment test = new Attainment();
        test.StudentID = thisStudentID;
        test.PatientID = thisPatientID;
        test.GenerateAttainments();
    }

    public void GenerateAttainments()
    {
        // I've ommitted other methods here for brevity, but basically:

        dtClassroomData = GetClassroomData();

        // delete old records from database

        // run new logic

        // insert new records into database
    }

    DataTable GetClassroomData()
    {
        // creates new datatable
        // populates from the database
        // returns the datatable
    }

}


问:
Error when install app on armbian (E: Package 'libssl1.1' has no installation candidate)
when I trying to install "free download manager" or other app with deb, it always give me this error:

E: Package 'libssl1.1' has no installation candidate

I just wan to install app on armbian with deb file.


问:
Uncaught Error: Class 'phpseclib\phpseclib\Crypt\RSA' not found
When tring to use/import the phpseclib RSA class unable to find out the class, could you help me please.

`

```<code>require "/vendor/autoload.php";
use phpseclib\Crypt\RSA;

// INPUT DATA
$privkey = "...";   // I used a RSA private key in PEM format, generated by openssl, but phpseclib supports many formats...
$mydata = "...";    // I generated some binary bytes here...

// SIGNING
$rsa = new RSA();
if ($rsa->loadKey($privkey) != TRUE) {
    echo "Error loading private key";
    return;
}
$rsa->setHash("sha512");
$rsa->setMGFHash("sha512"); // This NEEDS to be set, or the default will be used
$rsa->setSignatureMode(RSA::SIGNATURE_PSS); // This doesn't need to be set, as it is already the default value
$signatureBytes = $rsa->sign($mydata);
</code>```

`

Body:
When tring to use/import the phpseclib RSA class unable to find out the class, could you help me please.

`

require "/vendor/autoload.php";
use phpseclib\Crypt\RSA;

// INPUT DATA
$privkey = "...";   // I used a RSA private key in PEM format, generated by openssl, but phpseclib supports many formats...
$mydata = "...";    // I generated some binary bytes here...

// SIGNING
$rsa = new RSA();
if ($rsa->loadKey($privkey) != TRUE) {
    echo "Error loading private key";
    return;
}
$rsa->setHash("sha512");
$rsa->setMGFHash("sha512"); // This NEEDS to be set, or the default will be used
$rsa->setSignatureMode(RSA::SIGNATURE_PSS); // This doesn't need to be set, as it is already the default value
$signatureBytes = $rsa->sign($mydata);

`


问:
AWS Lambda acces to EC2 mssql timeout
I tryed to use a function lambda to connect to my mssql in EC2 windows instances..

But i got the error message like :
"errorMessage": "2023-01-03T09:16:22.241Z 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx Task timed out after 5.01 seconds"

ofc i changed the expiration time but it's not work.. always same error

What does the error message mean?

I upload pyodbc in lambda Layers, and test the connection with:

```<code>import pyodbc

def lambda_handler(event, context):
    driver = '{ODBC Driver 17 for SQL Server}'
    server = 'servername'
    port = '1433'
    database =  'db'
    username = 'username'
    password = 'pwd' # ideally put this in a SecretsManager secret instead of directly in the code
    connection = pyodbc.connect(f'DRIVER={driver};SERVER={server},{port};DATABASE={database};UID={username};PWD={password}')
    cursor = connection.cursor()
    query = """
        select @@version
    """

    cursor.execute(query)

    for row in cursor.fetchall():
        print(row[0])
</code>```

Full error message:
Status: error

```<code>Test Event Name
test

Response
{
  "errorMessage": "2023-01-03T09:16:22.241Z 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx Task timed out after 5.01 seconds"
}

Function Logs
START RequestId: 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx Version: $LATEST
2023-01-03T09:16:22.241Z 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx Task timed out after 5.01 seconds

END RequestId: 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx
REPORT RequestId: 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx  Duration: 5007.24 ms    Billed Duration: 5000 ms    Memory Size: 128 MB Max Memory Used: 43 MB  Init Duration: 145.43 ms

Request ID
16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx
</code>```

Title: AWS Lambda acces to EC2 mssql timeout

Body:
I tryed to use a function lambda to connect to my mssql in EC2 windows instances..

But i got the error message like :
"errorMessage": "2023-01-03T09:16:22.241Z 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx Task timed out after 5.01 seconds"

ofc i changed the expiration time but it's not work.. always same error

What does the error message mean?

I upload pyodbc in lambda Layers, and test the connection with:

import pyodbc

def lambda_handler(event, context):
    driver = '{ODBC Driver 17 for SQL Server}'
    server = 'servername'
    port = '1433'
    database =  'db'
    username = 'username'
    password = 'pwd' # ideally put this in a SecretsManager secret instead of directly in the code
    connection = pyodbc.connect(f'DRIVER={driver};SERVER={server},{port};DATABASE={database};UID={username};PWD={password}')
    cursor = connection.cursor()
    query = """
        select @@version
    """

    cursor.execute(query)

    for row in cursor.fetchall():
        print(row[0])

Full error message:
Status: error

Test Event Name
test

Response
{
  "errorMessage": "2023-01-03T09:16:22.241Z 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx Task timed out after 5.01 seconds"
}

Function Logs
START RequestId: 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx Version: $LATEST
2023-01-03T09:16:22.241Z 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx Task timed out after 5.01 seconds

END RequestId: 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx
REPORT RequestId: 16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx  Duration: 5007.24 ms    Billed Duration: 5000 ms    Memory Size: 128 MB Max Memory Used: 43 MB  Init Duration: 145.43 ms

Request ID
16863c26-xxxx-xxxx-xxxx-xxxxxxxxxxxx


问:
Renew OpenSSL Docker certificate
Today, I wanted to deploy an update but I got the following error on my docker machine :

x509: certificate has expired or is not yet valid: current time
2023-01-02T10:34:22Z is after 2022-12-29T08:51:09Z

I found the affected files in my server but my question is the following : is it possible to update (renew) the validity of the certificate without creating a new one ?

link : https://docs.docker.com/engine/security/certificates/

Title: Renew OpenSSL Docker certificate


问:
Using Authorization header as a cache key parameter in API gateway through AWS SAM / Cloudformation
So, I have an API defined in API gateway for which I activated caching. Now, I would like to use some query string parameters and headers for the cache keys. I have implemented those in my SAM YAML template like so:

```<code>parameters:
  - name: "queryParam1"
  in: "query"
  required: "false"
  type: "string"
  - name: "Authorization"
  in: "header"
  required: "false"
  type: "string"
</code>```

And using them as cache key parameters:

```<code>cacheKeyParameters:
  - method.request.querystring.queryParam1
  - method.request.header.Authorization
</code>```

When deploying the template the result is that queryParam1 is added as expected but the Authorization is not.

The expected result is:

Result I'm getting:

I noticed that the OpenAPI specification says that the parameter section should ignore headers with the name Authorization so I figured that's why it doesn't appear. I can manually go in and set the Authorization header in the API GW console but that's not desireable.

Any suggestions?

Body:
So, I have an API defined in API gateway for which I activated caching. Now, I would like to use some query string parameters and headers for the cache keys. I have implemented those in my SAM YAML template like so:

parameters:
  - name: "queryParam1"
  in: "query"
  required: "false"
  type: "string"
  - name: "Authorization"
  in: "header"
  required: "false"
  type: "string"

And using them as cache key parameters:

cacheKeyParameters:
  - method.request.querystring.queryParam1
  - method.request.header.Authorization

When deploying the template the result is that queryParam1 is added as expected but the Authorization is not.

The expected result is:

Result I'm getting:

I noticed that the OpenAPI specification says that the parameter section should ignore headers with the name Authorization so I figured that's why it doesn't appear. I can manually go in and set the Authorization header in the API GW console but that's not desireable.

Any suggestions?


问:
What would be different behaviour and result on different values of page options and their combination in Sveltekit?
Sveltekit provide 3 page options givent https://kit.svelte.dev/docs/page-options

prerender

csr

ssr

These are the possible cases

Taking one at a time

e.g. where we are setting

export const prerender = true;

or

export const prerender = true;

or

export const prerender = false;

or

export const csr = true;

or

export const csr = false;

or

export const ssr = true;

or

export const ssr = false;

Taking two at a time

export const prerender = true; and export const csr = true;

or

export const prerender = true; and export const csr = false;

or

export const prerender = false; and export const csr = true;

or

export const prerender = false; and export const csr = false;

or

export const prerender = true; and export const ssr = true;

or

export const prerender = true; and export const ssr = false;

or

export const prerender = false; and export const ssr = true;

or

export const prerender = false; and export const ssr = false;

...

...

So many more possibities of combination of value of ssr and csr

Taking three at time

e.g. So many possiblites of combination of values of ssr, csr and prerender

Out of these so many possiblites some may be non-sensible but some would be sensible.

So what would be different behaviour and results on these various possibities?