Wednesday, November 3, 2021

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


Adding SharePoint Image field in Word template

Posted: 03 Nov 2021 08:56 AM PDT

I'm trying to build a Word doc generator. Data is held in a SharePoint list (text, person info, images), and is then inserted into a Word template via Power Automate. There will be many entries in the list, all with unique data and images.

The Image fields are native SP Image columns, not hyperlinks. They will be uploaded each time the form is completed.

The problems I'm having are:

  1. While the text fields show up on Quick Parts, none of the Image fields do, so I can't insert them.

  2. I can manually add picture controls to the Word template, but in Power Automate, the Image fields aren't shown in Dynamic Content even though "Populate a Microsoft Word template" shows the Picture content controls.

Does anyone know why they don't show, and how I can get the Image fields to be added to the Word doc? Or, am I doing it the wrong way, and I should use attachments - in which case, how do I do that for multiple attached images?

fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj]

Posted: 03 Nov 2021 08:56 AM PDT

Getting error while running yarn install. I tried everything that's on internet but nothing worked. I have successfully installed node and npm. As part of the requirements I am supposed to run: yarn install

  1. windows 10 pro 64bit

  2. node v16.13.0

  3. node-gyp v8.3.0

  4. npm 8.1.0

    C:\Projects\TK>yarn install yarn install v1.22.17 info No lockfile found. warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... warning nuxt3 > @nuxt/webpack-builder > webpack-hot-middleware > querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. warning nuxt3 > @nuxt/nitro > @vercel/nft > node-pre-gyp@0.13.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future [2/4] Fetching packages... warning Pattern ["@nuxt/kit@npm:@nuxt/kit-edge@3.0.0-27265876.3cd4494"] is trying to unpack in the same destination "C:\Users\VISSRXS2\AppData\Local\Yarn\Cache\v6\npm-@nuxt-kit-3.0.0-27265876.3cd4494-3375d07f032a41ae6b58dc3725fae15ef5a76234-integrity\node_modules\@nuxt\kit" as pattern ["@nuxt/kit@npm:@nuxt/kit-edge@latest"]. This could result in non-deterministic behavior, skipping. [3/4] Linking dependencies... warning " > symbology@3.0.6" has unmet peer dependency "@mapbox/node-pre-gyp@^1.0.2". warning " > @css-render/vue3-ssr@0.15.6" has unmet peer dependency "vue@^3.0.11". warning " > naive-ui@2.20.1" has unmet peer dependency "vue@^3.0.0". warning "naive-ui > @babel/eslint-parser@7.16.0" has unmet peer dependency "@babel/core@>=7.11.0". warning "naive-ui > @babel/eslint-parser@7.16.0" has unmet peer dependency "eslint@^7.5.0 || ^8.0.0". warning "naive-ui > vdirs@0.1.4" has unmet peer dependency "vue@^3.0.11". warning "naive-ui > vooks@0.2.10" has unmet peer dependency "vue@^3.0.0". warning "naive-ui > vueuc@0.4.15" has unmet peer dependency "vue@^3.0.11". warning "nuxt-windicss > vite-plugin-windicss@1.4.12" has unmet peer dependency "vite@^2.0.1". warning "nuxt3 > @nuxt/vite-builder > autoprefixer@10.4.0" has unmet peer dependency "postcss@^8.1.0". warning "nuxt3 > @nuxt/vite-builder > postcss-import@14.0.2" has unmet peer dependency "postcss@^8.0.0".
    warning "nuxt3 > @nuxt/vite-builder > postcss-url@10.1.3" has unmet peer dependency "postcss@^8.0.0". warning "nuxt3 > @nuxt/vite-builder > rollup-plugin-visualizer@5.5.2" has unmet peer dependency "rollup@^2.0.0". [4/4] Building fresh packages... [7/7] ⡀ @prisma/client [2/7] ⡀ bcrypt [-/7] ⢀ waiting... [4/7] ⢀ symbology error C:\Projects\TK\node_modules\symbology: Command failed. Exit code: 1 Command: node ./scripts/install.js && npm run binary:install Arguments: Directory: C:\Projects\TK\node_modules\symbology Output: Removing any existing .zint directory... Cloning zint at '89518c4' in C:\Projects\TK\node_modules\symbology.zint Successfully cloned. Applying code patches... Creating zint config header file... Done.

    symbology@3.0.6 binary:install node-pre-gyp install --fallback-to-build

    node-pre-gyp info it worked if it ends with ok node-pre-gyp info using node-pre-gyp@1.0.6 node-pre-gyp info using node@16.13.0 | win32 | x64 node-pre-gyp info check checked for "C:\Projects\TK\node_modules\symbology\bin\binding\bin\symbology.node" (not found) node-pre-gyp http GET https://github.com/jshor/symbology/releases/download/3.0.6/symbology_win32_x64_node-v93.tar.gz node-pre-gyp ERR! install request to https://github.com/jshor/symbology/releases/download/3.0.6/symbology_win32_x64_node-v93.tar.gz failed, reason: unable to get local issuer certificate node-pre-gyp WARN Pre-built binaries not installable for symbology@3.0.6 and node@16.13.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error request to https://github.com/jshor/symbology/releases/download/3.0.6/symbology_win32_x64_node-v93.tar.gz failed, reason: unable to get local issuer certificate gyp info it worked if it ends with ok gyp info using node-gyp@8.2.0 gyp info using node@16.13.0 | win32 | x64 gyp info ok gyp info it worked if it ends with ok gyp info using node-gyp@8.2.0 gyp info using node@16.13.0 | win32 | x64 gyp info find Python using Python version 3.10.0 found at "C:\Python310\python.exe" gyp info find VS using VS2019 (16.11.31729.503) found at: gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools" gyp info find VS run with --verbose for detailed information gyp info spawn C:\Python310\python.exe gyp info spawn args [ gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py',gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'msvs', gyp info spawn args '-I', gyp info spawn args 'C:\Projects\TK\node_modules\symbology\build\config.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\addon.gypi',
    gyp info spawn args '-I', gyp info spawn args 'C:\Users\VISSRXS2\AppData\Local\node-gyp\Cache\16.13.0\include\node\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=C:\Users\VISSRXS2\AppData\Local\node-gyp\Cache\16.13.0', gyp info spawn args '-Dnode_gyp_dir=C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp',
    gyp info spawn args '-Dnode_lib_file=C:\\Users\\VISSRXS2\\AppData\\Local\\node-gyp\\Cache\\16.13.0\\<(target_arch)\\node.lib', gyp info spawn args '-Dmodule_root_dir=C:\Projects\TK\node_modules\symbology', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'C:\Projects\TK\node_modules\symbology\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info ok gyp info it worked if it ends with ok gyp info using node-gyp@8.2.0 gyp info using node@16.13.0 | win32 | x64 gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
    gyp info spawn args [ gyp info spawn args 'build/binding.sln', gyp info spawn args '/clp:Verbosity=minimal', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' gyp info spawn args ] Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
    cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] output.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] 2of5.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] auspost.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] aztec.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] code.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] code1.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] code16k.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] code49.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] code128.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] common.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] composite.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] dmatrix.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] gridmtx.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] gs1.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] imail.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] large.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] library.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] maxicode.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] medical.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] pdf417.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] plessey.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] png.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] postal.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] ps.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] qr.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] reedsol.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] rss.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] svg.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] telepen.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] upcean.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] bmp.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] codablock.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] dotcode.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] eci.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] emf.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] gb2312.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] gb18030.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] general_field.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] gif.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] hanxin.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] mailmark.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] pcx.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] raster.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] sjis.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] tif.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] ultra.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] vector.c cl : command line warning D9025: overriding '/W3' with '/w' [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] main.cpp C:\Projects\TK\node_modules\symbology\src\binding\main.cpp(10,10): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [C:\Projects\TK\node_modules\symbology\build\symbology.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:390:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Windows_NT 10.0.19043 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=C:\Projects\TK\node_modules\symbology\bin\binding\bin\symbology.node" "--module_name=symbology" "--module_path=C:\Projects\TK\node_modules\symbology\bin\binding\bin" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93" gyp ERR! cwd C:\Projects\TK\node_modules\symbology gyp ERR! node -v v16.13.0 gyp ERR! node-gyp -v v8.2.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Projects\TK\node_modules\symbology\bin\binding\bin\symbology.node --module_name=symbology --module_path=C:\Projects\TK\node_modules\symbology\bin\binding\bin --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1) node-pre-gyp ERR! stack at ChildProcess. (C:\Projects\TK\node_modules@mapbox\node-pre-gyp\lib\util\compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:390:28) node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1064:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) node-pre-gyp ERR! System Windows_NT 10.0.19043 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Projects\TK\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd C:\Projects\TK\node_modules\symbology node-pre-gyp ERR! node -v v16.13.0 node-pre-gyp ERR! node-pre-gyp -v v1.0.6 node-pre-gyp ERR! not ok Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-

