问:
Why is poetry not updating git+ssh dependency from private repo versioned using git tag?
I have two python projects, lib and app, managed through poetry. Lib is on github in a private repo and the version in its pyproject.toml is 0.2.0. This is tagged in github with git tag v0.2.0.

Access to the gh private repo is enabled by adding my ssh public key to my gh account using these instructions. Lib is then made a dependency of app using

```<code>poetry add git+ssh://git@github.com:org/lib.git#v0.2.0
</code>```

in the app folder and this creates the dependency in pyproject.toml of app with the line

```<code>lib = {git = "git@github.com:org/lib.git", rev = "v0.2.0"}
</code>```

So far, so good.

Now I make a change to lib and the version increases to 0.2.1 in pyproject.toml. The code is pushed to gh and tagged with git tag v0.2.1. I try to update the dependecy in app using

```<code>poetry update lib
</code>```

in the app folder but it doesn't work. Neither does poetry lock.

As a worksaround, if I issue the command

```<code>poetry add git+ssh://git@github.com:org/lib.git#v0.2.1
</code>```

then it updates without issue, however I would like poetry to check for updates with just

```<code>poetry update
</code>```

or

```<code>poetry update lib
</code>```

I have seen that this is possible for public repos (using https) and also (I think, but could be mistaken) where the git+ssh url is pinned to a branch, say #latest. However I cannot get it to work with a tagged version.

How to do this?

Body:
I have two python projects, lib and app, managed through poetry. Lib is on github in a private repo and the version in its pyproject.toml is 0.2.0. This is tagged in github with git tag v0.2.0.

Access to the gh private repo is enabled by adding my ssh public key to my gh account using these instructions. Lib is then made a dependency of app using

poetry add git+ssh://git@github.com:org/lib.git#v0.2.0

in the app folder and this creates the dependency in pyproject.toml of app with the line

lib = {git = "git@github.com:org/lib.git", rev = "v0.2.0"}

So far, so good.

Now I make a change to lib and the version increases to 0.2.1 in pyproject.toml. The code is pushed to gh and tagged with git tag v0.2.1. I try to update the dependecy in app using

poetry update lib

in the app folder but it doesn't work. Neither does poetry lock.

As a worksaround, if I issue the command

poetry add git+ssh://git@github.com:org/lib.git#v0.2.1

then it updates without issue, however I would like poetry to check for updates with just

poetry update

or

poetry update lib

I have seen that this is possible for public repos (using https) and also (I think, but could be mistaken) where the git+ssh url is pinned to a branch, say #latest. However I cannot get it to work with a tagged version.

How to do this?


来源: stackexchange

问:
htaccess root point to subdirectory without showing folder path
I've tried all sorts of ways. I am having trouble redirecting the root .htaccess file to a subdirectory/public file.
Currently, the root redirects to the folder but the path of file shows up in the url.

For example:
website.com/flarum/public should be website.com

```<code>...
public_html
-- .htaccess // below
-- flarum
---- public
------.htaccess //default flarum's htaccess
</code>```

.htaccess

```<code>RewriteEngine On

RewriteRule ^$ /flarum/public/ [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/flarum/public/
RewriteRule ^(.*)$ /flarum/public/$1
</code>```

right now it is showing, website.com/flarum/public where it should be website.com

ContentLicense: CC BY-SA 4.0

Body:
I've tried all sorts of ways. I am having trouble redirecting the root .htaccess file to a subdirectory/public file.
Currently, the root redirects to the folder but the path of file shows up in the url.

For example:
website.com/flarum/public should be website.com

...
public_html
-- .htaccess // below
-- flarum
---- public
------.htaccess //default flarum's htaccess

.htaccess

RewriteEngine On

