问:
Conda functions in terminal (Mac) won't work: KeyError('pkgs_dirs')
I cannot run Conda in Terminal (Mac) or many of its commands. Only conda activate <env> or conda deactivate run that I know of, and I can run Jupyter from my chosen environment thankfully. Otherwise I get the following error:

conda info could not be constructed. KeyError('pkgs_dirs')

I'm at a complete loss. Should I uninstall Anaconda and reinstall it? However, I cannot use any uninstall commands from Conda—a catch-22.

Here is the complete error report:

ERROR REPORT
    Traceback (most recent call last):
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1118, in __call__
        return func(*args, **kwargs)
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 57, in main_subshell
        p = generate_parser()
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 41, in generate_parser
        description='conda is a tool for managing and deploying applications,'
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 117, in __init__
        self._subcommands = context.plugin_manager.get_hook_results("subcommands")
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/base/context.py", line 421, in plugin_manager
        from ..plugins.manager import get_plugin_manager
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/plugins/manager.py", line 9, in <module>
        from . import solvers, virtual_packages
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/plugins/virtual_packages/__init__.py", line 5, in <module>
        from . import archspec, cuda, linux, osx, windows
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/plugins/virtual_packages/cuda.py", line 3, in <module>
        import ctypes
      File "/opt/anaconda3/lib/python3.7/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ImportError: dlopen(/opt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so, 0x0002): Library not loaded: @rpath/libffi.6.dylib
      Referenced from: <66269FD6-56F9-32A5-8A25-F986023901A1> /opt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
      Reason: tried: '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/lib/python3.7/lib-dynload/../../libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/lib/python3.7/lib-dynload/../../libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/bin/../lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/bin/../lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/lib/python3.7/lib-dynload/../../libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/lib/python3.7/lib-dynload/../../libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/bin/../lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/bin/../lib/libffi.6.dylib' (no such file), '/usr/local/lib/libffi.6.dylib' (no such file), '/usr/lib/libffi.6.dylib' (no such file, not in dyld cache)

With the result that

$ /opt/anaconda3/bin/conda
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
An unexpected error has occurred. Conda has prepared the above report.
```
<h1>Recent Environment History</h1>
<p><strong>conda-meta/history</strong></p>
<pre class="lang-yaml prettyprint-override"><code>==> 2022-03-01 15:37:32 <==
# cmd: /opt/anaconda3/bin/conda update anaconda
# conda version: 4.11.0
# update specs: ['anaconda']
# neutered specs: ['anaconda']
==> 2022-03-01 16:01:48 <==
# cmd: /opt/anaconda3/bin/conda update anaconda-navigator
# conda version: 4.11.0
# update specs: ['anaconda-navigator']
==> 2022-11-17 18:42:41 <==
# cmd: /opt/anaconda3/bin/conda install --yes --json --force-pscheck --prefix /opt/anaconda3 anaconda-navigator==2.3.2
# conda version: 4.11.0
# update specs: ['anaconda-navigator==2.3.2']
==> 2022-12-08 04:32:09 <==
# cmd: /opt/anaconda3/bin/conda update conda
# conda version: 22.9.0
# update specs: ['conda']
</code>```

I think the problem occurred after my last update, which was a few weeks ago in December and concerning Conda.

Body:
I cannot run Conda in Terminal (Mac) or many of its commands. Only conda activate <env> or conda deactivate run that I know of, and I can run Jupyter from my chosen environment thankfully. Otherwise I get the following error:

conda info could not be constructed. KeyError('pkgs_dirs')

I'm at a complete loss. Should I uninstall Anaconda and reinstall it? However, I cannot use any uninstall commands from Conda—a catch-22.

Here is the complete error report:

ERROR REPORT
    Traceback (most recent call last):
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1118, in __call__
        return func(*args, **kwargs)
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 57, in main_subshell
        p = generate_parser()
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 41, in generate_parser
        description='conda is a tool for managing and deploying applications,'
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 117, in __init__
        self._subcommands = context.plugin_manager.get_hook_results("subcommands")
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/base/context.py", line 421, in plugin_manager
        from ..plugins.manager import get_plugin_manager
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/plugins/manager.py", line 9, in <module>
        from . import solvers, virtual_packages
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/plugins/virtual_packages/__init__.py", line 5, in <module>
        from . import archspec, cuda, linux, osx, windows
      File "/opt/anaconda3/lib/python3.7/site-packages/conda/plugins/virtual_packages/cuda.py", line 3, in <module>
        import ctypes
      File "/opt/anaconda3/lib/python3.7/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ImportError: dlopen(/opt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so, 0x0002): Library not loaded: @rpath/libffi.6.dylib
      Referenced from: <66269FD6-56F9-32A5-8A25-F986023901A1> /opt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
      Reason: tried: '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/lib/python3.7/lib-dynload/../../libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/lib/python3.7/lib-dynload/../../libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/bin/../lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/bin/../lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/lib/python3.7/lib-dynload/../../libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/lib/python3.7/lib-dynload/../../libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/bin/../lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/concourse/worker/volumes/live/d698b2ce-b4b9-4fb4-6268-e633fba1b324/volume/python_1565725718142/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/libffi.6.dylib' (no such file), '/opt/anaconda3/bin/../lib/libffi.6.dylib' (no such file), '/usr/local/lib/libffi.6.dylib' (no such file), '/usr/lib/libffi.6.dylib' (no such file, not in dyld cache)

With the result that

$ /opt/anaconda3/bin/conda
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
An unexpected error has occurred. Conda has prepared the above report.

Recent Environment History

conda-meta/history

==> 2022-03-01 15:37:32 <==
# cmd: /opt/anaconda3/bin/conda update anaconda
# conda version: 4.11.0
# update specs: ['anaconda']
# neutered specs: ['anaconda']
==> 2022-03-01 16:01:48 <==
# cmd: /opt/anaconda3/bin/conda update anaconda-navigator
# conda version: 4.11.0
# update specs: ['anaconda-navigator']
==> 2022-11-17 18:42:41 <==
# cmd: /opt/anaconda3/bin/conda install --yes --json --force-pscheck --prefix /opt/anaconda3 anaconda-navigator==2.3.2
# conda version: 4.11.0
# update specs: ['anaconda-navigator==2.3.2']
==> 2022-12-08 04:32:09 <==
# cmd: /opt/anaconda3/bin/conda update conda
# conda version: 22.9.0
# update specs: ['conda']

I think the problem occurred after my last update, which was a few weeks ago in December and concerning Conda.


来源: stackexchange

问:
How to deploy Camel route in Azure Functions using Quarkus?
I need assistance with the following.  I am not sure if I am setting up my Camel Quarkus application correctly in order for it to deploy to Azure Functions.

I have looked at the Quarkus examples of deploying Quarkus application in Azure Functions.

https://quarkus.io/guides/azure-functions-http

I am trying to implement a Camel Quarkus application on Azure Functions.  I started off by creating an application from the following archetype.

