问:
Spring Integration Email using IMAP Office 365
We are planning to use Spring Integration Mail Support with Office365 using IMAP however, it is not working as intended and we are getting authentication failed errors:

```<code>2022-12-19 08:45:12.257 ERROR --- [   scheduling-1] o.s.i.h.LoggingHandler                   : org.springframework.messaging.MessagingException: failure occurred while polling for mail; nested exception is javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    at org.springframework.integration.mail.MailReceivingMessageSource.doReceive(MailReceivingMessageSource.java:74)
    at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:142)
    at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:212)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:444)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.pollForMessage(AbstractPollingEndpoint.java:413)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$4(AbstractPollingEndpoint.java:348)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$5(AbstractPollingEndpoint.java:341)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:95)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:708)
</code>```

Note: It is working fine using GMAIL via App password but for Office365 its not. Here is the sample bean we have:

```<code>    @Bean
    public IntegrationFlow iMapIntegrationFlow(
            // Remove for brevity
    ) {
        log.info("[Email Integration] Creating Spring Integration Flow Bean");
        var pollerSpec = Pollers
                .fixedRate(5000)
                .maxMessagesPerPoll(1);
        return IntegrationFlows
                .from(Mail.imapInboundAdapter("imap://username%40domain:PASSWORD@outlook.office365.com:993/INBOX")
                                .javaMailProperties(myJavaMailProperties)
                                .simpleContent(true)
                                .maxFetchSize(1),
                        e -> e.poller(pollerSpec))
                .transform(myTransformer)
                .handle(myHandler)
                .get();
    }
</code>```

Below are my Java Mail properties:

```<code>mail.imap.port=993
mail.imaps.ssl.enable=true
mail.debug=true
</code>```

Any help for the following questions are highly appreciated:

Is there something missing/incorrect in our config?

Is this basic authentication deprecation by MS causing the issue? https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online

If item#2 is true then is there a documented way in Spring Integration Mail to support OAuth2?

Body:
We are planning to use Spring Integration Mail Support with Office365 using IMAP however, it is not working as intended and we are getting authentication failed errors:

2022-12-19 08:45:12.257 ERROR --- [   scheduling-1] o.s.i.h.LoggingHandler                   : org.springframework.messaging.MessagingException: failure occurred while polling for mail; nested exception is javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    at org.springframework.integration.mail.MailReceivingMessageSource.doReceive(MailReceivingMessageSource.java:74)
    at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:142)
    at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:212)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:444)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.pollForMessage(AbstractPollingEndpoint.java:413)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$4(AbstractPollingEndpoint.java:348)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$5(AbstractPollingEndpoint.java:341)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:95)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:708)

Note: It is working fine using GMAIL via App password but for Office365 its not. Here is the sample bean we have:

    @Bean
    public IntegrationFlow iMapIntegrationFlow(
            // Remove for brevity
    ) {
        log.info("[Email Integration] Creating Spring Integration Flow Bean");
        var pollerSpec = Pollers
                .fixedRate(5000)
                .maxMessagesPerPoll(1);
        return IntegrationFlows
                .from(Mail.imapInboundAdapter("imap://username%40domain:PASSWORD@outlook.office365.com:993/INBOX")
                                .javaMailProperties(myJavaMailProperties)
                                .simpleContent(true)
                                .maxFetchSize(1),
                        e -> e.poller(pollerSpec))
                .transform(myTransformer)
                .handle(myHandler)
                .get();
    }

Below are my Java Mail properties:

mail.imap.port=993
mail.imaps.ssl.enable=true
mail.debug=true

Any help for the following questions are highly appreciated:

Is there something missing/incorrect in our config?

Is this basic authentication deprecation by MS causing the issue? https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online

If item#2 is true then is there a documented way in Spring Integration Mail to support OAuth2?


来源: stackexchange

问:
parsing child tags with xmlreader PHP
I'm trying to read an xml file of this format with XMLreader

```<code><users>
<agency id="1">
<name>qwerty</name>
<lastname>qwerty</lastname>
<phone>12345</phone>
</agency>
<items>
<item id="102">
<date></date>
<title></title>
<price></price>
<img></img>
<item>
<item id="103">
<date></date>
<title></title>
<price></price>
<img></img>
<item>
</items>
<agency id="2">
<name>uiop</name>
<lastname>uiop</lastname>
<phone>6789</phone>
</agency>
<items>
<item id="202">
<date></date>
<title></title>
<price></price>
<img></img>
<item>
<item id="203">
<date></date>
<title></title>
<price></price>
<img></img>
<item>
</items>
</users>
</code>```

php code:

```<code>$xmldata = new XMLReader();

$xmldata->open((__DIR__ ."/example_1.2.2.xml"),null,true);
while ($xmldata->read()) {
    if ($xmldata->nodeType == XMLReader::ELEMENT) {
         switch ($xmldata->name) {

            case 'agency':

            //case 'item': ???  how to analyze items
        $empl = new SimpleXMLElement($xmldata->readOuterXML());

        $agencyId= $empl->agency['id'];
        $name= $empl->name;
        $lastname= $empl->lastname;
</code>```

I can analyze each user with the various child elements. But I don't understand how I can analyze all user item.

Should I use a foreach? Or another case?

Thanks

ContentLicense: CC BY-SA 4.0

Title: parsing child tags with xmlreader PHP

Body:
I'm trying to read an xml file of this format with XMLreader

<users>
<agency id="1">
<name>qwerty</name>
<lastname>qwerty</lastname>
<phone>12345</phone>
</agency>
<items>
<item id="102">
<date></date>
<title></title>
<price></price>

<item>
<item id="103">
<date></date>
<title></title>
<price></price>

<item>
</items>
<agency id="2">
<name>uiop</name>
<lastname>uiop</lastname>
<phone>6789</phone>
</agency>
<items>
<item id="202">
<date></date>
<title></title>
<price></price>

<item>
<item id="203">
<date></date>
<title></title>
<price></price>

<item>
</items>
</users>

php code:

$xmldata = new XMLReader();

