问:
Plotting timestamps as string vs. datetime object
I am observing some strange behavior when plotting a column from my Pandas dataframe.

My data looks like the following:

```<code>    value   timestamp
0   67  2023-01-04T05:17:49+00:00
1   67  2023-01-04T05:27:57+00:00
2   66  2023-01-04T05:28:01+00:00
3   81  2023-01-04T05:28:19+00:00
4   67  2023-01-04T05:33:02+00:00
... ... ...
102 73  2023-01-04T22:22:04+00:00
103 76  2023-01-04T22:26:59+00:00
104 77  2023-01-04T22:27:12+00:00
105 75  2023-01-04T22:27:13+00:00
106 73  2023-01-04T22:32:35+00:00
</code>```

Now comes the fun part:

I convert the timestamp column to a pandas datetime object with: df['timestamp_dt'] = pd.to_datetime(df['timestamp']). I create a new column so you can observe the behavior.

I then plot both of the column with seaborn:

```<code>#Plot where timestamp is "String"
sns.lineplot(data=df, x="timestamp", y="bpm")
plt.show()
</code>```

```<code>#Plot where timestamp is "dattime object"
sns.lineplot(data=df, x="timestamp_dt", y="bpm")
plt.show()
</code>```

As you can see, converting the timestamps into datetime object results in a weird behavior of the graph.

Why is this and how can I convert the timestamps and have a normal looking graph?

I have looked at the following solution, which suggests adding a format. However I was not able to solve it that way.

Why does changing "Date" column to datetime ruin graph?

Body:
I am observing some strange behavior when plotting a column from my Pandas dataframe.

My data looks like the following:

    value   timestamp
0   67  2023-01-04T05:17:49+00:00
1   67  2023-01-04T05:27:57+00:00
2   66  2023-01-04T05:28:01+00:00
3   81  2023-01-04T05:28:19+00:00
4   67  2023-01-04T05:33:02+00:00
... ... ...
102 73  2023-01-04T22:22:04+00:00
103 76  2023-01-04T22:26:59+00:00
104 77  2023-01-04T22:27:12+00:00
105 75  2023-01-04T22:27:13+00:00
106 73  2023-01-04T22:32:35+00:00

Now comes the fun part:

I convert the timestamp column to a pandas datetime object with: df['timestamp_dt'] = pd.to_datetime(df['timestamp']). I create a new column so you can observe the behavior.

I then plot both of the column with seaborn:

#Plot where timestamp is "String"
sns.lineplot(data=df, x="timestamp", y="bpm")
plt.show()

#Plot where timestamp is "dattime object"
sns.lineplot(data=df, x="timestamp_dt", y="bpm")
plt.show()

As you can see, converting the timestamps into datetime object results in a weird behavior of the graph.

Why is this and how can I convert the timestamps and have a normal looking graph?

I have looked at the following solution, which suggests adding a format. However I was not able to solve it that way.

Why does changing "Date" column to datetime ruin graph?


来源: stackexchange

问:
gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
I'm running Django rest api with the django 3.2 on GCPUbuntu 20.04.5 LTS (GNU/Linux 5.15.0-1025-gcp x86_64). I'm getting an error when i run my docker containers. I need to use GDAL in one of my project modules. I'm pasting log from one the the containers my-api-webserver. There are 2 other containers running worker and scheduler servers which display the same errors.

gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'

The following is the detailed trace :