```<code>mvn archetype:generate \
    -DarchetypeGroupId=io.quarkus \
    -DarchetypeArtifactId=quarkus-azure-functions-http-archetype \
    -DarchetypeVersion=2.15.1.Final
</code>```

I have deployed the above application to Azure functions and it works.  I now try to extend this application to invoke a Camel route (i have included the Camel Quarkus dependencies in the application POM).  It builds and the sample endpoint is invocable locally on the IDE.

While the deployment to Azure function also works, however when I invoke this endpoint that is now hosted on Azure, I get the following message.

Has anyone experienced this or have any examples of setting up a Camel Quarkus application for Azure Functions deployment?

https://quarkus-getting-started-1671721071201.azurewebsites.net/api/test

Response
The page cannot be displayed because an internal server error has occurred.‹í½I–%&/mÊ{JõJ×àt¡€$Ø@ìÁˆÍæ’ìiG#)«*ÊeVe]f@Ìí¼÷Þ{ï½÷Þ{ï½÷º;N'÷ßÿ?\fdlöÎJÚÉž!€ªÈ?~|?"þ

Here is the example Java class that was added to the application.

```<code>package my.test;

import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;

public class MyTestFunction extends EndpointRouteBuilder {

    @Override
    public void configure() throws Exception {

        restConfiguration().bindingMode(RestBindingMode.json);

        rest("/test")
                .get().to("direct:hello");

        from("direct:hello").transform().constant("hello world");

    }

}

</code>```

The azure function binding looks like this.

```<code>{
  "scriptFile" : "../quarkus-getting-started-1.0.0-SNAPSHOT.jar",
  "entryPoint" : "io.quarkus.azure.functions.resteasy.runtime.Function.run",
  "bindings" : [ {
    "type" : "httpTrigger",
    "direction" : "in",
    "name" : "req",
    "route" : "{*path}",
    "methods" : [ "GET", "POST", "HEAD", "PUT", "OPTIONS", "DELETE" ],
    "dataType" : "binary",
    "authLevel" : "ANONYMOUS"
  }, {
    "type" : "http",
    "direction" : "out",
    "name" : "$return"
  } ]
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I need assistance with the following.  I am not sure if I am setting up my Camel Quarkus application correctly in order for it to deploy to Azure Functions.

I have looked at the Quarkus examples of deploying Quarkus application in Azure Functions.

https://quarkus.io/guides/azure-functions-http

I am trying to implement a Camel Quarkus application on Azure Functions.  I started off by creating an application from the following archetype.

mvn archetype:generate \
    -DarchetypeGroupId=io.quarkus \
    -DarchetypeArtifactId=quarkus-azure-functions-http-archetype \
    -DarchetypeVersion=2.15.1.Final

I have deployed the above application to Azure functions and it works.  I now try to extend this application to invoke a Camel route (i have included the Camel Quarkus dependencies in the application POM).  It builds and the sample endpoint is invocable locally on the IDE.

While the deployment to Azure function also works, however when I invoke this endpoint that is now hosted on Azure, I get the following message.

Has anyone experienced this or have any examples of setting up a Camel Quarkus application for Azure Functions deployment?

https://quarkus-getting-started-1671721071201.azurewebsites.net/api/test

Response
The page cannot be displayed because an internal server error has occurred.‹í½I–%&/mÊ{JõJ×àt¡€$Ø@ìÁˆÍæ’ìiG#)«*ÊeVe]f@Ìí¼÷Þ{ï½÷Þ{ï½÷º;N'÷ßÿ?\fdlöÎJÚÉž!€ªÈ?~|?"þ

Here is the example Java class that was added to the application.

package my.test;

import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;

public class MyTestFunction extends EndpointRouteBuilder {

    @Override
    public void configure() throws Exception {

        restConfiguration().bindingMode(RestBindingMode.json);

        rest("/test")
                .get().to("direct:hello");

        from("direct:hello").transform().constant("hello world");

    }

}

The azure function binding looks like this.

{
  "scriptFile" : "../quarkus-getting-started-1.0.0-SNAPSHOT.jar",
  "entryPoint" : "io.quarkus.azure.functions.resteasy.runtime.Function.run",
  "bindings" : [ {
    "type" : "httpTrigger",
    "direction" : "in",
    "name" : "req",
    "route" : "{*path}",
    "methods" : [ "GET", "POST", "HEAD", "PUT", "OPTIONS", "DELETE" ],
    "dataType" : "binary",
    "authLevel" : "ANONYMOUS"
  }, {
    "type" : "http",
    "direction" : "out",
    "name" : "$return"
  } ]
}


问:
Google Play Games apk detailed list button bar css?
The detailed list section at the bottom of the google play games apk application caught my attention. When I wanted to do the same, I searched on the internet but couldn't find it. Can I learn css codes from application? or is there a codepen example on the internet that has the same functionality?

Below are screenshots

Can I learn css codes from application? or is there a codepen example on the internet that has the same functionality?


问:
Only one streamlit column is updating on CSV
I'm new to streamlit, and I wanted to build an interactive app that updates a CSV file when pressing an "update" button.
I defined 3 columns ("A", "B", "C") that are editable from my CSV file (has two other columns). For some reason when I make my updates, only one of them ("A") is actually updating when I press the button, while the other two are not.

Here is my code:

```<code>def main():
    parser = argparse.ArgumentParser(description='')

    parser.add_argument("-d", "--data", type=str, required=False, default=data.csv)

    args = None
    try:
        args = parser.parse_args()
    except SystemExit as e:
        os._exit(e.code)

    st.set_page_config(layout="wide")

    grid_table = show_grid(args.data)
    st.sidebar.header("Options:")
    st.sidebar.button("Update CSV file", on_click=update, args=[grid_table, args.data])

def data_upload(data_path):
    df = pd.read_csv(data_path)
    return df

def show_grid(data_path):
    df = data_upload(data_path)

    gb = GridOptionsBuilder.from_dataframe(df)
    gb.configure_column("A", editable=True)
    gb.configure_column("B", editable=True)
    gb.configure_column("C", editable=True)
    grid_table = AgGrid(
        df,
        height=400,
        gridOptions=gb.build(),
        fit_columns_on_grid_load=True,
        allow_unsafe_jscode=True,
    )
    return grid_table

def update(grid_table, data_path):
    grid_table_df = pd.DataFrame(grid_table['data'])
    grid_table_df.to_csv(data_path, index=False)

if __name__ == '__main__':
    main()
</code>```

Tried to update columns "B" and "C" and expected them to update, but only changes done to column "A" seems to be updating on the CSV when pressing the update button.

Body:
I'm new to streamlit, and I wanted to build an interactive app that updates a CSV file when pressing an "update" button.
I defined 3 columns ("A", "B", "C") that are editable from my CSV file (has two other columns). For some reason when I make my updates, only one of them ("A") is actually updating when I press the button, while the other two are not.

Here is my code:

def main():
    parser = argparse.ArgumentParser(description='')

    parser.add_argument("-d", "--data", type=str, required=False, default=data.csv)

    args = None
    try:
        args = parser.parse_args()
    except SystemExit as e:
        os._exit(e.code)

    st.set_page_config(layout="wide")

    grid_table = show_grid(args.data)
    st.sidebar.header("Options:")
    st.sidebar.button("Update CSV file", on_click=update, args=[grid_table, args.data])

def data_upload(data_path):
    df = pd.read_csv(data_path)
    return df

def show_grid(data_path):
    df = data_upload(data_path)

    gb = GridOptionsBuilder.from_dataframe(df)
    gb.configure_column("A", editable=True)
    gb.configure_column("B", editable=True)
    gb.configure_column("C", editable=True)
    grid_table = AgGrid(
        df,
        height=400,
        gridOptions=gb.build(),
        fit_columns_on_grid_load=True,
        allow_unsafe_jscode=True,
    )
    return grid_table

def update(grid_table, data_path):
    grid_table_df = pd.DataFrame(grid_table['data'])
    grid_table_df.to_csv(data_path, index=False)

if __name__ == '__main__':
    main()

Tried to update columns "B" and "C" and expected them to update, but only changes done to column "A" seems to be updating on the CSV when pressing the update button.


问:
overfitting and data augmentation in random forest, prediction
I want to make a prediction model using Random Forest, but overfitting occurs. We adjusted various parameters due to overfitting, but there is no big change.

When I looked up the reason, I checked the Internet post that it could be caused by a small number of data (1,000). As you know, in the case of image classification, data augmentation increases the amount of data by gradually transforming the shape and angle of the image.

How about increasing the amount of data in predictions like this? And we copied the entire data, and we made about three times as many data as three thousand. This prevents overfitting and increases accuracy.

But I'm not sure if this is the right way in terms of data science, so I'm writing like this.

In addition to these methods, I would like to ask you how to avoid overfitting the prediction problem or how to increase the amount of data.

Thank you!


问:
The changes I make in javascript are not displayed on the site and I don't know what the problem is
here code in VS. This is a js file which make changes in PHP site.

```<code>$( function() {
    $( "#accordion" ).accordion({
        collapsible: true
    });
    } );

    function replaceClass(id, oldClass, newClass) {
        var elem = $(`#${id}`);
        if (elem.hasClass(oldClass)) {
            elem.removeClass(oldClass);
        }
        elem.addClass(newClass);
    }

    $(document).ready(function() {
        $("#darkmode").click(function() {
            replaceClass("garden", "light", "dark");
        });

        $("#lightmode").click(function() {
            replaceClass("garden", "dark", "light");
        });
    });

    document.addEventListener('DOMContentLoaded', function() {

        const deadline = new Date(2024, 11, 26);
        let timerId = null;
        function declensionNum(num, words) {
          return words[(num % 100 > 4 && num % 100 < 20) ? 2 : [2, 0, 1, 1, 1, 2][(num % 10 < 5) ? num % 10 : 5]];
        }
        function countdownTimer() {
          const diff = deadline - new Date();
          if (diff <= 0) {
            clearInterval(timerId);
          }
          const days = diff > 0 ? Math.floor(diff / 1000 / 60 / 60 / 24) : 0;
          const hours = diff > 0 ? Math.floor(diff / 1000 / 60 / 60) % 24 : 0;
          const minutes = diff > 0 ? Math.floor(diff / 1000 / 60) % 60 : 0;
          const seconds = diff > 0 ? Math.floor(diff / 1000) % 60 : 0;
          $days.textContent = days < 10 ? '0' + days : days;
          $hours.textContent = hours < 10 ? '0' + hours : hours;
          $minutes.textContent = minutes < 10 ? '0' + minutes : minutes;
          $seconds.textContent = seconds < 10 ? '0' + seconds : seconds;
          $days.dataset.title = declensionNum(days, ['день', 'дня', 'днів']);
          $hours.dataset.title = declensionNum(hours, ['година', 'години', 'годин']);
          $minutes.dataset.title = declensionNum(minutes, ['хвилина', 'хвилини', 'хвилин']);
          $seconds.dataset.title = declensionNum(seconds, ['секунда', 'секунди', 'секунд']);
        }
        const $days = document.querySelector('.timer__days');
        const $hours = document.querySelector('.timer__hours');
        const $minutes = document.querySelector('.timer__minutes');
        const $seconds = document.querySelector('.timer__seconds');
        countdownTimer();
        timerId = setInterval(countdownTimer, 1000);
      });

// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks on the button, open the modal
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
</code>```

and here code in site.

```<code>
$( function() {
    $( "#accordion" ).accordion({
        collapsible: true
    });
    } );

    function replaceClass(id, oldClass, newClass) {
        var elem = $(`#${id}`);
        if (elem.hasClass(oldClass)) {
            elem.removeClass(oldClass);
        }
        elem.addClass(newClass);
    }

    $(document).ready(function() {
        $("#darkmode").click(function() {
            replaceClass("garden", "light", "dark");
        });

        $("#lightmode").click(function() {
            replaceClass("garden", "dark", "light");
        });
    });

    document.addEventListener('DOMContentLoaded', function() {

        const deadline = new Date(2024, 11, 26);
        let timerId = null;
        function declensionNum(num, words) {
          return words[(num % 100 > 4 && num % 100 < 20) ? 2 : [2, 0, 1, 1, 1, 2][(num % 10 < 5) ? num % 10 : 5]];
        }
        function countdownTimer() {
          const diff = deadline - new Date();
          if (diff <= 0) {
            clearInterval(timerId);
          }
          const days = diff > 0 ? Math.floor(diff / 1000 / 60 / 60 / 24) : 0;
          const hours = diff > 0 ? Math.floor(diff / 1000 / 60 / 60) % 24 : 0;
          const minutes = diff > 0 ? Math.floor(diff / 1000 / 60) % 60 : 0;
          const seconds = diff > 0 ? Math.floor(diff / 1000) % 60 : 0;
          $days.textContent = days < 10 ? '0' + days : days;
          $hours.textContent = hours < 10 ? '0' + hours : hours;
          $minutes.textContent = minutes < 10 ? '0' + minutes : minutes;
          $seconds.textContent = seconds < 10 ? '0' + seconds : seconds;
          $days.dataset.title = declensionNum(days, ['день', 'дня', 'днів']);
          $hours.dataset.title = declensionNum(hours, ['година', 'години', 'годин']);
          $minutes.dataset.title = declensionNum(minutes, ['хвилина', 'хвилини', 'хвилин']);
          $seconds.dataset.title = declensionNum(seconds, ['секунда', 'секунди', 'секунд']);
        }
        const $days = document.querySelector('.timer__days');
        const $hours = document.querySelector('.timer__hours');
        const $minutes = document.querySelector('.timer__minutes');
        const $seconds = document.querySelector('.timer__seconds');
        countdownTimer();
        timerId = setInterval(countdownTimer, 1000);
      });
</code>```

mayde anybody can help me, i will be so thanksfull

i tried changed my site from PHP to HTML (I write site on PHP) and this didnt help me. maybe you have any idea.

Actually, i think this is because i have wrong version of something but maybe my code wrong.

Body:
here code in VS. This is a js file which make changes in PHP site.

$( function() {
    $( "#accordion" ).accordion({
        collapsible: true
    });
    } );

    function replaceClass(id, oldClass, newClass) {
        var elem = $(`#${id}`);
        if (elem.hasClass(oldClass)) {
            elem.removeClass(oldClass);
        }
        elem.addClass(newClass);
    }

    $(document).ready(function() {
        $("#darkmode").click(function() {
            replaceClass("garden", "light", "dark");
        });

        $("#lightmode").click(function() {
            replaceClass("garden", "dark", "light");
        });
    });

    document.addEventListener('DOMContentLoaded', function() {

        const deadline = new Date(2024, 11, 26);
        let timerId = null;
        function declensionNum(num, words) {
          return words[(num % 100 > 4 && num % 100 < 20) ? 2 : [2, 0, 1, 1, 1, 2][(num % 10 < 5) ? num % 10 : 5]];
        }
        function countdownTimer() {
          const diff = deadline - new Date();
          if (diff <= 0) {
            clearInterval(timerId);
          }
          const days = diff > 0 ? Math.floor(diff / 1000 / 60 / 60 / 24) : 0;
          const hours = diff > 0 ? Math.floor(diff / 1000 / 60 / 60) % 24 : 0;
          const minutes = diff > 0 ? Math.floor(diff / 1000 / 60) % 60 : 0;
          const seconds = diff > 0 ? Math.floor(diff / 1000) % 60 : 0;
          $days.textContent = days < 10 ? '0' + days : days;
          $hours.textContent = hours < 10 ? '0' + hours : hours;
          $minutes.textContent = minutes < 10 ? '0' + minutes : minutes;
          $seconds.textContent = seconds < 10 ? '0' + seconds : seconds;
          $days.dataset.title = declensionNum(days, ['день', 'дня', 'днів']);
          $hours.dataset.title = declensionNum(hours, ['година', 'години', 'годин']);
          $minutes.dataset.title = declensionNum(minutes, ['хвилина', 'хвилини', 'хвилин']);
          $seconds.dataset.title = declensionNum(seconds, ['секунда', 'секунди', 'секунд']);
        }
        const $days = document.querySelector('.timer__days');
        const $hours = document.querySelector('.timer__hours');
        const $minutes = document.querySelector('.timer__minutes');
        const $seconds = document.querySelector('.timer__seconds');
        countdownTimer();
        timerId = setInterval(countdownTimer, 1000);
      });

// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the  element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks on the button, open the modal
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on  (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}

and here code in site.

$( function() {
    $( "#accordion" ).accordion({
        collapsible: true
    });
    } );

    function replaceClass(id, oldClass, newClass) {
        var elem = $(`#${id}`);
        if (elem.hasClass(oldClass)) {
            elem.removeClass(oldClass);
        }
        elem.addClass(newClass);
    }

    $(document).ready(function() {
        $("#darkmode").click(function() {
            replaceClass("garden", "light", "dark");
        });

        $("#lightmode").click(function() {
            replaceClass("garden", "dark", "light");
        });
    });

    document.addEventListener('DOMContentLoaded', function() {

        const deadline = new Date(2024, 11, 26);
        let timerId = null;
        function declensionNum(num, words) {
          return words[(num % 100 > 4 && num % 100 < 20) ? 2 : [2, 0, 1, 1, 1, 2][(num % 10 < 5) ? num % 10 : 5]];
        }
        function countdownTimer() {
          const diff = deadline - new Date();
          if (diff <= 0) {
            clearInterval(timerId);
          }
          const days = diff > 0 ? Math.floor(diff / 1000 / 60 / 60 / 24) : 0;
          const hours = diff > 0 ? Math.floor(diff / 1000 / 60 / 60) % 24 : 0;
          const minutes = diff > 0 ? Math.floor(diff / 1000 / 60) % 60 : 0;
          const seconds = diff > 0 ? Math.floor(diff / 1000) % 60 : 0;
          $days.textContent = days < 10 ? '0' + days : days;
          $hours.textContent = hours < 10 ? '0' + hours : hours;
          $minutes.textContent = minutes < 10 ? '0' + minutes : minutes;
          $seconds.textContent = seconds < 10 ? '0' + seconds : seconds;
          $days.dataset.title = declensionNum(days, ['день', 'дня', 'днів']);
          $hours.dataset.title = declensionNum(hours, ['година', 'години', 'годин']);
          $minutes.dataset.title = declensionNum(minutes, ['хвилина', 'хвилини', 'хвилин']);
          $seconds.dataset.title = declensionNum(seconds, ['секунда', 'секунди', 'секунд']);
        }
        const $days = document.querySelector('.timer__days');
        const $hours = document.querySelector('.timer__hours');
        const $minutes = document.querySelector('.timer__minutes');
        const $seconds = document.querySelector('.timer__seconds');
        countdownTimer();
        timerId = setInterval(countdownTimer, 1000);
      });