$xmldata->open((__DIR__ ."/example_1.2.2.xml"),null,true);
while ($xmldata->read()) {
    if ($xmldata->nodeType == XMLReader::ELEMENT) {
         switch ($xmldata->name) {

            case 'agency':

            //case 'item': ???  how to analyze items
        $empl = new SimpleXMLElement($xmldata->readOuterXML());

        $agencyId= $empl->agency['id'];
        $name= $empl->name;
        $lastname= $empl->lastname;

I can analyze each user with the various child elements. But I don't understand how I can analyze all user item.

Should I use a foreach? Or another case?

Thanks


问:
Why is my useEffect hook running on first render?
I have a useEffect that should be running at first render and a second useEffect that should be running only when state count changes, but both of them are running at first render. I use the useRef hook to track whether the component has mounted or not. It should start out as false and once the effect runs for the first time, it should change to true. The thing is that I get logged not first render even in the first render. I give my code:

const { useEffect, useRef, useState } = React;

const Component = () => {
    const [count, setCount] = useState();
    const isMounted = useRef(false);

    useEffect(() => {
        console.log("first render");
    }, []);

    useEffect(() => {
        if (isMounted.current) {
            console.log("not first render");
        } else {
            isMounted.current = true;
        }
    }, [count]);

    return (

            <button
                onClick={() => {
                    setCount(count + 1);
                }}
            >
                Click Me
            </button>

    );
};

ReactDOM.createRoot(document.body).render(<Component />);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script></code>```

If anyone could explain me why it is happening I would be very grateful. Thanks.

Body:
I have a useEffect that should be running at first render and a second useEffect that should be running only when state count changes, but both of them are running at first render. I use the useRef hook to track whether the component has mounted or not. It should start out as false and once the effect runs for the first time, it should change to true. The thing is that I get logged not first render even in the first render. I give my code:

const { useEffect, useRef, useState } = React;

const Component = () => {
    const [count, setCount] = useState();
    const isMounted = useRef(false);

    useEffect(() => {
        console.log("first render");
    }, []);

    useEffect(() => {
        if (isMounted.current) {
            console.log("not first render");
        } else {
            isMounted.current = true;
        }
    }, [count]);

    return (

            <button
                onClick={() => {
                    setCount(count + 1);
                }}
            >
                Click Me
            </button>

    );
};

ReactDOM.createRoot(document.body).render(<Component />);

If anyone could explain me why it is happening I would be very grateful. Thanks.


问:
Can't install giotto-tda using docker on MacOSX
I'm working on a predictive model of a time series that I am able to run successfully in Python. The model uses the giotto-tda library that I am easily able to install using pip install giotto-tda.

However, when I try to containerize my application using docker I can't get to build the image as it fails to install giotto-tda saying it needs CMake. So I tried running pip install cmake and still got an error.

In fact, if I try to build an image with ONLY cmake and giotto-tda, I get an error.
Weirdly, this is only when I'm trying to build the image on MacOSX. I can do this successfully on Linux though.

My Dockerfile:

```<code>FROM python:3.8
RUN pip install cmake
RUN pip install -U giotto-tda
</code>```

Error:

```<code>[+] Building 154.0s (6/6) FINISHED
 => [internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 36B                                                                                0.0s
 => [internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                0.0s
 => [internal] load metadata for docker.io/library/python:3.8                                                                                2.8s
 => [1/3] FROM docker.io/library/python:3.8@sha256:300af00b63fc735ec85a1a8305e2bd0a5d3477c1857fdf135c8eb49d09479387                                     0.0s
 => CACHED [2/3] RUN pip install cmake                                                                                0.0s
 => ERROR [3/3] RUN pip install -U giotto-tda                                                                                151.1s
------
 > [3/3] RUN pip install -U giotto-tda:
#6 1.520 Collecting giotto-tda
#6 1.823   Downloading giotto-tda-0.1.4.tar.gz (99 kB)
#6 1.957      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.8/99.8 KB 1.2 MB/s eta 0:00:00
#6 2.000   Preparing metadata (setup.py): started
#6 2.213   Preparing metadata (setup.py): finished with status 'done'
...
...
...
...
...
...
...
...
#6 150.2       running build_ext
#6 150.2       CMake Warning:
#6 150.2         Ignoring extra path from command line:
#6 150.2
#6 150.2          "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589"
#6 150.2
#6 150.2
#6 150.2       CMake Error: The source directory "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589" does not appear to contain CMakeLists.txt.
#6 150.2       Specify --help for usage, or press the help button on the CMake GUI.
#6 150.2       Traceback (most recent call last):
#6 150.2         File "<string>", line 2, in <module>
#6 150.2         File "<pip-setuptools-caller>", line 34, in <module>
#6 150.2         File "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589/setup.py", line 183, in <module>
#6 150.2           setup(name=DISTNAME,
#6 150.2         File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
#6 150.2           return distutils.core.setup(**attrs)
#6 150.2         File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
#6 150.2           dist.run_commands()
#6 150.2         File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
#6 150.2           self.run_command(cmd)
#6 150.2         File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
#6 150.2           cmd_obj.run()
#6 150.2         File "/usr/local/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
#6 150.2           return orig.install.run(self)
#6 150.2         File "/usr/local/lib/python3.8/distutils/command/install.py", line 545, in run
#6 150.2           self.run_command('build')
#6 150.2         File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
#6 150.2           self.distribution.run_command(command)
#6 150.2         File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
#6 150.2           cmd_obj.run()
#6 150.2         File "/usr/local/lib/python3.8/distutils/command/build.py", line 135, in run
#6 150.2           self.run_command(cmd_name)
#6 150.2         File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
#6 150.2           self.distribution.run_command(command)
#6 150.2         File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
#6 150.2           cmd_obj.run()
#6 150.2         File "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589/setup.py", line 119, in run
#6 150.2           self.build_extension(ext)
#6 150.2         File "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589/setup.py", line 177, in build_extension
#6 150.2           subprocess.check_call(['cmake', ext.sourcedir] + cmake_args,
#6 150.2         File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
#6 150.2           raise CalledProcessError(retcode, cmd)
#6 150.2       subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589/build/lib.linux-aarch64-3.8', '-DPYTHON_EXECUTABLE=/usr/local/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
#6 150.2       [end of output]
#6 150.2
#6 150.2   note: This error originates from a subprocess, and is likely not a problem with pip.
#6 150.2 error: legacy-install-failure
#6 150.2
#6 150.2 × Encountered error while trying to install package.
#6 150.2 ╰─> giotto-tda
#6 150.2
#6 150.2 note: This is an issue with the package mentioned above, not pip.
#6 150.2 hint: See above for output from the failure.
#6 150.2 WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
#6 150.2 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip install -U giotto-tda]: exit code: 1

</code>```

I have tried using different versions of Python as well (latest, 3.6, etc.). Also tried downgrading pip to <20.0.0 because I read somewhere that CMake is breaking after pip 20.0.0, but without any success.

Is anyone else getting this error? How do I fix it. Isn't Docker's whole schtick providing platform-agnostic builds? It's ironic that I need to switch to Linux instead of MacOSX for building this image. I'm stuck at this and any help is appreciated.

EDIT: Grammatical error

Body:
I'm working on a predictive model of a time series that I am able to run successfully in Python. The model uses the giotto-tda library that I am easily able to install using pip install giotto-tda.

However, when I try to containerize my application using docker I can't get to build the image as it fails to install giotto-tda saying it needs CMake. So I tried running pip install cmake and still got an error.

In fact, if I try to build an image with ONLY cmake and giotto-tda, I get an error.
Weirdly, this is only when I'm trying to build the image on MacOSX. I can do this successfully on Linux though.

My Dockerfile:

FROM python:3.8
RUN pip install cmake
RUN pip install -U giotto-tda

Error:

[+] Building 154.0s (6/6) FINISHED
 => [internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 36B                                                                                0.0s
 => [internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                0.0s
 => [internal] load metadata for docker.io/library/python:3.8                                                                                2.8s
 => [1/3] FROM docker.io/library/python:3.8@sha256:300af00b63fc735ec85a1a8305e2bd0a5d3477c1857fdf135c8eb49d09479387                                     0.0s
 => CACHED [2/3] RUN pip install cmake                                                                                0.0s
 => ERROR [3/3] RUN pip install -U giotto-tda                                                                                151.1s
------
 > [3/3] RUN pip install -U giotto-tda:
#6 1.520 Collecting giotto-tda
#6 1.823   Downloading giotto-tda-0.1.4.tar.gz (99 kB)
#6 1.957      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.8/99.8 KB 1.2 MB/s eta 0:00:00
#6 2.000   Preparing metadata (setup.py): started
#6 2.213   Preparing metadata (setup.py): finished with status 'done'
...
...
...
...
...
...
...
...
#6 150.2       running build_ext
#6 150.2       CMake Warning:
#6 150.2         Ignoring extra path from command line:
#6 150.2
#6 150.2          "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589"
#6 150.2
#6 150.2
#6 150.2       CMake Error: The source directory "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589" does not appear to contain CMakeLists.txt.
#6 150.2       Specify --help for usage, or press the help button on the CMake GUI.
#6 150.2       Traceback (most recent call last):
#6 150.2         File "<string>", line 2, in <module>
#6 150.2         File "<pip-setuptools-caller>", line 34, in <module>
#6 150.2         File "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589/setup.py", line 183, in <module>
#6 150.2           setup(name=DISTNAME,
#6 150.2         File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
#6 150.2           return distutils.core.setup(**attrs)
#6 150.2         File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
#6 150.2           dist.run_commands()
#6 150.2         File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
#6 150.2           self.run_command(cmd)
#6 150.2         File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
#6 150.2           cmd_obj.run()
#6 150.2         File "/usr/local/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
#6 150.2           return orig.install.run(self)
#6 150.2         File "/usr/local/lib/python3.8/distutils/command/install.py", line 545, in run
#6 150.2           self.run_command('build')
#6 150.2         File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
#6 150.2           self.distribution.run_command(command)
#6 150.2         File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
#6 150.2           cmd_obj.run()
#6 150.2         File "/usr/local/lib/python3.8/distutils/command/build.py", line 135, in run
#6 150.2           self.run_command(cmd_name)
#6 150.2         File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
#6 150.2           self.distribution.run_command(command)
#6 150.2         File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
#6 150.2           cmd_obj.run()
#6 150.2         File "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589/setup.py", line 119, in run
#6 150.2           self.build_extension(ext)
#6 150.2         File "/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589/setup.py", line 177, in build_extension
#6 150.2           subprocess.check_call(['cmake', ext.sourcedir] + cmake_args,
#6 150.2         File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
#6 150.2           raise CalledProcessError(retcode, cmd)
#6 150.2       subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-4b7fqc_b/giotto-tda_6dea9f387bf549009359ec914602b589/build/lib.linux-aarch64-3.8', '-DPYTHON_EXECUTABLE=/usr/local/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
#6 150.2       [end of output]
#6 150.2
#6 150.2   note: This error originates from a subprocess, and is likely not a problem with pip.
#6 150.2 error: legacy-install-failure
#6 150.2
#6 150.2 × Encountered error while trying to install package.
#6 150.2 ╰─> giotto-tda
#6 150.2
#6 150.2 note: This is an issue with the package mentioned above, not pip.
#6 150.2 hint: See above for output from the failure.
#6 150.2 WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
#6 150.2 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip install -U giotto-tda]: exit code: 1

I have tried using different versions of Python as well (latest, 3.6, etc.). Also tried downgrading pip to <20.0.0 because I read somewhere that CMake is breaking after pip 20.0.0, but without any success.

Is anyone else getting this error? How do I fix it. Isn't Docker's whole schtick providing platform-agnostic builds? It's ironic that I need to switch to Linux instead of MacOSX for building this image. I'm stuck at this and any help is appreciated.

EDIT: Grammatical error


问:
Golang calls windows.CreateProcessAsUser function how to get Stdout content
Golang calls windows.CreateProcessAsUser function how to get Stdout content:

func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error)
```

I tried to convert the C code of Creating a Child Process with Redirected Input and Output to Go code, but failed.

Body:
Golang calls windows.CreateProcessAsUser function how to get Stdout content:

func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error)

I tried to convert the C code of Creating a Child Process with Redirected Input and Output to Go code, but failed.


问:
Failed to connect. Is Docker running? in Visual Studio Docker extension
I've been using the VScode Docker extension to visualize running containers.

Lately (2 weeks circa today) the Docker tab shows the error:

```<code>Failed to connect. Is Docker running?
</code>```

Error in tab](https://i.stack.imgur.com/bGMHg.png)

I can still operate using docker ps and exec and I can see the list of images installed in the machine.
I've searched online but I can't seem to be seeing this same error.

```<code>> Error: Template parsing error:template::1:194: executing "" at <.State>: can't evaluate filed State in type *formatter.containerContext
</code>```

I tried searching stack overlflow but it seems that I can't see the same error as I'm having.

Body:
I've been using the VScode Docker extension to visualize running containers.

Lately (2 weeks circa today) the Docker tab shows the error:

Failed to connect. Is Docker running?

Error in tab](https://i.stack.imgur.com/bGMHg.png)

I can still operate using docker ps and exec and I can see the list of images installed in the machine.
I've searched online but I can't seem to be seeing this same error.

> Error: Template parsing error:template::1:194: executing "" at <.State>: can't evaluate filed State in type *formatter.containerContext

I tried searching stack overlflow but it seems that I can't see the same error as I'm having.


问:
Clang AST: Unused methods of class templates don't appear in AST
I am working on a source-to-source conversion tool, using Clang's AST via libTooling.

There is one problem which I can't seem to workaround. Consider the following C++ code:

```<code>template<typename T>
struct s {
    void lazy1() {}
    void lazy2() {} // unused
};

int main() {
    s<int> inst;
    inst.lazy1();
    return 0;
}
</code>```

In Clang's AST, definition of lazy1() is fully available (i.e., a CompoundStmt exists as child), while lazy2() has no children:

```<code>[...]
`-ClassTemplateSpecializationDecl 0x7de4a8 <line:1:1, line:5:1> line:2:8 struct s definition
[...]
  |-CXXMethodDecl 0x7de790 <line:3:2, col:16> col:7 used lazy1 'void ()'
  | `-CompoundStmt 0x7de310 <col:15, col:16>
  |-CXXMethodDecl 0x7de840 <line:4:2, col:16> col:7 lazy2 'void ()'
[...]
</code>```

As I understand, Clang only emits method definitions if they are actually used. In this example, lazy2() is unused and I can't access any definition data in the AST.

I need to access all method definitions of all template specializations.

I am interested in a non-hacky, reliable solution. I am ready to patch Clang, if necessary. I've already tried this answer on Stackoverflow, however, in my case it doesn't work.

Body:
I am working on a source-to-source conversion tool, using Clang's AST via libTooling.

There is one problem which I can't seem to workaround. Consider the following C++ code:

template<typename T>
struct s {
    void lazy1() {}
    void lazy2() {} // unused
};

int main() {
    s<int> inst;
    inst.lazy1();
    return 0;
}

In Clang's AST, definition of lazy1() is fully available (i.e., a CompoundStmt exists as child), while lazy2() has no children:

[...]
`-ClassTemplateSpecializationDecl 0x7de4a8 <line:1:1, line:5:1> line:2:8 struct s definition
[...]
  |-CXXMethodDecl 0x7de790 <line:3:2, col:16> col:7 used lazy1 'void ()'
  | `-CompoundStmt 0x7de310 <col:15, col:16>
  |-CXXMethodDecl 0x7de840 <line:4:2, col:16> col:7 lazy2 'void ()'
[...]

As I understand, Clang only emits method definitions if they are actually used. In this example, lazy2() is unused and I can't access any definition data in the AST.

I need to access all method definitions of all template specializations.

I am interested in a non-hacky, reliable solution. I am ready to patch Clang, if necessary. I've already tried this answer on Stackoverflow, however, in my case it doesn't work.


问:
What happens when we create a common user specifying CONTAINER=CURRENT in Oracle Database?
What happens when we create a common user specifying CONTAINER=CURRENT?
Considering the following create user statement :

```<code>CREATE USER c##comm_user IDENTIFIED BY comm_pwd CONTAINER = CURRENT;
</code>```

Will that user still be a common user? If so, what is the difference between specifying CURRENT or ALL for the container, for both application containers or CDB container?

Body:
What happens when we create a common user specifying CONTAINER=CURRENT?
Considering the following create user statement :

CREATE USER c##comm_user IDENTIFIED BY comm_pwd CONTAINER = CURRENT;

Will that user still be a common user? If so, what is the difference between specifying CURRENT or ALL for the container, for both application containers or CDB container?


问:
Is there a way to not request location permission after LOCATION_WHEN_IN_USE permission has been granted on the system settings, on an Expo Project?
I am doing a react native project on expo. When a user have a "never" permission on the phone, when pressing share location button, the app asks if the user wants to change location manually and if "yes" the app redirects to system settings.

However when the user turns back and I try to access location through method getCurrentPositionAsync (expo-location library) and I still see the "LOCATION_FOREGROUND permission is required to do this operation" error, even though the LOCATION_WHEN_IN_USE permission has been granted on the system settings, because my app has not requested the permission through the expo-location API.

Is there a way to achieve this on an expo project, without having to ask twice? (testing on iphone)


问:
How to implement html tooth model (Angular, JS)
I am trying to create in the end Angular object "tooth", which would look like attached picture

Tooth has surfaces, which may have different colors, based on surface status (enamel, amalgam...)
I want these surface to be clickable, so I can change their status, as well as further data
My idea was to use a html image map on "generated picture", but it would result in "physical jpg file" to which I would link the map....
But set of teeth has many tooth, so I would have to have many files, .....

I have created java code, which "draws" the image and also generate the image map. Here is just code sample:

```<code>    //Drawing rectangles
g2d.drawRect(indent,indent,imgDim.width-stroke, imgDim.height-stroke);
g2d.drawRect(smallRectOrigX,smallRectOrigY,rectWidth+adjust, rectHeight+adjust);
//Drawing connection lines

g2d.drawLine(bigRectOrigX,bigRectOrigY,smallRectOrigX,smallRectOrigY);
g2d.drawLine(bigRectOrigX,bigRectEndY,smallRectOrigX,smallRectEndY);
g2d.drawLine(bigRectEndX,bigRectEndY,smallRectEndX,smallRectEndY);
g2d.drawLine(bigRectEndX,bigRectOrigY,smallRectEndX,smallRectOrigY);
</code>```

Basically what I need id to dynamically generate tooth image based on db data about the tooth surfaces and have a image map, which will allow me to work with the tooth...

I do not know, how to do this...Can you recommend me the solution?

Body:
I am trying to create in the end Angular object "tooth", which would look like attached picture

Tooth has surfaces, which may have different colors, based on surface status (enamel, amalgam...)
I want these surface to be clickable, so I can change their status, as well as further data
My idea was to use a html image map on "generated picture", but it would result in "physical jpg file" to which I would link the map....
But set of teeth has many tooth, so I would have to have many files, .....

I have created java code, which "draws" the image and also generate the image map. Here is just code sample:

    //Drawing rectangles
g2d.drawRect(indent,indent,imgDim.width-stroke, imgDim.height-stroke);
g2d.drawRect(smallRectOrigX,smallRectOrigY,rectWidth+adjust, rectHeight+adjust);
//Drawing connection lines

g2d.drawLine(bigRectOrigX,bigRectOrigY,smallRectOrigX,smallRectOrigY);
g2d.drawLine(bigRectOrigX,bigRectEndY,smallRectOrigX,smallRectEndY);
g2d.drawLine(bigRectEndX,bigRectEndY,smallRectEndX,smallRectEndY);
g2d.drawLine(bigRectEndX,bigRectOrigY,smallRectEndX,smallRectOrigY);

Basically what I need id to dynamically generate tooth image based on db data about the tooth surfaces and have a image map, which will allow me to work with the tooth...

I do not know, how to do this...Can you recommend me the solution?


问:
create a scoring value based on filtering in pandas
Imagine we have 2 dataframes. Df1 has 1000 rows and 12 columns and has a projection of a student for the next 12 months. The other dataframe (1000 by 15) has the credentials of all of our students. What I want is to implement the following logic:

group the students by id and country

if in df2 the column "test" has a value "not given" then give a score of 0 for all 12 months in df1

if in df2 the column "test" has a value "given" then i should count the "given" per id and country (the group by in step 1.)

I have done the following:

```<code># setting the filters
given = df2['test'] == 'not given'
not given = df2['test'] != 'not given'

#give the score 0 in all columns of df1 based on the filtering of df2
df1.loc[given] = 0

# try to find the number of students that have the same id and country based on the groupby on 1st step
temp_df2 = df2[not given]
groups = pd.DataFrame(temp_df2.groupby(["name", "country"]).size())
</code>```

When I do this I create a dataframe that has as index the "name" and "country" separated by "/". Now I do the following

```<code>groups.reset_index(level=0, inplace=True)
groups.reset_index(level=0, inplace=True)
groups.rename(columns = {0:'counts'}, inplace = True)
</code>```

Now I have a dataframe of the following form

```<code>groups

name           country           counts
Alex            Japan            2
George          Italy            1

</code>```

Now I want to find the values in df2 that have the same name and country and in the corresponding rows in df1 set 10 divided by the value of "counts" in groups dataframe. For example

I have to look in df2 for the rows that have the name Alex and country Japan and

then in df1 I should do 10/2 thus insert 5 in all 12 columns for the rows that I have found in step 1

However, I am not quite sure how to do this matching so I can make the division

Body:
Imagine we have 2 dataframes. Df1 has 1000 rows and 12 columns and has a projection of a student for the next 12 months. The other dataframe (1000 by 15) has the credentials of all of our students. What I want is to implement the following logic:

group the students by id and country

if in df2 the column "test" has a value "not given" then give a score of 0 for all 12 months in df1

if in df2 the column "test" has a value "given" then i should count the "given" per id and country (the group by in step 1.)

I have done the following:

# setting the filters
given = df2['test'] == 'not given'
not given = df2['test'] != 'not given'

#give the score 0 in all columns of df1 based on the filtering of df2
df1.loc[given] = 0

# try to find the number of students that have the same id and country based on the groupby on 1st step
temp_df2 = df2[not given]
groups = pd.DataFrame(temp_df2.groupby(["name", "country"]).size())

When I do this I create a dataframe that has as index the "name" and "country" separated by "/". Now I do the following

groups.reset_index(level=0, inplace=True)
groups.reset_index(level=0, inplace=True)
groups.rename(columns = {0:'counts'}, inplace = True)

Now I have a dataframe of the following form

groups

name           country           counts
Alex            Japan            2
George          Italy            1

Now I want to find the values in df2 that have the same name and country and in the corresponding rows in df1 set 10 divided by the value of "counts" in groups dataframe. For example

I have to look in df2 for the rows that have the name Alex and country Japan and

then in df1 I should do 10/2 thus insert 5 in all 12 columns for the rows that I have found in step 1

However, I am not quite sure how to do this matching so I can make the division


问:
i have to set a range for my textbox in wpf
have to set range for my textbox at runtime .the range should be be >=25 to <=50.
what should I use in WPF so that if user enters value out of range  then another textbox shows the incorrect range msg

I have tried some property but it is not accepting the range ......it is just giving the error msg on changing the default value

but I want to show the msg only when the range is less than 25 and greater than 50


问:
How to solve 'connect-redis' error 'A client must be directly provided to the RedisStore'
During the maintenance process, of a NodeJS backend application, I updated the connect-redis package to the last version 6.1.3 and bumped in the following error

Error: A client must be directly provided to the RedisStore

I tried to check online but I didn't understand what change I needed to make in my code to make it work

```<code>import redisStore from 'connect-redis';
import session from 'express-session';
import config from '../config/conf';

const RedisStore = redisStore(session);
const sessionStore = new RedisStore({ url: process.env.SESSION_REDIS_URL });
const sessionConfig = {
  name: 'os.sid',
  store: sessionStore,
  saveUninitialized: false,
  resave: false,
  secret: config.sessionSecret,
  secure: config.isProduction,
  cookie: {
    path: '/',
    httpOnly: true,
    secure: config.isProduction,
    maxAge: null,
  },
};
</code>```

I tried to read this but I cannot figure out what to change in my code with the imports

connec-redis post about the issue

Body:
During the maintenance process, of a NodeJS backend application, I updated the connect-redis package to the last version 6.1.3 and bumped in the following error

Error: A client must be directly provided to the RedisStore

I tried to check online but I didn't understand what change I needed to make in my code to make it work

import redisStore from 'connect-redis';
import session from 'express-session';
import config from '../config/conf';

const RedisStore = redisStore(session);
const sessionStore = new RedisStore({ url: process.env.SESSION_REDIS_URL });
const sessionConfig = {
  name: 'os.sid',
  store: sessionStore,
  saveUninitialized: false,
  resave: false,
  secret: config.sessionSecret,
  secure: config.isProduction,
  cookie: {
    path: '/',
    httpOnly: true,
    secure: config.isProduction,
    maxAge: null,
  },
};

I tried to read this but I cannot figure out what to change in my code with the imports

connec-redis post about the issue


问:
A problem occurred evaluating project ':honeywell_plugin'
I am trying to build an app for the honeywell pda EDA51
when importing the(honeywell_plugin 1.0.8) and running the app iam having the next problem.

The error msg is :

```<code>FAILURE: Build failed with an exception.

* Where:
Build file 'C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\honeywell_plugin-1.0.8\android\build.gradle' line: 43

* What went wrong:
A problem occurred evaluating project ':honeywell_plugin'.
> Project with path ':honeywell' could not be found in project ':honeywell_plugin'.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
Exception: Gradle task assembleDebug failed with exit code 1
</code>```

The function that the error is pointing to in the previous path :

```<code>dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    api project(':honeywell')
}
</code>```

The dependencies in my pubspec.yaml :

```<code>dependencies:
  flutter:
    sdk: flutter
  fluttertoast: ^8.0.8

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  honeywell_plugin: ^1.0.8
</code>```

The import in my .dart file :

```<code>import 'package:flutter/material.dart';
import 'package:honeywell_plugin/honeywell_plugin.dart';
</code>```

Body:
I am trying to build an app for the honeywell pda EDA51
when importing the(honeywell_plugin 1.0.8) and running the app iam having the next problem.

The error msg is :

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\honeywell_plugin-1.0.8\android\build.gradle' line: 43

* What went wrong:
A problem occurred evaluating project ':honeywell_plugin'.
> Project with path ':honeywell' could not be found in project ':honeywell_plugin'.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
Exception: Gradle task assembleDebug failed with exit code 1

The function that the error is pointing to in the previous path :

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    api project(':honeywell')
}

The dependencies in my pubspec.yaml :

dependencies:
  flutter:
    sdk: flutter
  fluttertoast: ^8.0.8

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  honeywell_plugin: ^1.0.8

The import in my .dart file :

import 'package:flutter/material.dart';
import 'package:honeywell_plugin/honeywell_plugin.dart';


问:
How to find pixel coordination from world coordinates?
I want to find pixel coordinates of my object from known world coordinate. My code finds pixel coordinate that is higher than max pixel coordinate. What is the problem on my code? I used this matrix for my calculation :  This is my code in ptyhon :</p>
```<code>focal_length = 1386
f_x = focal_length
f_y = focal_length
c_x = 1920/2
c_y = 1080/2

#-------------------- Find pixel

m_Rotation= np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) # I matrix
print("\n  m_Rotation \n", m_Rotation)

m_Translation = np.array([[8, 1, 5]])
print("\n  m_Translation \n", m_Translation)

m_Transformation = np.concatenate((m_Rotation, m_Translation.T), axis=1)
print("\n  m_Transformation \n", m_Transformation)

m_target = np.array([[5], [10], [2], [1]])
print("\n m_target \n", m_target)

result1 = np.dot(m_Transformation, m_target)
print("\n result1 \n", result1)

m_intrinsic = np.array([[f_x, 0, c_x], [0, f_y, c_y], [0, 0, 1]])
print("\n m_intrinsic \n", m_intrinsic)

result2 = np.dot(m_intrinsic, result1)
print("\n result2 \n", result2/result2[2])
</code>```

Body:
I want to find pixel coordinates of my object from known world coordinate. My code finds pixel coordinate that is higher than max pixel coordinate. What is the problem on my code? I used this matrix for my calculation :  This is my code in ptyhon :

focal_length = 1386
f_x = focal_length
f_y = focal_length
c_x = 1920/2
c_y = 1080/2

#-------------------- Find pixel

m_Rotation= np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) # I matrix
print("\n  m_Rotation \n", m_Rotation)

m_Translation = np.array([[8, 1, 5]])
print("\n  m_Translation \n", m_Translation)

m_Transformation = np.concatenate((m_Rotation, m_Translation.T), axis=1)
print("\n  m_Transformation \n", m_Transformation)

m_target = np.array([[5], [10], [2], [1]])
print("\n m_target \n", m_target)

result1 = np.dot(m_Transformation, m_target)
print("\n result1 \n", result1)

m_intrinsic = np.array([[f_x, 0, c_x], [0, f_y, c_y], [0, 0, 1]])
print("\n m_intrinsic \n", m_intrinsic)

result2 = np.dot(m_intrinsic, result1)
print("\n result2 \n", result2/result2[2])


问:
Error while testing Yolo model on an image
I've been using code from this link https://github.com/msindev/YOLO-v3-Object-Detection/blob/master/yolo_detection_images.py.
And there's a few changes that I did to the code such as the path to my cfg, weight, and coco files and the other change is [layerName[i[0] - 1] for i in net.getUnconnectedOutLayers()] to [layerName[i - 1] for i in net.getUnconnectedOutLayers()]. And I got the following error:

```<code> IndexError `index 57 is out of bounds for axis 0 with size 1` at `color = [int(c) for c in COLORS[classIDs[i]]]`.
</code>```

Is there any way I can fix this? I'm trying to run yolo model on a local machine.
Edit: change the index error from image to text.

Body:
I've been using code from this link https://github.com/msindev/YOLO-v3-Object-Detection/blob/master/yolo_detection_images.py.
And there's a few changes that I did to the code such as the path to my cfg, weight, and coco files and the other change is [layerName[i[0] - 1] for i in net.getUnconnectedOutLayers()] to [layerName[i - 1] for i in net.getUnconnectedOutLayers()]. And I got the following error:

 IndexError `index 57 is out of bounds for axis 0 with size 1` at `color = [int(c) for c in COLORS[classIDs[i]]]`.

Is there any way I can fix this? I'm trying to run yolo model on a local machine.
Edit: change the index error from image to text.


问:
Getting a PopUp while debugging an anonymous block in Oracle SQL Developer Tool
I got an error while debugging an anonymous block in Oracle SQL Developer tool. It pops up a window saying unable to find the source file. But as this is an anonymous block, I don't need a source file. Even if I save that file and try again, it doesn't work anyway. (SQL Developer Version: 22.2.1) Here is the error I get:

Any help will be appreciated


问:
AWS GlueContext getSink Vs write_dynamic_frame_from_options
I am working on a solution where I am writing a Glue job (PySpark)to read a csv file and save it as a parquet file.
I am using the api create_dynamic_frame_from_options to read the CSV.  Documented here.

I then perform some transformation and write the DynamicFrame using write_dynamic_frame_from_options by specifying the format = "parquet".

I can also see a getSink api available to write DynamicFrame.

I am not sure I get the difference between the two or if one should be preferred over other and in what scenarios.


问:
How to remove rows in a dataframe if the cells are empty using python?
I have a dataframe in which I am trying to retrieve data only if certain value exisits in a specific column. If the value in a specific column is empty or None, that particular row should be discarded. Below is the sample dataset:

```<code>|   A   |  B  | C |
| ----- | ----|---|
| Test1 | 111 | y |
| Test2 | 222 | y |
| Test3 | 333 |   |
| Test4 | 444 | y |
</code>```

If the data is missing in column C then that row should be discarded.
The desired output is:

```<code>|   A   |  B  | C |
| ----- | ----|---|
| Test1 | 111 | y |
| Test2 | 222 | y |
| Test4 | 444 | y |
</code>```

I am trying to achieve this using below snippet but, this produces duplicates also

```<code>for x in df["C"]:
    if x == "y":
        for y in df["A"]:
            sample.append(y)

        for z in df["B"]:
            sample_1.append(z)

    else:
        continue
</code>```

Is it also possible to use df.dropna() in this case?

Body:
I have a dataframe in which I am trying to retrieve data only if certain value exisits in a specific column. If the value in a specific column is empty or None, that particular row should be discarded. Below is the sample dataset:

|   A   |  B  | C |
| ----- | ----|---|
| Test1 | 111 | y |
| Test2 | 222 | y |
| Test3 | 333 |   |
| Test4 | 444 | y |

If the data is missing in column C then that row should be discarded.
The desired output is:

|   A   |  B  | C |
| ----- | ----|---|
| Test1 | 111 | y |
| Test2 | 222 | y |
| Test4 | 444 | y |

I am trying to achieve this using below snippet but, this produces duplicates also

for x in df["C"]:
    if x == "y":
        for y in df["A"]:
            sample.append(y)

        for z in df["B"]:
            sample_1.append(z)

    else:
        continue

Is it also possible to use df.dropna() in this case?


问:
Spring SOAP: Defining a package structure which does not use the URI namespace
Given the following XSD used by Spring SOAP web services:

```<code><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ccc.jjj.nnn/verify/"
           targetNamespace="http://ccc.jjj.nnn/verify/" elementFormDefault="qualified">
...

</xs:schema>
</code>```

the request and response classes used by the web services will reside in the following package structure:

```<code>- nnn
 - jjj
  - ccc
   - verify
</code>```

Is there a way to override this and specify a different package hierarchy?
It is not possible to change the XSD namespace itself, because this is already used in production, and changing it would impact the clients.

This was possible with WebSphere. In that technology, there was a mapping file which could include the following:

```<code><package-mapping>
   <package-type>com.jjj.ws</package-type>
   <namespaceURI>http://ccc.jjj.nnn/verify<namespaceURI>
</package-mapping>
</code>```

The classes exposed by the SOAP service would then reside in the following package structure:

```<code>- com
 - jjj
  - ws
</code>```

Thanks

Body:
Given the following XSD used by Spring SOAP web services:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ccc.jjj.nnn/verify/"
           targetNamespace="http://ccc.jjj.nnn/verify/" elementFormDefault="qualified">
...

</xs:schema>

the request and response classes used by the web services will reside in the following package structure:

- nnn
 - jjj
  - ccc
   - verify

Is there a way to override this and specify a different package hierarchy?
It is not possible to change the XSD namespace itself, because this is already used in production, and changing it would impact the clients.

This was possible with WebSphere. In that technology, there was a mapping file which could include the following:

<package-mapping>
   <package-type>com.jjj.ws</package-type>
   <namespaceURI>http://ccc.jjj.nnn/verify<namespaceURI>
</package-mapping>

The classes exposed by the SOAP service would then reside in the following package structure:

- com
 - jjj
  - ws

Thanks


问:
Direct self-reference leading to cycle (through reference chain: Issue with Jackson-databind)
I am working on serializing a Java object using Jackson-databind objectMapper.
My class structure is:

```<code>public class Car
{
  private String color;
  private String type;
  private String model;
  private Car thisCar;
}
</code>```

Serialization method:

```<code>private static void serialize () throws IOException {
  Car car = getCarData();
  ObjectMapper objectMapper = new ObjectMapper();
  objectMapper.writeValue(new File("car.json"), car);
  System.out.println("Object got serialized");
}
</code>```
```<code>private static Car getCarData () {
  Car car = new Car("Red", "Sedan");
  Wheels wheels = new Wheels("Front", "Rear", null);
  car.setThisCar(car);
  return car;
}
</code>```

While executing the serialize(), getting:

Exception in thread "main" com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Direct self-reference leading to cycle (through reference chain: <package>.Car["thisCar"])
    at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)
    at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1300)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter._handleSelfReference(BeanPropertyWriter.java:944)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:722)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:774)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178)
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)
    at com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4568)
    at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3763)
    at com.informatica.service.p2i.Serializer.serialize(Serializer.java:46)
    at com.informatica.service.p2i.Serializer.main(Serializer.java:29)
