问:
python script using fernet encryption getting error : cryptography.fernet.InvalidToken
I am trying to decrypt my password but it keeps giving me an error saying my token is invalid which is weird as i use it in the lines before and it works.

the error is:

```<code>cryptography.fernet.InvalidToken
</code>```
```<code>from cryptography.fernet import Fernet
import time
key = Fernet.generate_key()
cipher_suite = Fernet(key)

cipher_text = cipher_suite.encrypt(b"A really secret message. Not for prying eyes.")
plain_text = cipher_suite.decrypt(cipher_text)
PASSWORD = b'gAAAAABjsxMwxBTFdQ9_tFMYv-Ko1Ja7t5afvMiJBehRMqJyp-OapyRbP2IPBsboI-rZilgXhcIIpWWXq1Bwo732st7celJvX52Ahxten8lbF0LMzw7ND9Q9r2UFPeTyJjOp9Dr0mqhd'
password_decrypted = cipher_suite.decrypt(PASSWORD)
</code>```
```<code>Traceback (most recent call last):
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/fernet.py", line 133, in _verify_signature
    h.verify(data[-32:])
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/hazmat/primitives/hmac.py", line 70, in verify
    ctx.verify(signature)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/hazmat/backends/openssl/hmac.py", line 84, in verify
    raise InvalidSignature("Signature did not match digest.")
cryptography.exceptions.InvalidSignature: Signature did not match digest.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workspaces/big-schoolwork-repo/password manager/cli/password manager/main.py", line 9, in <module>
    password_decrypted = cipher_suite.decrypt(PASSWORD)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/fernet.py", line 90, in decrypt
    return self._decrypt_data(data, timestamp, time_info)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/fernet.py", line 151, in _decrypt_data
    self._verify_signature(data)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/fernet.py", line 135, in _verify_signature
    raise InvalidToken
cryptography.fernet.InvalidToken
</code>```

Body:
I am trying to decrypt my password but it keeps giving me an error saying my token is invalid which is weird as i use it in the lines before and it works.

the error is:

cryptography.fernet.InvalidToken

from cryptography.fernet import Fernet
import time
key = Fernet.generate_key()
cipher_suite = Fernet(key)

cipher_text = cipher_suite.encrypt(b"A really secret message. Not for prying eyes.")
plain_text = cipher_suite.decrypt(cipher_text)
PASSWORD = b'gAAAAABjsxMwxBTFdQ9_tFMYv-Ko1Ja7t5afvMiJBehRMqJyp-OapyRbP2IPBsboI-rZilgXhcIIpWWXq1Bwo732st7celJvX52Ahxten8lbF0LMzw7ND9Q9r2UFPeTyJjOp9Dr0mqhd'
password_decrypted = cipher_suite.decrypt(PASSWORD)

Traceback (most recent call last):
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/fernet.py", line 133, in _verify_signature
    h.verify(data[-32:])
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/hazmat/primitives/hmac.py", line 70, in verify
    ctx.verify(signature)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/hazmat/backends/openssl/hmac.py", line 84, in verify
    raise InvalidSignature("Signature did not match digest.")
cryptography.exceptions.InvalidSignature: Signature did not match digest.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workspaces/big-schoolwork-repo/password manager/cli/password manager/main.py", line 9, in <module>
    password_decrypted = cipher_suite.decrypt(PASSWORD)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/fernet.py", line 90, in decrypt
    return self._decrypt_data(data, timestamp, time_info)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/fernet.py", line 151, in _decrypt_data
    self._verify_signature(data)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/cryptography/fernet.py", line 135, in _verify_signature
    raise InvalidToken
cryptography.fernet.InvalidToken


来源: stackexchange

问:
How to preload video of ProgressiveMediaSource like exoPlayer.prepare( ) method but without calling exoPlayer.prepare( )
I want to preload videos without calling exoplayer prepare method.

I'm currently doing this:

```<code>        ProgressiveMediaSource mediaSource=new ProgressiveMediaSource.Factory(new CacheDataSource.Factory()
                .setCache(SimpleMediaPlayer.simpleCache)
                .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setUserAgent("ExoplayerDemo"))
                .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR))
                .createMediaSource(MediaItem.fromUri("https:xxxxxxx/Sending+Data+to+a+New+Activity+with+Intent+Extras.mp4"));
        ExoPlayer player = new ExoPlayer.Builder(this).build();
  player.setMediaSource(mediaSource);
player.prepare();
</code>```

I tried a method of ProgressiveMediaSource that is  prepare source () I thought that was exactly what I'm searching but that is not loading the video.

I want to preload the video before playing like exoplayer.prepare(), exoplayer.prepare() is fine but I don't want to create an exoplayer instance in the background if there will be something available.

ContentLicense: CC BY-SA 4.0

Body:
I want to preload videos without calling exoplayer prepare method.

I'm currently doing this:

        ProgressiveMediaSource mediaSource=new ProgressiveMediaSource.Factory(new CacheDataSource.Factory()
                .setCache(SimpleMediaPlayer.simpleCache)
                .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setUserAgent("ExoplayerDemo"))
                .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR))
                .createMediaSource(MediaItem.fromUri("https:xxxxxxx/Sending+Data+to+a+New+Activity+with+Intent+Extras.mp4"));
        ExoPlayer player = new ExoPlayer.Builder(this).build();
  player.setMediaSource(mediaSource);
player.prepare();

I tried a method of ProgressiveMediaSource that is  prepare source () I thought that was exactly what I'm searching but that is not loading the video.

I want to preload the video before playing like exoplayer.prepare(), exoplayer.prepare() is fine but I don't want to create an exoplayer instance in the background if there will be something available.


问:
Unable to fetch data in React if forms is used
I'm new to ReactJS and struggling to call a REST API. I'm intending to fetch existing details and bind it to an input box so that I can make changes and save the data through a POST request (yet to  implement). However, it looks like the get request is not getting executed. data is returned as null.

If I remove the  then the fetch call works fine and the input box gets updates as expected. What am I doing wrong here? Please advise. Thanks in advance.

```<code>import { useState, useEffect } from "react";
import { useParams } from "react-router-dom";

function Edit() {
    const [data, setData] = useState(null);

    const params = useParams();

    const handleSubmit = (event) => {
      event.preventDefault();

    };

    useEffect(() => {
      fetch(`https://localhost:7174/api/Books/48`)
        .then((response) => response.json())
        .then(setData);
    }, []);

    console.log(data);

  return (
    <form onSubmit={handleSubmit}>
      <input type="text" value={data.title} />
      <input type="submit" />
    </form>
  );
}

export default Edit;
</code>```

Tried using without forms and it was working fine.

Body:
I'm new to ReactJS and struggling to call a REST API. I'm intending to fetch existing details and bind it to an input box so that I can make changes and save the data through a POST request (yet to  implement). However, it looks like the get request is not getting executed. data is returned as null.

If I remove the  then the fetch call works fine and the input box gets updates as expected. What am I doing wrong here? Please advise. Thanks in advance.

import { useState, useEffect } from "react";
import { useParams } from "react-router-dom";

function Edit() {
    const [data, setData] = useState(null);

    const params = useParams();

    const handleSubmit = (event) => {
      event.preventDefault();

    };

    useEffect(() => {
      fetch(`https://localhost:7174/api/Books/48`)
        .then((response) => response.json())
        .then(setData);
    }, []);

    console.log(data);

  return (
    <form onSubmit={handleSubmit}>
      <input type="text" value={data.title} />
      <input type="submit" />
    </form>
  );
}

export default Edit;

Tried using without forms and it was working fine.


问:
C++ compiler warnings in xutility
I often face warning like this using VSCode and CMake when compiling my code:

```<code>C:\Program Files\Microsoft Visual Studio\2022\
       Community\VC\Tools\MSVC\14.31.31103\include\xuti
       lity(136,48): warning C4244: 'initializing': con
       version from 'const double' to '_Ty', possible l
       oss of data [C:\IBOIS57\_Code\Software\Python\co
       mpas_wood\backend\build_win\wood.vcxproj]
</code>```