mayde anybody can help me, i will be so thanksfull

i tried changed my site from PHP to HTML (I write site on PHP) and this didnt help me. maybe you have any idea.

Actually, i think this is because i have wrong version of something but maybe my code wrong.


问:
Is it possible to make a div work like how a "layer mask" would?
I was playing around with javascript, css, + html and I want to make a div that shows only a section of a separate full image (Similar to how a "layer mask" would in digital art). Is there any way that I could do this?

My code looks like this:

css:

```<code>#fulldiv {
  position: absolute;
  z-index: 9;
  border: 2px solid #302058;
  text-align: center;
  height: 150px;
}

#browserhead {
  width: 100px;
  padding: 5px;
  z-index: 10;
  background-color: #302058;
  color: #ffffff;
}
</code>```

html:

```<code><div id="fulldiv">
  <div id="browserhead">Title</div>

</div>
</code>```

I'm very new to much of coding, and I'm not the best at explaining what I mean, so my apologies if this doesn't make sense to anybody.

Body:
I was playing around with javascript, css, + html and I want to make a div that shows only a section of a separate full image (Similar to how a "layer mask" would in digital art). Is there any way that I could do this?

My code looks like this:

css:

#fulldiv {
  position: absolute;
  z-index: 9;
  border: 2px solid #302058;
  text-align: center;
  height: 150px;
}

#browserhead {
  width: 100px;
  padding: 5px;
  z-index: 10;
  background-color: #302058;
  color: #ffffff;
}

html:

Title

I'm very new to much of coding, and I'm not the best at explaining what I mean, so my apologies if this doesn't make sense to anybody.