```

I know in the Car class, there is a reference to self. We have a similar class structure in one of the projects which needs to be addressed with Jackson-databind serializer.

Can anyone help on resolving this self-reference issue with jackson.

I tried @JsonManagedReference and @JsonBackReference. But in an object like this Car, how can I use @JsonBackReference as the field object is referencing to its own class.

Body:
I am working on serializing a Java object using Jackson-databind objectMapper.
My class structure is:

public class Car
{
  private String color;
  private String type;
  private String model;
  private Car thisCar;
}

Serialization method:

private static void serialize () throws IOException {
  Car car = getCarData();
  ObjectMapper objectMapper = new ObjectMapper();
  objectMapper.writeValue(new File("car.json"), car);
  System.out.println("Object got serialized");
}

private static Car getCarData () {
  Car car = new Car("Red", "Sedan");
  Wheels wheels = new Wheels("Front", "Rear", null);
  car.setThisCar(car);
  return car;
}

While executing the serialize(), getting:

Exception in thread "main" com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Direct self-reference leading to cycle (through reference chain: <package>.Car["thisCar"])
    at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)
    at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1300)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter._handleSelfReference(BeanPropertyWriter.java:944)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:722)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:774)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178)
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)
    at com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4568)
    at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3763)
    at com.informatica.service.p2i.Serializer.serialize(Serializer.java:46)
    at com.informatica.service.p2i.Serializer.main(Serializer.java:29)

I know in the Car class, there is a reference to self. We have a similar class structure in one of the projects which needs to be addressed with Jackson-databind serializer.

Can anyone help on resolving this self-reference issue with jackson.

I tried @JsonManagedReference and @JsonBackReference. But in an object like this Car, how can I use @JsonBackReference as the field object is referencing to its own class.


问:
cannot find module or its corresponding type declarations JSZIP
I am trying to export a png from figma file. I refer
https://github.com/brianlovin/figma-export-zip

I use visual studio code editor. In my project, in terminal, I used

npm install jszip

It successfully installed and after that I can see js_zip in node modules.

When I use

import JSZip from '../node_modules/jszip/dist/jszip.min.js';
statement, I am getting an error.

cannot find module or its corresponding type declarations

I tried to install the jsZip library and I am expecting to use JSZIP related functions


问:
The name MainViewModel does not exist in the namespace "clr-namespace:LINQ3_Test_aus_LINQ2"
I get the error message which is written in the title.

My XAML looks like this:

```<code><Window x:Class="LINQ3_Test_aus_LINQ2.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:LINQ3_Test_aus_LINQ2"
    Title="MainWindow" Height="450" Width="800">