RewriteRule ^$ /flarum/public/ [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/flarum/public/
RewriteRule ^(.*)$ /flarum/public/$1

right now it is showing, website.com/flarum/public where it should be website.com


问:
How can I add a claim to a Device identity token in IdentityServer4?
I am using IdentityServer4 to authorize a device using Device Flow.  When the device is authorized I need to add a claim that is returned with the Device's token. The data for that claim is acquired during the consent. The claim is not associated with the user that performed the authorization grants, it is associated with the UserCode from the device.

It appears that the DeviceCode table used in EF Storage has a data column that would help store that claim.  However the JSON data is fixed to only include IdentityServer4.Models.DeviceCode.  Even if I extend that POCO to include the extra data point I still need to get the data into the identity_token's claims.

Am I heading down the wrong path?  I would wind up with implementations of IDeviceFlowCodeService and IDeviceFlowInteractionService and IDeviceFlowStore.  Dont I also need the token\connect override as well to add the claim?

Device Flow Interaction Service
rfc8628


问:
How to upgrade peer dependency used by other dependency when there's a circular dependency?
Suppose we have these internal/private NPM packages:

config

student-ui -- package includes some UI components related to students

course-ui -- package includes some UI components related to courses / classes

student-ui / package.json

{
    "dependencies": {
        "course-ui": "^1.0.0"
    },
    "peerDependencies": {
        "config": "^1.0.0"
    }
}
```
<h2>course-ui / package.json</h2>
<pre class="lang-json prettyprint-override"><code>{
    "dependencies": {
        "student-ui": "^1.0.0"
    },
    "peerDependencies": {
        "config": "^1.0.0"
    }
}
</code>```

So the dependency tree looks like this:

```<code>                                    student-ui <--> course-ui
                                        |                |
                                        |-->  config  <--|
</code>```

"Why does course-ui need a reference to student-ui?"

Suppose that when you view a course you can also view a list of students, so you need to use the StudentApi to make some API call, then display the list in a StudentList component -- all things owned by student-ui.

Supposed we do a major upgrade to config so now it's at 2.0.0. When we go to install the new version in student-ui, we can't because the peer dependency for course-ui requires version 1.x.

So, we need to update course-ui first -- but the same issue occurs, since it references student-ui.

We can fix this by adding overrides to student-ui / package.json just so we can build the package, so now the JSON looks like:

{
    "dependencies": {
        "course-ui": "^1.0.0"
    },
    "peerDependencies": {
        "config": "^1.0.0"
    },
    "overrides": {
        "course-ui": {
            "config": "@config"
        }
    }
}
```

This should allow student-ui to publish a new package, and then we can update config and student-ui within course-ui, and remove the overrides.

But, there's got to be a better way, right?

Body:
Suppose we have these internal/private NPM packages:

config

student-ui -- package includes some UI components related to students

course-ui -- package includes some UI components related to courses / classes

student-ui / package.json

{
    "dependencies": {
        "course-ui": "^1.0.0"
    },
    "peerDependencies": {
        "config": "^1.0.0"
    }
}

course-ui / package.json

{
    "dependencies": {
        "student-ui": "^1.0.0"
    },
    "peerDependencies": {
        "config": "^1.0.0"
    }
}

So the dependency tree looks like this:

                                    student-ui <--> course-ui
                                        |                |
                                        |-->  config  <--|

"Why does course-ui need a reference to student-ui?"

Suppose that when you view a course you can also view a list of students, so you need to use the StudentApi to make some API call, then display the list in a StudentList component -- all things owned by student-ui.

Supposed we do a major upgrade to config so now it's at 2.0.0. When we go to install the new version in student-ui, we can't because the peer dependency for course-ui requires version 1.x.

So, we need to update course-ui first -- but the same issue occurs, since it references student-ui.

We can fix this by adding overrides to student-ui / package.json just so we can build the package, so now the JSON looks like:

{
    "dependencies": {
        "course-ui": "^1.0.0"
    },
    "peerDependencies": {
        "config": "^1.0.0"
    },
    "overrides": {
        "course-ui": {
            "config": "@config"
        }
    }
}

This should allow student-ui to publish a new package, and then we can update config and student-ui within course-ui, and remove the overrides.

But, there's got to be a better way, right?


问:
"python setup.py bdist_wheel did not run successfully" Installing pandana
The problem:

```<code>Building wheels for collected packages: pandana, tables
  Building wheel for pandana (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\pandana
      copying pandana\network.py -> build\lib.win-amd64-cpython-311\pandana
      copying pandana\testing.py -> build\lib.win-amd64-cpython-311\pandana
      copying pandana\utils.py -> build\lib.win-amd64-cpython-311\pandana
      copying pandana\__init__.py -> build\lib.win-amd64-cpython-311\pandana
      creating build\lib.win-amd64-cpython-311\pandana\loaders
      copying pandana\loaders\osm.py -> build\lib.win-amd64-cpython-311\pandana\loaders
      copying pandana\loaders\pandash5.py -> build\lib.win-amd64-cpython-311\pandana\loaders
      copying pandana\loaders\__init__.py -> build\lib.win-amd64-cpython-311\pandana\loaders
      running build_ext
      skipping 'src\cyaccess.cpp' Cython extension (up-to-date)
      building 'pandana.cyaccess' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      creating build\temp.win-amd64-cpython-311\Release\src\contraction_hierarchies
      creating build\temp.win-amd64-cpython-311\Release\src\contraction_hierarchies\src
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I. "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc/accessibility.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src/accessibility.obj /w /openmp
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      accessibility.cpp
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\utility(200): warning C4244: 'inicializando': conversi¢n de '_Ty' a '_Ty2'; posible p‚rdida de datos
              with
              [
                  _Ty=float
              ]
              and
              [
                  _Ty2=int
              ]
      src/accessibility.cpp(193): note: Vea la referencia a la creaci¢n de una instancia de la funci¢n plantilla "std::pair<double,int>::pair<double,float,0>(std::pair<double,float> &&) noexcept" que se est  compilando
      src/accessibility.cpp(192): note: Vea la referencia a la creaci¢n de una instancia de la funci¢n plantilla "std::pair<double,int>::pair<double,float,0>(std::pair<double,float> &&) noexcept" que se est  compilando
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I. "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc/contraction_hierarchies/src/libch.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src/contraction_hierarchies/src/libch.obj /w /openmp
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      libch.cpp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I. "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc/graphalg.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src/graphalg.obj /w /openmp
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      graphalg.cpp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I. "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\cyaccess.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src\cyaccess.obj /w /openmp
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      cyaccess.cpp
      src\cyaccess.cpp(196): fatal error C1083: No se puede abrir el archivo incluir: 'longintrepr.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]
</code>```

What I have already tried:

pip install pandana

pip install --upgrade pip setuptools wheel

My system:

Windows 11, 64 Bit

Python 3.11.1

Microsoft Visual Studio Build Tools 2022 (17.4.3)

I would like to find the way to install "pandana".

Body:
The problem:

Building wheels for collected packages: pandana, tables
  Building wheel for pandana (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\pandana
      copying pandana\network.py -> build\lib.win-amd64-cpython-311\pandana
      copying pandana\testing.py -> build\lib.win-amd64-cpython-311\pandana
      copying pandana\utils.py -> build\lib.win-amd64-cpython-311\pandana
      copying pandana\__init__.py -> build\lib.win-amd64-cpython-311\pandana
      creating build\lib.win-amd64-cpython-311\pandana\loaders
      copying pandana\loaders\osm.py -> build\lib.win-amd64-cpython-311\pandana\loaders
      copying pandana\loaders\pandash5.py -> build\lib.win-amd64-cpython-311\pandana\loaders
      copying pandana\loaders\__init__.py -> build\lib.win-amd64-cpython-311\pandana\loaders
      running build_ext
      skipping 'src\cyaccess.cpp' Cython extension (up-to-date)
      building 'pandana.cyaccess' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      creating build\temp.win-amd64-cpython-311\Release\src\contraction_hierarchies
      creating build\temp.win-amd64-cpython-311\Release\src\contraction_hierarchies\src
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I. "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc/accessibility.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src/accessibility.obj /w /openmp
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      accessibility.cpp
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\utility(200): warning C4244: 'inicializando': conversi¢n de '_Ty' a '_Ty2'; posible p‚rdida de datos
              with
              [
                  _Ty=float
              ]
              and
              [
                  _Ty2=int
              ]
      src/accessibility.cpp(193): note: Vea la referencia a la creaci¢n de una instancia de la funci¢n plantilla "std::pair<double,int>::pair<double,float,0>(std::pair<double,float> &&) noexcept" que se est  compilando
      src/accessibility.cpp(192): note: Vea la referencia a la creaci¢n de una instancia de la funci¢n plantilla "std::pair<double,int>::pair<double,float,0>(std::pair<double,float> &&) noexcept" que se est  compilando
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I. "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc/contraction_hierarchies/src/libch.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src/contraction_hierarchies/src/libch.obj /w /openmp
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      libch.cpp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I. "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc/graphalg.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src/graphalg.obj /w /openmp
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      graphalg.cpp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I. "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Include" "-IC:\Users\Diego DM\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\cyaccess.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src\cyaccess.obj /w /openmp
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      cyaccess.cpp
      src\cyaccess.cpp(196): fatal error C1083: No se puede abrir el archivo incluir: 'longintrepr.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

What I have already tried:

pip install pandana

pip install --upgrade pip setuptools wheel

My system:

Windows 11, 64 Bit

Python 3.11.1

Microsoft Visual Studio Build Tools 2022 (17.4.3)

I would like to find the way to install "pandana".


问:
UWP ListView - How to update BringIntoView to show part of next item, in both directions
I am working on a listview of items and I need to allow user to scroll up/down but I need the bring into view handling to bring the item into view as well as a small part of the next item (in scrollviewer extent).  This will indicate to user that there is an item above or below in the list.

I have made a simplified sandbox app to work on this and here are screenshots of what I am trying to do. Arrow indicates scroll direction and the red parens indicate the part I cannot get to show up, meaning the partial amount of the next item.

Please ask if you need anything clarified, I understand this is a complex explanation.

What I have tried:

margin (+/-) on ItemsPresenter/ScrollViewer/ListView

handling ListView.SelectionChanged and using math and various logic to determine direction of scroll and then use ScrollViewer.ChangeView call with calculated vertical offset value.

handling ListView.BringIntoViewRequested and set args.Handled = true and issue new request with various BringIntoViewOptions values, including VerticalOffset, VerticalAlignmentRatio, and new TargetRect with adjusted Y value.

I have read several helpful existing questions here on SO that led me to the BringIntoViewOptions attempt. But nothing so far has worked.

None of these have worked. If I could describe what I want it would be to utilize the existing BringIntoView functionality but bring the item far enough into view that the next item shows a little.


问:
Why does spotipy don't come to an end when using the search function?
I recently started using the Spotify API spotipy in python (with Spyder 4.1.4 IDE and Anaconda) to get the song IDs from Spotify given a song name and artist. Therefore I use the search function defined in the API as follows:

```<code>import api_config
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id=api_config.APP_CLIENT_ID, client_secret=api_config.APP_CLIENT_SECRET))