my-api-webserver |   error: subprocess-exited-with-error
my-api-webserver |
my-api-webserver |   × python setup.py egg_info did not run successfully.
my-api-webserver |   │ exit code: 1
my-api-webserver |   ╰─> [125 lines of output]
my-api-webserver |       running egg_info
my-api-webserver |       creating /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info
my-api-webserver |       writing /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/PKG-INFO
my-api-webserver |       writing dependency_links to /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/dependency_links.txt
my-api-webserver |       writing requirements to /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/requires.txt
my-api-webserver |       writing top-level names to /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/top_level.txt
my-api-webserver |       writing manifest file '/tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/SOURCES.txt'
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 121, in fetch_config
my-api-webserver |           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
my-api-webserver |           self._execute_child(args, executable, preexec_fn, close_fds,
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
my-api-webserver |           raise child_exception_type(errno_num, err_msg, err_filename)
my-api-webserver |       FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 205, in get_gdal_config
my-api-webserver |           return fetch_config(option, gdal_config=self.gdal_config)
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 124, in fetch_config
my-api-webserver |           raise gdal_config_error(e)
my-api-webserver |       __main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 121, in fetch_config
my-api-webserver |           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
my-api-webserver |           self._execute_child(args, executable, preexec_fn, close_fds,
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
my-api-webserver |           raise child_exception_type(errno_num, err_msg, err_filename)
my-api-webserver |       FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 212, in get_gdal_config
my-api-webserver |           return fetch_config(option)
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 124, in fetch_config
my-api-webserver |           raise gdal_config_error(e)
my-api-webserver |       __main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "<string>", line 2, in <module>
my-api-webserver |         File "<pip-setuptools-caller>", line 34, in <module>
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 414, in <module>
my-api-webserver |           setup(**setup_kwargs)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
my-api-webserver |           return distutils.core.setup(**attrs)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
my-api-webserver |           return run_commands(dist)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
my-api-webserver |           dist.run_commands()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
my-api-webserver |           self.run_command(cmd)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command
my-api-webserver |           super().run_command(command)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
my-api-webserver |           cmd_obj.run()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 308, in run
my-api-webserver |           self.find_sources()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 316, in find_sources
my-api-webserver |           mm.run()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 560, in run
my-api-webserver |           self.add_defaults()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 597, in add_defaults
my-api-webserver |           sdist.add_defaults(self)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/sdist.py", line 106, in add_defaults
my-api-webserver |           super().add_defaults()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 252, in add_defaults
my-api-webserver |           self._add_defaults_ext()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
my-api-webserver |           build_ext = self.get_finalized_command('build_ext')
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 305, in get_finalized_command
my-api-webserver |           cmd_obj.ensure_finalized()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
my-api-webserver |           self.finalize_options()
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 275, in finalize_options
my-api-webserver |           self.gdaldir = self.get_gdal_config('prefix')
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 218, in get_gdal_config
my-api-webserver |           raise gdal_config_error(traceback_string + '\n' + msg)
my-api-webserver |       __main__.gdal_config_error: Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 121, in fetch_config
my-api-webserver |           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
my-api-webserver |           self._execute_child(args, executable, preexec_fn, close_fds,
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
my-api-webserver |           raise child_exception_type(errno_num, err_msg, err_filename)
my-api-webserver |       FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 205, in get_gdal_config
my-api-webserver |           return fetch_config(option, gdal_config=self.gdal_config)
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 124, in fetch_config
my-api-webserver |           raise gdal_config_error(e)
my-api-webserver |       gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 121, in fetch_config
my-api-webserver |           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
my-api-webserver |           self._execute_child(args, executable, preexec_fn, close_fds,
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
my-api-webserver |           raise child_exception_type(errno_num, err_msg, err_filename)
my-api-webserver |       FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 212, in get_gdal_config
my-api-webserver |           return fetch_config(option)
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 124, in fetch_config
my-api-webserver |           raise gdal_config_error(e)
my-api-webserver |       gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
my-api-webserver |
my-api-webserver |       Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
my-api-webserver |       [end of output]
my-api-webserver |
my-api-webserver |   note: This error originates from a subprocess, and is likely not a problem with pip.
my-api-webserver | error: metadata-generation-failed
my-api-webserver |
my-api-webserver | × Encountered error while generating package metadata.
my-api-webserver | ╰─> See above for output.
my-api-webserver |
my-api-webserver | note: This is an issue with the package mentioned above, not pip.
my-api-webserver | hint: See above for details.```
</div>
</div>
</p>
<p>This is my docker file :</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>FROM python:3.8.14

RUN apt-get -y update && apt-get -y upgrade && apt-get install -y ffmpeg && apt install libgdal-dev --upgrade
RUN export CPLUS_INCLUDE_PATH=/usr/include/gdal
RUN export C_INCLUDE_PATH=/usr/include/gdal
COPY wait-for-it.sh /wait-for-it.sh

# Copy any files over
COPY entrypoint.sh /entrypoint.sh

# Copy any files over
COPY bootstrap_development_data.sh /bootstrap_development_data.sh

# Change permissions
RUN chmod +x /entrypoint.sh
RUN chmod +x /bootstrap_development_data.sh
RUN chmod +x /wait-for-it.sh
RUN groupadd -r docker && useradd -r -g docker earthling
RUN chown -R earthling /root/

ENTRYPOINT ["/entrypoint.sh"]

COPY requirements.txt /requirements.txt
RUN pip3 install --upgrade pip setuptools wheel
RUN pip3 install -r /requirements.txt
RUN yes | pip uninstall django-rq-scheduler
RUN yes | pip install -U django-rq-scheduler

VOLUME ["/opt/my-api"]

EXPOSE 80

CMD ["python", "manage.py", "runserver", "0.0.0.0:80"]</code>```

I have separately also done the following :

```<code>sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin --upgrade
sudo apt remove gdal-bin
sudo apt install libgdal-dev --upgrade
sudo apt remove libgdal-dev
</code>```

After the above, when i run :

```<code>gdal-config --version
Result : 3.3.2
</code>```

This is my requirements.txt

aioredis==1.3.1
appdirs==1.4.4
asgiref==3.5.2
async-timeout==4.0.2
attrs==22.1.0
autobahn==22.7.1
Automat==20.2.0
bandit==1.7.4
babel==2.11.0
beautifulsoup4==4.11.1
boto3==1.26.41
botocore==1.29.41
certifi==2022.9.14
cffi==1.15.1
channels==3.0.5
channels-redis==3.4.1
chardet==5.0.0
click==8.1.3
colorama==0.4.5
colormath==3.0.0
constantly==15.1.0
coverage==6.4.4
croniter==1.3.7
cryptography==38.0.1
daphne==3.0.2
decorator==5.1.1
Django==3.2
django-amazon-ses==4.0.1
django-extra-views==0.14.0
django-appconf==1.0.5
django-cursor-pagination==0.2.0
django-extensions==3.2.1
django-imagekit==4.1.0
django-media-fixtures-next==1.0.1
django-model-utils==4.2.0
django-modeltranslation==0.18.4
django-nose==1.4.7
django-ordered-model==3.6
django-positions==0.6.0
django-proxy==1.2.1
django-redis==5.2.0
django-replicated==2.7
django-rq==2.5.1
django-rq-scheduler==2022.9
django-storages==1.13.1
django-utils-six==2.0
djangorestframework==3.13.1
django-widget-tweaks==1.4.12
django-haystack==3.2.1
django-treebeard==4.5.1
django-tables2==2.4.1
django-extensions==3.2.1
django-phone-verify==2.0.1
dparse==0.6.0
easy-thumbnails==2.8.4
Faker==12.0.1
feedparser==6.0.10
ffmpy==0.3.0
filelock==3.8.0
funcy==1.17
factory-boy>=3.2,<3.3
gitdb==4.0.9
GitPython==3.1.27
halo==0.0.31
hiredis==2.0.0
hyperlink==21.0.0
idna==3.4
incremental==21.3.0
jmespath==1.0.1
langdetect==1.0.9
log-symbols==0.0.14
mixer==7.2.2
msgpack==1.0.4
mysqlclient==2.1.1
natsort==8.2.0
networkx==2.8.6
nose==1.3.7
nose-exclude==0.5.0
numpy==1.23.3
onesignal-sdk==2.0.0
opencv-python==4.6.0.66
packaging==21.3
pathtools==0.1.2
pbr==5.10.0
pilkit==2.0
Pillow==9.2.0
pinocchio==0.4.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
PyJWT==2.4.0
pyOpenSSL==22.0.0
pyparsing==3.0.9
pytest-cov>=2.12,<3.1
python-dateutil==2.8.2
python-dotenv==0.21.0
python-magic==0.4.27
pytz==2022.2.1
PyYAML==6.0
purl==1.6
redis==4.3.4
requests==2.28.1
requests-file==1.5.1
rest-framework-generic-relations==2.1.0
rq==1.11.0
rq-scheduler==0.11.0
s3transfer==0.6.0
safety==2.1.1
sentry-sdk==1.9.8
service-identity==21.1.0
sgmllib3k==1.0.0
shutilwhich==1.1.0
six==1.16.0
smmap==5.0.0
soupsieve==2.3.2.post1
spectra==0.0.11
spinners==0.0.24
sqlparse==0.4.2
stevedore==4.0.0
stripe==4.1.0
sorl-thumbnail==12.9.0
termcolor==2.0.1
text-unidecode==1.3
tox>=3.23,<3.26
tldextract==3.3.1
toml==0.10.2
txaio==22.2.1
typing_extensions==4.3.0
uritools==4.0.0
url-normalize==1.4.3
urlextract==1.6.0
urllib3==1.26.12
watchdog==2.1.9
webpreview==1.7.2
whitenoise==6.2.0
zipp==3.8.1
zope.interface==5.4.0
django-cacheops==6.1.0
onesignal==0.1.3
onesignal-client==0.0.2
isort>=5.9,<5.11
flake8>=6.0.0
django-environ==0.9.0
mock==4.0.3
GDAL==3.3.2
setuptools==57.5.0

#commerce packages - development
# Excluding package already included above)

Werkzeug>=1.0,<2.1
django-debug-toolbar>=2.2,<3.6
psycopg2-binary>=2.8,<2.10

#Social-commerce packages - sandbox
Whoosh>=2.7,<2.8
pysolr==3.9.0
uWSGI>=2.0.19,<2.1

# Linting
flake8-debugger==4.1.2

# Helpers
pyprof2calltree>=1.4,<1.5
ipdb>=0.13,<0.14
ipython>=7.12,<9

# Country data
pycountry

#cli-based
colorlog==6.7.0
halo==0.0.31
requests==2.28.1
click==8.1.3```

Help appreciated !

ContentLicense: CC BY-SA 4.0

Body:
I'm running Django rest api with the django 3.2 on GCPUbuntu 20.04.5 LTS (GNU/Linux 5.15.0-1025-gcp x86_64). I'm getting an error when i run my docker containers. I need to use GDAL in one of my project modules. I'm pasting log from one the the containers my-api-webserver. There are 2 other containers running worker and scheduler servers which display the same errors.

gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'

The following is the detailed trace :

my-api-webserver |   error: subprocess-exited-with-error
my-api-webserver |
my-api-webserver |   × python setup.py egg_info did not run successfully.
my-api-webserver |   │ exit code: 1
my-api-webserver |   ╰─> [125 lines of output]
my-api-webserver |       running egg_info
my-api-webserver |       creating /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info
my-api-webserver |       writing /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/PKG-INFO
my-api-webserver |       writing dependency_links to /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/dependency_links.txt
my-api-webserver |       writing requirements to /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/requires.txt
my-api-webserver |       writing top-level names to /tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/top_level.txt
my-api-webserver |       writing manifest file '/tmp/pip-pip-egg-info-2zpklao8/GDAL.egg-info/SOURCES.txt'
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 121, in fetch_config
my-api-webserver |           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
my-api-webserver |           self._execute_child(args, executable, preexec_fn, close_fds,
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
my-api-webserver |           raise child_exception_type(errno_num, err_msg, err_filename)
my-api-webserver |       FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 205, in get_gdal_config
my-api-webserver |           return fetch_config(option, gdal_config=self.gdal_config)
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 124, in fetch_config
my-api-webserver |           raise gdal_config_error(e)
my-api-webserver |       __main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 121, in fetch_config
my-api-webserver |           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
my-api-webserver |           self._execute_child(args, executable, preexec_fn, close_fds,
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
my-api-webserver |           raise child_exception_type(errno_num, err_msg, err_filename)
my-api-webserver |       FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 212, in get_gdal_config
my-api-webserver |           return fetch_config(option)
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 124, in fetch_config
my-api-webserver |           raise gdal_config_error(e)
my-api-webserver |       __main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "<string>", line 2, in <module>
my-api-webserver |         File "<pip-setuptools-caller>", line 34, in <module>
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 414, in <module>
my-api-webserver |           setup(**setup_kwargs)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
my-api-webserver |           return distutils.core.setup(**attrs)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
my-api-webserver |           return run_commands(dist)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
my-api-webserver |           dist.run_commands()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
my-api-webserver |           self.run_command(cmd)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command
my-api-webserver |           super().run_command(command)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
my-api-webserver |           cmd_obj.run()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 308, in run
my-api-webserver |           self.find_sources()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 316, in find_sources
my-api-webserver |           mm.run()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 560, in run
my-api-webserver |           self.add_defaults()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 597, in add_defaults
my-api-webserver |           sdist.add_defaults(self)
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/command/sdist.py", line 106, in add_defaults
my-api-webserver |           super().add_defaults()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 252, in add_defaults
my-api-webserver |           self._add_defaults_ext()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
my-api-webserver |           build_ext = self.get_finalized_command('build_ext')
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 305, in get_finalized_command
my-api-webserver |           cmd_obj.ensure_finalized()
my-api-webserver |         File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
my-api-webserver |           self.finalize_options()
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 275, in finalize_options
my-api-webserver |           self.gdaldir = self.get_gdal_config('prefix')
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 218, in get_gdal_config
my-api-webserver |           raise gdal_config_error(traceback_string + '\n' + msg)
my-api-webserver |       __main__.gdal_config_error: Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 121, in fetch_config
my-api-webserver |           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
my-api-webserver |           self._execute_child(args, executable, preexec_fn, close_fds,
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
my-api-webserver |           raise child_exception_type(errno_num, err_msg, err_filename)
my-api-webserver |       FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 205, in get_gdal_config
my-api-webserver |           return fetch_config(option, gdal_config=self.gdal_config)
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 124, in fetch_config
my-api-webserver |           raise gdal_config_error(e)
my-api-webserver |       gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 121, in fetch_config
my-api-webserver |           p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
my-api-webserver |           self._execute_child(args, executable, preexec_fn, close_fds,
my-api-webserver |         File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
my-api-webserver |           raise child_exception_type(errno_num, err_msg, err_filename)
my-api-webserver |       FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
my-api-webserver |
my-api-webserver |       During handling of the above exception, another exception occurred:
my-api-webserver |
my-api-webserver |       Traceback (most recent call last):
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 212, in get_gdal_config
my-api-webserver |           return fetch_config(option)
my-api-webserver |         File "/tmp/pip-install-am7iveqp/gdal_636d6d66a9b14d6e9183a48706abd53e/setup.py", line 124, in fetch_config
my-api-webserver |           raise gdal_config_error(e)
my-api-webserver |       gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
my-api-webserver |
my-api-webserver |       Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
my-api-webserver |       [end of output]
my-api-webserver |
my-api-webserver |   note: This error originates from a subprocess, and is likely not a problem with pip.
my-api-webserver | error: metadata-generation-failed
my-api-webserver |
my-api-webserver | × Encountered error while generating package metadata.
my-api-webserver | ╰─> See above for output.
my-api-webserver |
my-api-webserver | note: This is an issue with the package mentioned above, not pip.
my-api-webserver | hint: See above for details.

This is my docker file :

FROM python:3.8.14

RUN apt-get -y update && apt-get -y upgrade && apt-get install -y ffmpeg && apt install libgdal-dev --upgrade
RUN export CPLUS_INCLUDE_PATH=/usr/include/gdal
RUN export C_INCLUDE_PATH=/usr/include/gdal
COPY wait-for-it.sh /wait-for-it.sh

# Copy any files over
COPY entrypoint.sh /entrypoint.sh

# Copy any files over
COPY bootstrap_development_data.sh /bootstrap_development_data.sh

# Change permissions
RUN chmod +x /entrypoint.sh
RUN chmod +x /bootstrap_development_data.sh
RUN chmod +x /wait-for-it.sh
RUN groupadd -r docker && useradd -r -g docker earthling
RUN chown -R earthling /root/

ENTRYPOINT ["/entrypoint.sh"]

COPY requirements.txt /requirements.txt
RUN pip3 install --upgrade pip setuptools wheel
RUN pip3 install -r /requirements.txt
RUN yes | pip uninstall django-rq-scheduler
RUN yes | pip install -U django-rq-scheduler

VOLUME ["/opt/my-api"]

EXPOSE 80

CMD ["python", "manage.py", "runserver", "0.0.0.0:80"]

I have separately also done the following :

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin --upgrade
sudo apt remove gdal-bin
sudo apt install libgdal-dev --upgrade
sudo apt remove libgdal-dev

After the above, when i run :

gdal-config --version
Result : 3.3.2

This is my requirements.txt

aioredis==1.3.1
appdirs==1.4.4
asgiref==3.5.2
async-timeout==4.0.2
attrs==22.1.0
autobahn==22.7.1
Automat==20.2.0
bandit==1.7.4
babel==2.11.0
beautifulsoup4==4.11.1
boto3==1.26.41
botocore==1.29.41
certifi==2022.9.14
cffi==1.15.1
channels==3.0.5
channels-redis==3.4.1
chardet==5.0.0
click==8.1.3
colorama==0.4.5
colormath==3.0.0
constantly==15.1.0
coverage==6.4.4
croniter==1.3.7
cryptography==38.0.1
daphne==3.0.2
decorator==5.1.1
Django==3.2
django-amazon-ses==4.0.1
django-extra-views==0.14.0
django-appconf==1.0.5
django-cursor-pagination==0.2.0
django-extensions==3.2.1
django-imagekit==4.1.0
django-media-fixtures-next==1.0.1
django-model-utils==4.2.0
django-modeltranslation==0.18.4
django-nose==1.4.7
django-ordered-model==3.6
django-positions==0.6.0
django-proxy==1.2.1
django-redis==5.2.0
django-replicated==2.7
django-rq==2.5.1
django-rq-scheduler==2022.9
django-storages==1.13.1
django-utils-six==2.0
djangorestframework==3.13.1
django-widget-tweaks==1.4.12
django-haystack==3.2.1
django-treebeard==4.5.1
django-tables2==2.4.1
django-extensions==3.2.1
django-phone-verify==2.0.1
dparse==0.6.0
easy-thumbnails==2.8.4
Faker==12.0.1
feedparser==6.0.10
ffmpy==0.3.0
filelock==3.8.0
funcy==1.17
factory-boy>=3.2,<3.3
gitdb==4.0.9
GitPython==3.1.27
halo==0.0.31
hiredis==2.0.0
hyperlink==21.0.0
idna==3.4
incremental==21.3.0
jmespath==1.0.1
langdetect==1.0.9
log-symbols==0.0.14
mixer==7.2.2
msgpack==1.0.4
mysqlclient==2.1.1
natsort==8.2.0
networkx==2.8.6
nose==1.3.7
nose-exclude==0.5.0
numpy==1.23.3
onesignal-sdk==2.0.0
opencv-python==4.6.0.66
packaging==21.3
pathtools==0.1.2
pbr==5.10.0
pilkit==2.0
Pillow==9.2.0
pinocchio==0.4.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
PyJWT==2.4.0
pyOpenSSL==22.0.0
pyparsing==3.0.9
pytest-cov>=2.12,<3.1
python-dateutil==2.8.2
python-dotenv==0.21.0
python-magic==0.4.27
pytz==2022.2.1
PyYAML==6.0
purl==1.6
redis==4.3.4
requests==2.28.1
requests-file==1.5.1
rest-framework-generic-relations==2.1.0
rq==1.11.0
rq-scheduler==0.11.0
s3transfer==0.6.0
safety==2.1.1
sentry-sdk==1.9.8
service-identity==21.1.0
sgmllib3k==1.0.0
shutilwhich==1.1.0
six==1.16.0
smmap==5.0.0
soupsieve==2.3.2.post1
spectra==0.0.11
spinners==0.0.24
sqlparse==0.4.2
stevedore==4.0.0
stripe==4.1.0
sorl-thumbnail==12.9.0
termcolor==2.0.1
text-unidecode==1.3
tox>=3.23,<3.26
tldextract==3.3.1
toml==0.10.2
txaio==22.2.1
typing_extensions==4.3.0
uritools==4.0.0
url-normalize==1.4.3
urlextract==1.6.0
urllib3==1.26.12
watchdog==2.1.9
webpreview==1.7.2
whitenoise==6.2.0
zipp==3.8.1
zope.interface==5.4.0
django-cacheops==6.1.0
onesignal==0.1.3
onesignal-client==0.0.2
isort>=5.9,<5.11
flake8>=6.0.0
django-environ==0.9.0
mock==4.0.3
GDAL==3.3.2
setuptools==57.5.0

#commerce packages - development
# Excluding package already included above)

Werkzeug>=1.0,<2.1
django-debug-toolbar>=2.2,<3.6
psycopg2-binary>=2.8,<2.10

#Social-commerce packages - sandbox
Whoosh>=2.7,<2.8
pysolr==3.9.0
uWSGI>=2.0.19,<2.1

# Linting
flake8-debugger==4.1.2

# Helpers
pyprof2calltree>=1.4,<1.5
ipdb>=0.13,<0.14
ipython>=7.12,<9

# Country data
pycountry

#cli-based
colorlog==6.7.0
halo==0.0.31
requests==2.28.1
click==8.1.3

Help appreciated !


问:
(failed)net::ERR_HTTP2_PROTOCOL_ERROR for JWT
I'm using this code in my .NET API:

```<code>jwtOptions.Events = new JwtBearerEvents()
{
    OnAuthenticationFailed = c =>
    {
        c.NoResult();

        Logger.LogException(c.Exception);

        c.Response.StatusCode = 401;
        c.Response.ContentType = "text/plain";
        if (ApiConfig.IsDeveloping)
        {
            return c.Response.WriteAsync(c.Exception.ToString());
        }
        return c.Response.WriteAsync("An error occured processing your authentication.");
    },
    OnTokenValidated = c =>
    {
        if (c.Principal.IsInRole("SuperAdmin"))
        {
            c.HttpContext.Items["IsSuperAdmin"] = true;
        }
        return Task.CompletedTask;
    }
};
</code>```

But this causes my React client to not get the errors if the authentication token is invalid.

When I look at the Chrome's Network tab, I see this error:

(failed)net::ERR_HTTP2_PROTOCOL_ERROR

What should I do? What have I done wrong in my .NET code?

Update I realized that it depends on the token that I send. If I send a totally invalid token like lkjsdlkjf then I get the 401 response. But if I use a valid JWT token from internet that is invalid for my current session, I get this error.

Update 2

This is the request/response I logged using Wireshark. Request/response seem to be fine. But Chrome or Postman cannot understand it correctly:

```<code>GET /locale/data HTTP/1.1
X-Forwarded-Host: api.admin.example.local
X-Forwarded-Proto: https
Connection: Upgrade
Host: api.admin.example.local
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
User-Agent: PostmanRuntime/7.29.2
Accept: */*
Postman-Token: 02c8e0f2-0afb-4112-8abf-c4815ea66176
Accept-Encoding: gzip, deflate, br

HTTP/1.1 401 Unauthorized
Content-Type: text/plain
Date: Mon, 09 Jan 2023 07:47:32 GMT
Server: Kestrel
Cache-Control: no-cache, no-store, must-revalidate
Content-Encoding: br
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
Vary: Accept-Encoding
Milliseconds: 2238

33
...An error occured processing your authentication.
</code>```

Body:
I'm using this code in my .NET API:

jwtOptions.Events = new JwtBearerEvents()
{
    OnAuthenticationFailed = c =>
    {
        c.NoResult();

        Logger.LogException(c.Exception);

        c.Response.StatusCode = 401;
        c.Response.ContentType = "text/plain";
        if (ApiConfig.IsDeveloping)
        {
            return c.Response.WriteAsync(c.Exception.ToString());
        }
        return c.Response.WriteAsync("An error occured processing your authentication.");
    },
    OnTokenValidated = c =>
    {
        if (c.Principal.IsInRole("SuperAdmin"))
        {
            c.HttpContext.Items["IsSuperAdmin"] = true;
        }
        return Task.CompletedTask;
    }
};

But this causes my React client to not get the errors if the authentication token is invalid.

When I look at the Chrome's Network tab, I see this error:

(failed)net::ERR_HTTP2_PROTOCOL_ERROR

What should I do? What have I done wrong in my .NET code?

Update I realized that it depends on the token that I send. If I send a totally invalid token like lkjsdlkjf then I get the 401 response. But if I use a valid JWT token from internet that is invalid for my current session, I get this error.

Update 2

This is the request/response I logged using Wireshark. Request/response seem to be fine. But Chrome or Postman cannot understand it correctly:

GET /locale/data HTTP/1.1
X-Forwarded-Host: api.admin.example.local
X-Forwarded-Proto: https
Connection: Upgrade
Host: api.admin.example.local
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
User-Agent: PostmanRuntime/7.29.2
Accept: */*
Postman-Token: 02c8e0f2-0afb-4112-8abf-c4815ea66176
Accept-Encoding: gzip, deflate, br

HTTP/1.1 401 Unauthorized
Content-Type: text/plain
Date: Mon, 09 Jan 2023 07:47:32 GMT
Server: Kestrel
Cache-Control: no-cache, no-store, must-revalidate
Content-Encoding: br
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
Vary: Accept-Encoding
Milliseconds: 2238

33
...An error occured processing your authentication.


问:
Javascript Array with Links
I am using an javascript array to swap images and act like a slide show.  I am looking to apply an image map to each image and link to a specific page when clicked.

I need to code an image map hot spot covering a rectangle from (24,247) to (174,284) becomes a link.  But I need each image to link to a different page (the hotspot location remains the same on every image.)   How do I program this so when each image changes in the slide show it links to a different page?

Here is the coding involved:
in Head Section  (js file listed far below):

```<code><style> #Slideshow1 img {height:356px; width:912px}</style>
<script type="text/javascript" src="js/slideshowmerge.js"></script>
</code>```

In the HTML Section to place array:

```<code><div class="box_broadstyle">
<script>

  var imgArray = new Array();
  imgArray[0] = "images2/slide_pics/full/ashley.png";
  imgArray[1] = "images2/slide_pics/full/auburn.png";
  imgArray[2] = "images2/slide_pics/full/brooklyn.png";
  imgArray[3] = "images2/slide_pics/full/cobane.png";
  imgArray[4] = "images2/slide_pics/full/giddeon.png";
  imgArray[5] = "images2/slide_pics/full/hartford.png";
  imgArray[6] = "images2/slide_pics/full/saratoga.png";
  imgArray[7] = "images2/slide_pics/full/seabrook.png";
  imgArray[8] = "images2/slide_pics/full/spring.png";
  slideshowMerge('Slideshow1','',imgArray,20,5000);

</script><
    </div>
</code>```

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

Slideshowmerge.js listed here:

```<code>//=======================
//
// Merging Image Slideshow
//
//
//=======================

var slideshowMergeAnimate = new Array();
var slideshowMergeTimer   = new Array();
var slideshowMergeCount   = new Array();
var slideshowMergeImages  = new Array();

//======================

function slideshowMerge(id,cl,imageArray,fadeInterval,holdTime)
{

  for(i=0;i<imageArray.length;i++)
  {
    var imgLoad = new Image();
    imgLoad.src = imageArray[i];
  }

  if(cl)
    cl = ' class="'+cl+'"';

  document.write('<div id="'+id+'"'+cl+' style="position:relative">');
  document.write('<img id="'+id+'img1" style="position:absolute; top:0px; left:0px;" onload="slideshowMergeRun(\''+id+'\')"/>');
  document.write('<img id="'+id+'img2" style="position:absolute; top:0px; left:0px;display:none;"/></div>');

  slideshowMergeCount[id]   = 0;
  slideshowMergeImages[id]  = imageArray;
  slideshowMergeAnimate[id] = 'run';
  slideshowMergeTimer[id]   = setInterval('slideshowMergeAnimation(\''+id+'\',\''+holdTime+'\');',fadeInterval);

}

//======================

function slideshowMergeAnimation(id,holdTime)
{
  if(slideshowMergeAnimate[id]=='run')
  {
    var obj1 = document.getElementById(id+'img1');
    var obj2 = document.getElementById(id+'img2');

    var opa  = slideshowMergeCount[id]%100;

    if(opa==0)
    {
      if(obj1.src)
      {
        slideshowMergeAnimate[id] = 'hold';
        setTimeout('slideshowMergeRun(\''+id+'\')',holdTime);
        obj2.src = obj1.src;
        obj2.style.display = 'block';
      }
    }
    else if(opa==1)
    {
      slideshowMergeAnimate[id] = 'load';
      obj1.src = slideshowMergeImages[id][Math.floor(slideshowMergeCount[id]/100)%slideshowMergeImages[id].length];
    }

    obj1.style.opacity = (opa/100).toString();
    obj1.style.filter  = "alpha(opacity="+opa.toString()+")";
    obj2.style.opacity = ((100-opa)/100).toString();
    obj2.style.filter  = "alpha(opacity="+(100-opa).toString()+")";

    slideshowMergeCount[id]++;

    if(slideshowMergeCount[id]==(slideshowMergeImages[id].length*100))
      slideshowMergeCount[id]=0;
  }
}

//======================

function slideshowMergeRun(id)
{
  slideshowMergeAnimate[id] = 'run';
}

//======================
</code>```

ContentLicense: CC BY-SA 3.0

Title: Javascript Array with Links

Body:
I am using an javascript array to swap images and act like a slide show.  I am looking to apply an image map to each image and link to a specific page when clicked.

I need to code an image map hot spot covering a rectangle from (24,247) to (174,284) becomes a link.  But I need each image to link to a different page (the hotspot location remains the same on every image.)   How do I program this so when each image changes in the slide show it links to a different page?

Here is the coding involved:
in Head Section  (js file listed far below):

In the HTML Section to place array:

<

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

Slideshowmerge.js listed here:

//=======================
//
// Merging Image Slideshow
//
//
//=======================

var slideshowMergeAnimate = new Array();
var slideshowMergeTimer   = new Array();
var slideshowMergeCount   = new Array();
var slideshowMergeImages  = new Array();

//======================

function slideshowMerge(id,cl,imageArray,fadeInterval,holdTime)
{

  for(i=0;i<imageArray.length;i++)
  {
    var imgLoad = new Image();
    imgLoad.src = imageArray[i];
  }

  if(cl)
    cl = ' class="'+cl+'"';

  document.write('
');
  document.write('');
  document.write('
');

  slideshowMergeCount[id]   = 0;
  slideshowMergeImages[id]  = imageArray;
  slideshowMergeAnimate[id] = 'run';
  slideshowMergeTimer[id]   = setInterval('slideshowMergeAnimation(\''+id+'\',\''+holdTime+'\');',fadeInterval);

}

//======================

function slideshowMergeAnimation(id,holdTime)
{
  if(slideshowMergeAnimate[id]=='run')
  {
    var obj1 = document.getElementById(id+'img1');
    var obj2 = document.getElementById(id+'img2');

    var opa  = slideshowMergeCount[id]%100;

    if(opa==0)
    {
      if(obj1.src)
      {
        slideshowMergeAnimate[id] = 'hold';
        setTimeout('slideshowMergeRun(\''+id+'\')',holdTime);
        obj2.src = obj1.src;
        obj2.style.display = 'block';
      }
    }
    else if(opa==1)
    {
      slideshowMergeAnimate[id] = 'load';
      obj1.src = slideshowMergeImages[id][Math.floor(slideshowMergeCount[id]/100)%slideshowMergeImages[id].length];
    }

    obj1.style.opacity = (opa/100).toString();
    obj1.style.filter  = "alpha(opacity="+opa.toString()+")";
    obj2.style.opacity = ((100-opa)/100).toString();
    obj2.style.filter  = "alpha(opacity="+(100-opa).toString()+")";

    slideshowMergeCount[id]++;

    if(slideshowMergeCount[id]==(slideshowMergeImages[id].length*100))
      slideshowMergeCount[id]=0;
  }
}

//======================

function slideshowMergeRun(id)
{
  slideshowMergeAnimate[id] = 'run';
}

//======================


问:
The SMTP server requires a secure connection or the client was not authenticated.While sending Email in c#
i am getting

The SMTP server requires a secure connection or the client was not authenticated.

The server response was:

5.7.0 Authentication Required

...while sending Email in C#.
How to solve it?

```<code>string to = "jane@contoso.com";
string from = "ben@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server);
Console.WriteLine("Changing time out from {0} to 100.", client.Timeout);
client.Timeout = 100;
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;

try {
    client.Send(message);
    }
catch (Exception ex) {
    }
</code>```

Body:
i am getting

The SMTP server requires a secure connection or the client was not authenticated.

The server response was:

5.7.0 Authentication Required

...while sending Email in C#.
How to solve it?

string to = "jane@contoso.com";
string from = "ben@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server);
Console.WriteLine("Changing time out from {0} to 100.", client.Timeout);
client.Timeout = 100;
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;

try {
    client.Send(message);
    }
catch (Exception ex) {
    }


问:
[TypeError: undefined is not an object (evaluating '_ExpoBackgroundFetch.default.registerTaskAsync')]
[TypeError: undefined is not an object (evaluating '_ExpoBackgroundFetch.default.registerTaskAsync')]

I am getting this error trying to registerTaskAsync in the following code

async function initBackgroundFetch(taskName,
  taskFn,
  interval = 60 * 15) {
  try {
    if (!TaskManager.isTaskDefined(taskName)) {
      TaskManager.defineTask(taskName, taskFn);
    }
    const options = {
      minimumInterval: interval // in seconds
    };
    await BackgroundFetch.registerTaskAsync(taskName, options);
  } catch (err) {
    console.log("registerTaskAsync() failed:", err);
  }
}

initBackgroundFetch('myTaskName', myTask, 5)
```

I am not able to find what's wrong with it

Expecting The asyncTask to register and execute

Body:
[TypeError: undefined is not an object (evaluating '_ExpoBackgroundFetch.default.registerTaskAsync')]

I am getting this error trying to registerTaskAsync in the following code

async function initBackgroundFetch(taskName,
  taskFn,
  interval = 60 * 15) {
  try {
    if (!TaskManager.isTaskDefined(taskName)) {
      TaskManager.defineTask(taskName, taskFn);
    }
    const options = {
      minimumInterval: interval // in seconds
    };
    await BackgroundFetch.registerTaskAsync(taskName, options);
  } catch (err) {
    console.log("registerTaskAsync() failed:", err);
  }
}

initBackgroundFetch('myTaskName', myTask, 5)

I am not able to find what's wrong with it

Expecting The asyncTask to register and execute


问:
How to pause and resume mysql pool connection in nodejs
i want pause and resume mysql pool connection just like normal connection

config.mysqlPoolConnetion.getConnection((err, mysqlConn) => { mysqlConn.pause; });


问:
There are multiple heroes that share the same tag within a subtree. While navigation by using Navigator pop
While navigating from one page to another after clicking material button, I'm getting the following error
Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), each Hero must have a unique non-null tag. In this case, multiple heroes had the following tag: <SnackBar Hero tag - Text("Data Saved")> Here is the subtree for one of the offending heroes: Hero
Here I'm using 3 material button, one is for save, cancel and delete.
I'm navigating in save button.


问:
golang: optional console on windows
I am writing a service program which is expected to run in background.  On Windows it will open a console window when run.  I want it to go to background directly without that console window, so I used the -ldconf "-H=windowsgui" option, which worked as expected.

However, there is a catch. The program has a command line option -help, which output command line usage in the console.  If I use -H=windowsgui, the help text is NOT printed even I start it in cmd.exe prompt.

It seems that the windowsgui option is not what I want. Is there anyway that the -help still works at commant line, and the console window will not persist if the program runs normally.  I do not care if there is a console window pops up, provided that it disappears shortly without user intervention. i.e. I want a way on windows which is similar to the & operator on Linux.

P.S. if provided solution uses any other tools, I want that tool to be a Windows component, not any 3rd-party program. Thanks.

Title: golang: optional console on windows


问:
Recharts Stacked bar chart hides bar with less value
When trying to show multiple bar charts stacked horizontally the bar with large points covers up the maximum space and the bar with less points is overlapped, How to show fix this or add minimum with to each bar as in case of value one it shows the bar clearly.

```<code><ResponsiveContainer height={50} width={"100%"}>
          <BarChart
            layout="vertical"
            data={[bar]}
            margin={{left: 30, right: 50}}
            stackOffset="expand"
          >
            <XAxis hide type="number"/>
            <YAxis
              type="category"
              dataKey="name"
              fontSize="20"
              hide
            />
            <Tooltip wrapperStyle={{zIndex: 1}} cursor={{fill: 'transparent'}}/>
            {bar['Not Triggered'] && <Bar dataKey="Not Triggered" fill="#FF6D6F" stackId="a" isAnimationActive={false}>
              <LabelList
                dataKey='Not Triggered'
                position="center"
                content={renderBarCustomizedLabel}
              />
            </Bar>}
            {bar['Not Started'] && <Bar dataKey="Not Started" fill="#F9AB4B" stackId="a" isAnimationActive={false}>
              <LabelList
                dataKey="Not Started"
                position="center"
                content={renderBarCustomizedLabel}
              />
            </Bar>}
            {bar['Ongoing'] && <Bar dataKey="Ongoing" fill="#57B0E2" stackId="a" isAnimationActive={false}>
              <LabelList
                dataKey="Ongoing"
                position="center"
                content={renderBarCustomizedLabel}
              />
            </Bar>}
            {bar['completed'] && <Bar dataKey="Completed" fill="#4EA167" stackId="a" isAnimationActive={false}>
              <LabelList
                dataKey="Completed"
                position="center"
                content={renderBarCustomizedLabel}
              />
            </Bar>}
          </BarChart>
        </ResponsiveContainer>
</code>```

Body:
When trying to show multiple bar charts stacked horizontally the bar with large points covers up the maximum space and the bar with less points is overlapped, How to show fix this or add minimum with to each bar as in case of value one it shows the bar clearly.

<ResponsiveContainer height={50} width={"100%"}>
          <BarChart
            layout="vertical"
            data={[bar]}
            margin={{left: 30, right: 50}}
            stackOffset="expand"
          >
            <XAxis hide type="number"/>
            <YAxis
              type="category"
              dataKey="name"
              fontSize="20"
              hide
            />
            <Tooltip wrapperStyle={{zIndex: 1}} cursor={{fill: 'transparent'}}/>
            {bar['Not Triggered'] && <Bar dataKey="Not Triggered" fill="#FF6D6F" stackId="a" isAnimationActive={false}>
              <LabelList
                dataKey='Not Triggered'
                position="center"
                content={renderBarCustomizedLabel}
              />
            </Bar>}
            {bar['Not Started'] && <Bar dataKey="Not Started" fill="#F9AB4B" stackId="a" isAnimationActive={false}>
              <LabelList
                dataKey="Not Started"
                position="center"
                content={renderBarCustomizedLabel}
              />
            </Bar>}
            {bar['Ongoing'] && <Bar dataKey="Ongoing" fill="#57B0E2" stackId="a" isAnimationActive={false}>
              <LabelList
                dataKey="Ongoing"
                position="center"
                content={renderBarCustomizedLabel}
              />
            </Bar>}
            {bar['completed'] && <Bar dataKey="Completed" fill="#4EA167" stackId="a" isAnimationActive={false}>
              <LabelList
                dataKey="Completed"
                position="center"
                content={renderBarCustomizedLabel}
              />
            </Bar>}
          </BarChart>
        </ResponsiveContainer>


问:
How to fix error: ‘nullptr’ was not declared in this scope
I am trying to build gcc-12.2.0 using documentation given in lfs (linux from scratch) https://www.linuxfromscratch.org/blfs/view/svn/general/gcc.html. I am coming across the error: ‘nullptr’ was not declared in this scope. I am running gcc-7.5.0 on ubuntu-18.04.
A bit of background to the error is that there first a warning

    ../../../gcc-12.2.0/libcpp/include/cpplib.h:1141:1: warning: scoped enums only available with -std=c++11 or -std=gnu++11
 enum class CPP_time_kind.
```
<p>Then the errror (4 times)</p>
<pre class="lang-none prettyprint-override"><code>    ../../../gcc-12.2.0/libcpp/files.cc: In function ‘bool _cpp_stack_file(cpp_reader*, _cpp_file*, include_type, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:910:15: error: ‘nullptr’ was not declared in this scope
   char *buf = nullptr;

    ../../../gcc-12.2.0/libcpp/files.cc: In function ‘_cpp_file* test_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1125:10: error: ‘nullptr’ was not declared in this scope
   return nullptr;

    ../../../gcc-12.2.0/libcpp/files.cc: In function ‘const char* _cpp_find_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1150:10: error: ‘nullptr’ was not declared in this scope
   return nullptr;

    ../../../gcc-12.2.0/libcpp/files.cc: In function ‘const char* cpp_probe_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1163:10: error: ‘nullptr’ was not declared in this scope
   return nullptr;
</code>```

All the posts I have googled relate to this error appearing in the running of a specific program using c++ or g++, not in compiling gcc.

I have no idea how to include -std=c++11 in my gcc build.

Assistance in solving this problem will be appreciated.

Body:
I am trying to build gcc-12.2.0 using documentation given in lfs (linux from scratch) https://www.linuxfromscratch.org/blfs/view/svn/general/gcc.html. I am coming across the error: ‘nullptr’ was not declared in this scope. I am running gcc-7.5.0 on ubuntu-18.04.
A bit of background to the error is that there first a warning

    ../../../gcc-12.2.0/libcpp/include/cpplib.h:1141:1: warning: scoped enums only available with -std=c++11 or -std=gnu++11
 enum class CPP_time_kind.

Then the errror (4 times)

    ../../../gcc-12.2.0/libcpp/files.cc: In function ‘bool _cpp_stack_file(cpp_reader*, _cpp_file*, include_type, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:910:15: error: ‘nullptr’ was not declared in this scope
   char *buf = nullptr;

    ../../../gcc-12.2.0/libcpp/files.cc: In function ‘_cpp_file* test_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1125:10: error: ‘nullptr’ was not declared in this scope
   return nullptr;

    ../../../gcc-12.2.0/libcpp/files.cc: In function ‘const char* _cpp_find_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1150:10: error: ‘nullptr’ was not declared in this scope
   return nullptr;

    ../../../gcc-12.2.0/libcpp/files.cc: In function ‘const char* cpp_probe_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1163:10: error: ‘nullptr’ was not declared in this scope
   return nullptr;

All the posts I have googled relate to this error appearing in the running of a specific program using c++ or g++, not in compiling gcc.

I have no idea how to include -std=c++11 in my gcc build.

Assistance in solving this problem will be appreciated.


问:
nginx-controller snippet change error code
To customize the behavior of the Nginx Ingress controller when it returns a status code of 500, you will need to modify the Nginx configuration to capture the status code and customize the response.

Here is an example of how you might do this using a snippet in the nginx.ingress.kubernetes.io/server-snippet annotation of an Ingress resource:

```<code>> nginx.ingress.kubernetes.io/server-snippet: |
> location
> @ingress_service_custom_error_500 {
>     internal;
>     if (return 500){
>       add_header Content-Type application/json always;
>       return 403 "{\"msg\":\"TOKEN IS WRONG\"}";
>     }
>     return 500;   }
</code>```

How to do it correctly

Body:
To customize the behavior of the Nginx Ingress controller when it returns a status code of 500, you will need to modify the Nginx configuration to capture the status code and customize the response.

Here is an example of how you might do this using a snippet in the nginx.ingress.kubernetes.io/server-snippet annotation of an Ingress resource:

> nginx.ingress.kubernetes.io/server-snippet: |
> location
> @ingress_service_custom_error_500 {
>     internal;
>     if (return 500){
>       add_header Content-Type application/json always;
>       return 403 "{\"msg\":\"TOKEN IS WRONG\"}";
>     }
>     return 500;   }

How to do it correctly


问:
How to remove duplicate rows in pretty table
There are multiple duplicate rows in the pretty table that I created. Is there a way to remove these duplictaed like in a datframe?

I tried sorting and removing or directly removing from the dictionary. But is there any other way to remove duplicates?


问:
How to fix apt package contamination?
I have a linux distro "Pop_OS" installation that is contaminated by ubuntu. Specifically, its audio driver is broken.

When I try to use aptitude to force install "pulseaudio", it demonstrates the simple situation:

```<code>$ sudo aptitude install pulseaudio
The following NEW packages will be installed:
  pulseaudio
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 913 kB of archives. After unpacking 4,674 kB will be used.
The following packages have unmet dependencies:
 pop-desktop : Conflicts: pulseaudio but 1:15.99.1+dfsg1-1ubuntu2 is to be installed
               Conflicts: pulseaudio:i386 but it is not going to be installed
 pipewire-alsa : Conflicts: pulseaudio but 1:15.99.1+dfsg1-1ubuntu2 is to be installed
                 Conflicts: pulseaudio:i386 but it is not going to be installed
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     pulseaudio [Not Installed]

Accept this solution? [Y/n/q/?] n

*** No more solutions available ***

The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     pulseaudio [Not Installed]
</code>```

Obviously, the easy solution would be to uninstall pulseaudio but 1:15.99.1+dfsg1-1ubuntu2 (which cannot be found in upstream), and resolve the conflict. But aptitude shows that "*** No more solutions available ***"

So, why is aptitude so incapable of resolving such a simple conflict? And what tool is smart enough to do that?

Title: How to fix apt package contamination?

Body:
I have a linux distro "Pop_OS" installation that is contaminated by ubuntu. Specifically, its audio driver is broken.

When I try to use aptitude to force install "pulseaudio", it demonstrates the simple situation:

$ sudo aptitude install pulseaudio
The following NEW packages will be installed:
  pulseaudio
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 913 kB of archives. After unpacking 4,674 kB will be used.
The following packages have unmet dependencies:
 pop-desktop : Conflicts: pulseaudio but 1:15.99.1+dfsg1-1ubuntu2 is to be installed
               Conflicts: pulseaudio:i386 but it is not going to be installed
 pipewire-alsa : Conflicts: pulseaudio but 1:15.99.1+dfsg1-1ubuntu2 is to be installed
                 Conflicts: pulseaudio:i386 but it is not going to be installed
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     pulseaudio [Not Installed]

Accept this solution? [Y/n/q/?] n

*** No more solutions available ***

The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     pulseaudio [Not Installed]

Obviously, the easy solution would be to uninstall pulseaudio but 1:15.99.1+dfsg1-1ubuntu2 (which cannot be found in upstream), and resolve the conflict. But aptitude shows that "*** No more solutions available ***"

So, why is aptitude so incapable of resolving such a simple conflict? And what tool is smart enough to do that?


问:
useRef value doesn't update in useEffect
I update a useRef.current value in an useEffect, and I want to use that value in another useEffect. But then I find that it doesn't get the updated value, even though I console it in global and make sure it do updated.

```<code>const articleAmountRef = useRef<number>(0);
useEffect(() => {
    if (windowResized === "small" || windowResized === undefined) return;
    let isFetching = false;
    let isPaging = true;
    let paging = 0;
    const el = scrollRef.current;

    setArticles([]);

    async function queryNews(input: string) {
      isFetching = true;
      setIsLoading(true);
      setScrolling(false);
      setSearchState(true);
      setPageOnLoad(true);

      const resp = await index.search(`${input}`, {
        page: paging,
      });

      const hits = resp?.hits as ArticleType[];

/////////Change useRef value here///////////
      articleAmountRef.current = resp?.nbHits;
      setArticles((prev) => [...prev, ...hits]);

      setIsLoading(false);

      paging = paging + 1;
      if (paging === resp?.nbPages) {
        isPaging = false;
        setScrolling(true);
        return;
      }

      isFetching = false;
      setScrolling(true);
      setSearchState(false);
      setPageOnLoad(false);
    }

    async function scrollHandler(e: WheelEvent) {
      if (el!.scrollWidth - (window.innerWidth + el!.scrollLeft) <= 200) {
        if (e.deltaY < 0 || isFetching || !isPaging) return;
        queryNews(keyword);
      }
    }

    queryNews(keyword);

    el?.addEventListener("wheel", scrollHandler);

    return () => {
      el?.removeEventListener("wheel", scrollHandler);
    };
  }, [keyword, setArticles, setSearchState, windowResized]);

console.log(
        "outside useEffect,articleAmountRef.current=",
        articleAmountRef.current
      );

/////////use updated useRef value in this useEffect///////////

useEffect(() => {
    if (windowResized === "small" || windowResized === undefined) return;
    blockWidth.current = newsBlockRef.current?.offsetWidth!;
    console.log(
      "inside useEffect,articleAmountRef.current=",
      articleAmountRef.current
    );

    if (windowWidth >= 1280) {
      contentLength.current =
        Math.ceil(articleAmountRef.current / 2) * blockWidth.current +
        Math.ceil(articleAmountRef.current / 2) * 60;
    }
    if (windowWidth < 1280) {
      contentLength.current =
        Math.ceil(articleAmountRef.current / 2) * blockWidth.current +
        Math.ceil(articleAmountRef.current / 2) * 30;
    }
  }, [windowResized]);
</code>```

console.log results looks like below:
useRef result

How can I make second useRef get updated value?I want second useRef has value "11476". I tried to write articleAmountRef.current as second useRef's dependency, but eslint warning me "Mutable values like 'articleAmountRef.current' aren't valid dependencies because mutating them doesn't re-render the component."

Since value "11476" is a result of fetch data, I want it update after fetch data getting back. And this value only needs to fetch once, it doesn't need to update every time component re-render, so I tried to save this value by useRef instead of uesState.

Thank you for your kindly help!

Body:
I update a useRef.current value in an useEffect, and I want to use that value in another useEffect. But then I find that it doesn't get the updated value, even though I console it in global and make sure it do updated.

const articleAmountRef = useRef<number>(0);
useEffect(() => {
    if (windowResized === "small" || windowResized === undefined) return;
    let isFetching = false;
    let isPaging = true;
    let paging = 0;
    const el = scrollRef.current;

    setArticles([]);

    async function queryNews(input: string) {
      isFetching = true;
      setIsLoading(true);
      setScrolling(false);
      setSearchState(true);
      setPageOnLoad(true);

      const resp = await index.search(`${input}`, {
        page: paging,
      });

      const hits = resp?.hits as ArticleType[];

/////////Change useRef value here///////////
      articleAmountRef.current = resp?.nbHits;
      setArticles((prev) => [...prev, ...hits]);

      setIsLoading(false);

      paging = paging + 1;
      if (paging === resp?.nbPages) {
        isPaging = false;
        setScrolling(true);
        return;
      }

      isFetching = false;
      setScrolling(true);
      setSearchState(false);
      setPageOnLoad(false);
    }

    async function scrollHandler(e: WheelEvent) {
      if (el!.scrollWidth - (window.innerWidth + el!.scrollLeft) <= 200) {
        if (e.deltaY < 0 || isFetching || !isPaging) return;
        queryNews(keyword);
      }
    }

    queryNews(keyword);

    el?.addEventListener("wheel", scrollHandler);

    return () => {
      el?.removeEventListener("wheel", scrollHandler);
    };
  }, [keyword, setArticles, setSearchState, windowResized]);

console.log(
        "outside useEffect,articleAmountRef.current=",
        articleAmountRef.current
      );

/////////use updated useRef value in this useEffect///////////

useEffect(() => {
    if (windowResized === "small" || windowResized === undefined) return;
    blockWidth.current = newsBlockRef.current?.offsetWidth!;
    console.log(
      "inside useEffect,articleAmountRef.current=",
      articleAmountRef.current
    );

    if (windowWidth >= 1280) {
      contentLength.current =
        Math.ceil(articleAmountRef.current / 2) * blockWidth.current +
        Math.ceil(articleAmountRef.current / 2) * 60;
    }
    if (windowWidth < 1280) {
      contentLength.current =
        Math.ceil(articleAmountRef.current / 2) * blockWidth.current +
        Math.ceil(articleAmountRef.current / 2) * 30;
    }
  }, [windowResized]);

console.log results looks like below:
useRef result

How can I make second useRef get updated value?I want second useRef has value "11476". I tried to write articleAmountRef.current as second useRef's dependency, but eslint warning me "Mutable values like 'articleAmountRef.current' aren't valid dependencies because mutating them doesn't re-render the component."

Since value "11476" is a result of fetch data, I want it update after fetch data getting back. And this value only needs to fetch once, it doesn't need to update every time component re-render, so I tried to save this value by useRef instead of uesState.

Thank you for your kindly help!


问:
How to remove the "Early Access" label beside the app name in closed testing on the Google Play Store
I have faced an issue about after published the app on play store by using closed testing track, the app will show the label "(Early Access)" beside the app name. Is it possible to remove it?


问:
Use getDisplayMedia to record the screen, when the microphone is added from the system, there is no sound！

In chrome browser, I am using MacBook to record a 30 minutes class, in code, use getDisplayMedia to get the screen stream：

```<code>   navigator.mediaDevices.getDisplayMedia({audio:true,video:true}).then((mediaStream)=>{
     mediaRecorder = new MediaRecorder(mediaStream,{mineType:'video/webm'})
   })
</code>```

2.When the recording started 5 minutes later, I connected an external microphone to the MacBook, then lectured through the microphone, and then hoped that my voice would be recorded through the microphone, but the strange thing is that since the microphone is connected, there is no recording screen behind The sound is down, what’s the matter, how can I operate so that I can continue recording when switching microphones?

Body:
In chrome browser, I am using MacBook to record a 30 minutes class, in code, use getDisplayMedia to get the screen stream：

   navigator.mediaDevices.getDisplayMedia({audio:true,video:true}).then((mediaStream)=>{
     mediaRecorder = new MediaRecorder(mediaStream,{mineType:'video/webm'})
   })

2.When the recording started 5 minutes later, I connected an external microphone to the MacBook, then lectured through the microphone, and then hoped that my voice would be recorded through the microphone, but the strange thing is that since the microphone is connected, there is no recording screen behind The sound is down, what’s the matter, how can I operate so that I can continue recording when switching microphones?


问:
Create failed case when push notification using FCM
I followed this guide to create push notifications. The push notification works correctly, but I am confused about the response:

As the docs said, a list of failed push notification devices will be listed in failed_registration_ids, but the response from FCM only has failedRegistrationTokens.
Because I want to create a scenario in which some devices are not working (offline or powered off), and the push notification cannot be delivered, and I was hoping that failed device tokens would be listed in failedRegistrationTokens but they are not, and it still responds to me with successCount: 3, failureCount: 0

My question is: Is there any way to create a case where push notifications fail to push to some devices and the response looks like this:

```<code>{
  "success":1,
  "failure":2,
  "failed_registration_ids":[
     "regId1",
     "regId2"
  ]
}
</code>```

P.S. I tried several methods, including turning off the device, turning off the internet connection, and then removing the app. But I still can't create this case.

P.S.2. I also tried the Legacy API, but it only pushes up to 1000 device tokens per call; it will require sending push notifications several times when I want to push more than 1000 devices, but I want to complete it in a single call, like sending to a devices group or topic.

Thanks in advance.

Body:
I followed this guide to create push notifications. The push notification works correctly, but I am confused about the response:

As the docs said, a list of failed push notification devices will be listed in failed_registration_ids, but the response from FCM only has failedRegistrationTokens.
Because I want to create a scenario in which some devices are not working (offline or powered off), and the push notification cannot be delivered, and I was hoping that failed device tokens would be listed in failedRegistrationTokens but they are not, and it still responds to me with successCount: 3, failureCount: 0

My question is: Is there any way to create a case where push notifications fail to push to some devices and the response looks like this:

{
  "success":1,
  "failure":2,
  "failed_registration_ids":[
     "regId1",
     "regId2"
  ]
}

P.S. I tried several methods, including turning off the device, turning off the internet connection, and then removing the app. But I still can't create this case.

P.S.2. I also tried the Legacy API, but it only pushes up to 1000 device tokens per call; it will require sending push notifications several times when I want to push more than 1000 devices, but I want to complete it in a single call, like sending to a devices group or topic.

Thanks in advance.


问:
Does the coxrt package for R support interactions?
I have a data set, which is right-truncated. Participants were included at cancer recurrence and data on a biomarker in the primary tumor was obtained from patient records. I want to investigate the association between the biomarker and cancer recurrence. I tried to use the coxrt package for R, but another problem arose as the hazards are not proportional. Therefore, I wanted to include an exposure#time interaction. Does the coxrt package support this? If so, how do I include the term properly?

I used the following code to fit an univariate model:

all <- data.frame(biomarker=data$biomarker, biomarkerg=as.numeric(data$biomarker>7.4), T=data$recurtime, R=data$time)

sol <- try(coxph.RT(T~biomarkerg, right=R, data=all, bs=TRUE, nbs.rep=1000)) knitr::kable(sol$summary) knitr::kable(sol$bs$summary)

I tried including an interaction term but the result is identical to the result from above:

sola <- try(coxph.RT(T~biomarkerg+biomarkerg*T, right=R, data=all, bs=TRUE, nbs.rep=1000)) knitr::kable(sola$summary) knitr::kable(sola$bs$summary)

I also tried this version:

sola <- try(coxph.RT(T~biomarkerg*T, right=R, data=all, bs=TRUE, nbs.rep=1000)) knitr::kable(sola$summary) knitr::kable(sola$bs$summary)


问:
When both biometrics are enrolled i.e. face id and fingerprint, local auth shows both
I have a login page. User can login through face id or finger print. I am using local auth package 1.1.11 (because Biometrictype.fingerPrint and faceId works here after that it uses BiometricsType.weak and BiometricsType.Strong) to local perform authentication. I am facing an issue that when both biometrics are enrolled in my device i.e. face id and fingerprint, local auth shows both biometrics when i taped on fingerprint sensor or face id.

static Future<bool> authenticate() async {

List<BiometricType> availableBiometrics =
await _auth.getAvailableBiometrics();

```<code>final isAvailable = await hasBiometrics();
if (!isAvailable) return false;

if (availableBiometrics.contains(BiometricType.fingerprint)) {
  try {
    return await _auth.authenticate(
      biometricOnly: true,
      stickyAuth: true,
      useErrorDialogs: true,
      localizedReason: 'Scan Fingerprint to Authenticate',

    );
  } on PlatformException catch (e) {
    debugPrint(e.toString());
    myToastError('Please add finger print first');
    return false;
  }
}
return Future.value(true);
</code>```

}

static Future<bool> authenticateFaceId() async {

List<BiometricType> availableBiometrics =
await _auth.getAvailableBiometrics();

```<code>final isAvailable = await hasBiometrics();
if (!isAvailable) return false;
if (availableBiometrics.contains(BiometricType.faceId)) {
  try {
    return await _auth.authenticate(
      biometricOnly: true,
      useErrorDialogs: false,
      sensitiveTransaction: false,
      stickyAuth: true,
      localizedReason: 'Scan Face to Authenticate',

    );
  } on PlatformException catch (e) {
    debugPrint(e.toString());
    myToastError('Please add face id first');
    return false;
  }
} else {
  return Future.value(false);
}
</code>```

}

Body:
I have a login page. User can login through face id or finger print. I am using local auth package 1.1.11 (because Biometrictype.fingerPrint and faceId works here after that it uses BiometricsType.weak and BiometricsType.Strong) to local perform authentication. I am facing an issue that when both biometrics are enrolled in my device i.e. face id and fingerprint, local auth shows both biometrics when i taped on fingerprint sensor or face id.

static Future<bool> authenticate() async {

List<BiometricType> availableBiometrics =
await _auth.getAvailableBiometrics();

final isAvailable = await hasBiometrics();
if (!isAvailable) return false;

if (availableBiometrics.contains(BiometricType.fingerprint)) {
  try {
    return await _auth.authenticate(
      biometricOnly: true,
      stickyAuth: true,
      useErrorDialogs: true,
      localizedReason: 'Scan Fingerprint to Authenticate',

    );
  } on PlatformException catch (e) {
    debugPrint(e.toString());
    myToastError('Please add finger print first');
    return false;
  }
}
return Future.value(true);

}

static Future<bool> authenticateFaceId() async {

List<BiometricType> availableBiometrics =
await _auth.getAvailableBiometrics();

final isAvailable = await hasBiometrics();
if (!isAvailable) return false;
if (availableBiometrics.contains(BiometricType.faceId)) {
  try {
    return await _auth.authenticate(
      biometricOnly: true,
      useErrorDialogs: false,
      sensitiveTransaction: false,
      stickyAuth: true,
      localizedReason: 'Scan Face to Authenticate',

    );
  } on PlatformException catch (e) {
    debugPrint(e.toString());
    myToastError('Please add face id first');
    return false;
  }
} else {
  return Future.value(false);
}

}


问:
Firebase cloud scheduler doesn't run promises
i have a firebase pubsub scheduled task and i am scheduling it this way:

```<code>export const notificationTrigger = functions.pubsub
    .schedule("0 20 * * *")
    .onRun(() => {
      console.log("CRON JOB TRIGGERED");
      notificationTriggerHandler();
    });
</code>```

and my notificationTriggerHandler looks like this:

```<code>    export async function notificationTriggerHandler(): Promise<void> {
        try {
            console.log("LOG 1: notificationTrigger handler execution start");
            const response = await firestore().collection("collection_name").get();
            console.log(":LOG 2: GOT RESPONSE");
            for (const doc of response.docs) {
              const docData = doc.data();
            }
        } catch (e) {
            console.log("ERROR FETCHING : ", e);
          }
        return null
    }
</code>```

now the issue I am facing is whenever this function is triggered it doesn't get past the first LOG: 1 the execution always stops there and the firestore query is never executed and the LOG: 2 is never displayed on the console, any reason that might cause this?

and just to be sure i created another document change trigger with calls the same notificationTriggerHandler like this:

```<code>export const notificationTestTrigger = functions.firestore
    .document("test_trigger/{id}")
    .onWrite(notificationTriggerHandler);
</code>```

and when i trigger this from a document change the function run properly and shows me both of the logs, so i am really struggling here to understand why it works with a document change trigger and why it does with a cron job scheduler?

Body:
i have a firebase pubsub scheduled task and i am scheduling it this way:

export const notificationTrigger = functions.pubsub
    .schedule("0 20 * * *")
    .onRun(() => {
      console.log("CRON JOB TRIGGERED");
      notificationTriggerHandler();
    });

and my notificationTriggerHandler looks like this:

    export async function notificationTriggerHandler(): Promise<void> {
        try {
            console.log("LOG 1: notificationTrigger handler execution start");
            const response = await firestore().collection("collection_name").get();
            console.log(":LOG 2: GOT RESPONSE");
            for (const doc of response.docs) {
              const docData = doc.data();
            }
        } catch (e) {
            console.log("ERROR FETCHING : ", e);
          }
        return null
    }

now the issue I am facing is whenever this function is triggered it doesn't get past the first LOG: 1 the execution always stops there and the firestore query is never executed and the LOG: 2 is never displayed on the console, any reason that might cause this?

and just to be sure i created another document change trigger with calls the same notificationTriggerHandler like this:

export const notificationTestTrigger = functions.firestore
    .document("test_trigger/{id}")
    .onWrite(notificationTriggerHandler);

and when i trigger this from a document change the function run properly and shows me both of the logs, so i am really struggling here to understand why it works with a document change trigger and why it does with a cron job scheduler?


问:
Upload spatial data in GDB or geodataBase format in ASP.NET Core code first
I have a database in geodatabase(.gdb) format with several layers inside.
I entered the layers in ArcGIS software to gdb.

Now I want to automatically create the table for data attribute of that layer in the sqlserver database when each layer is uploaded in asp.net core code first.

This layer was done manually by connecting to SQL database and importing layers through ArcGIS software.

But this method is not logical and I want to provide gdb storage conditions through the program and in ASP.NET Core.
I am waiting for your kind guidance


问:
Redis java.net.SocketTimeoutException: Read timed out on setting value while High memory utilization on redis cluster
I am using Jedis client for redis in my spring service.
Below is the similar code which I use for setting value into a hashedkey.

```<code>        Jedis jedis = null;
        try {
        1-- jedis = redisJedisPool.getResource();
        2-- jedis.hset(key,"data", dataValue);
            for (Entry<String, String> entry : hmap.entrySet()) {
                if (some condition)
        3--         jedis.hset(key, entry.getKey(), entry.getValue());
            }

        4-- jedis.expire(key, ttl);

        }catch(Exception e) {
            logger.error("Error for key {}, Reason: {}", key, e.getMessage());
        }
        finally {
            RedisConnectionManager.closeJedisResource(jedis);
        }

</code>```

there was heavy load on this service and thus a high memory utilization of the redis cluster was noticed.
I faced a lot of SocketTimeoutException from the above function(all exception where catched in the catch block).

Exception:

```<code>Error for key: {key}, Reason: java.net.SocketTimeoutException: Read timed out
</code>```

Main Issue: After this intermittent issue I see a lot of keys with ttl as -1(infinite expiry). Almost all these keys where logged in the above catch block.

Need thoughts on this from the community on what can be the possible issue here.

Action I took for verifying: I checked the data for few of these keys(with ttl -1) and saw that the data that was to be set at line 3(inside the for loop) didn't set all the data. But I came across couple of keys which had ttl as -1, not all data was set but that key was not logged in the above catch block. And this is the only func where the setting of data in cache takes place in my service.
After this I am not able to conclude the above hypothesis.

Body:
I am using Jedis client for redis in my spring service.
Below is the similar code which I use for setting value into a hashedkey.

        Jedis jedis = null;
        try {
        1-- jedis = redisJedisPool.getResource();
        2-- jedis.hset(key,"data", dataValue);
            for (Entry<String, String> entry : hmap.entrySet()) {
                if (some condition)
        3--         jedis.hset(key, entry.getKey(), entry.getValue());
            }

        4-- jedis.expire(key, ttl);

        }catch(Exception e) {
            logger.error("Error for key {}, Reason: {}", key, e.getMessage());
        }
        finally {
            RedisConnectionManager.closeJedisResource(jedis);
        }

there was heavy load on this service and thus a high memory utilization of the redis cluster was noticed.
I faced a lot of SocketTimeoutException from the above function(all exception where catched in the catch block).

Exception:

Error for key: {key}, Reason: java.net.SocketTimeoutException: Read timed out

Main Issue: After this intermittent issue I see a lot of keys with ttl as -1(infinite expiry). Almost all these keys where logged in the above catch block.

Need thoughts on this from the community on what can be the possible issue here.

Action I took for verifying: I checked the data for few of these keys(with ttl -1) and saw that the data that was to be set at line 3(inside the for loop) didn't set all the data. But I came across couple of keys which had ttl as -1, not all data was set but that key was not logged in the above catch block. And this is the only func where the setting of data in cache takes place in my service.
After this I am not able to conclude the above hypothesis.


问:
Change Tracking in Entity Framework across different instances
I'm seeking a bit more information about hos Entity Framework is using change tracking.

For a project I'm expanding upon, we are using Entity Framework Core 6 and have quite a complex structure for the customer's products. Those products have one or more prices, which in turn can have a currency. All of these are entities in the database.
We needed to add a new entity TvChannels that can also have prices, which have the same structure as the aforementioned products. So when adding or updating a price I need to make sure that I'm creating the correct association to Currency.
Up untill now we had a simple way of fetching the entity when creating the new price:

```<code>price.CurrencyType = _productDbContext.CurrencyType.FirstOrDefault(c => c.CurrencyTypeId.Equals(currencyTypeId))
</code>```

Instead of copying this across to the other repository service that now should add prices to  TvPackages, I made a common service to fetch the entity for both repository services.

```<code>price.CurrencyType = _commonRepositoryService.GetCurrencyEntity(currencyTypeId)
</code>```

Now when adding a price after this change, Entity Framework can no longer see that the CurrencyType that I'm trying to use already exists and tries to add it again, resulting in a foreign key constraint exception thrown.

I have found that if I add property to Price called CurrencyTypeId and just set this instead of the entity it works aswell, which for me is much nicer instead of having to get all the associated entities.

```<code>price.CurrencyTypeId = currencyTypeId
</code>```

So the problem at hand is solved but I'm looking for an answer on why the change tracking is not working when just using a common repo service, is the ProductDbContext disposed because the dependency injection is creating the context again?

So I think my question is threefold:

Are there any drawbacks to use the CurrencyTypeId property to set the related entities?

Is there any way to get EF to create those Id properties on the entities automatically when there is a related entity?

If at some point I wanted to use a common repo to fetch related entities because it wasn't just enough to set the id, what would the best practice be in that case to avoid duplicated code across repo services?

Body:
I'm seeking a bit more information about hos Entity Framework is using change tracking.

For a project I'm expanding upon, we are using Entity Framework Core 6 and have quite a complex structure for the customer's products. Those products have one or more prices, which in turn can have a currency. All of these are entities in the database.
We needed to add a new entity TvChannels that can also have prices, which have the same structure as the aforementioned products. So when adding or updating a price I need to make sure that I'm creating the correct association to Currency.
Up untill now we had a simple way of fetching the entity when creating the new price:

price.CurrencyType = _productDbContext.CurrencyType.FirstOrDefault(c => c.CurrencyTypeId.Equals(currencyTypeId))

Instead of copying this across to the other repository service that now should add prices to  TvPackages, I made a common service to fetch the entity for both repository services.

price.CurrencyType = _commonRepositoryService.GetCurrencyEntity(currencyTypeId)

Now when adding a price after this change, Entity Framework can no longer see that the CurrencyType that I'm trying to use already exists and tries to add it again, resulting in a foreign key constraint exception thrown.

I have found that if I add property to Price called CurrencyTypeId and just set this instead of the entity it works aswell, which for me is much nicer instead of having to get all the associated entities.

price.CurrencyTypeId = currencyTypeId

So the problem at hand is solved but I'm looking for an answer on why the change tracking is not working when just using a common repo service, is the ProductDbContext disposed because the dependency injection is creating the context again?

So I think my question is threefold:

Are there any drawbacks to use the CurrencyTypeId property to set the related entities?

Is there any way to get EF to create those Id properties on the entities automatically when there is a related entity?

If at some point I wanted to use a common repo to fetch related entities because it wasn't just enough to set the id, what would the best practice be in that case to avoid duplicated code across repo services?