<Window.DataContext>
    <local:MainViewModel/>
</Window.DataContext>
<Grid>
    <TextBox x:Name="txt_LiefNr" HorizontalAlignment="Left" Height="26" Margin="55,50,0,0" TextWrapping="Wrap" Text="{Binding LiefNr}" VerticalAlignment="Top" Width="125"/>
    <TextBox x:Name="txt_LiefName" HorizontalAlignment="Left" Height="26" Margin="55,93,0,0" TextWrapping="Wrap" Text="{Binding LiefName}" VerticalAlignment="Top" Width="125"/>
    <Button x:Name="btn_LiefNr" Content="Button" HorizontalAlignment="Left" Height="26" Margin="215,50,0,0" VerticalAlignment="Top" Width="116" Command="{Binding LookupCommand}"/>
</Grid>
</code>```

and my MainViewModel.cs like this:

```<code>using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace LINQ3_Test_aus_LINQ2
{
     public  class MainViewModel : INotifyPropertyChanged
    {
        private string _liefNr;
        private string _liefName;

        public ICommand LookupCommand { get; set; }

        public string LiefNr
        {
            get { return _liefNr; }
            set
            {
                _liefNr = value;
                OnPropertyChanged();
            }
        }

        public string LiefName
        {
            get { return _liefName; }
            set
            {
                _liefName = value;
                OnPropertyChanged();
            }
        }

        public MainViewModel()
        {
            LookupCommand = new RelayCommand(Lookup);
        }

        private void Lookup()
        {
            Excel.OpenFile();
            LiefName = Excel.Fill(LiefNr);
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
</code>```

I cant find a solution to this error thats why i am asking you. I have checked multiple times if something is wrong the the names, but there is not its all written correctly.

Body:
I get the error message which is written in the title.

My XAML looks like this:

<Window x:Class="LINQ3_Test_aus_LINQ2.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:LINQ3_Test_aus_LINQ2"
    Title="MainWindow" Height="450" Width="800">
<Window.DataContext>
    <local:MainViewModel/>
</Window.DataContext>
<Grid>
    <TextBox x:Name="txt_LiefNr" HorizontalAlignment="Left" Height="26" Margin="55,50,0,0" TextWrapping="Wrap" Text="{Binding LiefNr}" VerticalAlignment="Top" Width="125"/>
    <TextBox x:Name="txt_LiefName" HorizontalAlignment="Left" Height="26" Margin="55,93,0,0" TextWrapping="Wrap" Text="{Binding LiefName}" VerticalAlignment="Top" Width="125"/>
    <Button x:Name="btn_LiefNr" Content="Button" HorizontalAlignment="Left" Height="26" Margin="215,50,0,0" VerticalAlignment="Top" Width="116" Command="{Binding LookupCommand}"/>
</Grid>

and my MainViewModel.cs like this:

using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace LINQ3_Test_aus_LINQ2
{
     public  class MainViewModel : INotifyPropertyChanged
    {
        private string _liefNr;
        private string _liefName;

        public ICommand LookupCommand { get; set; }

        public string LiefNr
        {
            get { return _liefNr; }
            set
            {
                _liefNr = value;
                OnPropertyChanged();
            }
        }

        public string LiefName
        {
            get { return _liefName; }
            set
            {
                _liefName = value;
                OnPropertyChanged();
            }
        }

        public MainViewModel()
        {
            LookupCommand = new RelayCommand(Lookup);
        }

        private void Lookup()
        {
            Excel.OpenFile();
            LiefName = Excel.Fill(LiefNr);
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

I cant find a solution to this error thats why i am asking you. I have checked multiple times if something is wrong the the names, but there is not its all written correctly.


问:
Cannot load extension to chromium in headful mode inside Github actions
I'm trying to test my chrome extension using Github Actions.

This is how I setup the tests and the fixtures:

extensionContext: async ({ exe_path }, use) => {
  const pathToExtension = path.join(__dirname, '..', 'build');
  const extensionContext = await chromium.launch({
    headless: false,
    args: [
      `--disable-extensions-except=${pathToExtension}`,
      `--load-extension=${pathToExtension}`,
    ],
    executablePath: exe_path,
  });
  await use(await extensionContext.newContext());
  await extensionContext.close();
},
```
<p>I'm running the system test inside Github actions using a Makefile, the target runs the next command:</p>
<pre class="lang-bash prettyprint-override"><code>xvfb-run --auto-servernum --server-args='-screen 0, 1920x1080x24' yarn run test --project=${BROWSER}
</code>```

The setup is as follows (Also from the Makefile):

yarn install --frozen-lockfile
yarn run playwright install --with-deps
```

When I run the above code, chromium.launch hangs and the test fails after the 30s timeout.
When I remove the --disable-extensions-except flag launch succeeds, but the extension is not loaded (although the --load-extension flag remains).

Is there a working example on how to test extensions in headful mode inside any CI/CD framework (preferably Github actions)?

Additional Info:

Playwright Version: 1.28.0

Operating System: Linux (ubuntu-latest runner in Github actions)

Node.js version: 18.12.0

Browser: chromium

Thanks

Body:
I'm trying to test my chrome extension using Github Actions.

This is how I setup the tests and the fixtures:

extensionContext: async ({ exe_path }, use) => {
  const pathToExtension = path.join(__dirname, '..', 'build');
  const extensionContext = await chromium.launch({
    headless: false,
    args: [
      `--disable-extensions-except=${pathToExtension}`,
      `--load-extension=${pathToExtension}`,
    ],
    executablePath: exe_path,
  });
  await use(await extensionContext.newContext());
  await extensionContext.close();
},

I'm running the system test inside Github actions using a Makefile, the target runs the next command:

xvfb-run --auto-servernum --server-args='-screen 0, 1920x1080x24' yarn run test --project=${BROWSER}

The setup is as follows (Also from the Makefile):

yarn install --frozen-lockfile
yarn run playwright install --with-deps

When I run the above code, chromium.launch hangs and the test fails after the 30s timeout.
When I remove the --disable-extensions-except flag launch succeeds, but the extension is not loaded (although the --load-extension flag remains).

Is there a working example on how to test extensions in headful mode inside any CI/CD framework (preferably Github actions)?

Additional Info:

Playwright Version: 1.28.0

Operating System: Linux (ubuntu-latest runner in Github actions)

Node.js version: 18.12.0

Browser: chromium

Thanks


问:
Serverless, monorepo, avoid deployment of not changed services in Github Action
TLDR Is there a way to backup the Serverless configuration files (for instance in .serverless) that triggers the Service files not changed. Skipping deployment ... behavior in CI/CD pipelines.

Background:
We do run a quite large (200 REST endpoints) application built with Serverless 3 on top of AWS Lambda. We have recently moved from deploying from local machines to fully automating the deployments in three stages with Github Actions.

Problem: The deployments take around 20 minutes each and we found that it was often quicker on local machines. The reason being that on local machines the Serverless framework figured out which stacks to actually deploy and which not by computing a SHA checksum of the artefacts and only actually deploying to the cloud provider if the assets have changed.

Question: How can we backup configuration files (for instance the .serverless configuration folders) nested within the structure of our mono-repo in such a way that these files are available on each consecutive build run such that Serverless can issue the Service files not changed. Skipping deployment ... warning on unchanged functions instead of running a full deployment each time.


问:
getx value not listen on button click
I want to listen to value from the button press with getx, but the getx value won't change except hot reload is pressed manually.

```<code>
RxBool visible = false.obs;

Visibility(
visible: statusRequest!
                                            .toLowerCase()
                                            .contains("canceled") ||
                                        statusRequest!
                                            .toLowerCase()
                                            .contains("rejected")
                                    ? true
                                    : false,
                                child: Container(
                                  width: size.width * 0.9,
                                  height: size.height * 0.06,
                                  child: Obx(
                                    () => ElevatedButton(
                                        style: ElevatedButton.styleFrom(
                                            backgroundColor: kButtonColor),
                                        onPressed: () {
                                          print("Request button tapped");
                                          final form = formKey.currentState!;
                                          setState(() {
                                            visible.value = !visible.value;
                                            print('visibel ' +
                                                visible.toString());
                                          });
                                        },
                                        child: RichText(
                                          text: TextSpan(children: [
                                            TextSpan(
                                              text: !visible.value
                                                  ? 'Edit Settlement'
                                                  : 'Cancel Edit',
                                              style: TextStyle(
                                                  fontSize: 16,
                                                  color: Colors.white,
                                                  fontWeight: FontWeight.bold),
                                            ),
                                          ]),
                                        )),
                                  ),
                                ),

),
</code>```

and in this the function I call from initState

```<code>addPerDateDraft(int i) async {
    dynamicPerDate.add(DynamicSettlementPerDate(
        key: UniqueKey(),
        isEdit: visible,
        Date: dataListTravelAdvance[0].settlementDetail![i].claimDate,
        listDetail: dataListTravelAdvance[0].settlementDetail![i].detail!.obs));
    print('date draft added $i');
    setState(() {});
  }
</code>```

inside class DynamicSettlementPerDate there a func to create a category object from CategorySettlement.

```<code>addCategoryPerDateFromDraft() {
    setState(() {
      for (int i = 0; widget.listDetail!.length > i; i++) {
        var typeClaim = widget.listDetail![i].typeClaim;
        var totalClaim = widget.listDetail![i].totalClaim!.obs;

        widget.listCategorySettlement!.add(CategorySettlement(
          isEdit: widget.isEdit,
          selectedCategory: typeClaim,
          amountCategory: totalClaim,
        ));
      }
    });
    print('new CategorySettlement from draft added');
    print('${widget.listCategorySettlement}');
  }
</code>```

inside CategorySettlement is a text field and dropdown that I want to disable/enable from the main class with isEdit.

```<code>lass CategorySettlement extends StatefulWidget {
  String? selectedCategory;
  RxInt? amountCategory;
  String? Function(String?)? validators;
  TextEditingController? amountController;
  RxBool? isEdit;
  CategorySettlement(
      {Key? key,
      this.validators,
      this.selectedCategory,
      this.amountCategory,
      this.amountController,
      this.isEdit})
      : super(key: key);

  @override
  _CategorySettlementState createState() => _CategorySettlementState();
}
</code>```

Title: getx value not listen on button click

Body:
I want to listen to value from the button press with getx, but the getx value won't change except hot reload is pressed manually.

RxBool visible = false.obs;

Visibility(
visible: statusRequest!
                                            .toLowerCase()
                                            .contains("canceled") ||
                                        statusRequest!
                                            .toLowerCase()
                                            .contains("rejected")
                                    ? true
                                    : false,
                                child: Container(
                                  width: size.width * 0.9,
                                  height: size.height * 0.06,
                                  child: Obx(
                                    () => ElevatedButton(
                                        style: ElevatedButton.styleFrom(
                                            backgroundColor: kButtonColor),
                                        onPressed: () {
                                          print("Request button tapped");
                                          final form = formKey.currentState!;
                                          setState(() {
                                            visible.value = !visible.value;
                                            print('visibel ' +
                                                visible.toString());
                                          });
                                        },
                                        child: RichText(
                                          text: TextSpan(children: [
                                            TextSpan(
                                              text: !visible.value
                                                  ? 'Edit Settlement'
                                                  : 'Cancel Edit',
                                              style: TextStyle(
                                                  fontSize: 16,
                                                  color: Colors.white,
                                                  fontWeight: FontWeight.bold),
                                            ),
                                          ]),
                                        )),
                                  ),
                                ),

),

and in this the function I call from initState

addPerDateDraft(int i) async {
    dynamicPerDate.add(DynamicSettlementPerDate(
        key: UniqueKey(),
        isEdit: visible,
        Date: dataListTravelAdvance[0].settlementDetail![i].claimDate,
        listDetail: dataListTravelAdvance[0].settlementDetail![i].detail!.obs));
    print('date draft added $i');
    setState(() {});
  }

inside class DynamicSettlementPerDate there a func to create a category object from CategorySettlement.

addCategoryPerDateFromDraft() {
    setState(() {
      for (int i = 0; widget.listDetail!.length > i; i++) {
        var typeClaim = widget.listDetail![i].typeClaim;
        var totalClaim = widget.listDetail![i].totalClaim!.obs;

        widget.listCategorySettlement!.add(CategorySettlement(
          isEdit: widget.isEdit,
          selectedCategory: typeClaim,
          amountCategory: totalClaim,
        ));
      }
    });
    print('new CategorySettlement from draft added');
    print('${widget.listCategorySettlement}');
  }

inside CategorySettlement is a text field and dropdown that I want to disable/enable from the main class with isEdit.

lass CategorySettlement extends StatefulWidget {
  String? selectedCategory;
  RxInt? amountCategory;
  String? Function(String?)? validators;
  TextEditingController? amountController;
  RxBool? isEdit;
  CategorySettlement(
      {Key? key,
      this.validators,
      this.selectedCategory,
      this.amountCategory,
      this.amountController,
      this.isEdit})
      : super(key: key);

  @override
  _CategorySettlementState createState() => _CategorySettlementState();
}


问:
C preprocessor, how to change #define value by another #define?
I would like to change #define value according to another #define enabled. Not #if ... #else, not #undef.

example:

```<code>#define xxxx_ScanNumber   5
.....
// if consumeTimeTooMuch == 1,
// then change xxxx_ScanNumber based on original define value.
#define consumeTimeTooMuch   1
#define xxxx_ScanNumber   (xxxx_ScanNumber - 2)
</code>```

I am not sure that I can change define value by itself?
Please let me know, thank you in advance.

Body:
I would like to change #define value according to another #define enabled. Not #if ... #else, not #undef.

example:

#define xxxx_ScanNumber   5
.....
// if consumeTimeTooMuch == 1,
// then change xxxx_ScanNumber based on original define value.
#define consumeTimeTooMuch   1
#define xxxx_ScanNumber   (xxxx_ScanNumber - 2)

I am not sure that I can change define value by itself?
Please let me know, thank you in advance.


问:
Merge two charts or adding dots for values with Charts Ant Design
How could I add two charts in one view or adding dots for BoxPlot, becase I will add another value for y-axis not only the low, high , q1 , q2 I want to add additional values and present it as dots,

The view that I'm looking for is similar to below screen shot:


问:
How to detect whether gesture navigation or button navigation is active?
After Android 10, users can prefer gesture navigation mode. I want to detect whether the device in gesture navigation mode or not. I will change the design with respect to system navigation preference.

I can't find anything in documentation. How to do it?

Do you have any official API or workaround?


问:
JSONArray problem, cant get data, Android Studio
I have a problem with JsonArrayRequest,can't pull data from the "openweathermap" API, when I do the same thing with StringRequest, it pulls the data without any problem. But it doesn't work with JsonArrayRequest.

```<code>btn_cityID.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                // Instantiate the RequestQueue.
                RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
                String apikey = "//";
                String url = "//";

                JsonArrayRequest request = new JsonArrayRequest(Request.Method.GET, url,null, new Response.Listener<JSONArray>() {
                    @Override
                    public void onResponse(JSONArray response){

                        Toast.makeText(MainActivity.this, response.toString(), Toast.LENGTH_SHORT).show();
                    }
                }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(MainActivity.this, "Unable to fetch data: ", Toast.LENGTH_SHORT).show();
                    }
                });
//             StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
//                    @Override
//                    public void onResponse(String response) {
//
//                        Toast.makeText(MainActivity.this, response, Toast.LENGTH_SHORT).show();
//                    }
//                }, new Response.ErrorListener() {
//                    @Override
//                    public void onErrorResponse(VolleyError error) {
//                        Toast.makeText(MainActivity.this, "Unable to fetch data: ", Toast.LENGTH_SHORT).show();
//                    }
//                });

                queue.add(request);

            }
        });
</code>```

API response:

{
"coord": {
"lon": -0.1257,
"lat": 51.5085
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10d"
}
],
"base": "stations",
"main": {
"temp": 285.39,
"feels_like": 285.1,
"temp_min": 284.32,
"temp_max": 286.08,
"pressure": 1007,
"humidity": 93
},
"visibility": 10000,
"wind": {
"speed": 7.2,
"deg": 210
},
"rain": {
"1h": 0.27
},
"clouds": {
"all": 100
},
"dt": 1671445217,
"sys": {
"type": 2,
"id": 2075535,
"country": "GB",
"sunrise": 1671436957,
"sunset": 1671465146
},
"timezone": 0,
"id": 2643743,
"name": "London",
"cod": 200
}

Body:
I have a problem with JsonArrayRequest,can't pull data from the "openweathermap" API, when I do the same thing with StringRequest, it pulls the data without any problem. But it doesn't work with JsonArrayRequest.

btn_cityID.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                // Instantiate the RequestQueue.
                RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
                String apikey = "//";
                String url = "//";

                JsonArrayRequest request = new JsonArrayRequest(Request.Method.GET, url,null, new Response.Listener<JSONArray>() {
                    @Override
                    public void onResponse(JSONArray response){

                        Toast.makeText(MainActivity.this, response.toString(), Toast.LENGTH_SHORT).show();
                    }
                }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(MainActivity.this, "Unable to fetch data: ", Toast.LENGTH_SHORT).show();
                    }
                });