query = "foo"
res = sp.search(q=query, limit=1)
</code>```

When executing this script, it should send a GET-request to Spotify as if i type the query in the search bar but unfortunately it is somehow stuck in a loop so it doesn't come to an end and gives me the result from the search. Furthermore when I try to cancel the execution the script seems to run on and I'm not able to execute the same or another script unless restarting the kernel. There is also no error message telling me what could cause the problem.

I already tried to limit my problem to a single word instead of the whole song title and artist to avoid issues with the query string being wrong.
To make sure there's no error with the network connection, spotipy module installation or Spotify authentication I tried different other spotipy commands and they all worked great except the search function.

Body:
I recently started using the Spotify API spotipy in python (with Spyder 4.1.4 IDE and Anaconda) to get the song IDs from Spotify given a song name and artist. Therefore I use the search function defined in the API as follows:

import api_config
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id=api_config.APP_CLIENT_ID, client_secret=api_config.APP_CLIENT_SECRET))

query = "foo"
res = sp.search(q=query, limit=1)

When executing this script, it should send a GET-request to Spotify as if i type the query in the search bar but unfortunately it is somehow stuck in a loop so it doesn't come to an end and gives me the result from the search. Furthermore when I try to cancel the execution the script seems to run on and I'm not able to execute the same or another script unless restarting the kernel. There is also no error message telling me what could cause the problem.

I already tried to limit my problem to a single word instead of the whole song title and artist to avoid issues with the query string being wrong.
To make sure there's no error with the network connection, spotipy module installation or Spotify authentication I tried different other spotipy commands and they all worked great except the search function.


问:
Fetch only first specific bytes of an image URL to create a placeholder (browser)
I want to fetch only 1300 bytes of an image from a URL to create a placeholder before the image is completely loaded. I tried using XMLHttpRequest and progress event (for a 2.12KB image)

 req.addEventListener("progress", (ev) => {
        console.log("loaded bytes", ev.loaded); // 2179
    })
```
<p>but the first time the event triggers <code>ev.loaded</code> is 2179 so the whole file has got already downloaded (I don't want it!). That being said, when I tried Python <code>requests</code> with stream mode and declaring <code>chunk_size</code>, that 1300 bytes were successfully written into the file without any problem:</p>
<pre class="lang-py prettyprint-override"><code>with requests.get(url , stream=True) as response:
    for chunk in response.iter_content(chunk_size=1300):
        print(len(chunk)) # 1300
        with open("test.jpg" , "wb") as f:
            f.write(chunk)
            break
</code>```

Assuming the server does not accept the Range header, is there a way to do so with any API in the browser?

Body:
I want to fetch only 1300 bytes of an image from a URL to create a placeholder before the image is completely loaded. I tried using XMLHttpRequest and progress event (for a 2.12KB image)

 req.addEventListener("progress", (ev) => {
        console.log("loaded bytes", ev.loaded); // 2179
    })

but the first time the event triggers ev.loaded is 2179 so the whole file has got already downloaded (I don't want it!). That being said, when I tried Python requests with stream mode and declaring chunk_size, that 1300 bytes were successfully written into the file without any problem:

with requests.get(url , stream=True) as response:
    for chunk in response.iter_content(chunk_size=1300):
        print(len(chunk)) # 1300
        with open("test.jpg" , "wb") as f:
            f.write(chunk)
            break

Assuming the server does not accept the Range header, is there a way to do so with any API in the browser?


问:
TIFF files not displaying in gallery
I uploaded some TIFF files to my wiki and tried to display them with gallery:

```<code><gallery>
file1.tif
file2.tif
</gallery>
</code>```

But, the thumbnails don't display.  All I see is this:

I tried installing the PagedTiffHandler extension but it made no difference.  I tried uploading with tiff extension instead of just tif and no difference.

Why won't gallery display the TIFF images?

UPDATE:  I fumbled around and found that I could add $wgTiffThumbnailType = array( 'png', 'image/png' ); to LocalSettings.php and it would display thumbnail as png.

This works as long as the TIFF resolution is less than 12.5 MP.

Title: TIFF files not displaying in gallery

Body:
I uploaded some TIFF files to my wiki and tried to display them with gallery:

<gallery>
file1.tif
file2.tif
</gallery>

But, the thumbnails don't display.  All I see is this:

I tried installing the PagedTiffHandler extension but it made no difference.  I tried uploading with tiff extension instead of just tif and no difference.

Why won't gallery display the TIFF images?

UPDATE:  I fumbled around and found that I could add $wgTiffThumbnailType = array( 'png', 'image/png' ); to LocalSettings.php and it would display thumbnail as png.

This works as long as the TIFF resolution is less than 12.5 MP.


问:
C# TCP add Client thread-safe List<T>
In the below code I am adding new clients to the clientList:

```<code>public partial class Form1 : Form
    {
        TcpListener tcpListener = new TcpListener(System.Net.IPAddress.Any, 6666);
        private int appStatus = 0;
        TcpClient client;
        TcpClient streamData;
        List<TcpClient> clientList = new List<TcpClient>();
        NetworkStream networkStream;
        Thread th_StartListen, th_inPutStream, th_outPutStream, th_checkConnection;
        StringBuilder strOutput;

        public Form1()
        {
            InitializeComponent();
            customizeDesign();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            th_StartListen = new Thread(new ThreadStart(StartListen));
            th_StartListen.Start();
            txtCmdOutput.Focus();
        }

        private void StartListen()
        {
            //Creating a TCP Connection and listening to the port
            tcpListener = new TcpListener(System.Net.IPAddress.Any, 6666);
            tcpListener.Start();
            toolStripStatusLabel1.Text = "Listening on port 6666 ...";
            int counter = 0;
            appStatus = 0;

            while (true)
            {
                try
                {
                    client = tcpListener.AcceptTcpClient();
                    counter++;
                    clientList.Add(client);

                    clientList.AsParallel().ForAll(item => clientList.Add(client));

                    Parallel.ForEach(clientList, item =>
                    {
                        lock (clientList)
                            clientList.Add(client);
                    });

                    IPEndPoint ipend = (IPEndPoint)client.Client.RemoteEndPoint;
                    //Updating status of connection
                    toolStripStatusLabel1.Text = "Connected from " + IPAddress.Parse(ipend.Address.ToString());
                    appStatus = 1;

                    th_outPutStream = new Thread(delegate () { outPutStream(client); });
                    th_outPutStream.Start();
                    th_inPutStream = new Thread(delegate () { inPutStream(client); });
                    th_inPutStream.Start();
                    th_checkConnection = new Thread(checkConnection);
                    th_checkConnection.Start();
                }
                catch (Exception err)
                {
                    {
                        Cleanup();
                    }
                }
            }
        }
</code>```

I was advised that using a non-thread-safe List<T> to keep a list of clients is not a good solution.

So I was wondering how I could apply a thread-safe List<T> as to add the clients without encountering any errors.

So I attempted to do the following:

clientList.AsParallel().ForAll(item => clientList.Add(client));
```
<p>Could anyone suggest a correct methodology?</p>
<p>Is the above code thread-safe? Is there a chance of the processed list getting could get corrupted? Or should I use a lock before adding?</p>
```Parallel.ForEach(clientList, item =>
                    {
                        lock (clientList)
                            clientList.Add(client);
                    });
```

Title: C# TCP add Client thread-safe List<T>

Body:
In the below code I am adding new clients to the clientList:

public partial class Form1 : Form
    {
        TcpListener tcpListener = new TcpListener(System.Net.IPAddress.Any, 6666);
        private int appStatus = 0;
        TcpClient client;
        TcpClient streamData;
        List<TcpClient> clientList = new List<TcpClient>();
        NetworkStream networkStream;
        Thread th_StartListen, th_inPutStream, th_outPutStream, th_checkConnection;
        StringBuilder strOutput;

        public Form1()
        {
            InitializeComponent();
            customizeDesign();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            th_StartListen = new Thread(new ThreadStart(StartListen));
            th_StartListen.Start();
            txtCmdOutput.Focus();
        }

        private void StartListen()
        {
            //Creating a TCP Connection and listening to the port
            tcpListener = new TcpListener(System.Net.IPAddress.Any, 6666);
            tcpListener.Start();
            toolStripStatusLabel1.Text = "Listening on port 6666 ...";
            int counter = 0;
            appStatus = 0;

            while (true)
            {
                try
                {
                    client = tcpListener.AcceptTcpClient();
                    counter++;
                    clientList.Add(client);

                    clientList.AsParallel().ForAll(item => clientList.Add(client));

                    Parallel.ForEach(clientList, item =>
                    {
                        lock (clientList)
                            clientList.Add(client);
                    });

                    IPEndPoint ipend = (IPEndPoint)client.Client.RemoteEndPoint;
                    //Updating status of connection
                    toolStripStatusLabel1.Text = "Connected from " + IPAddress.Parse(ipend.Address.ToString());
                    appStatus = 1;

                    th_outPutStream = new Thread(delegate () { outPutStream(client); });
                    th_outPutStream.Start();
                    th_inPutStream = new Thread(delegate () { inPutStream(client); });
                    th_inPutStream.Start();
                    th_checkConnection = new Thread(checkConnection);
                    th_checkConnection.Start();
                }
                catch (Exception err)
                {
                    {
                        Cleanup();
                    }
                }
            }
        }

I was advised that using a non-thread-safe List<T> to keep a list of clients is not a good solution.

So I was wondering how I could apply a thread-safe List<T> as to add the clients without encountering any errors.

So I attempted to do the following:

clientList.AsParallel().ForAll(item => clientList.Add(client));

Could anyone suggest a correct methodology?

Is the above code thread-safe? Is there a chance of the processed list getting could get corrupted? Or should I use a lock before adding?

Parallel.ForEach(clientList, item =>
                    {
                        lock (clientList)
                            clientList.Add(client);
                    });


问:
GraphQL extract possible queries from a schema
I have a graphql schema that i'm parsing

```<code>type User {
  id: ID!
  name: String!
  email: String!
  age: Int
  posts: [Post!]!
}

type Post {
  id: ID!
  title: String!
  body: String!
  author: User!
  comments: [Comment!]!
}

type Comment {
  id: ID!
  body: String!
  author: User!
  post: Post!
}

type Query {
  users: [User!]!
  user(id: ID!): User
  posts: [Post!]!
  post(id: ID!): Post
  comments: [Comment!]!
  comment(id: ID!): Comment
}
</code>```

i want to get extract each possible query from it as a seperate string

in the above example,

String 1

```<code>type Query {
  users: [User!]!
}
</code>```

String 2

```<code>type Query {
  user(id: ID!): User
}
</code>```

String 3

```<code>type Query {
  posts: [Post!]!
}
</code>```

String 4

```<code>type Query {
  post(id: ID!): Post
}
</code>```

String 5

```<code>type Query {
  comments: [Comment!]!
}
</code>```

String 6

```<code>type Query {
  comment(id: ID!): Comment
}
</code>```

what is the best way to achieve this ? i'm using graphql javascript package

Body:
I have a graphql schema that i'm parsing

type User {
  id: ID!
  name: String!
  email: String!
  age: Int
  posts: [Post!]!
}

type Post {
  id: ID!
  title: String!
  body: String!
  author: User!
  comments: [Comment!]!
}

type Comment {
  id: ID!
  body: String!
  author: User!
  post: Post!
}

type Query {
  users: [User!]!
  user(id: ID!): User
  posts: [Post!]!
  post(id: ID!): Post
  comments: [Comment!]!
  comment(id: ID!): Comment
}

i want to get extract each possible query from it as a seperate string

in the above example,

String 1

type Query {
  users: [User!]!
}

String 2

type Query {
  user(id: ID!): User
}

String 3

type Query {
  posts: [Post!]!
}

String 4

type Query {
  post(id: ID!): Post
}

String 5

type Query {
  comments: [Comment!]!
}

String 6

type Query {
  comment(id: ID!): Comment
}

what is the best way to achieve this ? i'm using graphql javascript package


问:
Index Match & SumIfs formula giving error
I am getting a #Ref error while using sumif and index match formula for below tables.

All I am trying to do here is to sum total hours for a particular employee who worked on multiple projects for a specific period.

For below example for Shafil Buksh, it should return 26 hours but instead I get an error.

Can you please suggest the correction to this formula or if I should use completely different formula to get the result?

Thank you in advance!


问:
TypeError: can't multiply sequence by non-int of type 'float'. Attaching code below :
```<code># Model SED

df2=pd.read_csv('fm10t5750g05k2odfnew.dat', skiprows =1 , delim_whitespace = True )
df2.rename({'VTURB=2':'wavelength','TITLE':'1','[-1.0]':'2', 'L/H=1.25' :'freq', 'NOVER' :'Hnu', 'NEW':'6', 'ODF':'7'}, axis =1 , inplace = True )
df2.drop ([ '1'] , axis =1 , inplace = True )
print (df2.columns)

df2.drop ( df2.tail (1).index, inplace = True )
df2.drop ( df2.head (30).index , inplace = True )

wave = np.array(df2['wavelength']) # nm
flux_lamb_new= np.array(df2['Hnu'])
modfreq = np.array(df2['freq'])
wave_SI= np.array(wave)
modfluxSI = modfreq*flux_lamb_new*4*np.pi

TypeError                                 Traceback (most recent call last)
Input In [279], in <cell line: 15>()
 13 modfreq = np.array(df2['freq'])
 14 wave_SI= np.array(wave)
---> 15 modfluxSI = modfreq*flux_lamb_new*4*np.pi
</code>```

TypeError: can't multiply sequence by non-int of type 'float'

Since i'm new to python i am not sure how to proceed. if someone could help solve this i'd be grateful. Thanks!

Body:
# Model SED

df2=pd.read_csv('fm10t5750g05k2odfnew.dat', skiprows =1 , delim_whitespace = True )
df2.rename({'VTURB=2':'wavelength','TITLE':'1','[-1.0]':'2', 'L/H=1.25' :'freq', 'NOVER' :'Hnu', 'NEW':'6', 'ODF':'7'}, axis =1 , inplace = True )
df2.drop ([ '1'] , axis =1 , inplace = True )
print (df2.columns)

df2.drop ( df2.tail (1).index, inplace = True )
df2.drop ( df2.head (30).index , inplace = True )

wave = np.array(df2['wavelength']) # nm
flux_lamb_new= np.array(df2['Hnu'])
modfreq = np.array(df2['freq'])
wave_SI= np.array(wave)
modfluxSI = modfreq*flux_lamb_new*4*np.pi

TypeError                                 Traceback (most recent call last)
Input In [279], in <cell line: 15>()
 13 modfreq = np.array(df2['freq'])
 14 wave_SI= np.array(wave)
---> 15 modfluxSI = modfreq*flux_lamb_new*4*np.pi

TypeError: can't multiply sequence by non-int of type 'float'

Since i'm new to python i am not sure how to proceed. if someone could help solve this i'd be grateful. Thanks!


问:
How to configure logrotate config file with dateext format to have minutes and hours not only year month date
I am trying to configure the logrotate config file with dateext to have year/date/month/hour/minutes
As i know logrotate supports only -%Y-%m-%d-%s format.
I have problem right now if I am using only -%Y-%m-%d format, and have log which have to be rotated more than one time per day, will skip the rotation.

any suggestions?


问:
Having trouble in my first time trying to use switch case
I have 4 buttons that when clicked are supposed to display the current time (for check in, out, lunch in, out). I'm using a Fetch API to record these times and I'm trying to use a switch case so it'll diferentiate between activities and record the activity type. Althought it is not giving me an error message, it doesn't really do anything either.

Here's what I'm working with:

```<code>function handleClick(elementName) {

    var fieldName
    switch (elementName) { // #lblCheckin, #lblCheckout, ......
        case "#lbl-checkin":
            fieldName = 'checkInTime'
            break;

            case "#lbl-lunchout":
            fieldName = 'lunchOutTime'
            break;

            case "#lbl-lunchin":
            fieldName = 'lunchInTime'
            break;

            case "#lbl-checkout":
            fieldName = 'checkOutTime'
            break;

        default:
            throw new Error('Nao foi possivel armazenar o tipo de evento')
    }

    var label = document.querySelector(elementName)
    var now = new Date()
    var currentTime = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds()
    label.textContent = currentTime
    submitValues(fieldName, currentTime);
}

function submitValues(currentFieldName, currentTimeValue) {
    fetch('https://func-kxp-checkin-api-dev-01.azurewebsites.net/api/createCheckin', {
        method: 'POST',
        body: JSON.stringify({
            currentFieldName: currentTimeValue
        }),
        headers: {
          'Content-Type': 'application/json'
        }
      })
        .then(response => response.json())
        .then(data => console.log(data))
    }

</code>```

This is what the API displays:

```<code>[
  {
    "currentFieldName": "17:32:30",
    "date": "2023-01-04"
  },
  {
    "currentFieldName": "17:35:11",
    "date": "2023-01-04"
  },
  {
    "currentFieldName": "17:40:48",
    "date": "2023-01-04"
  },
  {
    "currentFieldName": "17:40:49",
    "date": "2023-01-04"
  },
  {
    "currentFieldName": "17:40:50",
    "date": "2023-01-04"
  }
]
</code>```

Any ideas on how to get it working properly?

One thing to note is that VSCode states that this highlighted part of the code is there but it's not being read:

function submitValues(**currentFieldName**

I'm trying to apply a switch case to my API but nothing happens.

Body:
I have 4 buttons that when clicked are supposed to display the current time (for check in, out, lunch in, out). I'm using a Fetch API to record these times and I'm trying to use a switch case so it'll diferentiate between activities and record the activity type. Althought it is not giving me an error message, it doesn't really do anything either.

Here's what I'm working with:

function handleClick(elementName) {

    var fieldName
    switch (elementName) { // #lblCheckin, #lblCheckout, ......
        case "#lbl-checkin":
            fieldName = 'checkInTime'
            break;

            case "#lbl-lunchout":
            fieldName = 'lunchOutTime'
            break;

            case "#lbl-lunchin":
            fieldName = 'lunchInTime'
            break;

            case "#lbl-checkout":
            fieldName = 'checkOutTime'
            break;

        default:
            throw new Error('Nao foi possivel armazenar o tipo de evento')
    }

    var label = document.querySelector(elementName)
    var now = new Date()
    var currentTime = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds()
    label.textContent = currentTime
    submitValues(fieldName, currentTime);
}

function submitValues(currentFieldName, currentTimeValue) {
    fetch('https://func-kxp-checkin-api-dev-01.azurewebsites.net/api/createCheckin', {
        method: 'POST',
        body: JSON.stringify({
            currentFieldName: currentTimeValue
        }),
        headers: {
          'Content-Type': 'application/json'
        }
      })
        .then(response => response.json())
        .then(data => console.log(data))
    }

This is what the API displays:

[
  {
    "currentFieldName": "17:32:30",
    "date": "2023-01-04"
  },
  {
    "currentFieldName": "17:35:11",
    "date": "2023-01-04"
  },
  {
    "currentFieldName": "17:40:48",
    "date": "2023-01-04"
  },
  {
    "currentFieldName": "17:40:49",
    "date": "2023-01-04"
  },
  {
    "currentFieldName": "17:40:50",
    "date": "2023-01-04"
  }
]

Any ideas on how to get it working properly?

One thing to note is that VSCode states that this highlighted part of the code is there but it's not being read:

function submitValues(**currentFieldName**

I'm trying to apply a switch case to my API but nothing happens.


问:
JSON to JSON Liquid template transformation
I am very new to this Azure Liquid templates. I'm parsing JSON to JSON using Dot Liquid.

I have "userDefinedFields" under "data" is an array of 4 fields i.e., Reason, Number, Bill and Key. In JSON, sometimes "userDefinedFields" may have 4 fields or 3 fields or 2 fields. I have to get all the 4 fields (Reason, Number, Bill and Key) from "userDefinedFields" and rest fields from "data" as an output of Liquid transformation:

```<code>    id
    newID
    userDefinedFields :
        if name=="Reason", get the value
        if name=="Number", get the value
        if name=="Bill", get the value
        if name=="Key", get the value
</code>```

I want Liquid template code to pick all the 4 fields together as one set (whether it has null value or proper value).

What can I try next?

Body:
I am very new to this Azure Liquid templates. I'm parsing JSON to JSON using Dot Liquid.

I have "userDefinedFields" under "data" is an array of 4 fields i.e., Reason, Number, Bill and Key. In JSON, sometimes "userDefinedFields" may have 4 fields or 3 fields or 2 fields. I have to get all the 4 fields (Reason, Number, Bill and Key) from "userDefinedFields" and rest fields from "data" as an output of Liquid transformation:

    id
    newID
    userDefinedFields :
        if name=="Reason", get the value
        if name=="Number", get the value
        if name=="Bill", get the value
        if name=="Key", get the value

I want Liquid template code to pick all the 4 fields together as one set (whether it has null value or proper value).

What can I try next?


问:
How do I trigger a multibranch pipeline job from another for a branch that hasn't yet been built?
My Jenkins configuration automatically runs multibranch pipeline "foo" for each branch that is submitted to github as a pull request.

For some of these branches, I would like to trigger a separate multibranch pipeline called "bar" depending on some github metadata. In principle, this is fairly simple:

```<code>pipeline {
    stages {
        stage("My stage") {
            script {
                if (ShouldTriggerBar()) {
                    build(job: "/bar/${env.BRANCH_NAME}", wait: false)
                }
            }

            ...
        }
    }
}
</code>```

And this does work if the current branch has previously been manually built on multibranch pipeline "bar".

However, if this is the first time that the current branch will be build on "bar", I get this error:

No item named /bar/my_branch found

How do I trigger a multibranch pipeline job for a branch that hasn't yet been built?

Body:
My Jenkins configuration automatically runs multibranch pipeline "foo" for each branch that is submitted to github as a pull request.

For some of these branches, I would like to trigger a separate multibranch pipeline called "bar" depending on some github metadata. In principle, this is fairly simple:

pipeline {
    stages {
        stage("My stage") {
            script {
                if (ShouldTriggerBar()) {
                    build(job: "/bar/${env.BRANCH_NAME}", wait: false)
                }
            }

            ...
        }
    }
}

And this does work if the current branch has previously been manually built on multibranch pipeline "bar".

However, if this is the first time that the current branch will be build on "bar", I get this error:

No item named /bar/my_branch found

How do I trigger a multibranch pipeline job for a branch that hasn't yet been built?


问:
VSCode Outline View for C++ Catch Testing TEST_CASEs
I am using VSCode for C++ Catch2 code and find the Outline View to be lacking stubs for each TEST_CASE or SECTION.

Is there a way to edit the VSCode's Outline View to be able to parse these macros?


问:
Prisma unable to be read in a function
I have code to seed a database in a file called lifeseed.ts. I run it by typing node ./lifeseed.ts. For some reason it is giving me the error below. No clue why, you all got any questions?

```<code>const { PrismaClient } = require('@prisma/client');
const { faker } = require('@faker-js/faker');

const prisma = new PrismaClient();

main();

async function main() {
    console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Starting 2,999 Coin Transaction Seed Function");
    for (let i=0; i<=5; i++) {
        await prisma.coinTransaction.create({
            data: {
                userId: 1,
                coinId: 1,
                paymentId: 'test'+faker.datatype.uuid(),
                checkoutSessionCompleted: new Date('1-1-1969')
            }
        });
    }
    console.log("Seed Function Completed");
};
</code>```

Here is the error below:

```<code>PS C:\Users\jonat\facti\server\prisma\seeds> node .\lifeseed.ts
Starting AI Community Seed Function
C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:27892
    return JSON.parse(await this.engine.dmmf());
                                        ^

TypeError: this.engine.dmmf is not a function
    at LibraryEngine.getDmmf (C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:27892:41)
    at async C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:35539:24
    at async PrismaClient._executeRequest (C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:36111:22)
    at async PrismaClient._request (C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:36082:16)
    at async C:\Users\jonat\facti\server\prisma\seeds\lifeseed.ts:107:29 {
  clientVersion: '4.8.0'
</code>```

Title: Prisma unable to be read in a function

Body:
I have code to seed a database in a file called lifeseed.ts. I run it by typing node ./lifeseed.ts. For some reason it is giving me the error below. No clue why, you all got any questions?

const { PrismaClient } = require('@prisma/client');
const { faker } = require('@faker-js/faker');

const prisma = new PrismaClient();

main();

async function main() {
    console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Starting 2,999 Coin Transaction Seed Function");
    for (let i=0; i<=5; i++) {
        await prisma.coinTransaction.create({
            data: {
                userId: 1,
                coinId: 1,
                paymentId: 'test'+faker.datatype.uuid(),
                checkoutSessionCompleted: new Date('1-1-1969')
            }
        });
    }
    console.log("Seed Function Completed");
};

Here is the error below:

PS C:\Users\jonat\facti\server\prisma\seeds> node .\lifeseed.ts
Starting AI Community Seed Function
C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:27892
    return JSON.parse(await this.engine.dmmf());
                                        ^

TypeError: this.engine.dmmf is not a function
    at LibraryEngine.getDmmf (C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:27892:41)
    at async C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:35539:24
    at async PrismaClient._executeRequest (C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:36111:22)
    at async PrismaClient._request (C:\Users\jonat\facti\server\node_modules\@prisma\client\runtime\index.js:36082:16)
    at async C:\Users\jonat\facti\server\prisma\seeds\lifeseed.ts:107:29 {
  clientVersion: '4.8.0'


问:
Error <path> attribute d: Expected number, "MNaN,NaN\n A32.5,…"
Error:  attribute d: Expected number, "MNaN,NaN\n  A32.5,…". bundle.js:16703

I seem to be getting this error after calling a function (getInfoById(id)).

```<code>  useEffect(() => {
    async function fetchData() {
      const realm_id = //id omitted
      const app = new Realm.App({ id: realm_id });
      const credentials = //credentials omitted

      try {
        const user = await app.logIn(credentials);
        debugger;
        await user.functions
          .getInfoById(id)
          .then((result) => setInfo(result));
      } catch (error) {
        console.log("This went wrong: ", error);
      }
    }
    fetchData();
  }, [id]);
</code>```

I have looked up this error and all I can find online is that it looks like it might be an issue with nested data. But the result is an object, as expected, so I can't figure out what is happening. Everything is working like I expect, I'm just trying to clear out/ understand this error.

Body:
Error:  attribute d: Expected number, "MNaN,NaN\n  A32.5,…". bundle.js:16703

I seem to be getting this error after calling a function (getInfoById(id)).

  useEffect(() => {
    async function fetchData() {
      const realm_id = //id omitted
      const app = new Realm.App({ id: realm_id });
      const credentials = //credentials omitted

      try {
        const user = await app.logIn(credentials);
        debugger;
        await user.functions
          .getInfoById(id)
          .then((result) => setInfo(result));
      } catch (error) {
        console.log("This went wrong: ", error);
      }
    }
    fetchData();
  }, [id]);

I have looked up this error and all I can find online is that it looks like it might be an issue with nested data. But the result is an object, as expected, so I can't figure out what is happening. Everything is working like I expect, I'm just trying to clear out/ understand this error.


问:
Running parallel gradle jobs - busy Daemons could not be reused
I'm trying to run multiple 'gradle installdebug' commands in parallel using a java program using multiple threads. Basically, this is to compile multiple pre-written android apps together in parallel as those apps are not dependent on each other. But all other gradle commands waits with the message 'busy Daemons could not be reused' until the first command completes its execution. I need help in running all the gradle command independently at the same time. more details below.

I have 10 android app folders in windows 10 machine and my java program goes into each of this app folder and executes 'gradle installdebug' command. This happens in parallel using multiple threads. This command compiles android app into APK and install it to the running android emulator. All of the 10 commands get executed successfully and the APKs are installed as expected. The problem I'm facing is that the 9 gradle jobs are queued until the first one is finished, and then remaining 9 gradle jobs runs in parallel. I tried to run the same gradle commands with .Net c# code too, but same issue is observed. I believe this is not a multithreading issue from java code or c# code, instead it is a gradle configuration issue. Looks like I'm missing something while forming the gradle command or configuring the gradle either globally or in the android app gradle settings files.

I'm using the gradle 7.5.1 offline version that I extracted into C: drive for the gradle binary/command as the android app have no dependencies to download while compiling. At end of the question, I provided the android gradle settings files too.

This is the command that I execute from the code.

cmd.exe /c C:\gradle-7.5.1-bin\bin\gradle installdebug

```<code>Starting a Gradle Daemon (subsequent builds will be faster)
Task :preBuild UP-TO-DATE
Task :javaPreCompileDebug
Task :mergeDebugResources
and goes on....
</code>```

Initially for few tasks it runs in parallel with above output then for rest of the commands the gradle outputs the following messages and waits. In this example, from the 7th command it starts queuing. But If I run the program again, only one gradle command gets the daemon, rest all gets queued. On multiple runs the busy daemons count keeps increasing even beyond 100s.

```<code>Starting a Gradle Daemon, 6 busy Daemons could not be reused, use --status for details
[ My Note: here it waits for the first gradle command to finish, then this continues. same for the rest of the 8 commands ]
Task :preBuild UP-TO-DATE
Task :javaPreCompileDebug
Task :mergeDebugResources
and goes on....
</code>```

I tried the command with --no-daemon as shown below.

cmd.exe /c C:\gradle-7.5.1-bin\bin\gradle --offline --no-daemon --build-cache installdebug

With this command I don't see the 'busy Daemons could not be reused' message, but it is slow as for each command a single Daemon started and stopped as shown in below output. Also, this is still having the same problem of waiting for the first command to be complete before running other commands for other android apps.

```<code>To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.5.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
[ My Note: here it waits for the first gradle command to finish, then this continues. same for the rest of the 8 commands ]
> Task :preBuild UP-TO-DATE
> Task :javaPreCompileDebug
and goes on....
</code>```

I have no idea why the other 9 gradle commands are waiting until the first one finished as there is no dependency between them because each of these commands are executed in separate android app folders.

To provide more info, the following is the "build.gradle" file the each of those 10 android apps has.

```<code>plugins {
    id 'com.android.application'
}

android {
    namespace "com.example.simple.myapp1"
    compileSdk 31

    defaultConfig {
        applicationId "com.example.simple.myapp1"
        minSdk 30
        targetSdk 31
        versionCode 1
        versionName "1.0"
    }

    signingConfigs {
        aerndappsigning {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storeFile file('platform.jks')
            storePassword 'android'
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }

        debug {
            signingConfig signingConfigs.aerndappsigning
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

}
</code>```

the following is the "gradle.properties" file in the android app.

```<code>org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
android.nonTransitiveRClass=true
org.gradle.daemon=true
org.gradle.parallel=true
</code>```

the following is the "local.properties" file in the android app.

```<code>sdk.dir=D\:\\AndroidSdk
</code>```

finally, the following is the "settings.gradle" file in the android app.

```<code>pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
    plugins {
        id 'com.android.application' version '7.1.0-alpha11'
        id 'com.android.library' version '7.1.0-alpha11'
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "myapp1"
include ':app'
</code>```

Before posting this question, I searched solutions online, landed up on many posts having similar output, but nothing helped as none of those use cases is similar to what I explained above like running the command in parallel in multiple threads.
The other suggested solutions I tried and their outcomes is as follows:

gradle --stop -> this stops the running gradle daemons but does not completely remove them, ending up with same 'could not reuse' problem.

C:\Users\<myuserdir>\.gradle\daemon\7.5.1 -> removing this directory removes all the stopped daemons completely, but this again ended up being slow as daemons are started again. On the next run we again started seeing the 'busy daemons' error.

org.gradle.daemon=true; org.gradle.parallel=true -> added these 2 lines to 'gradle.properties' files. no difference in output.

Please note that this 'gradle installdebug' is executed within different android app folders that are meant for different android apps. I'm not referring to the gradle configurations of sub-projects inside single android app. I'm also not referring to the parallel gradle tasks within a single android app.

I would highly appreciate if you can provide any input to resolve this issue as I have very limited knowledge in the gradle configuration. In a nutshell, I'm looking for a gradle configuration or parameters where all of the 'gradle installdebug' commands can run independently when executed from multiple threads. Is it possible to start 'n' number (say 10) of gradle daemons and keep it running and use it to serve 'n' commands in parallel and never stop until explicitly stopped?

Body:
I'm trying to run multiple 'gradle installdebug' commands in parallel using a java program using multiple threads. Basically, this is to compile multiple pre-written android apps together in parallel as those apps are not dependent on each other. But all other gradle commands waits with the message 'busy Daemons could not be reused' until the first command completes its execution. I need help in running all the gradle command independently at the same time. more details below.

I have 10 android app folders in windows 10 machine and my java program goes into each of this app folder and executes 'gradle installdebug' command. This happens in parallel using multiple threads. This command compiles android app into APK and install it to the running android emulator. All of the 10 commands get executed successfully and the APKs are installed as expected. The problem I'm facing is that the 9 gradle jobs are queued until the first one is finished, and then remaining 9 gradle jobs runs in parallel. I tried to run the same gradle commands with .Net c# code too, but same issue is observed. I believe this is not a multithreading issue from java code or c# code, instead it is a gradle configuration issue. Looks like I'm missing something while forming the gradle command or configuring the gradle either globally or in the android app gradle settings files.

I'm using the gradle 7.5.1 offline version that I extracted into C: drive for the gradle binary/command as the android app have no dependencies to download while compiling. At end of the question, I provided the android gradle settings files too.

This is the command that I execute from the code.

cmd.exe /c C:\gradle-7.5.1-bin\bin\gradle installdebug

Starting a Gradle Daemon (subsequent builds will be faster)
Task :preBuild UP-TO-DATE
Task :javaPreCompileDebug
Task :mergeDebugResources
and goes on....

Initially for few tasks it runs in parallel with above output then for rest of the commands the gradle outputs the following messages and waits. In this example, from the 7th command it starts queuing. But If I run the program again, only one gradle command gets the daemon, rest all gets queued. On multiple runs the busy daemons count keeps increasing even beyond 100s.

Starting a Gradle Daemon, 6 busy Daemons could not be reused, use --status for details
[ My Note: here it waits for the first gradle command to finish, then this continues. same for the rest of the 8 commands ]
Task :preBuild UP-TO-DATE
Task :javaPreCompileDebug
Task :mergeDebugResources
and goes on....

I tried the command with --no-daemon as shown below.

cmd.exe /c C:\gradle-7.5.1-bin\bin\gradle --offline --no-daemon --build-cache installdebug

With this command I don't see the 'busy Daemons could not be reused' message, but it is slow as for each command a single Daemon started and stopped as shown in below output. Also, this is still having the same problem of waiting for the first command to be complete before running other commands for other android apps.

To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.5.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
[ My Note: here it waits for the first gradle command to finish, then this continues. same for the rest of the 8 commands ]
> Task :preBuild UP-TO-DATE
> Task :javaPreCompileDebug
and goes on....

I have no idea why the other 9 gradle commands are waiting until the first one finished as there is no dependency between them because each of these commands are executed in separate android app folders.

To provide more info, the following is the "build.gradle" file the each of those 10 android apps has.

plugins {
    id 'com.android.application'
}

android {
    namespace "com.example.simple.myapp1"
    compileSdk 31

    defaultConfig {
        applicationId "com.example.simple.myapp1"
        minSdk 30
        targetSdk 31
        versionCode 1
        versionName "1.0"
    }

    signingConfigs {
        aerndappsigning {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storeFile file('platform.jks')
            storePassword 'android'
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }

        debug {
            signingConfig signingConfigs.aerndappsigning
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

}

the following is the "gradle.properties" file in the android app.

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
android.nonTransitiveRClass=true
org.gradle.daemon=true
org.gradle.parallel=true

the following is the "local.properties" file in the android app.

sdk.dir=D\:\\AndroidSdk

finally, the following is the "settings.gradle" file in the android app.

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
    plugins {
        id 'com.android.application' version '7.1.0-alpha11'
        id 'com.android.library' version '7.1.0-alpha11'
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "myapp1"
include ':app'

Before posting this question, I searched solutions online, landed up on many posts having similar output, but nothing helped as none of those use cases is similar to what I explained above like running the command in parallel in multiple threads.
The other suggested solutions I tried and their outcomes is as follows:

gradle --stop -> this stops the running gradle daemons but does not completely remove them, ending up with same 'could not reuse' problem.

C:\Users\<myuserdir>\.gradle\daemon\7.5.1 -> removing this directory removes all the stopped daemons completely, but this again ended up being slow as daemons are started again. On the next run we again started seeing the 'busy daemons' error.

org.gradle.daemon=true; org.gradle.parallel=true -> added these 2 lines to 'gradle.properties' files. no difference in output.

Please note that this 'gradle installdebug' is executed within different android app folders that are meant for different android apps. I'm not referring to the gradle configurations of sub-projects inside single android app. I'm also not referring to the parallel gradle tasks within a single android app.

I would highly appreciate if you can provide any input to resolve this issue as I have very limited knowledge in the gradle configuration. In a nutshell, I'm looking for a gradle configuration or parameters where all of the 'gradle installdebug' commands can run independently when executed from multiple threads. Is it possible to start 'n' number (say 10) of gradle daemons and keep it running and use it to serve 'n' commands in parallel and never stop until explicitly stopped?


问:
Compute the hessian matrix of the last layer with respect to its model parameter
I have the following neural network arch

```<code>class Net(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 6, 5)
        self.pool = nn.MaxPool2d(2, 2)
        self.conv2 = nn.Conv2d(6, 16, 5)
        self.fc1 = nn.Linear(16 * 5 * 5, 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, 10)

        self.outputs = {}

    def forward(self, x):
        x = self.pool(F.relu(self.conv1(x)))
        self.outputs['conv1'] = x  # store the output of conv1
        x = self.pool(F.relu(self.conv2(x)))
        self.outputs['conv2'] = x  # store the output of conv2
        x = torch.flatten(x, 1)
        self.outputs['flatten'] = x  # store the output of flatten
        x = F.relu(self.fc1(x))
        self.outputs['fc1'] = x  # store the output of fc1
        x = F.relu(self.fc2(x))
        self.outputs['fc2'] = x  # store the output of fc2
        x = self.fc3(x)
        self.outputs['fc3'] = x  # store the output of fc3
        return x
</code>```

I tried to Compute the hessian matrix of the last layer with respect to its model parameter as follows

```<code>import torch
import functorch
from torch.nn.utils import _stateless

model = Net()
inputs = inputs
criterion = torch.nn.CrossEntropyLoss()

def loss(params):
    out: torch.Tensor = _stateless.functional_call(model, {n: p for n, p in zip(names, params)}, inputs)
    return criterion (out, labels)

names = list(n for n, _ in model.named_parameters())
print(functorch.hessian(loss)(tuple(model.fc3.parameters())))
</code>```

I got the following error:
RuntimeError: weight should have at least three dimensions

I am not sure what this means. any ideas or tips would be appreciated!

Body:
I have the following neural network arch

class Net(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 6, 5)
        self.pool = nn.MaxPool2d(2, 2)
        self.conv2 = nn.Conv2d(6, 16, 5)
        self.fc1 = nn.Linear(16 * 5 * 5, 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, 10)

        self.outputs = {}

    def forward(self, x):
        x = self.pool(F.relu(self.conv1(x)))
        self.outputs['conv1'] = x  # store the output of conv1
        x = self.pool(F.relu(self.conv2(x)))
        self.outputs['conv2'] = x  # store the output of conv2
        x = torch.flatten(x, 1)
        self.outputs['flatten'] = x  # store the output of flatten
        x = F.relu(self.fc1(x))
        self.outputs['fc1'] = x  # store the output of fc1
        x = F.relu(self.fc2(x))
        self.outputs['fc2'] = x  # store the output of fc2
        x = self.fc3(x)
        self.outputs['fc3'] = x  # store the output of fc3
        return x

I tried to Compute the hessian matrix of the last layer with respect to its model parameter as follows

import torch
import functorch
from torch.nn.utils import _stateless

model = Net()
inputs = inputs
criterion = torch.nn.CrossEntropyLoss()

def loss(params):
    out: torch.Tensor = _stateless.functional_call(model, {n: p for n, p in zip(names, params)}, inputs)
    return criterion (out, labels)

names = list(n for n, _ in model.named_parameters())
print(functorch.hessian(loss)(tuple(model.fc3.parameters())))

I got the following error:
RuntimeError: weight should have at least three dimensions

I am not sure what this means. any ideas or tips would be appreciated!


问:
Is there an OpenID library for python which supports UI extensions?
I'm using the python openid library available here:

https://github.com/openid/python-openid

I would like to use the UI extensions to OpenID to
ensure that the authentication process is performed via
a popup rather than redirection to the provider's site.

However, the above library does not seem to have support
for the extensions built in - has anyone added support
for the UI extensions to this library?

ContentLicense: CC BY-SA 3.0


问:
Executing the "leaks" command in vscode debug mode
When debugging my C programms, I can execute in the vscode terminal the following command leaks --atExit -- ./MyProgram arg1 arg2 arg3
But I prefer to use vscode debug mode.
Is it possible to execute this command in debug mode ?
Here's a sample of my launch.json :

```<code>{
            "name": "C Launch with LIBFT",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/a.out",
            "preLaunchTask": "build_and_debug_libft",
            "internalConsoleOptions": "openOnSessionStart",
            "logging": {
                "moduleLoad": false,
                "programOutput": true,
                "trace": false
            },
            "showDisplayString": false,
            "args": ["5 7 9 1 6 8 4"],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [],
            "externalConsole": false
            "osx": {
                "MIMode": "lldb",
            }
}
</code>```

I have tried to tweak my "launch.json" file, but I can't find a way to debug using this command.
I tried replacing

"program": "${workspaceRoot}/a.out",
with

"program": "leaks --atExit -- ${workspaceRoot}/a.out",

but i got the following pop-up error :

launch: program 'leaks --atExit -- /Users/alevra/Documents/projets/a.out' does not exist

Body:
When debugging my C programms, I can execute in the vscode terminal the following command leaks --atExit -- ./MyProgram arg1 arg2 arg3
But I prefer to use vscode debug mode.
Is it possible to execute this command in debug mode ?
Here's a sample of my launch.json :

{
            "name": "C Launch with LIBFT",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/a.out",
            "preLaunchTask": "build_and_debug_libft",
            "internalConsoleOptions": "openOnSessionStart",
            "logging": {
                "moduleLoad": false,
                "programOutput": true,
                "trace": false
            },
            "showDisplayString": false,
            "args": ["5 7 9 1 6 8 4"],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [],
            "externalConsole": false
            "osx": {
                "MIMode": "lldb",
            }
}

I have tried to tweak my "launch.json" file, but I can't find a way to debug using this command.
I tried replacing

"program": "${workspaceRoot}/a.out",
with

"program": "leaks --atExit -- ${workspaceRoot}/a.out",

but i got the following pop-up error :

launch: program 'leaks --atExit -- /Users/alevra/Documents/projets/a.out' does not exist


问:
How to get count from subcollection firebase?
I have a structure like this:
'items/itemid/type/typeid'

So I want to count all the docs 'type' and get the value in a Text.

I am struggling to do this when I have subcollection, but with only one collection it's no problem.

I use this when it is only one collection: fb.instance.collection('items').snapshots(); with a Streambuilder.


问:
Is it possible to create the Marvel Spiderman 2018 Lab Circuit Projects and Lab Spectrographs puzzles as a JavaScript run website?
Is it possible to recreate this puzzle game as an online website game using Javascript?
My idea is to create various games using the Spiderman puzzles as references. However I would like to if its possible that the same mechanics that made it work in the video game can be used in an online game using code(Javascript for the UI)
Lab Circuit puzzle
Lab Spectrographs puzzle

I can not find a working example of this puzzle being done correctly, all i could find is have to make a sliding square puzzles using javascript. If anyone has any useful resources or advice to give it would be most appreciative.


问:
System.NotSupportedException: Can't call read method while there's a pending read operation. How to avoid?
I'm modifying an IMAP library due to an error, here's the code:

```<code>internal static string ReadLine(this Stream stream, ref int maxLength, Encoding encoding, char? termChar, int ReadTimeout = 10000) {
        if (stream.CanTimeout)
            stream.ReadTimeout = ReadTimeout;

        var maxLengthSpecified = maxLength > 0;
        int i;
        byte b = 0, b0;
        var read = false;
        using (var mem = new MemoryStream()) {
            while (true) {
                b0 = b;

                i = stream.ReadByte(); //Error pops here
                if (i == -1) break;
                else read = true;

                b = (byte)i;
                if (maxLengthSpecified) maxLength--;

                if (maxLengthSpecified && mem.Length == 1 && b == termChar && b0 == termChar) {
                    maxLength++;
                    continue;
                }

                if (b == 10 || b == 13) {
                    if (mem.Length == 0 && b == 10) {
                        continue;
                    } else break;
                }

                mem.WriteByte(b);
                if (maxLengthSpecified && maxLength == 0)
                    break;
            }

            if (mem.Length == 0 && !read) return null;
            return encoding.GetString(mem.ToArray());
        }
    }
</code>```

This function is from Nuget Package AE.NET.MAIL. All i need to know is if there's a way to handle "An unhandled exception of type 'System.NotSupportedException' occurred in System.dll
The Read method cannot be called when another read operation is pending."

Body:
I'm modifying an IMAP library due to an error, here's the code:

internal static string ReadLine(this Stream stream, ref int maxLength, Encoding encoding, char? termChar, int ReadTimeout = 10000) {
        if (stream.CanTimeout)
            stream.ReadTimeout = ReadTimeout;

        var maxLengthSpecified = maxLength > 0;
        int i;
        byte b = 0, b0;
        var read = false;
        using (var mem = new MemoryStream()) {
            while (true) {
                b0 = b;

                i = stream.ReadByte(); //Error pops here
                if (i == -1) break;
                else read = true;

                b = (byte)i;
                if (maxLengthSpecified) maxLength--;

                if (maxLengthSpecified && mem.Length == 1 && b == termChar && b0 == termChar) {
                    maxLength++;
                    continue;
                }

                if (b == 10 || b == 13) {
                    if (mem.Length == 0 && b == 10) {
                        continue;
                    } else break;
                }

                mem.WriteByte(b);
                if (maxLengthSpecified && maxLength == 0)
                    break;
            }

            if (mem.Length == 0 && !read) return null;
            return encoding.GetString(mem.ToArray());
        }
    }

This function is from Nuget Package AE.NET.MAIL. All i need to know is if there's a way to handle "An unhandled exception of type 'System.NotSupportedException' occurred in System.dll
The Read method cannot be called when another read operation is pending."


问:
Django 4.1 : bulk_create() can only be used with concrete fields in update_fields
I try to use the new arguments updata_fields and unique_fields in Django 4.1, but I realy don't know what to do about this error...

Here is my model :

```<code>class Sequence(models.Model):
    id = models.CharField(max_length=50, primary_key=True)
    sequence = models.TextField()
    position = models.IntegerField(default=0, validators=[MinValueValidator(0)])
    isCds = models.BooleanField(default=True) # True: cds | False: peptidic

    genome = models.ForeignKey(Genome, on_delete=models.CASCADE)
</code>```

and the code that raise the error :

```<code>sequenceFields = [field.name for field in sequenceFields if field.name != 'id']
self.stdout.write(self.style.SUCCESS(str(sequenceFields))) # Just to be sure the list is correct
Sequence.objects.bulk_create(sequences, update_conflicts=True, update_fields=sequenceFields, unique_fields=['id'])
</code>```

And I have the ouput : ValueError: bulk_create() can only be used with concrete fields in update_fields.

I looked for an example of this use of bulk_create online but I could not find one.

Body:
I try to use the new arguments updata_fields and unique_fields in Django 4.1, but I realy don't know what to do about this error...

Here is my model :

class Sequence(models.Model):
    id = models.CharField(max_length=50, primary_key=True)
    sequence = models.TextField()
    position = models.IntegerField(default=0, validators=[MinValueValidator(0)])
    isCds = models.BooleanField(default=True) # True: cds | False: peptidic

    genome = models.ForeignKey(Genome, on_delete=models.CASCADE)

and the code that raise the error :

sequenceFields = [field.name for field in sequenceFields if field.name != 'id']
self.stdout.write(self.style.SUCCESS(str(sequenceFields))) # Just to be sure the list is correct
Sequence.objects.bulk_create(sequences, update_conflicts=True, update_fields=sequenceFields, unique_fields=['id'])

And I have the ouput : ValueError: bulk_create() can only be used with concrete fields in update_fields.

I looked for an example of this use of bulk_create online but I could not find one.


问:
How can I access the DOM of a chrome extension from a regular web page?
I have a standard web page that runs inside of a chrome tab. There is a third party chrome extension that I would like to access its DOM elements from my web page. I have no control over this extension and cannot access the extension's source code.

I would like to be able to access html elements and hook into events in this extension from my web page. Is this possible?

Please provide working source code as I am new to chrome extensions.

I tried searching on google and using the chrome extension api page. The examples that I found are around going from the extension to the web page. I need to do the reverse.

It does seems message passing between the two is possible but again that's not what I'm trying to do.


问:
Remote Git daemon immediately disconnects my client on a "git pull"
I am attempting to do a simple

```<code>$git pull
</code>```

From my remote master repository.  When I do so, the command just hangs and never does anything, no timeout, no errors -- just waiting silently.

Meanwhile, on the remote system, I can watch my daemon do this:

```<code>[30395] Connection from 192.168.1.203:55260
[30395] Extended attributes (20 bytes) exist <host=192.168.1.125>
[30395] Request upload-pack for '/staging.git'
[30386] [30395] Disconnected
</code>```

The Disconnected happens very quickly.  But again, there is no error or reaction of any kind on my side.

Now, on my machine I was easily able to clone a new copy of my remote master.  And from that new clone I can do a git pull without any problem.

So, what might be going on here?  How can I troubleshoot this behavior?

Body:
I am attempting to do a simple

$git pull

From my remote master repository.  When I do so, the command just hangs and never does anything, no timeout, no errors -- just waiting silently.

Meanwhile, on the remote system, I can watch my daemon do this:

[30395] Connection from 192.168.1.203:55260
[30395] Extended attributes (20 bytes) exist <host=192.168.1.125>
[30395] Request upload-pack for '/staging.git'
[30386] [30395] Disconnected

The Disconnected happens very quickly.  But again, there is no error or reaction of any kind on my side.

Now, on my machine I was easily able to clone a new copy of my remote master.  And from that new clone I can do a git pull without any problem.

So, what might be going on here?  How can I troubleshoot this behavior?


问:
How do I copy json dictionary values to other json files with unique keys?
I have a JSON file with a dictionary. Something simple like

```<code>{ "1": "Filepath/image.png",
"2": "Filepath/image.png"
etc. }
</code>```

Then I have 3 other JSON dictionary files with unique keys (RFID tag numbers).
I want the copy the values of the first file and overwrite the values of the other 3 JSON files. I know the keys I want for the 3 files, so I have them in 3 lists.

This is the last script I tried to achieve this, but it just determined the keys didn't match.

```<code>import json
import os
import glob
import time

# Get a list of all the files in the folder
files = glob.glob("json/*")

# Sort the list of files by modification time
files.sort(key=lambda x: os.path.getmtime(x))

# Get the filepath of the newest file
newest_file = files[-1]

print(newest_file)

# Open the newest file and read its contents
with open(newest_file, 'r') as f:
    data = json.load(f)

# List of keys to use for each file
keys_1 = ["13603414011682", "1360739520482", "136010319878103", "136073122213110", "136034217194177", "1360352372244",
 "1360739715155", "136072188183203", "136034163207198", "1360738615152", "1201261612531", "136034225204135", "136034230076"]
keys_2 = ["136073152053", "136034158129181", "13603412514289", "1360345793206", "136034148129191", "136010459115168", "136034145143180", "1360739170220", "1360351355527", "13603410960251","1360355159163", "13601049817949", "13603422660116"]
keys_3 = ["136075353245", "1360743335192", "13601043613070", "1360738365211", "136073133188248", "136034184248234", "13603571150122", "1360341385624", "136074741236", "136074211164181", "111", "222", "333"]

# Create the first file
subset_1 = {}
for i, key in enumerate(keys_1):
    subset_1[key] = data.get(key, f'Key not found at index {i}')

with open('json/charlie.json', 'w') as f:
    json.dump(subset_1, f)

# Create the second file
subset_2 = {}
for i, key in enumerate(keys_2):
    subset_2[key] = data.get(key, f'Key not found at index {i}')

with open('json/hagrid.json', 'w') as f:
    json.dump(subset_2, f)

# Create the third file
subset_3 = {}
for i, key in enumerate(keys_3):
    subset_3[key] = data.get(key, f'Key not found at index {i}')

with open('json/junior.json', 'w') as f:
    json.dump(subset_3, f)

</code>```

Body:
I have a JSON file with a dictionary. Something simple like

{ "1": "Filepath/image.png",
"2": "Filepath/image.png"
etc. }

Then I have 3 other JSON dictionary files with unique keys (RFID tag numbers).
I want the copy the values of the first file and overwrite the values of the other 3 JSON files. I know the keys I want for the 3 files, so I have them in 3 lists.

This is the last script I tried to achieve this, but it just determined the keys didn't match.

import json
import os
import glob
import time

# Get a list of all the files in the folder
files = glob.glob("json/*")

# Sort the list of files by modification time
files.sort(key=lambda x: os.path.getmtime(x))

# Get the filepath of the newest file
newest_file = files[-1]

print(newest_file)

# Open the newest file and read its contents
with open(newest_file, 'r') as f:
    data = json.load(f)

# List of keys to use for each file
keys_1 = ["13603414011682", "1360739520482", "136010319878103", "136073122213110", "136034217194177", "1360352372244",
 "1360739715155", "136072188183203", "136034163207198", "1360738615152", "1201261612531", "136034225204135", "136034230076"]
keys_2 = ["136073152053", "136034158129181", "13603412514289", "1360345793206", "136034148129191", "136010459115168", "136034145143180", "1360739170220", "1360351355527", "13603410960251","1360355159163", "13601049817949", "13603422660116"]
keys_3 = ["136075353245", "1360743335192", "13601043613070", "1360738365211", "136073133188248", "136034184248234", "13603571150122", "1360341385624", "136074741236", "136074211164181", "111", "222", "333"]

# Create the first file
subset_1 = {}
for i, key in enumerate(keys_1):
    subset_1[key] = data.get(key, f'Key not found at index {i}')

with open('json/charlie.json', 'w') as f:
    json.dump(subset_1, f)

# Create the second file
subset_2 = {}
for i, key in enumerate(keys_2):
    subset_2[key] = data.get(key, f'Key not found at index {i}')

with open('json/hagrid.json', 'w') as f:
    json.dump(subset_2, f)

# Create the third file
subset_3 = {}
for i, key in enumerate(keys_3):
    subset_3[key] = data.get(key, f'Key not found at index {i}')

with open('json/junior.json', 'w') as f:
    json.dump(subset_3, f)


问:
Force Docker to use memory instead of disk space
When I run my docker containers in Google Cloud Run, any disk space they use comes from the available memory.

I'm running several self-hosted github action runners on a single local server, and they have worn out my SSD over the past year. The thing is, all the data they are saving is pointless. None of it needs to be saved. It exists for a few minutes during the build, and then is deleted.

Is it possible for me to instead run all these docker machines using memory for the disk space? That would improve performance and stop putting unnecessary wear on a hard drive.


问:
Linq Expression Could Not Be Translated - DistinctBy Breaking Linq
Whenever I run this I get the above error. I am on .NET Core 6 and EF Core.

For some reason I only get the error when the DistinctBy clause is in there.

```<code>var notifications = _context.Notifications.Where(x => x.ToUser == user.Id);

if (!getRead)
{
   notifications = notifications
      .Where(x => x.IsRead == false);
}

if (getUnique)
{
   notifications = notifications.DistinctBy(x => x.SuggestionId);
}

return await notifications
   .OrderByDescending(x => x.DateCreated)
   .ToListAsync();
</code>```

The goal is to get a list of notifications that only show the latest notification about a certain Suggestion. I have tried the GroupBy ... Select way of going about it but that doesnt work either.

Body:
Whenever I run this I get the above error. I am on .NET Core 6 and EF Core.

For some reason I only get the error when the DistinctBy clause is in there.

var notifications = _context.Notifications.Where(x => x.ToUser == user.Id);

if (!getRead)
{
   notifications = notifications
      .Where(x => x.IsRead == false);
}

if (getUnique)
{
   notifications = notifications.DistinctBy(x => x.SuggestionId);
}

return await notifications
   .OrderByDescending(x => x.DateCreated)
   .ToListAsync();

The goal is to get a list of notifications that only show the latest notification about a certain Suggestion. I have tried the GroupBy ... Select way of going about it but that doesnt work either.