问:
Activity not moving to another activty in android studio
```<code>package com.example.bookapp;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Patterns;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.example.bookapp.databinding.ActivityLoginBinding;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

public class LoginActivity extends AppCompatActivity {

    private ActivityLoginBinding binding;
    private FirebaseAuth firebaseAuth;
    private ProgressDialog progressDialog;

    private Button BtnLogin;
    private EditText TxtEmail;
    private EditText TxtPassword;
    private TextView singUp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        firebaseAuth = firebaseAuth.getInstance();
        progressDialog = new ProgressDialog(this);
        progressDialog.setTitle("Please wait");
        progressDialog.setCanceledOnTouchOutside(false);

        BtnLogin =(Button) findViewById(R.id.loginBtn);
        singUp =(TextView) findViewById(R.id.noAccountTv);

        singUp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view)
            {
                Intent i = new Intent(LoginActivity.this, RegisterActivity.class);
                startActivity(i);
            }
        });

        BtnLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view)
            {
                validateData();
            }
        });
    }

    private String email = "", password = "";

    private void validateData() {
        TxtEmail =(EditText) findViewById(R.id.emailet);
        email =TxtEmail.getText().toString().trim();

        TxtPassword = (EditText) findViewById(R.id.passwordet);
        password = TxtPassword.getText().toString().trim();

        if(!Patterns.EMAIL_ADDRESS.matcher(email).matches())
        {
            Toast.makeText(this, "Invalid Email Pattern..!", Toast.LENGTH_SHORT).show();
        }
        else if(TextUtils.isEmpty(password))
        {
            Toast.makeText(this,"Please enter password",Toast.LENGTH_SHORT).show();
        }
        else
        {
            loginUser();
        }
    }

    private void loginUser()
    {
        progressDialog.setMessage("Logging In");
        progressDialog.show();

        firebaseAuth.signInWithEmailAndPassword(email,password)
                .addOnSuccessListener(new OnSuccessListener<AuthResult>() {
                    @Override
                    public void onSuccess(AuthResult authResult) {
                    checkUser();
                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure( Exception e) {
                    progressDialog.dismiss();
                    Toast.makeText(LoginActivity.this,""+e.getMessage(),Toast.LENGTH_SHORT).show();
                    }
                });
    }

    private void checkUser()
    {
        progressDialog.setMessage("Checking User..");
        FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
        DatabaseReference ref  = FirebaseDatabase.getInstance().getReference("Users");
        ref.child(firebaseUser.getUid())
                .addListenerForSingleValueEvent(new ValueEventListener() {
                    @Override

                    public void onDataChange(DataSnapshot snapshot)
                    {
                        progressDialog.dismiss();
                        String userType = ""+snapshot.child("userType").getValue();
                    if(userType.equals("user"))
                    {
                        Intent i = new Intent(LoginActivity.this,DashboardUserActivity.class);
                        startActivity(i);
                        finish();
                    }
                    else if(userType.equals("admin"))
                    {
                        Intent i = new Intent(LoginActivity.this,DashboardAdminActivity.class);
                        startActivity(i);
                        finish();
                    }
                    }
                    @Override
                    public void onCancelled(DatabaseError error) {

                    }
                });
    }

}
</code>```

Application is unable to move to the DashboardAdminActivity/DashboardUserActivity while progressbar is showing & email and password validation is also working, but it's not going to the next activities according to the "usertype".
I also tried intent another way, but it's not working, if you guys can find any error/correction in my code, it would be appreciated.

Body:
package com.example.bookapp;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Patterns;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.example.bookapp.databinding.ActivityLoginBinding;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

public class LoginActivity extends AppCompatActivity {

    private ActivityLoginBinding binding;
    private FirebaseAuth firebaseAuth;
    private ProgressDialog progressDialog;

    private Button BtnLogin;
    private EditText TxtEmail;
    private EditText TxtPassword;
    private TextView singUp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        firebaseAuth = firebaseAuth.getInstance();
        progressDialog = new ProgressDialog(this);
        progressDialog.setTitle("Please wait");
        progressDialog.setCanceledOnTouchOutside(false);

        BtnLogin =(Button) findViewById(R.id.loginBtn);
        singUp =(TextView) findViewById(R.id.noAccountTv);

        singUp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view)
            {
                Intent i = new Intent(LoginActivity.this, RegisterActivity.class);
                startActivity(i);
            }
        });

        BtnLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view)
            {
                validateData();
            }
        });
    }

    private String email = "", password = "";

    private void validateData() {
        TxtEmail =(EditText) findViewById(R.id.emailet);
        email =TxtEmail.getText().toString().trim();

        TxtPassword = (EditText) findViewById(R.id.passwordet);
        password = TxtPassword.getText().toString().trim();

        if(!Patterns.EMAIL_ADDRESS.matcher(email).matches())
        {
            Toast.makeText(this, "Invalid Email Pattern..!", Toast.LENGTH_SHORT).show();
        }
        else if(TextUtils.isEmpty(password))
        {
            Toast.makeText(this,"Please enter password",Toast.LENGTH_SHORT).show();
        }
        else
        {
            loginUser();
        }
    }

    private void loginUser()
    {
        progressDialog.setMessage("Logging In");
        progressDialog.show();

        firebaseAuth.signInWithEmailAndPassword(email,password)
                .addOnSuccessListener(new OnSuccessListener<AuthResult>() {
                    @Override
                    public void onSuccess(AuthResult authResult) {
                    checkUser();
                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure( Exception e) {
                    progressDialog.dismiss();
                    Toast.makeText(LoginActivity.this,""+e.getMessage(),Toast.LENGTH_SHORT).show();
                    }
                });
    }

    private void checkUser()
    {
        progressDialog.setMessage("Checking User..");
        FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
        DatabaseReference ref  = FirebaseDatabase.getInstance().getReference("Users");
        ref.child(firebaseUser.getUid())
                .addListenerForSingleValueEvent(new ValueEventListener() {
                    @Override

                    public void onDataChange(DataSnapshot snapshot)
                    {
                        progressDialog.dismiss();
                        String userType = ""+snapshot.child("userType").getValue();
                    if(userType.equals("user"))
                    {
                        Intent i = new Intent(LoginActivity.this,DashboardUserActivity.class);
                        startActivity(i);
                        finish();
                    }
                    else if(userType.equals("admin"))
                    {
                        Intent i = new Intent(LoginActivity.this,DashboardAdminActivity.class);
                        startActivity(i);
                        finish();
                    }
                    }
                    @Override
                    public void onCancelled(DatabaseError error) {

                    }
                });
    }

}

Application is unable to move to the DashboardAdminActivity/DashboardUserActivity while progressbar is showing & email and password validation is also working, but it's not going to the next activities according to the "usertype".
I also tried intent another way, but it's not working, if you guys can find any error/correction in my code, it would be appreciated.


问:
 whose size overflows its parent but respects the padding of its parent's parent
My page has a structure like

```<code><body>
    <div class="outer">
        Some text
        <div class="inner">
            More text
        </div>
    </div>
</body>
</code>```