//             StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
//                    @Override
//                    public void onResponse(String response) {
//
//                        Toast.makeText(MainActivity.this, response, Toast.LENGTH_SHORT).show();
//                    }
//                }, new Response.ErrorListener() {
//                    @Override
//                    public void onErrorResponse(VolleyError error) {
//                        Toast.makeText(MainActivity.this, "Unable to fetch data: ", Toast.LENGTH_SHORT).show();
//                    }
//                });

                queue.add(request);

            }
        });

API response:

{
"coord": {
"lon": -0.1257,
"lat": 51.5085
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10d"
}
],
"base": "stations",
"main": {
"temp": 285.39,
"feels_like": 285.1,
"temp_min": 284.32,
"temp_max": 286.08,
"pressure": 1007,
"humidity": 93
},
"visibility": 10000,
"wind": {
"speed": 7.2,
"deg": 210
},
"rain": {
"1h": 0.27
},
"clouds": {
"all": 100
},
"dt": 1671445217,
"sys": {
"type": 2,
"id": 2075535,
"country": "GB",
"sunrise": 1671436957,
"sunset": 1671465146
},
"timezone": 0,
"id": 2643743,
"name": "London",
"cod": 200
}


问:
Github latest release raw url to download through node js stream
How to get raw url of latest release so i can download through node js streams