I clearly understand that there is an issue with my code when types are not the same.
But this error points somewhere that is not my code.
Is it possible to show where this warning is coming from?

I am already printing preprocessing and compilation messages in verbose mode.

This is the full message:

```<code>-- Build files have been written to: C:/IBOIS57/_Code/Software/Python/compas_wood/backend/build_win
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Checking Build System
  Building Custom Rule C:/IBOIS57/_Code/Software/Python/compas_wood/backend/CMakeLists.txt
  clipper.engine.cpp
  clipper.offset.cpp
  Generating Code...
  Clipper2.vcxproj -> C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\Release\Clipper2.lib
  Building Custom Rule C:/IBOIS57/_Code/Software/Python/compas_wood/backend/CMakeLists.txt
  stb_image.cpp
  stb_image_write.cpp
  Generating Code...
  STB.vcxproj -> C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\Release\STB.lib
  Building Custom Rule C:/IBOIS57/_Code/Software/Python/compas_wood/backend/CMakeLists.txt
  imgui_demo.cpp
  imgui_draw.cpp
  imgui_tables.cpp
  imgui_widgets.cpp
  imgui.cpp
  imgui_impl_opengl3.cpp
  imgui_impl_glfw.cpp
  Generating Code...
  imgui_lib.vcxproj -> C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\Release\imgui_lib.lib
  Building Custom Rule C:/IBOIS57/_Code/Software/Python/compas_wood/backend/CMakeLists.txt
  cmake_pch.cxx
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(135,1): warning C4267: 'initializing': conversion from 'siz
e_t' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(134): message : see reference to function template instanti
ation '_Ty *std::construct_at<_Objty,unsigned __int64,void>(_Ty *const ,unsigned __int64 &&) noexcept(<expr>)' being compiled
[C:\IBOIS57\_Code\Software\Pytho
n\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=int,
              _Objty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,unsigned __int64>(_Alloc &,_Objty *const ,unsigned __int64 &&)' being compiled [C:\IBOIS57\_Co
de\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<int>,
              _Ty=int,
              _Objty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,unsigned __int64>(_Alloc &,_Objty *const ,unsigned __int64 &&)' being compiled [C:\IBOIS57\_Co
de\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<int>,
              _Ty=int,
              _Objty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(620): message : see reference to function template instantiat
ion '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<unsigned __int64>(unsigned __int64 &&)' being compiled [C:\IBOIS57\_Code\So
ftware\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=int
          ]
C:\IBOIS57\_Code\Software\Python\compas_wood\backend\src/viewer/include/opengl/opengl_triangulation.h(151): message : see reference to function template insta
ntiation '_Ty &std::vector<_Ty,std::allocator<_Ty>>::emplace_back<unsigned __int64>(unsigned __int64 &&)' being compiled [C:\IBOIS57\_Code\Software\Python\com
pas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(673,1): warning C4267: 'initializing': conversion from 'size
_t' to '_Objty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Objty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(135,50): warning C4244: 'initializing': conversion from '_T
y' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=double
          ]
          and
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(134): message : see reference to function template instanti
ation '_Ty *std::construct_at<_Objty,double,void>(_Ty *const ,double &&) noexcept(<expr>)' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backen
d\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double>(_Alloc &,_Objty *const ,double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\c
ompas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double>(_Alloc &,_Objty *const ,double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\c
ompas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(620): message : see reference to function template instantiat
ion '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<double>(double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\compas
_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\IBOIS57\_Code\Software\Python\compas_wood\backend\src\wood\include\cgal_mesh_util.h(606): message : see reference to function template instantiation '_Ty &
std::vector<_Ty,std::allocator<_Ty>>::emplace_back<double>(double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcx
proj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(680,47): warning C4244: 'initializing': conversion from '_Ty
' to '_Objty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=double
          ]
          and
          [
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(135,50): warning C4244: 'initializing': conversion from 'co
nst double' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(134): message : see reference to function template instanti
ation '_Ty *std::construct_at<_Objty,const double&,void>(_Ty *const ,const double &) noexcept(<expr>)' being compiled [C:\IBOIS57\_Code\Software\Python\compas
_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double&>(_Alloc &,_Objty *const ,const double &)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double&>(_Alloc &,_Objty *const ,const double &)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(620): message : see reference to function template instantiat
ion '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<const double&>(const double &)' being compiled [C:\IBOIS57\_Code\Software\P
ython\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\IBOIS57\_Code\Software\Python\compas_wood\backend\src\wood\include\cgal_mesh_util.h(710): message : see reference to function template instantiation '_Ty &
std::vector<_Ty,std::allocator<_Ty>>::emplace_back<const double&>(const double &)' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_
win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(680,47): warning C4244: 'initializing': conversion from 'con
st double' to '_Objty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(135,50): warning C4244: 'initializing': conversion from '_T
y' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=const double
          ]
          and
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(134): message : see reference to function template instanti
ation '_Ty *std::construct_at<_Objty,const double,void>(_Ty *const ,const double &&) noexcept(<expr>)' being compiled [C:\IBOIS57\_Code\Software\Python\compas
_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double>(_Alloc &,_Objty *const ,const double &&)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double>(_Alloc &,_Objty *const ,const double &&)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(620): message : see reference to function template instantiat
ion '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<const double>(const double &&)' being compiled [C:\IBOIS57\_Code\Software\P
ython\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\IBOIS57\_Code\Software\Python\compas_wood\backend\src\wood\include\cgal_mesh_util.h(755): message : see reference to function template instantiation '_Ty &
std::vector<_Ty,std::allocator<_Ty>>::emplace_back<const double>(const double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_
win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(680,47): warning C4244: 'initializing': conversion from '_Ty
' to '_Objty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=const double
          ]
          and
          [
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(136,48): warning C4244: 'initializing': conversion from '_T
y' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=double
          ]
          and
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(673): message : see reference to function template instantia
tion '_Ty *std::construct_at<_Objty,double,void>(_Ty *const ,double &&) noexcept' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_w
in\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double>(_Alloc &,_Objty *const ,double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\c
ompas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double>(_Alloc &,_Objty *const ,double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\c
ompas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(136,48): warning C4244: 'initializing': conversion from 'co
nst double' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(673): message : see reference to function template instantia
tion '_Ty *std::construct_at<_Objty,const double&,void>(_Ty *const ,const double &) noexcept' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\bac
kend\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double&>(_Alloc &,_Objty *const ,const double &)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double&>(_Alloc &,_Objty *const ,const double &)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(136,48): warning C4244: 'initializing': conversion from '_T
y' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=const double
          ]
          and
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(673): message : see reference to function template instantia
tion '_Ty *std::construct_at<_Objty,const double,void>(_Ty *const ,const double &&) noexcept' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\bac
kend\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double>(_Alloc &,_Objty *const ,const double &&)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double>(_Alloc &,_Objty *const ,const double &&)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
  main.cpp
  wood_globals.cpp
  clipper_util.cpp
  wood_element.cpp
  wood_joint.cpp
  wood_test.cpp
  wood_main.cpp
  viewer_wood.cpp
  wood_xml.cpp
  cgal_mesh_boolean.cpp
  opengl_globals_geometry.cpp
  opengl_globals.cpp
  Generating Code...
</code>```

Title: C++ compiler warnings in xutility

Body:
I often face warning like this using VSCode and CMake when compiling my code:

C:\Program Files\Microsoft Visual Studio\2022\
       Community\VC\Tools\MSVC\14.31.31103\include\xuti
       lity(136,48): warning C4244: 'initializing': con
       version from 'const double' to '_Ty', possible l
       oss of data [C:\IBOIS57\_Code\Software\Python\co
       mpas_wood\backend\build_win\wood.vcxproj]

I clearly understand that there is an issue with my code when types are not the same.
But this error points somewhere that is not my code.
Is it possible to show where this warning is coming from?

I am already printing preprocessing and compilation messages in verbose mode.