The outer
 is sized using max-width, and I would like the inner
 to have a width of 150%, so it pokes out of its parent to the right. However, if the browser window is narrow, then I want to clamp the inner
's width so that it still obeys the padding on the  element.

The following snippet achieves my desired behavior:

When the browser is very wide, the orange box is 150% the size of the aquamarine box.

When the browser is somewhat narrower, the orange box shrinks so that its right edge is 100px from the right edge of the browser window. (Note that this 100px matches the 100px padding of the body.)

When the browser is very narrow, so that the aquamarine box extends all the way to the right edge, the orange box also extends all the way to the right edge.

However, I find my solution inadequate because it relies on a manual calculation that depends on the padding, border, and margin settings of the  and outer
 elements. It therefore very hard to maintain. Is there a way to simply tell the inner
 "overflow, but obey the padding settings on the  element"?

* {
  padding: 0;
  margin: 0;
}

body {
  padding: 100px;
}

.outer {
  padding: 80px;
  border: 10px solid black;
  max-width: 600px;
  background-color: aquamarine;
}

.inner {
  background-color: orange;
  width: 150%;
  /*
            max-width = (viewport width)
                        - 2 * (body padding)
                        - 1 * (.outer border)
                        - 1 * (.outer padding)

            I'm trying to avoid this manual calculation
            */
  max-width: calc(100vw - 290px);
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./style.css">
</head>

<body>
  <div class="outer">
    This element has a max width of 600px.
    <div class="inner">
      This element should be 150% the width of its parent, unless doing so causes it to overflow, in which case it should be as big as possible while still obeying the padding on the body. Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ullam, aperiam
      excepturi accusantium neque dolores consequatur hic repellendus doloribus inventore dolore fugit ipsum minima nostrum rerum. Id possimus voluptates ipsam rem.
    </div>
  </div>
</body>

</html></code>```

Title: <div> whose size overflows its parent but respects the padding of its parent's parent

Body:
My page has a structure like

        Some text

            More text

The outer
 is sized using max-width, and I would like the inner
 to have a width of 150%, so it pokes out of its parent to the right. However, if the browser window is narrow, then I want to clamp the inner
's width so that it still obeys the padding on the  element.

The following snippet achieves my desired behavior:

When the browser is very wide, the orange box is 150% the size of the aquamarine box.

When the browser is somewhat narrower, the orange box shrinks so that its right edge is 100px from the right edge of the browser window. (Note that this 100px matches the 100px padding of the body.)

When the browser is very narrow, so that the aquamarine box extends all the way to the right edge, the orange box also extends all the way to the right edge.

However, I find my solution inadequate because it relies on a manual calculation that depends on the padding, border, and margin settings of the  and outer
 elements. It therefore very hard to maintain. Is there a way to simply tell the inner
 "overflow, but obey the padding settings on the  element"?

* {
  padding: 0;
  margin: 0;
}

body {
  padding: 100px;
}

.outer {
  padding: 80px;
  border: 10px solid black;
  max-width: 600px;
  background-color: aquamarine;
}

.inner {
  background-color: orange;
  width: 150%;
  /*
            max-width = (viewport width)
                        - 2 * (body padding)
                        - 1 * (.outer border)
                        - 1 * (.outer padding)

            I'm trying to avoid this manual calculation
            */
  max-width: calc(100vw - 290px);
}

<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./style.css">

    This element has a max width of 600px.

      This element should be 150% the width of its parent, unless doing so causes it to overflow, in which case it should be as big as possible while still obeying the padding on the body. Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ullam, aperiam
      excepturi accusantium neque dolores consequatur hic repellendus doloribus inventore dolore fugit ipsum minima nostrum rerum. Id possimus voluptates ipsam rem.


问:
implementing obj-rs example to glium
I am trying to load a model into glium, I am using crate obj-rs for this. My model works fine with this example. Unfortunately whenever I try to move code from the example to my project (which is basically code copied from here) I fail with an error:

error[E0277]: the trait bound `glium::Display: glium::backend::Facade` is not satisfied
   --> src/main.rs:27:32
    |
27  |     let vb = obj.vertex_buffer(&display)?;
    |                  ------------- ^^^^^^^^ the trait `glium::backend::Facade` is not implemented for `glium::Display`
    |                  |
    |                  required by a bound introduced by this call
    |
    = help: the trait `glium::backend::Facade` is implemented for `Rc<glium::context::Context>`
note: required by a bound in `obj::glium_support::<impl Obj<V, I>>::vertex_buffer`
   --> /Users/user/project/obj-rs/src/lib.rs:309:33
    |
309 |         pub fn vertex_buffer<F: Facade>(
    |                                 ^^^^^^ required by this bound in `obj::glium_support::<impl Obj<V, I>>::vertex_buffer`

error[E0277]: the trait bound `glium::Display: glium::backend::Facade` is not satisfied
   --> src/main.rs:28:31
    |
28  |     let ib = obj.index_buffer(&display)?;
    |                  ------------ ^^^^^^^^ the trait `glium::backend::Facade` is not implemented for `glium::Display`
    |                  |
    |                  required by a bound introduced by this call
    |
    = help: the trait `glium::backend::Facade` is implemented for `Rc<glium::context::Context>`
note: required by a bound in `obj::glium_support::<impl Obj<V, I>>::index_buffer`
   --> /Users/user/project/obj-rs/src/lib.rs:317:32
    |
317 |         pub fn index_buffer<F: Facade>(
    |                                ^^^^^^ required by this bound in `obj::glium_support::<impl Obj<V, I>>::index_buffer`
```
<p>I am new to rust so most of the time I don't know what I am doing. I find it really hard to simply make copied code work. I tried implementing Facade for Display but that didn't seem to make any difference, just more errors. Could you tell me what's wrong, or at least provide me with an example that works, I just want to add my own models to glium examples.</p>
<p>Here are the parts of code that I changed:</p>
```fn main() -> Result<(), Box<dyn std::error::Error>>{
    #[allow(unused_imports)]
    use glium::{glutin, Surface};
    use obj::{load_obj, Obj};
    use glium::glutin::dpi::LogicalSize;

    let event_loop = glutin::event_loop::EventLoop::new();
    let window = glutin::window::WindowBuilder::new()
        .with_inner_size(LogicalSize::new(500.0, 400.0))
        .with_title("obj-rs");

    let context = glutin::ContextBuilder::new().with_depth_buffer(24);
    let display = glium::Display::new(window, context, &event_loop)?;

    let input = include_bytes!("model.obj");
    let obj: Obj = load_obj(&input[..])?;

    //two lines causing the problem
    //let vb = obj.vertex_buffer(&display)?;
    //let ib = obj.index_buffer(&display)?;

    let positions = glium::VertexBuffer::new(&display, &teapot::VERTICES).unwrap();
    ..... rest is the same as in the glium example
```
<p>One thing that I would like to differ from obj-rs example is not to use local source if you know what I mean. Basically something like this:</p>
<pre class="lang-ini prettyprint-override"><code>[dependencies]
glium = "*"
obj-rs = { version = "*", features = ["glium"] }
</code>```

Title: implementing obj-rs example to glium

Body:
I am trying to load a model into glium, I am using crate obj-rs for this. My model works fine with this example. Unfortunately whenever I try to move code from the example to my project (which is basically code copied from here) I fail with an error:

error[E0277]: the trait bound `glium::Display: glium::backend::Facade` is not satisfied
   --> src/main.rs:27:32
    |
27  |     let vb = obj.vertex_buffer(&display)?;
    |                  ------------- ^^^^^^^^ the trait `glium::backend::Facade` is not implemented for `glium::Display`
    |                  |
    |                  required by a bound introduced by this call
    |
    = help: the trait `glium::backend::Facade` is implemented for `Rc<glium::context::Context>`
note: required by a bound in `obj::glium_support::<impl Obj<V, I>>::vertex_buffer`
   --> /Users/user/project/obj-rs/src/lib.rs:309:33
    |
309 |         pub fn vertex_buffer<F: Facade>(
    |                                 ^^^^^^ required by this bound in `obj::glium_support::<impl Obj<V, I>>::vertex_buffer`

error[E0277]: the trait bound `glium::Display: glium::backend::Facade` is not satisfied
   --> src/main.rs:28:31
    |
28  |     let ib = obj.index_buffer(&display)?;
    |                  ------------ ^^^^^^^^ the trait `glium::backend::Facade` is not implemented for `glium::Display`
    |                  |
    |                  required by a bound introduced by this call
    |
    = help: the trait `glium::backend::Facade` is implemented for `Rc<glium::context::Context>`
note: required by a bound in `obj::glium_support::<impl Obj<V, I>>::index_buffer`
   --> /Users/user/project/obj-rs/src/lib.rs:317:32
    |
317 |         pub fn index_buffer<F: Facade>(
    |                                ^^^^^^ required by this bound in `obj::glium_support::<impl Obj<V, I>>::index_buffer`

I am new to rust so most of the time I don't know what I am doing. I find it really hard to simply make copied code work. I tried implementing Facade for Display but that didn't seem to make any difference, just more errors. Could you tell me what's wrong, or at least provide me with an example that works, I just want to add my own models to glium examples.

Here are the parts of code that I changed:

fn main() -> Result<(), Box<dyn std::error::Error>>{
    #[allow(unused_imports)]
    use glium::{glutin, Surface};
    use obj::{load_obj, Obj};
    use glium::glutin::dpi::LogicalSize;

    let event_loop = glutin::event_loop::EventLoop::new();
    let window = glutin::window::WindowBuilder::new()
        .with_inner_size(LogicalSize::new(500.0, 400.0))
        .with_title("obj-rs");

    let context = glutin::ContextBuilder::new().with_depth_buffer(24);
    let display = glium::Display::new(window, context, &event_loop)?;

    let input = include_bytes!("model.obj");
    let obj: Obj = load_obj(&input[..])?;

    //two lines causing the problem
    //let vb = obj.vertex_buffer(&display)?;
    //let ib = obj.index_buffer(&display)?;

    let positions = glium::VertexBuffer::new(&display, &teapot::VERTICES).unwrap();
    ..... rest is the same as in the glium example

One thing that I would like to differ from obj-rs example is not to use local source if you know what I mean. Basically something like this:

[dependencies]
glium = "*"
obj-rs = { version = "*", features = ["glium"] }


问:
Tensorflow Keras custom layer: prediction is fast but training is very slow
I'm trying to make my own simple RNN layer. The forward pass works pretty fast (when I tested it on train or test set, it finishes in a few seconds), but training is very slow (says ETA 30 min). The training seems to work though: if I lower the parameters and leave it, I can see accuracy slowly improves.

If I switch to keras LSTM, the training is fast, so I think there is something wrong with my custom layer's implementation.

Here is my RNN Layer:

```<code>class MyRNNLayer(tf.keras.layers.Layer):
    def __init__(self, units):
        super().__init__()
        self.units = units

    def build(self, input_shape):
        # input_shape: (batch_size, # timesteps, input_dim)
        assert len(input_shape) == 3
        self.w_state = self.add_weight(shape=(self.units, self.units), initializer="random_normal", trainable=True)
        self.w_input = self.add_weight(shape=(self.units, input_shape[-1]), initializer="random_normal", trainable=True)
        self.b = self.add_weight(shape=(self.units,), initializer="random_normal", trainable=True)

    def call(self, inputs):
        state = tf.zeros((tf.shape(inputs)[0], self.units))
        for i in range(tf.shape(inputs)[1]):
            state = tf.nn.tanh(
                tf.transpose(tf.matmul(self.w_state, tf.transpose(state)))
                + tf.transpose(tf.matmul(self.w_input, tf.transpose(tf.gather(inputs, i, axis=1))))
                + self.b
            )
            # state shape is correct: 32 x 8, throughout the loop
            # tf.print(tf.shape(state))
        return state
</code>```

Data preprocessing:

```<code>(x_train, y_train), (x_test, y_test) = tf.keras.datasets.imdb.load_data(num_words = 2000)
x_train = tf.keras.preprocessing.sequence.pad_sequences(x_train, maxlen=80)
x_test = tf.keras.preprocessing.sequence.pad_sequences(x_test, maxlen=80)
</code>```

Model:

```<code>model = tf.keras.models.Sequential([
    tf.keras.layers.Embedding(2000, 128),
    MyRNNLayer(8),
    # tf.keras.layers.LSTM(8),
    tf.keras.layers.Dense(1, activation="sigmoid"),
])
</code>```

Test forward pass (finishes in a few seconds):

```<code>print(model(x_test))
</code>```

Training (slow, ETA 30 min, takes a few seconds per batch)

```<code>model.compile(
    loss="binary_crossentropy",
    optimizer="adam",
    metrics=["accuracy"],
)
model.fit(x_train, y_train, validation_data=(x_test, y_test), batch_size=32, epochs=1)
</code>```

What is making my training so slow? Is there a tf method I used during call that is very un-performant during the gradient backward pass?

Body:
I'm trying to make my own simple RNN layer. The forward pass works pretty fast (when I tested it on train or test set, it finishes in a few seconds), but training is very slow (says ETA 30 min). The training seems to work though: if I lower the parameters and leave it, I can see accuracy slowly improves.

If I switch to keras LSTM, the training is fast, so I think there is something wrong with my custom layer's implementation.

Here is my RNN Layer:

class MyRNNLayer(tf.keras.layers.Layer):
    def __init__(self, units):
        super().__init__()
        self.units = units

    def build(self, input_shape):
        # input_shape: (batch_size, # timesteps, input_dim)
        assert len(input_shape) == 3
        self.w_state = self.add_weight(shape=(self.units, self.units), initializer="random_normal", trainable=True)
        self.w_input = self.add_weight(shape=(self.units, input_shape[-1]), initializer="random_normal", trainable=True)
        self.b = self.add_weight(shape=(self.units,), initializer="random_normal", trainable=True)

    def call(self, inputs):
        state = tf.zeros((tf.shape(inputs)[0], self.units))
        for i in range(tf.shape(inputs)[1]):
            state = tf.nn.tanh(
                tf.transpose(tf.matmul(self.w_state, tf.transpose(state)))
                + tf.transpose(tf.matmul(self.w_input, tf.transpose(tf.gather(inputs, i, axis=1))))
                + self.b
            )
            # state shape is correct: 32 x 8, throughout the loop
            # tf.print(tf.shape(state))
        return state

Data preprocessing:

(x_train, y_train), (x_test, y_test) = tf.keras.datasets.imdb.load_data(num_words = 2000)
x_train = tf.keras.preprocessing.sequence.pad_sequences(x_train, maxlen=80)
x_test = tf.keras.preprocessing.sequence.pad_sequences(x_test, maxlen=80)

Model:

model = tf.keras.models.Sequential([
    tf.keras.layers.Embedding(2000, 128),
    MyRNNLayer(8),
    # tf.keras.layers.LSTM(8),
    tf.keras.layers.Dense(1, activation="sigmoid"),
])

Test forward pass (finishes in a few seconds):

print(model(x_test))

Training (slow, ETA 30 min, takes a few seconds per batch)

model.compile(
    loss="binary_crossentropy",
    optimizer="adam",
    metrics=["accuracy"],
)
model.fit(x_train, y_train, validation_data=(x_test, y_test), batch_size=32, epochs=1)

What is making my training so slow? Is there a tf method I used during call that is very un-performant during the gradient backward pass?


问:
How to create 1 second video files from original
i'm trying to create 1 second video files from the original using ffmpeg.  i'm using this command:

ffmpeg -i "video.mp4" -c copy -map 0 -segment_time 00:00:01 -f segment -reset_timestamps 1 output%03d.mp4

it creates the files but many of the output files are longer than 1 second duration.  is there a better or more accurate way to create these 1 second segments?


问:
90º rotated textview gets size to display text as the horizontal space
I have a textview where I want to show text in vertical (just like rotated 90º). With android:rotation="-90" you can get this.

If the text would have no rotation, and you would like to fit a sentence, you would first look at the width of the textview, since text will try to be in 1 line. Since I rotate the text, here I expect to see the height of the object. However, Android is still considering the width. I need to fix the size of the width, but this causes me a problem for the text: Although the textview has a big vertical dimension and text would fit, Android thinks it needs to use the width to calculate the available space. At the end this causes me overflow of the text, appearing for example, just one word as multiple lines of 1 char.

How can I make android to understand that the space for the lenght to fit the text is now the vertical, instead of the horizontal?


问:
Why doesn't ofstream create a new file?
I have a problem where ofstream isn't creating a text file. I compile and run the program just fine with no errors and I am 100 percent certain that I am in the right directory and that there are no spelling mistakes or errors. What is strange is when I move my program to my C drive or onedrive folder, then the text file is created, it just doesn't work in any of my other folders. I don't know what the problem is and I have scoured the internet for the past couple hours trying to find a solution, but I think it has something to do with my file permissions perhaps?

Here is my code, it's just a really simple program:

```<code>#include <iostream>
#include <fstream>

using namespace std;

int main() {

    ofstream myfile;
    myfile.open("newnumbers.txt");

}
</code>```

Title: Why doesn't ofstream create a new file?

Body:
I have a problem where ofstream isn't creating a text file. I compile and run the program just fine with no errors and I am 100 percent certain that I am in the right directory and that there are no spelling mistakes or errors. What is strange is when I move my program to my C drive or onedrive folder, then the text file is created, it just doesn't work in any of my other folders. I don't know what the problem is and I have scoured the internet for the past couple hours trying to find a solution, but I think it has something to do with my file permissions perhaps?

Here is my code, it's just a really simple program:

#include <iostream>
#include <fstream>

using namespace std;

int main() {

    ofstream myfile;
    myfile.open("newnumbers.txt");

}


问:
Find neighborhood with given max level
I need to get all nodes that belongs to the neighborhood of selected node. For example if given level equals 1 the result for graph below should be [black, red, red, red, red], if level equals 2 [black, red, red, red, red, green, green, green, green, green, green, green, green] etc.

I tried some recursion, but it works a bit like DFS and because the stop criterion was depth <= max_level it was skipping some nodes that should be included.

def get_neighborhood(node, edges, neighborhood_level, depth, nodes_acc):
    neighbors_filter = np.where(edges[1] == node)
    all_neighbors    = edges[0][neighbors_filter]
    neighbors        = all_neighbors[check_if_not_in(all_neighbors, nodes_acc)]

    if depth == neighborhood_level:
        return nodes_acc

    for neighbor in neighbors:
        nodes_acc = torch.unique(torch.cat((nodes_acc, torch.Tensor([neighbor]))))

    for neighbor in neighbors:
        nodes_acc = torch.unique(torch.cat((nodes_acc, get_neighborhood(neighbor, edges, neighborhood_level, depth + 1, nodes_acc))))

    return nodes_acc

```
<ul>
<li>node:</li>
</ul>
```tensor(some_id)
```
<ul>
<li>edges:</li>
</ul>
```tensor([[source, source, source, ..., source, source],
        [target, target, target, ..., target, target]])
```

I would really appreciate any tip. Input data doesn't have to be torch.Tensor. It could be numpy.array or plain list as well. I can convert that later :)

Thanks!

Title: Find neighborhood with given max level

Body:
I need to get all nodes that belongs to the neighborhood of selected node. For example if given level equals 1 the result for graph below should be [black, red, red, red, red], if level equals 2 [black, red, red, red, red, green, green, green, green, green, green, green, green] etc.

I tried some recursion, but it works a bit like DFS and because the stop criterion was depth <= max_level it was skipping some nodes that should be included.

def get_neighborhood(node, edges, neighborhood_level, depth, nodes_acc):
    neighbors_filter = np.where(edges[1] == node)
    all_neighbors    = edges[0][neighbors_filter]
    neighbors        = all_neighbors[check_if_not_in(all_neighbors, nodes_acc)]

    if depth == neighborhood_level:
        return nodes_acc

    for neighbor in neighbors:
        nodes_acc = torch.unique(torch.cat((nodes_acc, torch.Tensor([neighbor]))))

    for neighbor in neighbors:
        nodes_acc = torch.unique(torch.cat((nodes_acc, get_neighborhood(neighbor, edges, neighborhood_level, depth + 1, nodes_acc))))

    return nodes_acc

node:

tensor(some_id)

edges:

tensor([[source, source, source, ..., source, source],
        [target, target, target, ..., target, target]])

I would really appreciate any tip. Input data doesn't have to be torch.Tensor. It could be numpy.array or plain list as well. I can convert that later :)

Thanks!