import https from "https"
const { pipeline } = require("stream/promises")
import path from "path"
import fs from "fs"

async function download(url) {
    return new Promise(async (onSuccess) => {
        https.get(url, async (res) => {
            let fileName = url.split("/").pop()
            const fileWriteStream = fs.createWriteStream(path.join(__dirname, fileName), {
                autoClose: true,
                flags: "w",
            })
            await pipeline(res, fileWriteStream)
            onSuccess("success")
        })
    })
}
// works fine
await download("https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1")
// doesnt work
await download("https://github.com/spicetify/spicetify-cli/releases/download/v2.15.0/spicetify-2.15.0-windows-x64.zip")
```

if this is not possible whats the way to download latest release throught node-js as i use electron

Body:
How to get raw url of latest release so i can download through node js streams

import https from "https"
const { pipeline } = require("stream/promises")
import path from "path"
import fs from "fs"

async function download(url) {
    return new Promise(async (onSuccess) => {
        https.get(url, async (res) => {
            let fileName = url.split("/").pop()
            const fileWriteStream = fs.createWriteStream(path.join(__dirname, fileName), {
                autoClose: true,
                flags: "w",
            })
            await pipeline(res, fileWriteStream)
            onSuccess("success")
        })
    })
}
// works fine
await download("https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1")
// doesnt work
await download("https://github.com/spicetify/spicetify-cli/releases/download/v2.15.0/spicetify-2.15.0-windows-x64.zip")

if this is not possible whats the way to download latest release throught node-js as i use electron


问:
Spring ssl conf: Certificate for <test.com> doesn't match common name of the certificate subject: TEST
```<code>KeyStore clientStore = KeyStore.getInstance(certType);
        InputStream certFileStream = awsUtil.getCertificateFile();
        clientStore.load(certFileStream, certPassword.toCharArray());
        certFileStream.close();

        SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
        sslContextBuilder.setProtocol("TLS");
        sslContextBuilder.loadKeyMaterial(clientStore, certPassword.toCharArray());
        sslContextBuilder.loadTrustMaterial(clientStore, (chain, authType) -> true);
        HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);

        PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create()
                .setSSLSocketFactory(SSLConnectionSocketFactoryBuilder.create().setSslContext(sslContextBuilder.build())
                        .setTlsVersions(TLS.V_1_3, TLS.V_1_2).build()).build();

        CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();

        return new ApacheHttp5Client(httpClient);