This is the full message:

-- Build files have been written to: C:/IBOIS57/_Code/Software/Python/compas_wood/backend/build_win
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Checking Build System
  Building Custom Rule C:/IBOIS57/_Code/Software/Python/compas_wood/backend/CMakeLists.txt
  clipper.engine.cpp
  clipper.offset.cpp
  Generating Code...
  Clipper2.vcxproj -> C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\Release\Clipper2.lib
  Building Custom Rule C:/IBOIS57/_Code/Software/Python/compas_wood/backend/CMakeLists.txt
  stb_image.cpp
  stb_image_write.cpp
  Generating Code...
  STB.vcxproj -> C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\Release\STB.lib
  Building Custom Rule C:/IBOIS57/_Code/Software/Python/compas_wood/backend/CMakeLists.txt
  imgui_demo.cpp
  imgui_draw.cpp
  imgui_tables.cpp
  imgui_widgets.cpp
  imgui.cpp
  imgui_impl_opengl3.cpp
  imgui_impl_glfw.cpp
  Generating Code...
  imgui_lib.vcxproj -> C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\Release\imgui_lib.lib
  Building Custom Rule C:/IBOIS57/_Code/Software/Python/compas_wood/backend/CMakeLists.txt
  cmake_pch.cxx
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(135,1): warning C4267: 'initializing': conversion from 'siz
e_t' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(134): message : see reference to function template instanti
ation '_Ty *std::construct_at<_Objty,unsigned __int64,void>(_Ty *const ,unsigned __int64 &&) noexcept(<expr>)' being compiled
[C:\IBOIS57\_Code\Software\Pytho
n\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=int,
              _Objty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,unsigned __int64>(_Alloc &,_Objty *const ,unsigned __int64 &&)' being compiled [C:\IBOIS57\_Co
de\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<int>,
              _Ty=int,
              _Objty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,unsigned __int64>(_Alloc &,_Objty *const ,unsigned __int64 &&)' being compiled [C:\IBOIS57\_Co
de\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<int>,
              _Ty=int,
              _Objty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(620): message : see reference to function template instantiat
ion '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<unsigned __int64>(unsigned __int64 &&)' being compiled [C:\IBOIS57\_Code\So
ftware\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=int
          ]
C:\IBOIS57\_Code\Software\Python\compas_wood\backend\src/viewer/include/opengl/opengl_triangulation.h(151): message : see reference to function template insta
ntiation '_Ty &std::vector<_Ty,std::allocator<_Ty>>::emplace_back<unsigned __int64>(unsigned __int64 &&)' being compiled [C:\IBOIS57\_Code\Software\Python\com
pas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(673,1): warning C4267: 'initializing': conversion from 'size
_t' to '_Objty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Objty=int
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(135,50): warning C4244: 'initializing': conversion from '_T
y' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=double
          ]
          and
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(134): message : see reference to function template instanti
ation '_Ty *std::construct_at<_Objty,double,void>(_Ty *const ,double &&) noexcept(<expr>)' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backen
d\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double>(_Alloc &,_Objty *const ,double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\c
ompas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double>(_Alloc &,_Objty *const ,double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\c
ompas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(620): message : see reference to function template instantiat
ion '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<double>(double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\compas
_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\IBOIS57\_Code\Software\Python\compas_wood\backend\src\wood\include\cgal_mesh_util.h(606): message : see reference to function template instantiation '_Ty &
std::vector<_Ty,std::allocator<_Ty>>::emplace_back<double>(double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcx
proj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(680,47): warning C4244: 'initializing': conversion from '_Ty
' to '_Objty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=double
          ]
          and
          [
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(135,50): warning C4244: 'initializing': conversion from 'co
nst double' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(134): message : see reference to function template instanti
ation '_Ty *std::construct_at<_Objty,const double&,void>(_Ty *const ,const double &) noexcept(<expr>)' being compiled [C:\IBOIS57\_Code\Software\Python\compas
_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double&>(_Alloc &,_Objty *const ,const double &)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double&>(_Alloc &,_Objty *const ,const double &)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(620): message : see reference to function template instantiat
ion '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<const double&>(const double &)' being compiled [C:\IBOIS57\_Code\Software\P
ython\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\IBOIS57\_Code\Software\Python\compas_wood\backend\src\wood\include\cgal_mesh_util.h(710): message : see reference to function template instantiation '_Ty &
std::vector<_Ty,std::allocator<_Ty>>::emplace_back<const double&>(const double &)' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_
win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(680,47): warning C4244: 'initializing': conversion from 'con
st double' to '_Objty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(135,50): warning C4244: 'initializing': conversion from '_T
y' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=const double
          ]
          and
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(134): message : see reference to function template instanti
ation '_Ty *std::construct_at<_Objty,const double,void>(_Ty *const ,const double &&) noexcept(<expr>)' being compiled [C:\IBOIS57\_Code\Software\Python\compas
_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double>(_Alloc &,_Objty *const ,const double &&)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double>(_Alloc &,_Objty *const ,const double &&)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(620): message : see reference to function template instantiat
ion '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<const double>(const double &&)' being compiled [C:\IBOIS57\_Code\Software\P
ython\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\IBOIS57\_Code\Software\Python\compas_wood\backend\src\wood\include\cgal_mesh_util.h(755): message : see reference to function template instantiation '_Ty &
std::vector<_Ty,std::allocator<_Ty>>::emplace_back<const double>(const double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_
win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(680,47): warning C4244: 'initializing': conversion from '_Ty
' to '_Objty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=const double
          ]
          and
          [
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(136,48): warning C4244: 'initializing': conversion from '_T
y' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=double
          ]
          and
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(673): message : see reference to function template instantia
tion '_Ty *std::construct_at<_Objty,double,void>(_Ty *const ,double &&) noexcept' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_w
in\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double>(_Alloc &,_Objty *const ,double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\c
ompas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,double>(_Alloc &,_Objty *const ,double &&)' being compiled [C:\IBOIS57\_Code\Software\Python\c
ompas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(136,48): warning C4244: 'initializing': conversion from 'co
nst double' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(673): message : see reference to function template instantia
tion '_Ty *std::construct_at<_Objty,const double&,void>(_Ty *const ,const double &) noexcept' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\bac
kend\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double&>(_Alloc &,_Objty *const ,const double &)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double&>(_Alloc &,_Objty *const ,const double &)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xutility(136,48): warning C4244: 'initializing': conversion from '_T
y' to '_Ty', possible loss of data [C:\IBOIS57\_Code\Software\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Ty=const double
          ]
          and
          [
              _Ty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\xmemory(673): message : see reference to function template instantia
tion '_Ty *std::construct_at<_Objty,const double,void>(_Ty *const ,const double &&) noexcept' being compiled [C:\IBOIS57\_Code\Software\Python\compas_wood\bac
kend\build_win\wood.vcxproj]
          with
          [
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(602): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double>(_Alloc &,_Objty *const ,const double &&)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\vector(607): message : see reference to function template instantiat
ion 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,const double>(_Alloc &,_Objty *const ,const double &&)' being
compiled [C:\IBOIS57\_Code\Softw
are\Python\compas_wood\backend\build_win\wood.vcxproj]
          with
          [
              _Alloc=std::allocator<float>,
              _Ty=float,
              _Objty=float
          ]
  main.cpp
  wood_globals.cpp
  clipper_util.cpp
  wood_element.cpp
  wood_joint.cpp
  wood_test.cpp
  wood_main.cpp
  viewer_wood.cpp
  wood_xml.cpp
  cgal_mesh_boolean.cpp
  opengl_globals_geometry.cpp
  opengl_globals.cpp
  Generating Code...


问:
How to use keras vis (gradcam, saliency map) on google colab?
I would like to use keras vis library in google colab to display saliency maps and grad cams of my keras model.

Keras vis is old and unmaintained and uses a deprecated function from scipy 1.1.0. Google colab has scipy on version 1.7.3.

```<code>from vis.visualization import visualize_cam
</code>```

The above line gives me the error:

```<code>ImportError: cannot import name 'imresize' from 'scipy.misc' (/usr/local/lib/python3.8/dist-packages/scipy/misc/__init__.py)
</code>```

I tried to uninstall scipy and install the version 1.1.0, but building the wheel takes forever / I cancelled it after trying for 2h...

Is there any other way how to use those functions from keras vis? Is there a better libary to display pixel attribution from keras models?

Body:
I would like to use keras vis library in google colab to display saliency maps and grad cams of my keras model.

Keras vis is old and unmaintained and uses a deprecated function from scipy 1.1.0. Google colab has scipy on version 1.7.3.

from vis.visualization import visualize_cam

The above line gives me the error:

ImportError: cannot import name 'imresize' from 'scipy.misc' (/usr/local/lib/python3.8/dist-packages/scipy/misc/__init__.py)

I tried to uninstall scipy and install the version 1.1.0, but building the wheel takes forever / I cancelled it after trying for 2h...

Is there any other way how to use those functions from keras vis? Is there a better libary to display pixel attribution from keras models?


问:
How to make google maps container height fixed
So i'm building a real estate app. in the listings results page i have 2 columns (think fo zillow for example) , 1 for the listings results the other for the google map with each location's pin on it. i'm having trouble making google map container height 100% of the vh fixed and the results column scrollable with the results. I will attach a photo showcasing my problem. Here's my code ( i'm using tailwind + react )

```<code>const [map, setMap] = useState(null)

    const onLoad = useCallback(function callback(map) {
        // This is just an example of getting and using the map instance!!! don't just blindly copy!
        const bounds = new window.google.maps.LatLngBounds(center);
        map.fitBounds(bounds);

        setMap(map)
    }, [])
 const containerStyle = {
        height:'100vh',
        width:'100%'
    };

 const center = {
        lat: -3.745,
        lng: -38.523
    };

return (<>
   { /* 2 grid columns one for the map and the other for the results> */}
    <div className="sm:grid sm:grid-cols-[1fr_850px]">
          <div className="grid-cols-1 h-screen">
                    {isLoaded ? (
                        <GoogleMap
                             // here goes the container style declared above
                            mapContainerStyle={containerStyle}
                            center={center}
                            zoom={10}
                            onLoad={onLoad}
                            onUnmount={onUnmount}
                        >
                            <></>
                        </GoogleMap>
                    ) : <></>}
            </div>
            <div className="bg-[#F5F7FB] sm:pt-20 ">
                 // here goes my properties code since it's too long i won't bother you with it since the problem is the parent height property.
            <div>
    </div>
</>
</code>```

What am i doing wrong? When i remove the google map container and set a red background everything works fine but as soon as i put it back, it messes my whole layout.
[![ail][1]][1]

Body:
So i'm building a real estate app. in the listings results page i have 2 columns (think fo zillow for example) , 1 for the listings results the other for the google map with each location's pin on it. i'm having trouble making google map container height 100% of the vh fixed and the results column scrollable with the results. I will attach a photo showcasing my problem. Here's my code ( i'm using tailwind + react )

const [map, setMap] = useState(null)

    const onLoad = useCallback(function callback(map) {
        // This is just an example of getting and using the map instance!!! don't just blindly copy!
        const bounds = new window.google.maps.LatLngBounds(center);
        map.fitBounds(bounds);

        setMap(map)
    }, [])
 const containerStyle = {
        height:'100vh',
        width:'100%'
    };

 const center = {
        lat: -3.745,
        lng: -38.523
    };

return (<>
   { /* 2 grid columns one for the map and the other for the results> */}

                    {isLoaded ? (
                        <GoogleMap
                             // here goes the container style declared above
                            mapContainerStyle={containerStyle}
                            center={center}
                            zoom={10}
                            onLoad={onLoad}
                            onUnmount={onUnmount}
                        >
                            <></>
                        </GoogleMap>
                    ) : <></>}

                 // here goes my properties code since it's too long i won't bother you with it since the problem is the parent height property.

</>

What am i doing wrong? When i remove the google map container and set a red background everything works fine but as soon as i put it back, it messes my whole layout.
[![ail][1]][1]


问:
Trying to set a coordinate to be the origin point adds another random point instead of pushing it to the front
I am trying to make a program for the traveling salesman problem that uses a nearest neighbor method. I am using Django for this project. The problem is, when I try to set one of the coordinate objects to the front of the calculation, it adds another different point to be the origin. Is there anything obviously wrong with my program?

#calcRoute.py

```<code>from django.db import models
from .models import Coordinate, SortedPoint
import math

class Point:
  def __init__(self, longitude, latitude, isPassed, isOrigin):
    self.longitude = longitude
    self.latitude = latitude
    self.isPassed = isPassed
    self.isOrigin = isOrigin

def haversine(lat1, lon1, lat2, lon2): # haversine formula to caluclate distance between points on a globe
    # convert degrees to radians
    lat1, lon1, lat2, lon2 = map(math.radians, [lat1, lon1, lat2, lon2])

    # calculate distance
    dlat = lat2 - lat1
    dlon = lon2 - lon1
    a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2
    c = 2 * math.asin(math.sqrt(a))
    r = 6378  # radius of earth in kilometers
    return c * r

def nearest_neighbor(points, origin): # return the nearest neighbor
  nearestNeighbor = None
  nearestDistance = float('inf')

  for point in points:
    # skip the origin point
    if point == origin:
      continue

    distance = haversine(origin.longitude, origin.latitude, point.longitude, point.latitude)

    if distance < nearestDistance:
      nearestNeighbor = point
      nearestDistance = distance

  return nearestNeighbor

def save_points(points): # save points to db
  for point in points:
    sorted_point = SortedPoint(longitude=point.longitude, latitude=point.latitude, isPassed=point.isPassed)
    sorted_point.save()

def calc_route():
  SortedPoint.objects.all().delete()
  # load coordinates from db
  coordinates = Coordinate.objects.all()

  points = [Point(coordinate.longitude, coordinate.latitude, False, coordinate.isOrigin) for coordinate in coordinates]
  origin = points[0]
  for i in range(len(points)):
    if points[i].isOrigin is True:
      origin = points[i]
  ending = origin
  passedPoints = [origin]
  currentPoint = origin
  points.remove(origin)

  while len(points) > 0:
    nearestNeighbor = nearest_neighbor(points, currentPoint)
    passedPoints.append(nearestNeighbor)
    points.remove(nearestNeighbor)
    currentPoint = nearestNeighbor

  # append origen to the list of passed points
  passedPoints.append(ending)
  save_points(passedPoints) #save
</code>```

#views.py

```<code>
def set_origin(request, id):
    point = SortedPoint.objects.get(id=id)
    point.isOrigin = True
    return redirect('editRoute')

@login_required(login_url='administration')
def update_coords(request):
    Coordinate.objects.all().delete()
    sorted_points = SortedPoint.objects.all()
    for sorted_point in sorted_points:
        coord = Coordinate(latitude=sorted_point.latitude, longitude=sorted_point.longitude, routeName=sorted_point.routeName, isPassed=sorted_point.isPassed, isOrigin=sorted_point.isOrigin)
        coord.save()

    calc_route()
    return redirect('editRoute')
</code>```

#models.py

```<code>
from django.db import models
# Create your models here.

class Coordinate(models.Model):
    latitude = models.FloatField()
    longitude = models.FloatField()
    routeName = models.CharField(max_length=200, default='abc')
    isPassed = models.BooleanField(default=False)
    isOrigin = models.BooleanField(default=False)

class SortedPoint(models.Model):
  longitude = models.FloatField()
  latitude = models.FloatField()
  routeName = models.CharField(max_length=200, default='abc')
  isPassed = models.BooleanField()
  isOrigin = models.BooleanField(default=False)
</code>```

#urls.py (within urlpatterns[])

```<code>
path('edit-route/set_origin/<int:id>/', views.set_origin, name='set_origin'),
    path('edit-route/update_coords/', views.update_coords, name='update_coords'),

</code>```

I have tried multiple different ways of setting it as the origin, tried different points to be the origin, and asked some friends. None of it worked.

Body:
I am trying to make a program for the traveling salesman problem that uses a nearest neighbor method. I am using Django for this project. The problem is, when I try to set one of the coordinate objects to the front of the calculation, it adds another different point to be the origin. Is there anything obviously wrong with my program?

#calcRoute.py

from django.db import models
from .models import Coordinate, SortedPoint
import math

class Point:
  def __init__(self, longitude, latitude, isPassed, isOrigin):
    self.longitude = longitude
    self.latitude = latitude
    self.isPassed = isPassed
    self.isOrigin = isOrigin

def haversine(lat1, lon1, lat2, lon2): # haversine formula to caluclate distance between points on a globe
    # convert degrees to radians
    lat1, lon1, lat2, lon2 = map(math.radians, [lat1, lon1, lat2, lon2])

    # calculate distance
    dlat = lat2 - lat1
    dlon = lon2 - lon1
    a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2
    c = 2 * math.asin(math.sqrt(a))
    r = 6378  # radius of earth in kilometers
    return c * r

def nearest_neighbor(points, origin): # return the nearest neighbor
  nearestNeighbor = None
  nearestDistance = float('inf')

  for point in points:
    # skip the origin point
    if point == origin:
      continue

    distance = haversine(origin.longitude, origin.latitude, point.longitude, point.latitude)

    if distance < nearestDistance:
      nearestNeighbor = point
      nearestDistance = distance

  return nearestNeighbor

def save_points(points): # save points to db
  for point in points:
    sorted_point = SortedPoint(longitude=point.longitude, latitude=point.latitude, isPassed=point.isPassed)
    sorted_point.save()

def calc_route():
  SortedPoint.objects.all().delete()
  # load coordinates from db
  coordinates = Coordinate.objects.all()

  points = [Point(coordinate.longitude, coordinate.latitude, False, coordinate.isOrigin) for coordinate in coordinates]
  origin = points[0]
  for i in range(len(points)):
    if points[i].isOrigin is True:
      origin = points[i]
  ending = origin
  passedPoints = [origin]
  currentPoint = origin
  points.remove(origin)

  while len(points) > 0:
    nearestNeighbor = nearest_neighbor(points, currentPoint)
    passedPoints.append(nearestNeighbor)
    points.remove(nearestNeighbor)
    currentPoint = nearestNeighbor

  # append origen to the list of passed points
  passedPoints.append(ending)
  save_points(passedPoints) #save

#views.py

def set_origin(request, id):
    point = SortedPoint.objects.get(id=id)
    point.isOrigin = True
    return redirect('editRoute')

@login_required(login_url='administration')
def update_coords(request):
    Coordinate.objects.all().delete()
    sorted_points = SortedPoint.objects.all()
    for sorted_point in sorted_points:
        coord = Coordinate(latitude=sorted_point.latitude, longitude=sorted_point.longitude, routeName=sorted_point.routeName, isPassed=sorted_point.isPassed, isOrigin=sorted_point.isOrigin)
        coord.save()

    calc_route()
    return redirect('editRoute')

#models.py

from django.db import models
# Create your models here.

class Coordinate(models.Model):
    latitude = models.FloatField()
    longitude = models.FloatField()
    routeName = models.CharField(max_length=200, default='abc')
    isPassed = models.BooleanField(default=False)
    isOrigin = models.BooleanField(default=False)

class SortedPoint(models.Model):
  longitude = models.FloatField()
  latitude = models.FloatField()
  routeName = models.CharField(max_length=200, default='abc')
  isPassed = models.BooleanField()
  isOrigin = models.BooleanField(default=False)

#urls.py (within urlpatterns[])

path('edit-route/set_origin/<int:id>/', views.set_origin, name='set_origin'),
    path('edit-route/update_coords/', views.update_coords, name='update_coords'),

I have tried multiple different ways of setting it as the origin, tried different points to be the origin, and asked some friends. None of it worked.


问:
PHPStan cast to more specific array shape
In my code, I call a method whose return value is typed as follows:

```<code>/**
 * @return array<int, array<string,mixed>>
 */
public function fetchAllAssociative(): array;
</code>```

The subtype array<string, mixed> describes the database record in a generic way. I know exactly what this database record looks like so I want to be more specific in documenting the method:

```<code>/**
 * @return array<int, array{id: int, firstName: string, lastName: string}>
 */
public function getAllUsers(): array
{
  return $this->userRepository->fetchAllAssociative();
}
</code>```

However, PHPStan complains that I should type my methods exactly as fetchAllAssociative:

Method UserRepository::getAllUsers() should return array<int, array{id: int, firstName: string, lastName: string}> but returns array<int, array<string, mixed>>.

Is there a way to cast it? My workaround is to introduce a new variable and use the @var tag but I don't really like it (other static code analysis tools don't like it as well)

```<code>/**
 * @return array<int, array{id: int, firstName: string, lastName: string}>
 */
public function getAllUsers(): array
{
  /**
   * @var array<int, array{id: int, firstName: string, lastName: string}> $data
   */
  $data = $this->userRepository->fetchAllAssociative();

  return $data;
}
</code>```

Body:
In my code, I call a method whose return value is typed as follows:

/**
 * @return array<int, array<string,mixed>>
 */
public function fetchAllAssociative(): array;

The subtype array<string, mixed> describes the database record in a generic way. I know exactly what this database record looks like so I want to be more specific in documenting the method:

/**
 * @return array<int, array{id: int, firstName: string, lastName: string}>
 */
public function getAllUsers(): array
{
  return $this->userRepository->fetchAllAssociative();
}

However, PHPStan complains that I should type my methods exactly as fetchAllAssociative:

Method UserRepository::getAllUsers() should return array<int, array{id: int, firstName: string, lastName: string}> but returns array<int, array<string, mixed>>.

Is there a way to cast it? My workaround is to introduce a new variable and use the @var tag but I don't really like it (other static code analysis tools don't like it as well)

/**
 * @return array<int, array{id: int, firstName: string, lastName: string}>
 */
public function getAllUsers(): array
{
  /**
   * @var array<int, array{id: int, firstName: string, lastName: string}> $data
   */
  $data = $this->userRepository->fetchAllAssociative();

  return $data;
}


问:
.net c# windows forms, play sound without overlaping
I am using  the current code to play a background music e sounds for the buttons click;

```<code>private void FormMain_Load(object sender, EventArgs e)
            {
                WindowState = FormWindowState.Maximized;            //Colocar A janela em FullScreen
                SoundPlayer music = new SoundPlayer(@"D:\Escola\Licenciatura\4º Ano\1º Semestre\Progig\Projeto\beyblade\Assets\Sounds\soundtrack.wav");
                music.Play();
            }
            private void exitToolStripMenuItem_Click_1(object sender, EventArgs e)
            {
                SoundPlayer soundclick = new SoundPlayer(@"D:\Escola\Licenciatura\4º Ano\1º Semestre\Progig\Projeto\beyblade\Assets\Sounds\click.mp3");
                soundclick.Play();
            }
</code>```

The song plays when the form loads, but when I click on a sound the background music stops and plays the sound from the click, is not there a way to keep both?

Body:
I am using  the current code to play a background music e sounds for the buttons click;

private void FormMain_Load(object sender, EventArgs e)
            {
                WindowState = FormWindowState.Maximized;            //Colocar A janela em FullScreen
                SoundPlayer music = new SoundPlayer(@"D:\Escola\Licenciatura\4º Ano\1º Semestre\Progig\Projeto\beyblade\Assets\Sounds\soundtrack.wav");
                music.Play();
            }
            private void exitToolStripMenuItem_Click_1(object sender, EventArgs e)
            {
                SoundPlayer soundclick = new SoundPlayer(@"D:\Escola\Licenciatura\4º Ano\1º Semestre\Progig\Projeto\beyblade\Assets\Sounds\click.mp3");
                soundclick.Play();
            }

The song plays when the form loads, but when I click on a sound the background music stops and plays the sound from the click, is not there a way to keep both?


问:
Segmenting a video live stream into videos of a fixed length using ffmpeg
I want to use an ffmpeg command to save segments of length 10 seconds from a video being streamed via HTTP using VLC.

The command I used to carry out the task is:
ffmpeg -i http://[Local IPv4 address]:8080 -f segment -segment_time 10 -vcodec copy -acodec copy -reset_timestamps 1 video%03d.mp4

However, the lengths of the output videos I'm receiving are around 8.333 or 16.666 seconds in duration. (The videos video000.mp4, video005.mp4, video010.mp4, video015.mp4... have duration of around 16.666 seconds and the remaining videos have duration of around 8.333 seconds).

I'm aware that the segmentation of input video happens based on the occurrences of keyframes in the video. It appears that the key frames in the video being streamed occur with an interval of around 8 seconds.

Is there a way to obtain video segments that are closer to 10 seconds in duration from the live stream of such a video?

Also, I occasionally get the "Non-monotonous DTS in output stream 0:0" warning while executing the above command. I tried using different flags (+genpts, +igndts, +ignidx) hoping that the warning message would not be displayed, but no luck. Is it possible that there is any correlation between this warning and the issue with lengths of the segments?


问:
Add number identifier for new users in Supabase
I want to add a trigger in a Supabase database that adds a unique identifier for new users (upon sign-up) that is shorter than the UUID that is generated, one that can be used in routing. My plan is to simply do something similar to Facebook, where I just do something like joe.smith + # of "Joe Smiths" already in the database (ex. joe.smith.12).

To do this, I am creating a function trigger:

```<code>declare
  total integer;
  first_name text;
  last_name text;
  identifier text;

begin
  first_name := split_part(new.raw_user_meta_data->>'full_name', ' ', 0);
  last_name := split_part(new.raw_user_meta_data->>'full_name', ' ', 1);
  identifier := concat(first_name, '.', last_name, '.');
  total := (select count(full_name_identifier)::int from public.profiles where full_name like concat(identifier, '%'));
  insert into public.profiles (id, full_name, avatar_url, full_name_identifier)
  values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url', concat(identifier, cast(identifier as text)));
  return new;
end;
</code>```

Is this correct?

Body:
I want to add a trigger in a Supabase database that adds a unique identifier for new users (upon sign-up) that is shorter than the UUID that is generated, one that can be used in routing. My plan is to simply do something similar to Facebook, where I just do something like joe.smith + # of "Joe Smiths" already in the database (ex. joe.smith.12).

To do this, I am creating a function trigger:

declare
  total integer;
  first_name text;
  last_name text;
  identifier text;

begin
  first_name := split_part(new.raw_user_meta_data->>'full_name', ' ', 0);
  last_name := split_part(new.raw_user_meta_data->>'full_name', ' ', 1);
  identifier := concat(first_name, '.', last_name, '.');
  total := (select count(full_name_identifier)::int from public.profiles where full_name like concat(identifier, '%'));
  insert into public.profiles (id, full_name, avatar_url, full_name_identifier)
  values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url', concat(identifier, cast(identifier as text)));
  return new;
end;

Is this correct?


问:
How to correctly handle encoding in scraping a site
I am quite a newbie in coding but i am trying to learn to use Python for web scraping.
At this time I am trying to extract the price of a product from this code:

```<code>
<div class="a-column a-span2 a-text-right sc-item-right-col a-span-last">
   <p class="a-spacing-mini">
    <span class="a-size-medium a-color-base sc-product-price a-text-bold">
        1 089,70 €
    </span>
 </p>
</div>

</code>```

using this code:

```<code>def get_amazon_price(dom):
    item_price = dom.xpath('//span[@class="a-size-medium a-color-base sc-product-price a-text-bold"]/text()')[0]
    print(item_price)
    item_price = item_price.replace('€', '').replace(",", "").replace(".", "")
    item_price = int(item_price)/100
    print(item_price)
    return item_price
</code>```

The issue is that running the code several times doesn't give me the same result (sometimes i get the correct price 1089,70 and sometimes i get no price value).
I think this can be something related to encoding, can you help me?
Thanks a lot.

I am trying to extract a price from a web page but doing that gives different result. I think this can be related to encoding.

Body:
I am quite a newbie in coding but i am trying to learn to use Python for web scraping.
At this time I am trying to extract the price of a product from this code:

        1 089,70 €

using this code:

def get_amazon_price(dom):
    item_price = dom.xpath('//span[@class="a-size-medium a-color-base sc-product-price a-text-bold"]/text()')[0]
    print(item_price)
    item_price = item_price.replace('€', '').replace(",", "").replace(".", "")
    item_price = int(item_price)/100
    print(item_price)
    return item_price

The issue is that running the code several times doesn't give me the same result (sometimes i get the correct price 1089,70 and sometimes i get no price value).
I think this can be something related to encoding, can you help me?
Thanks a lot.

I am trying to extract a price from a web page but doing that gives different result. I think this can be related to encoding.


问:
Copy data from a table in one postgres database to another, (different host names), using psql
What code should I use if I want to execute a batch file with the psql copy command, (to transfer data from one postgres database table to another)?

How do I connect to the databases with two different host names at once?

How do I set the connection parameters?

I tried using this:

```<code>psql \
    -U user_name \
    -h production_server \
    -d database_name \
    -c "\\copy users to stdout" | \
psql -U user_name \
    -h staging_server \
    -d database_name \
    -c "\\copy users from stdin"
</code>```

Body:
What code should I use if I want to execute a batch file with the psql copy command, (to transfer data from one postgres database table to another)?

How do I connect to the databases with two different host names at once?

How do I set the connection parameters?

I tried using this:

psql \
    -U user_name \
    -h production_server \
    -d database_name \
    -c "\\copy users to stdout" | \
psql -U user_name \
    -h staging_server \
    -d database_name \
    -c "\\copy users from stdin"


问:
How do I get the one-year percent change with Bureau of Labor Statistics API public data?
I hope that I can clearly explain what I'm trying to do here. I'm able to retrieve the series date and values through the Bureau of Labor Statistics(BLS) API data. https://www.bls.gov/

I want to now get the 1-year percent change for each value. I'm grateful for any help on this. XXXXX is where I put my registration ID, so I can access more than three years of data.

Here's the developer's page: https://www.bls.gov/developers/api_signature_v2.htm#parameters

```<code>base_url = 'https://api.bls.gov/publicAPI/v2/timeseries/data/'
series = {'id': 'CUSR0000SA0',
          'name': 'Consumer Price Index - All Urban Consumers'}
data_url = '{}{}/?registrationkey=XXXXXXXXXXXXXXXXXX&startyear=2010&endyear=2022'.format(base_url, series['id'])

import requests
r = requests.get(data_url).json()
print('Status: ' + r['status'])

r = r['Results']['series'][0]['data']
print(r[0])

import pandas as pd
##M13 is annual year, which I'm skipping since I only want months 1-12
dates = ['{}{}'.format(i['period'], i['year']) for i in r if i['period'] < 'M13']
index = pd.to_datetime(dates)
data = {series['id']: [float(i['value']) for i in r if i['period'] < 'M13']}

df = pd.DataFrame(index=index, data=data).iloc[::-1]
</code>```

I'm not sure how to write up retrieving calculations in my code.
I tried "calculations: {[i['calculations'][0] for i in r if i['period'] < 'M13']}" but that is not right.

Body:
I hope that I can clearly explain what I'm trying to do here. I'm able to retrieve the series date and values through the Bureau of Labor Statistics(BLS) API data. https://www.bls.gov/

I want to now get the 1-year percent change for each value. I'm grateful for any help on this. XXXXX is where I put my registration ID, so I can access more than three years of data.

Here's the developer's page: https://www.bls.gov/developers/api_signature_v2.htm#parameters

base_url = 'https://api.bls.gov/publicAPI/v2/timeseries/data/'
series = {'id': 'CUSR0000SA0',
          'name': 'Consumer Price Index - All Urban Consumers'}
data_url = '{}{}/?registrationkey=XXXXXXXXXXXXXXXXXX&startyear=2010&endyear=2022'.format(base_url, series['id'])

import requests
r = requests.get(data_url).json()
print('Status: ' + r['status'])

r = r['Results']['series'][0]['data']
print(r[0])

import pandas as pd
##M13 is annual year, which I'm skipping since I only want months 1-12
dates = ['{}{}'.format(i['period'], i['year']) for i in r if i['period'] < 'M13']
index = pd.to_datetime(dates)
data = {series['id']: [float(i['value']) for i in r if i['period'] < 'M13']}

df = pd.DataFrame(index=index, data=data).iloc[::-1]

I'm not sure how to write up retrieving calculations in my code.
I tried "calculations: {[i['calculations'][0] for i in r if i['period'] < 'M13']}" but that is not right.


问:
ModuleNotFoundError: No module named 'pyttsx3.drivers.' #253
I am a mac user who has encountered this issue ModuleNotFoundError: No module named 'pyttsx3.drivers.' and I was just trying to use pyttsx3 for a simple task and this error came and I have seen answers for this but all of them are realted to windows and there is not a solution which supports Mac OS, Here is the full Traceback:

```<code>Traceback (most recent call last):
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/python3.11/site-packages/pyttsx3/__init__.py", line 20, in init
    eng = _activeEngines[driverName]
          ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/weakref.py", line 136, in __getitem__
    o = self.data[key]()
        ~~~~~~~~~^^^^^
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/Stack Overflow Question.py", line 7, in <module>
    engine = pyttsx3.init('')
             ^^^^^^^^^^^^^^^^
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/python3.11/site-packages/pyttsx3/__init__.py", line 22, in init
    eng = Engine(driverName, debug)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/python3.11/site-packages/pyttsx3/engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/python3.11/site-packages/pyttsx3/driver.py", line 50, in __init__
    self._module = importlib.import_module(name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyttsx3.drivers.'

</code>```

I tried methods like renistalling pyttsx3 but it still didn't solve the problem .

Body:
I am a mac user who has encountered this issue ModuleNotFoundError: No module named 'pyttsx3.drivers.' and I was just trying to use pyttsx3 for a simple task and this error came and I have seen answers for this but all of them are realted to windows and there is not a solution which supports Mac OS, Here is the full Traceback:

Traceback (most recent call last):
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/python3.11/site-packages/pyttsx3/__init__.py", line 20, in init
    eng = _activeEngines[driverName]
          ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/weakref.py", line 136, in __getitem__
    o = self.data[key]()
        ~~~~~~~~~^^^^^
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/Stack Overflow Question.py", line 7, in <module>
    engine = pyttsx3.init('')
             ^^^^^^^^^^^^^^^^
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/python3.11/site-packages/pyttsx3/__init__.py", line 22, in init
    eng = Engine(driverName, debug)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/python3.11/site-packages/pyttsx3/engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/s.sinha@aics.espritscholen.nl/PycharmProjects/AI First/venv/lib/python3.11/site-packages/pyttsx3/driver.py", line 50, in __init__
    self._module = importlib.import_module(name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyttsx3.drivers.'

I tried methods like renistalling pyttsx3 but it still didn't solve the problem .


问:
In Next.js, how can I handle all the routes and links in one file?
In Next.js, how can I handle all the routes and links in one file so that in the future, if the paths of the folders and files are changed, I don't have to change the links in the whole project?

When I put the file name as Href in the link tag, I get a 404 error and I have to put the folder name in the URL too.
for example I want this: href="/Article"
not this: href="/Article/Article"


问:
Is there a way to plot multilines instead of dots in python on a 3D plotly plot?
I'm trying to plot thicknesses with the variables x, y, z_base and z_top and z_single. Essentially I have two data types, thicknesses (z_base and z_top) and spot heights (no bounding surfaces, but this is most of my data). I want to plot these on the same graph with a combination of points and lines.

I can currently plot only one z variable at a time; is there a way to plot all my z variables at the same time (many Z to one XY without creating new rows?)

Also is there a way to plot multilines instead of two dots wherever there is a thickness?

This is what I started with:

```<code>fig = px.scatter_3d(data, x='x', y='y', z='z_single',
color='Type')
fig.show()
</code>```

I tried doing this with the hope that I could assign multiple columns to z, but it didn't work:

```<code>fig = px.scatter_3d(data, x='x', y='y', z='z_base', z='z_top',
color='Type')
fig.show()
</code>```

I have no idea how to approach multilines though!

Body:
I'm trying to plot thicknesses with the variables x, y, z_base and z_top and z_single. Essentially I have two data types, thicknesses (z_base and z_top) and spot heights (no bounding surfaces, but this is most of my data). I want to plot these on the same graph with a combination of points and lines.

I can currently plot only one z variable at a time; is there a way to plot all my z variables at the same time (many Z to one XY without creating new rows?)

Also is there a way to plot multilines instead of two dots wherever there is a thickness?

This is what I started with:

fig = px.scatter_3d(data, x='x', y='y', z='z_single',
color='Type')
fig.show()

I tried doing this with the hope that I could assign multiple columns to z, but it didn't work:

fig = px.scatter_3d(data, x='x', y='y', z='z_base', z='z_top',
color='Type')
fig.show()

I have no idea how to approach multilines though!


问:
hi, I am using Django Framework and I want to limit the Questions but I want to give the limit from frontend and also to make Questions random
I am using Django Framework and I want to limit the Questions but I want to give the limit number from frontend I am using flutter as frontend so how can I do it,

I did something but it is not working for me so how can I do it can someone help me, please

when I want to test the URL in postman the limitation is not working, I want this limit for filtering the questions in frontend and I also I want to make questions to random and I do not know how to do it I thing I have to Make it with random

here is my code:
views.py

```<code>class QuizQuetionsList(generics.ListAPIView):
serializer_class=QuizQuetionsSerializer

def get_queryset(self):
    quiz_id=self.kwargs['quiz_id']

    quiz=models.Quiz.objects.get(pk=quiz_id)
    if 'limit' in self.request.GET:
        limit=int(self.request.GET['limit'])
        return models.QuizQuetions.objects.filter(quiz=quiz).order_by('id')[:limit]
    else:
        return models.QuizQuetions.objects.filter(quiz=quiz)
</code>```

urls.py
path('chapter-
quetions/int:quizChapter_id/int:limit/',views.QuizChapterQuetionsList.as_view()),

to get solution to my problem

Body:
I am using Django Framework and I want to limit the Questions but I want to give the limit number from frontend I am using flutter as frontend so how can I do it,

I did something but it is not working for me so how can I do it can someone help me, please

when I want to test the URL in postman the limitation is not working, I want this limit for filtering the questions in frontend and I also I want to make questions to random and I do not know how to do it I thing I have to Make it with random

here is my code:
views.py

class QuizQuetionsList(generics.ListAPIView):
serializer_class=QuizQuetionsSerializer

def get_queryset(self):
    quiz_id=self.kwargs['quiz_id']

    quiz=models.Quiz.objects.get(pk=quiz_id)
    if 'limit' in self.request.GET:
        limit=int(self.request.GET['limit'])
        return models.QuizQuetions.objects.filter(quiz=quiz).order_by('id')[:limit]
    else:
        return models.QuizQuetions.objects.filter(quiz=quiz)

urls.py
path('chapter-
quetions/int:quizChapter_id/int:limit/',views.QuizChapterQuetionsList.as_view()),

to get solution to my problem


问:
Include Subtotal Column Name On Each Of the Subtotal Rows in BI-Publisher using guided format
I have a simple data where I am making a matrix table and include subtotals for Acct, Div Bu and Dept as shown in the below sample.

I am using the guided format to make the report. I want to include each of the Acct, Div Bu and Dept Name for the Subtotal Rows.

The subtotal rows should contain Total for 2320-100, Total for 5040, Total for 0000 instead of Total for Dept, Total for Div Bu and Total for Acct.


问:
Brother bluetooth thermal Printer(RJ 3035 B) showing Red blinking light(error) after 1 print while printing a customPdf. Using type B Brother iOS SDK
I am developing a simple game using Swift ,UIKIt.

I am priting the end result of every game on a receipt that i make programatically.

I am using the Brother Bluetooth Thermal printer - RJ 3035B.

The printer succesfully prints one receipt and after printing it stops printing and the red (error) light keeps blinking.

I am trying different page sizes or change in pdf size but it is not helping.

Here is my code which i took from Brothers Swift sample:-

```<code>func printFinalPDF() {

        if(pdf_document == nil)
        {
            let alert = UIAlertController.init(title: "Alert", message: "Please select PDF file", preferredStyle: UIAlertController.Style.alert)
            let yesButton = UIAlertAction.init(title: "OK", style: UIAlertAction.Style.default, handler: {(alert: UIAlertAction!) in })

            alert.addAction(yesButton)
            self.present(alert, animated: true, completion: nil)
            return
        }

        let IsOpen = lib.openportMFI("com.issc.datapath")
        if(IsOpen == 1)
        {
            self.parseIndex()
            self.cmd()
            lib.closeport(5)
            print("")

            NSLog("%@",String.localizedStringWithFormat("%@", lib.printerstatus()! as CVarArg))
            let data = lib.printerstatus()
            print(data?.hexDescription)

        }

    }

    func parseIndex(){
        let _num = NSCharacterSet.decimalDigits;
        let _input = NSCharacterSet.init(charactersIn: PDF_PAGE)

        if(PDF_PAGE.count != 0)
        {
            if(_num.isSuperset(of: _input as CharacterSet))
            {
                PDF_PAGE_INT = Int(PDF_PAGE)!;
            }
            else
            {
                PDF_PAGE = "0";
                PDF_PAGE_INT = 0;
            }
        }
        else
        {
            PDF_PAGE = "0";
            PDF_PAGE_INT = 0;

        }
    }

    func cmd(){
        lib.setup("100", height: "140", speed: "14", density: "10", sensor: "1", vertical: "1", offset: "0")
        lib.sendcommand("SIZE 100 mm, 90 mm\r\n");
        if(PDF_PAGE_INT == 0){
            lib.printPDFbyFile(pdf_document, x: 0, y: 0, printer_dpi: 100)
        }
        else
        {
            lib.printPDFbyFile(pdf_document, x:0, y:0, printer_dpi:100, page_index:Int32(PDF_PAGE_INT))
        }
//        printWithWifi()
    }
</code>```

Body:
I am developing a simple game using Swift ,UIKIt.

I am priting the end result of every game on a receipt that i make programatically.

I am using the Brother Bluetooth Thermal printer - RJ 3035B.

The printer succesfully prints one receipt and after printing it stops printing and the red (error) light keeps blinking.

I am trying different page sizes or change in pdf size but it is not helping.

Here is my code which i took from Brothers Swift sample:-

func printFinalPDF() {

        if(pdf_document == nil)
        {
            let alert = UIAlertController.init(title: "Alert", message: "Please select PDF file", preferredStyle: UIAlertController.Style.alert)
            let yesButton = UIAlertAction.init(title: "OK", style: UIAlertAction.Style.default, handler: {(alert: UIAlertAction!) in })

            alert.addAction(yesButton)
            self.present(alert, animated: true, completion: nil)
            return
        }

        let IsOpen = lib.openportMFI("com.issc.datapath")
        if(IsOpen == 1)
        {
            self.parseIndex()
            self.cmd()
            lib.closeport(5)
            print("")

            NSLog("%@",String.localizedStringWithFormat("%@", lib.printerstatus()! as CVarArg))
            let data = lib.printerstatus()
            print(data?.hexDescription)

        }

    }

    func parseIndex(){
        let _num = NSCharacterSet.decimalDigits;
        let _input = NSCharacterSet.init(charactersIn: PDF_PAGE)

        if(PDF_PAGE.count != 0)
        {
            if(_num.isSuperset(of: _input as CharacterSet))
            {
                PDF_PAGE_INT = Int(PDF_PAGE)!;
            }
            else
            {
                PDF_PAGE = "0";
                PDF_PAGE_INT = 0;
            }
        }
        else
        {
            PDF_PAGE = "0";
            PDF_PAGE_INT = 0;

        }
    }

    func cmd(){
        lib.setup("100", height: "140", speed: "14", density: "10", sensor: "1", vertical: "1", offset: "0")
        lib.sendcommand("SIZE 100 mm, 90 mm\r\n");
        if(PDF_PAGE_INT == 0){
            lib.printPDFbyFile(pdf_document, x: 0, y: 0, printer_dpi: 100)
        }
        else
        {
            lib.printPDFbyFile(pdf_document, x:0, y:0, printer_dpi:100, page_index:Int32(PDF_PAGE_INT))
        }
//        printWithWifi()
    }


问:
Swift Charts: Prevent horizontal bar marks from overlapping Y axis label
Pretty basic code for a horizontal bar chart using Apple's Swift Charts:

```<code>private var testData: [(String, Int)] = []

init() {
    for i in (0 ..< 10).reversed() {
        testData.append(
            ("Item\(i)", i + 3)
        )
    }
}

var body: some View {
    Chart(testData, id: \.0) { item in
        BarMark(
            x: .value("x", item.1),
            y: .value("y", item.0)
        )
        .foregroundStyle(Color.red)
        .annotation(
            position: .overlay,
            alignment: .trailing
        ) {
            Text("\(item.1)")
                .foregroundColor(.white)
                .fontWeight(.bold)
                .padding(.trailing)
        }
    }
    .chartXAxis(.hidden)
    .chartYAxis {
        AxisMarks(
            position: .trailing
        ) { value in
            AxisValueLabel(centered: true) {
                if let stringValue = value.as(String.self) {
                    Text(stringValue)
                        .font(.title2)
                }
            }
        }
    }
}
</code>```

With this result but I can't seem to prevent the chart from overlapping the Y axis label:

Even if I align the label with position: .leading it's still hidden under the chart. Any help would be appreciated.

Body:
Pretty basic code for a horizontal bar chart using Apple's Swift Charts:

private var testData: [(String, Int)] = []

init() {
    for i in (0 ..< 10).reversed() {
        testData.append(
            ("Item\(i)", i + 3)
        )
    }
}

var body: some View {
    Chart(testData, id: \.0) { item in
        BarMark(
            x: .value("x", item.1),
            y: .value("y", item.0)
        )
        .foregroundStyle(Color.red)
        .annotation(
            position: .overlay,
            alignment: .trailing
        ) {
            Text("\(item.1)")
                .foregroundColor(.white)
                .fontWeight(.bold)
                .padding(.trailing)
        }
    }
    .chartXAxis(.hidden)
    .chartYAxis {
        AxisMarks(
            position: .trailing
        ) { value in
            AxisValueLabel(centered: true) {
                if let stringValue = value.as(String.self) {
                    Text(stringValue)
                        .font(.title2)
                }
            }
        }
    }
}

With this result but I can't seem to prevent the chart from overlapping the Y axis label:

Even if I align the label with position: .leading it's still hidden under the chart. Any help would be appreciated.


问:
Limit precision on JSONEncoder's Double output
I'm working on a document-based SwiftUI application, and my file contents includes large arrays of doubles. The application involves importing some data from CSV, and then the file saves this data in a data structure.

However, when looking at the file sizes, the custom document type I declare in my application is 2-3 times larger than the CSV file. The other bits of metadata could not possibly be that large.

Here's the JSON output that is saved to file:

Here's the CSV file that was imported:

On looking at the raw text of the JSON output and comparing it with the original CSV, it became obvious that the file format I declare was using a lot of unnecessary precision. How do I make Swift's JSONEncoder only use, for example, 4 decimal places of precision?