How to update properties of object in array in mongoose

Posted: 03 Nov 2021 08:56 AM PDT

I've a collection which elements all contain array of objects, I want to update some properties of certain object. There is the collection:

{      _id:'a45ea2',      array: [          {              _id: '3fa5ce'              property: 'qwe'          },          {              _id: '5f5f1b'              property: 'asd'          },      ]  }  {      _id:'cd7114',      array: [          {              _id: '27f580'              property: 'qwe'          },          {              _id: '2f33dd'              property: 'asd'          },      ]  }  

e.g. wanna update obj named _id with property 5f5f1b to property 000000

Add attribute to view based on if another attribute is in a list

Posted: 03 Nov 2021 08:56 AM PDT

Lets say I have a view with a CommissionNumber and a CreationDate:

Select CommissionNumber, CreationDate  FROM dbo.CarView  

There's another table (let's name that dbo.CanceledOrders) with CommissionNumbers of orders that were canceled. I would like to add to this view an attribute that is true or false based on the commissionNumber is in that second table. That is supposed to look something like that:

 Select CommissionNumber, CreationDate, IsCancelled as (case....      FROM dbo.CarView  

I can't get the syntax right. Can anybody help me?

DynamoDBMapper load vs batchLoad performance

Posted: 03 Nov 2021 08:56 AM PDT

If I have to consume 25 items from the same table in dynamoDB via dynamoDBMapper, does doing it via the Load method have worse performance compared to batchLoad ?

load : https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.Methods.html#DynamoDBMapper.Methods.load

batchLoad : https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.Methods.html#DynamoDBMapper.Methods.batchLoad

nginx configuration for http2 on elastic beanstalk

Posted: 03 Nov 2021 08:56 AM PDT

I'm trying to setup an HTTP2 node server on elastic beanstalk using nginx. I have been reading some articles and I came across this one: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/nodejs-platform-proxy.html . Where it explains how to change the nginx configuration. I modified the http version to use http 2.0, as follows:

files:    /etc/nginx/conf.d/proxy.conf:      mode: "000644"      owner: root      group: root      content: |        upstream nodejs {          server 127.0.0.1:8081;          keepalive 256;        }          server {          listen 8080;            if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") {              set $year $1;              set $month $2;              set $day $3;              set $hour $4;          }          access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd;          access_log  /var/log/nginx/access.log  main;            location / {              proxy_pass  http://nodejs;              proxy_set_header   Connection "";              proxy_http_version 2.0;              proxy_set_header        Host            $host;              proxy_set_header        X-Real-IP       $remote_addr;              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;          }            gzip on;          gzip_comp_level 4;          gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;            location /static {              alias /var/app/current/static;          }          }      /opt/elasticbeanstalk/hooks/configdeploy/post/99_kill_default_nginx.sh:      mode: "000755"      owner: root      group: root      content: |        #!/bin/bash -xe        rm -f /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf        service nginx stop        service nginx start    container_commands:    removeconfig:      command: "rm -f /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf"  

Basically I have just modified the line proxy_http_version 2.0;. But it does not work! The environment is not healthy and I'm seeing the following logs:

access.log

172.16.1.51 - - [03/Nov/2021:15:44:45 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.0.132 - - [03/Nov/2021:15:45:03 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.1.51 - - [03/Nov/2021:15:45:15 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.0.132 - - [03/Nov/2021:15:45:34 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.1.51 - - [03/Nov/2021:15:45:45 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.0.132 - - [03/Nov/2021:15:46:04 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.1.51 - - [03/Nov/2021:15:46:15 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  217.216.95.140 - - [03/Nov/2021:15:46:22 +0000] "GET /health HTTP/1.1" 009 26 "-" "curl/7.64.1" "-"  217.216.95.140 - - [03/Nov/2021:15:46:32 +0000] "GET /health HTTP/1.1" 009 26 "-" "curl/7.64.1" "-"  172.16.0.132 - - [03/Nov/2021:15:46:34 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.1.51 - - [03/Nov/2021:15:46:45 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.0.132 - - [03/Nov/2021:15:47:04 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  172.16.1.51 - - [03/Nov/2021:15:47:15 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" "-"  

The requests from curl are mine, trying to debug the problem. The other ones are the health checker of my load balancer. In curl I'm using the public IP of the EC2 instance, getting the following:

curl --http2 --insecure --verbose http://18.232.139.145/health

*   Trying 18.232.139.145...  * TCP_NODELAY set  * Connected to 18.232.139.145 (18.232.139.145) port 80 (#0)  > GET /health HTTP/1.1  > Host: 18.232.139.145  > User-Agent: curl/7.64.1  > Accept: */*  > Connection: Upgrade, HTTP2-Settings  > Upgrade: h2c  > HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA  >  Warning: Binary output can mess up your terminal. Use "--output -" to tell  Warning: curl to output it to your terminal anyway, or consider "--output  Warning: <FILE>" to save to a file.  * Failed writing body (0 != 26)  * Closing connection 0  

And from the erros.log:

2021/11/03 15:44:00 [error] 4395#4395: *33 connect() failed (111: Connection refused) while connecting to upstream, client: 205.185.120.103, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "18.232.139.145:80"  2021/11/03 15:44:03 [warn] 4395#4395: *35 using uninitialized "year" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:03 [warn] 4395#4395: *35 using uninitialized "month" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:03 [warn] 4395#4395: *35 using uninitialized "day" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:03 [warn] 4395#4395: *35 using uninitialized "hour" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:15 [warn] 4395#4395: *36 using uninitialized "year" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:15 [warn] 4395#4395: *36 using uninitialized "month" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:15 [warn] 4395#4395: *36 using uninitialized "day" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:15 [warn] 4395#4395: *36 using uninitialized "hour" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:33 [warn] 4395#4395: *37 using uninitialized "year" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:33 [warn] 4395#4395: *37 using uninitialized "month" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:33 [warn] 4395#4395: *37 using uninitialized "day" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:33 [warn] 4395#4395: *37 using uninitialized "hour" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:45 [warn] 4395#4395: *38 using uninitialized "year" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:45 [warn] 4395#4395: *38 using uninitialized "month" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:45 [warn] 4395#4395: *38 using uninitialized "day" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:44:45 [warn] 4395#4395: *38 using uninitialized "hour" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:03 [warn] 4395#4395: *39 using uninitialized "year" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:03 [warn] 4395#4395: *39 using uninitialized "month" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:03 [warn] 4395#4395: *39 using uninitialized "day" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:03 [warn] 4395#4395: *39 using uninitialized "hour" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:15 [warn] 4395#4395: *40 using uninitialized "year" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:15 [warn] 4395#4395: *40 using uninitialized "month" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:15 [warn] 4395#4395: *40 using uninitialized "day" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:15 [warn] 4395#4395: *40 using uninitialized "hour" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:34 [warn] 4395#4395: *41 using uninitialized "year" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:34 [warn] 4395#4395: *41 using uninitialized "month" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:34 [warn] 4395#4395: *41 using uninitialized "day" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:34 [warn] 4395#4395: *41 using uninitialized "hour" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:45 [warn] 4395#4395: *42 using uninitialized "year" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:45 [warn] 4395#4395: *42 using uninitialized "month" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:45 [warn] 4395#4395: *42 using uninitialized "day" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:45:45 [warn] 4395#4395: *42 using uninitialized "hour" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:04 [warn] 4395#4395: *43 using uninitialized "year" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:04 [warn] 4395#4395: *43 using uninitialized "month" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:04 [warn] 4395#4395: *43 using uninitialized "day" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:04 [warn] 4395#4395: *43 using uninitialized "hour" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:15 [warn] 23073#23073: *1 using uninitialized "year" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:15 [warn] 23073#23073: *1 using uninitialized "month" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:15 [warn] 23073#23073: *1 using uninitialized "day" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:15 [warn] 23073#23073: *1 using uninitialized "hour" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:22 [error] 23073#23073: *2 upstream sent no valid HTTP/1.0 header while reading response header from upstream, client: 217.216.95.140, server: , request: "GET /health HTTP/1.1", upstream: "http://127.0.0.1:8080/health", host: "18.232.139.145"  2021/11/03 15:46:32 [error] 23073#23073: *4 upstream sent no valid HTTP/1.0 header while reading response header from upstream, client: 217.216.95.140, server: , request: "GET /health HTTP/1.1", upstream: "http://127.0.0.1:8080/health", host: "18.232.139.145"  2021/11/03 15:46:34 [warn] 23073#23073: *6 using uninitialized "year" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:34 [warn] 23073#23073: *6 using uninitialized "month" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:34 [warn] 23073#23073: *6 using uninitialized "day" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:34 [warn] 23073#23073: *6 using uninitialized "hour" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:45 [warn] 23073#23073: *7 using uninitialized "year" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:45 [warn] 23073#23073: *7 using uninitialized "month" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:45 [warn] 23073#23073: *7 using uninitialized "day" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:46:45 [warn] 23073#23073: *7 using uninitialized "hour" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:47:04 [warn] 23073#23073: *8 using uninitialized "year" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:47:04 [warn] 23073#23073: *8 using uninitialized "month" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:47:04 [warn] 23073#23073: *8 using uninitialized "day" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:47:04 [warn] 23073#23073: *8 using uninitialized "hour" variable while logging request, client: 172.16.0.132, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:47:15 [warn] 23073#23073: *9 using uninitialized "year" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:47:15 [warn] 23073#23073: *9 using uninitialized "month" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:47:15 [warn] 23073#23073: *9 using uninitialized "day" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  2021/11/03 15:47:15 [warn] 23073#23073: *9 using uninitialized "hour" variable while logging request, client: 172.16.1.51, server: , request: "PRI * HTTP/2.0"  

Any idea what's going on? Do you need more information?

  • Note: the server is using fastify with http2 enabled (in local it works great)

I cannot create a thread without an obious reason in c++

Posted: 03 Nov 2021 08:56 AM PDT

I don't see whats wrong could you show me please?

void UI(std::uint32_t& handle) { while (true) { std::cin >> handle; sf::sleep(sf::milliseconds(30)); } }    int main() {      std::uint32_t uiHandle; std::thread UIThread(UI, uiHandle); UIThread.detach();  

so on...

python scrapping for javascript not working and specific data

Posted: 03 Nov 2021 08:56 AM PDT

to begin, i wanted to scrap this table that load from java script and i only want to scrap specific row of data such as base on Fund abbreviation or search base on that, but my basic script here is not working well. please help

from bs4 import BeautifulSoup  from requests_html import HTMLSession  session = HTMLSession()  url = 'https://www.publicmutual.com.my/Our-Products/UT-Fund-Prices'  r = session.get(url)  r.html.render()  soup=BeautifulSoup(r.html.html,'html.parser')  table = soup.find('table', attrs={'class':'fundtable col-sm-12'})  print(table)   

how do i make this work and scrap information only certain rows that i wanted based on the fund name or fund abbreviation column?

Katex or Latex pattern

Posted: 03 Nov 2021 08:55 AM PDT

Anyone with Katex or Latex skills? I need help accomplishing the pattern in the image. Please assist.enter image description here

Google app script random - Exception: Argument non valide : name - while naming renaming sheets

Posted: 03 Nov 2021 08:55 AM PDT

Hello and thanks for trying to help,

I am making a small code to copy some data from a spreadsheet to another specified one. To arrange all the data in the new spreadsheet, I need to put it in different sheets, with references name.

The error occurs when a new sheet is created (by copy) and is going to be renamed. This is working fine most of the time, but not always, which of course, is a problem. It tells me the error is line 49 tss.getSheets()[i].setName(ref[i]);, and it is :

Exception: Unvalid argument : name  

This is strange because names are almost identical for all sheets, for example S36779 is working, but S36780 is not.

See below the code (it is not finished, but the sheet duplicate part is)

      function onOpen(e) {              SpreadsheetApp.getUi()            .createMenu('Fiche Produit')            .addItem('Créer une fiche produit','creaficheproduit')            .addSeparator()                  .addToUi();            }            function creaficheproduit() {              var tss = SpreadsheetApp.getActiveSpreadsheet();        var sheets = tss.getSheets();        for (i = 0; i < sheets.length-1; i++) {          tss.deleteSheet(sheets[i+1]);          }         var tsh = tss.getSheets()[0];              var ui = SpreadsheetApp.getUi();          var prompt = ui.prompt('Indiquer le lien de la Fiche CS source', 'lien',ui.ButtonSet.OK_CANCEL)         var response = prompt.getResponseText();        var button = prompt.getSelectedButton();              if (button == ui.Button.OK) {                var sss = SpreadsheetApp.openByUrl(response);          var ssh = sss.getSheetByName('Fiche_eclate_CS');                var lrow = getFirstEmptyRowByColumnArray (ssh,"D");          var ref = ssh.getRange("D3:D"+lrow).getValues();                var gamme = ssh.getRange(7,3).getValue();          tsh.getRange(2,6).setValue(gamme);          var dtotal = ssh.getRange(6,7).getValue();          var htotal = ssh.getRange(7,7).getValue();          var dAJ = ssh.getRange(9,7).getValue();          var hAJ = ssh.getRange(10,7).getValue();          tsh.getRange(4,7).setValue(dtotal + " - h" + htotal);          tsh.getRange(5,7).setValue(dAJ + " - h" + hAJ);                for (var i = 0; i < 5; i++){            if(i == 0){              tss.getSheets()[0].setName(ref[i]);              }            else {            tss.duplicateActiveSheet();            tss.getSheets()[i].setName(ref[i]);            }          }                    for (var i = 0; i < 5; i++){            var sh = tss.getSheets()[i];            sh.getRange(3,6).setValue(ref[i]);          }              }        else{        }            }            function getFirstEmptyRowByColumnArray(sheet,row) {                var column = sheet.getRange(row + "3:" + row);        var values = column.getValues();         var ct = 0;        while ( values[ct] && values[ct][0] != "" ) {          ct++;        }        return (ct);      }    

Feel free to ask for more details.

Thanks in advance,

Getting rid of unneccessary permissions in AndroidManifest.xml

Posted: 03 Nov 2021 08:55 AM PDT

This is what kind of permissions I have in android/app/src/main/AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />  <uses-permission android:name="android.permission.USE_FINGERPRINT" />  <uses-permission android:name="android.permission.VIBRATE" />  

But for some of the reason in the build, in AndroidManifest.xml file ( build/intermediates/merged_manifests/debug/AndroidManifest.xml ) I have this permissions:

<uses-permission android:name="android.permission.INTERNET" />  <uses-permission android:name="android.permission.USE_FINGERPRINT" />  <uses-permission android:name="android.permission.VIBRATE" />  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />  

Trying to find a way how to get rid of:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />  

I want to rewrite this random generator to autoincrement in PHP

Posted: 03 Nov 2021 08:56 AM PDT

<?php   function createRandomNumber() {       $chars = "003232303232023232023456789";       srand((double)microtime()*1000000);       $i = 0;       $pass = '' ;       while ($i <= 7) {          $num = rand() % 33;          $tmp = substr($chars, $num, 1);          $pass = $pass . $tmp;          $i++;      }      return $pass;  }   $finalinvoice='INV-'.createRandomNumber(); ?>`''      

What context should I give to AlertDialog.Builder?

Posted: 03 Nov 2021 08:55 AM PDT

I have a problem with AlertDialog.Builder, I am trying to find the right context to give to builder = AlertDialog.Builder(this) but I keep having this error message Type mismatch. Required: Context Found: ProfilFragment

import : androidx.appcompat.app.AlertDialog

I really don't know at this point what context to use instead. Thank you

Lost type in PyTorch optimization

Posted: 03 Nov 2021 08:55 AM PDT

I'm trying to implement a simple minimizer in PyTorch, here is the code:

for i in range(10):      print('i =', i, ' q =', q)      v_trans = transform_dq(v, q)      loss = mse(v_trans, v_target)      loss.backward()      q = q - eta * q.grad    print('Final q = ', q)  

Where v and q are tensors, and eta = 0.01.

The problem is that at the line q = q - eta * q.grad I get an error on the second iteration of the loop:

TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'  

It looks like the update for q changes the graph in an unwanted way (q is not a leaf of the graph anymore and hence it doesn't have a grad). If that is the case, then how to implement this simple minimizer?

Unexplained delay in ASP.NET WebAPI in hop from web app directory to action route

Posted: 03 Nov 2021 08:56 AM PDT

Under an 'apps' web site, we've created a web application through docker/powershell using:

New-WebApplication -Name 'service_b' -Site 'apps' -PhysicalPath 'C:\ServiceB.API' -ApplicationPool 'DefaultAppPool'.  

With SignalFx tracing enabled, we notice a very long, unexplainable delay when IIS or WebAPI seems to redirect from a path that includes the web application name /service_b/api/1.0/users/status to the path that lacks the web app name api/1.0/users/status, and we have no idea what it's doing during this seemingly pointless step:

enter image description here

I don't think the request is leaving the application server. What exactly is IIS/WebAPI doing during this step? Perhaps the request is being reordered to the back of a queue and treated as a new request? This all occurs before any of the application code runs, which we know because the 'Auth' logic -- the very first thing to run -- doesn't even start after the 1.74 second delay, which seems to be consumed by some kind of internal IIS/WebAPI routing.

Note: ServiceA is another application with tracing enabled that's making a REST call to ServiceB. The call reaches ServiceB very quickly in just a few microseconds, so the 1.74s delay happens after ServiceB has already received the request and started clocking its own tracing span.

how to use FutureBuilder with Visibility in a widget flutter

Posted: 03 Nov 2021 08:56 AM PDT

It has been days since I am trying to figure out how to keep hidden posts hidden from the user, who has hidden it. I tried filtering with .where(), but then i was stuck in figuring how to filter it with the userId, which was NOT in the array in the firestore posts collection. Then I tried setting rules to

match /reviews/{review}{  allow read: if request.auth != null && !(request.auth.uid in   resource.data.hidingUserId)}     

but that did not work as well. Was not getting any posts, as permission was denied completely.

So now I am trying following methods:

hidePost(BuildContext context) async {  setState(() {    isVisible = !isVisible;  });    await postRef.doc(widget.post.postId).update({'hidingUserId':   FieldValue.arrayUnion([FirebaseAuth.instance.currentUser.uid])});  showInSnackBar(context, Languages.of(context).postHidden);    final SharedPreferences prefs = await SharedPreferences.getInstance();  return prefs.setBool("visibility", !isVisible);  }    getVisibility() async{  final SharedPreferences prefs = await SharedPreferences.getInstance();  return prefs.getBool("visibility");  }  

and then in my widget I have:

child: Visibility(    visible: getVisibility(),    child: Container(          decoration: BoxDecoration(            color: Colors.white60,            borderRadius: BorderRadius.circular(15.0),          ),          child: Column( blahblablah...)  

The error I am getting is type 'Future<dynamic>' is not a subtype of type 'bool' on the getVisibility() method. Maybe I need to use FutureBuilder, but I don't know where to use it. Please, help me get over with this issue? Thank you so much!

Login after registration, avoid ajax innerhtml [duplicate]

Posted: 03 Nov 2021 08:56 AM PDT

After a successful register, i want the user to be redirected to header('Location: home.php')
but that page will also output where i want only the php echo to be shown (errors)

enter image description here

Question

How can i keep the JavaScript (innerHTML) to handle errors such as

echo '<div class="error">Username or email exists!</div>';  

While, I do not want home.php to be thrown in it (see image)
I want the user to be redirected to home.php, after registered successfully

An explanation with a snippet of code (because im new) will help resolve this

This happens because of Ajax, innerHTML:

<script>          var form = document.querySelector('.register form');          form.onsubmit = function(event) {              event.preventDefault();              var form_data = new FormData(form);              var xhr = new XMLHttpRequest();              xhr.open('POST', form.action, true);              xhr.onload = function () {                  document.querySelector('.msg').innerHTML = this.responseText;              };              xhr.send(form_data);          };          </script>  

register.html

<div class="register login">    <form action="register.php" method="post" autocomplete="off">  <input type="text" name="username" placeholder="Username" id="username" required>  <input type="password" name="password" placeholder="Password" id="password" required>  <input type="password" name="cpassword" placeholder="Confirm Password" id="cpassword" required>  <input type="email" name="email" placeholder="Email" id="email" required>  <div class="msg"></div>  <input type="submit" value="Register">  </form>  </div>  

register.php

// Username doesn't exist, insert new account  $stmt = $pdo->prepare('INSERT INTO accounts (username, password, email, activation_code) VALUES (?, ?, ?, ?)');  // We do not want to expose passwords in our database, so hash the password and use password_verify when a user logs in.  $password = password_hash($_POST['password'], PASSWORD_DEFAULT);  $uniqid = account_activation ? uniqid() : 'activated';  $stmt->execute([ $_POST['username'], $password, $_POST['email'], $uniqid ]);    // Login in the user  session_regenerate_id();  $_SESSION['loggedin'] = TRUE;  $_SESSION['name'] = $_POST['username'];  $_SESSION['id'] = $pdo->->lastInsertId();  $_SESSION['role'] = 'the default role';      header('Location: home.php');      exit;  }  

Powershell removes multiple consecutive whitespaces when I pass arguments to a nested Start-Process command

Posted: 03 Nov 2021 08:56 AM PDT

This powershell code works fine:

powershell -NoProfile -Command {Start-Process -FilePath wscript.exe -Verb RunAs -ArgumentList '"C:\Users\TestAccount\Desktop\cartella  con  spazi\test.vbs" "/CurrentDirectory:C:\Users\TestAccount\Desktop\Cartella  con  spazi" "/AppData:C:\Users\TestAccount\AppData\Roaming"'}  

But when I enter the complete command, powershell leaves only one space between the words, when there are two consecutive ones in my path:

Start-Process -FilePath powershell.exe -WorkingDirectory "$env:ALLUSERSPROFILE" -Credential $credential -WindowStyle Hidden -ArgumentList "-NoProfile -Command & {Start-Process -FilePath wscript.exe -Verb RunAs -ArgumentList '\`"C:\Users\TestAccount\Desktop\cartella  con  spazi\test.vbs\`" \`"/CurrentDirectory:C:\Users\TestAccount\Desktop\Cartella  con  spazi\`" \`"/AppData:C:\Users\TestAccount\AppData\Roaming\`"'}"  

Same error with this:

Start-Process -FilePath powershell.exe -WorkingDirectory "$env:ALLUSERSPROFILE" -Credential $credential -WindowStyle Hidden -ArgumentList "-NoProfile -Command Start-Process -FilePath wscript.exe -Verb RunAs -ArgumentList '\`"C:\Users\TestAccount\Desktop\cartella  con  spazi\test.vbs\`" \`"/CurrentDirectory:C:\Users\TestAccount\Desktop\Cartella  con  spazi\`" \`"/AppData:C:\Users\TestAccount\AppData\Roaming\`"'"  

This is the error message:

enter image description here

As you can see, in the error message the path contains only one space between words, while in the code I have correctly entered two consecutive ones.

This is the code to enter the credentials (just before the line that gives an error):

$username = 'Username'  $password = 'Password'  $securePassword = ConvertTo-SecureString $password -AsPlainText -Force  $credential = New-Object System.Management.Automation.PSCredential $username, $securePassword  

I've been getting a single line of code to work properly for days but without success. You can adopt the strategy you think is most appropriate to help me.

Is there any way to speed up this loop?

Posted: 03 Nov 2021 08:56 AM PDT

I am pretty new to programming and am looking for help to speed up this process. At the current rate the loop will take approximately 24-30 hours.

    library(readxl)    ## Load data##  A02_pre <- read_excel("C:/Users/Gebruiker/Desktop/Nieuwe map/Mappen participanten/Pre/A02/A02_vivo13_wk2_4mei_90uur.xlsx",                                            col_types = c("text", "text", "text",                                                          "numeric", "numeric", "numeric",                                                          "numeric", "numeric", "numeric",                                                          "text", "text", "text", "numeric",                                                          "numeric", "numeric", "numeric",                                                          "numeric", "numeric", "text", "numeric",                                                          "numeric", "numeric", "numeric",                                                          "numeric", "numeric", "text", "numeric",                                                          "numeric", "numeric", "numeric",                                                          "text", "text"))          A02_pre_hr <- read_excel("C:/Users/Gebruiker/Desktop/Nieuwe map/Mappen participanten/Pre/A02/A02 - 17817.xlsx", )  View(A02_pre_hr)      ### Convert string to date time ##  A02_pre$`ns1:Time` = as.POSIXct(A02_pre$`ns1:Time`,                                                      format="%Y-%m-%dT%H:%M:%OSZ",tz ="GMT")  A02_pre_hr$start = as.POSIXct(substr(A02_pre_hr$start,1,nchar(A02_pre_hr$start)-4),                                        format="%Y-%m-%d %H:%M:%S",tz ="GMT")    ## Test dates ##  A02_pre$`ns1:Time`[1] < A02_pre_hr$start[1]        measurementTime <- A02_pre$`ns1:Time`  heartRate <- A02_pre$`ns1:Value4`        **### Run for loop starting here   toCheck = 1:length(measurementTime)  maxj = 0  for(i in 1:(nrow(A02_pre_hr)-1)){        activityStartTime = A02_pre_hr$start[i]        activityEndTime= A02_pre_hr$start[i+1]        heartRateSum = 0    heartRateCount = 0        ## Loop over heart rate measurements & assign average to activity    for(j in toCheck[toCheck>maxj]){                  if(measurementTime[j]>=activityStartTime & measurementTime[j]<= activityEndTime){                heartRateCount = heartRateCount+1        heartRateSum = heartRateSum + heartRate[j]        }else if(heartRateCount>0){        break;      }    }    averageHeartRate = NA    if(heartRateCount>0){      averageHeartRate = heartRateSum / heartRateCount    }    A02_pre_hr$averageHeartRate[i] = averageHeartRate    print(i)  }**      ### Summary ####  by(A02_pre_hr$averageHeartRate, A02_pre_hr$class, summary)  
> head(A02_pre)  # A tibble: 6 x 32    Sport `ns1:Id`  StartTime  `ns1:TotalTimeSe~ `ns1:DistanceMe~ `ns1:MaximumSpe~ `ns1:Calories` `ns1:Value` `ns1:Value2` `ns1:Intensity` `ns1:TriggerMet~ `ns1:Time`          `ns1:DistanceMe~    <chr> <chr>     <chr>                  <dbl>            <dbl>            <dbl>          <dbl>       <dbl>        <dbl> <chr>           <chr>            <dttm>                         <dbl>  1 Other 2018-05-~ 2018-05-0~            323996            7635.             4.01          14056          73          143 Active          Manual           2018-05-04 11:22:18                0  2 Other 2018-05-~ 2018-05-0~            323996            7635.             4.01          14056          73          143 Active          Manual           2018-05-04 11:22:19                0  3 Other 2018-05-~ 2018-05-0~            323996            7635.             4.01          14056          73          143 Active          Manual           2018-05-04 11:22:20                0  4 Other 2018-05-~ 2018-05-0~            323996            7635.             4.01          14056          73          143 Active          Manual           2018-05-04 11:22:21                0  5 Other 2018-05-~ 2018-05-0~            323996            7635.             4.01          14056          73          143 Active          Manual           2018-05-04 11:22:22                0  6 Other 2018-05-~ 2018-05-0~            323996            7635.             4.01          14056          73          143 Active          Manual           2018-05-04 11:22:23                0        > head(A02_pre_hr)  # A tibble: 6 x 11    results_id start               duration class    steps    mi   aee   tee   met counts averageHeartRate         <dbl> <dttm>                 <dbl> <chr>    <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl> <lgl>             1      17817 2018-05-04 13:09:37     22.4 standing     0     2    16    91  1.14     14 NA                2      17817 2018-05-04 13:10:00     60   standing     0    12    21    96  1.21    138 NA                3      17817 2018-05-04 13:11:00     60   standing     0     1    15    90  1.14      0 NA                4      17817 2018-05-04 13:12:00     60   standing     0    11    20    96  1.20    256 NA                5      17817 2018-05-04 13:13:00     60   standing     0     2    16    91  1.14      0 NA                6      17817 2018-05-04 13:14:00     60   standing     0   102    64   144  1.77   2059 NA            

Custom attribute constructor - PXCustomSelectorAttribute

Posted: 03 Nov 2021 08:56 AM PDT

Good day

I have created a custom attribute for the customer ID attribute on Sales orders. With the current attributes on the Customer ID customers that are in credit hold are not shown in the list.

My idea is to change the list dynamically so that if the order type is QT customers that are in credit hold still show in the list.

My problem is I don't know if there is a way to send/get the current SOOrder.OrderType

Here is where I am at

  namespace PX.Objects.SO  {        [PXNonInstantiatedExtension]      public class SO_SOOrder_ExistingColumn : PXCacheExtension<PX.Objects.SO.SOOrder>      {          #region CustomerID            [PXMergeAttributes(Method = MergeMethod.Append)]          // [CustomercustomersAttribute(Current<SOOrder.orderType>))]          [CustomercustomersAttribute()]          public int? CustomerID { get; set; }          

No comments:

Post a Comment