</code>```

This is my ssl configuration for feign client. I get this error:

```<code>feign.RetryableException: Certificate for <test.com> doesn't match common name of the certificate subject: TEST
</code>```

I dont want to use this because of security problems:

```<code>SSLConnectionSocketFactory scsf = SSLConnectionSocketFactory(
     SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build(),
        NoopHostnameVerifier.INSTANCE)
</code>```

Body:
KeyStore clientStore = KeyStore.getInstance(certType);
        InputStream certFileStream = awsUtil.getCertificateFile();
        clientStore.load(certFileStream, certPassword.toCharArray());
        certFileStream.close();

        SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
        sslContextBuilder.setProtocol("TLS");
        sslContextBuilder.loadKeyMaterial(clientStore, certPassword.toCharArray());
        sslContextBuilder.loadTrustMaterial(clientStore, (chain, authType) -> true);
        HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);

        PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create()
                .setSSLSocketFactory(SSLConnectionSocketFactoryBuilder.create().setSslContext(sslContextBuilder.build())
                        .setTlsVersions(TLS.V_1_3, TLS.V_1_2).build()).build();

        CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();

        return new ApacheHttp5Client(httpClient);

This is my ssl configuration for feign client. I get this error:

feign.RetryableException: Certificate for <test.com> doesn't match common name of the certificate subject: TEST

I dont want to use this because of security problems:

SSLConnectionSocketFactory scsf = SSLConnectionSocketFactory(
     SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build(),
        NoopHostnameVerifier.INSTANCE)


问:
How to suppress copyright information on colordiff
```<code>diff /tmp/file.a /tmp/file.b | colordiff
</code>```

Gives output such as

```<code>colordiff 1.0.20 (http://www.colordiff.org/)
(C)2002-2022 John Doe, jdoe@birds.com
..
..
..
..
</code>```

I can't see any command line option for suppressing the
colordiff 1.0.20 (http://www.colordiff.org/)
(C)2002-2022 John Doe, jdoe@birds.com

I remember reading it somewhere that we could suppress it, but can't find it in colordiff --help any leads appreciated :)

Thanks!

Body:
diff /tmp/file.a /tmp/file.b | colordiff

Gives output such as

colordiff 1.0.20 (http://www.colordiff.org/)
(C)2002-2022 John Doe, jdoe@birds.com
..
..
..
..

I can't see any command line option for suppressing the
colordiff 1.0.20 (http://www.colordiff.org/)
(C)2002-2022 John Doe, jdoe@birds.com

I remember reading it somewhere that we could suppress it, but can't find it in colordiff --help any leads appreciated :)

Thanks!


问:
Highcharts Sankey diagram direction reversal issue
Wanted to revese the rendering of Highcharts Sankey Diagram from left-to-right to right-to-left. according to Highcharts forum, it was suggested to switch the keys value from:

```<code> series: [{
        keys: ['from', 'to', 'weight'],
        data: ...
        }]
</code>```

to:

```<code> series: [{
        keys: ['to', 'from', 'weight'],
        data: ...
        }]
</code>```

Output:

before:

After:

Code:

Left-to-right diagram (rendering Fine!): LINK

right-to-left diagram (Not rendering properly): LINK

Referring the abv. image, once the keys are switched the diagram is not rendering properly. Ideally, wanted to render diagrams in both left-to-right and right-to-left directions.

Body:
Wanted to revese the rendering of Highcharts Sankey Diagram from left-to-right to right-to-left. according to Highcharts forum, it was suggested to switch the keys value from:

 series: [{
        keys: ['from', 'to', 'weight'],
        data: ...
        }]

to:

 series: [{
        keys: ['to', 'from', 'weight'],
        data: ...
        }]

Output:

before:

After:

Code:

Left-to-right diagram (rendering Fine!): LINK

right-to-left diagram (Not rendering properly): LINK

Referring the abv. image, once the keys are switched the diagram is not rendering properly. Ideally, wanted to render diagrams in both left-to-right and right-to-left directions.


问:
line contains NUL error in reading a .dat file
I want to read a dat file in python but I received the NUL error :

```<code>`from astropy.io import ascii`
ascii.read('fx=0.1_RHS=0.5_fa=0.5_x_lightcone_dtb_6minres.dat')

Error: line contains NUL

</code>```

how can I solve this issue?

I've tried to read this file with csv.reader() through the following code. finally I could open the file but I suppose it's not an appropriate choice:

```<code>import csv

with open('fx=0.1_RHS=0.5_fa=0.5_x_lightcone_dtb_6minres.dat', newline='') as csv_file:
    reader = csv.reader(csv_file)
    while True:
        try:
            row = next(reader)
            print(row)
        except csv.Error:
            continue
        except StopIteration:
            break
</code>```

these are some lines of the result which looks wrong:
result

Body:
I want to read a dat file in python but I received the NUL error :

`from astropy.io import ascii`
ascii.read('fx=0.1_RHS=0.5_fa=0.5_x_lightcone_dtb_6minres.dat')

Error: line contains NUL

how can I solve this issue?

I've tried to read this file with csv.reader() through the following code. finally I could open the file but I suppose it's not an appropriate choice:

import csv

with open('fx=0.1_RHS=0.5_fa=0.5_x_lightcone_dtb_6minres.dat', newline='') as csv_file:
    reader = csv.reader(csv_file)
    while True:
        try:
            row = next(reader)
            print(row)
        except csv.Error:
            continue
        except StopIteration:
            break

these are some lines of the result which looks wrong:
result


问:
Possible to change column that has data validation values?
I have a problem where I want to change a column N that contains data validation values based on another column AA, if column AA contains specific values (X,Y). Data validation column N has options for X or Y.

I have a script which works in non data validation columns but does not work in a column N. This is the error I receive when running the script:

The data you entered in cell N2 violates the data validation rules set on this cell. Please enter one of the following values: A, B, C, D, X, Y.

Is there any way to go round this?

```<code>function Test1() {
   const ss = SpreadsheetApp.getActive();
   const sh= ss.getSheetByName("Template");
   const vs = sh.getRange(1,14,sh.getLastRow(),sh.getLastColumn()).getValues()
   let a = vs.map((r,i) => {
     if(r[14] == "X" || r[14] == "Y") {
       return ["Yes"];
     } else {
       return [r[1]];
     }
   });
   sh.getRange(1,14,a.length, a[0].length).setValues(a);
}
</code>```

Body:
I have a problem where I want to change a column N that contains data validation values based on another column AA, if column AA contains specific values (X,Y). Data validation column N has options for X or Y.

I have a script which works in non data validation columns but does not work in a column N. This is the error I receive when running the script:

The data you entered in cell N2 violates the data validation rules set on this cell. Please enter one of the following values: A, B, C, D, X, Y.

Is there any way to go round this?

function Test1() {
   const ss = SpreadsheetApp.getActive();
   const sh= ss.getSheetByName("Template");
   const vs = sh.getRange(1,14,sh.getLastRow(),sh.getLastColumn()).getValues()
   let a = vs.map((r,i) => {
     if(r[14] == "X" || r[14] == "Y") {
       return ["Yes"];
     } else {
       return [r[1]];
     }
   });
   sh.getRange(1,14,a.length, a[0].length).setValues(a);
}