问:
Duplicate symbols when linking libwebrtc.a on Android
Building WebRTC directly is somewhat painful (& rather time consuming so not ideal in paid for CI environments) so I've opted to use some excellent precompiled static libraries released on GitHub to speed things up. This has worked perfectly for all platforms I'm targetting (Windows, MacOS, iOS, Apple TVOS, linux...) except for Android.

When linking the binary on Android I encounter several duplicate symbol errors related to the std libary:

ld: error: duplicate symbol: std::logic_error::logic_error(char const*)
>>> defined at stdexcept_default.ipp:24 (../../../../../_source/android/webrtc/src/buildtools/third_party/libc++/trunk/src/support/runtime/stdexcept_default.ipp:24)
>>>            stdexcept.o:(std::logic_error::logic_error(char const*)) in archive /root/webrtc/lib/armeabi-v7a/libwebrtc.a
>>> defined at stdexcept_default.ipp:24 (/buildbot/src/android/ndk-release-r23/toolchain/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp:24)
>>>            stdexcept.o:(.text._ZNSt11logic_errorC2EPKc+0x1) in archive /app/android-sdk-linux/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_static.a

...

ld: error: duplicate symbol: std::runtime_error::runtime_error(char const*)
>>> defined at stdexcept_default.ipp:35 (../../../../../_source/android/webrtc/src/buildtools/third_party/libc++/trunk/src/support/runtime/stdexcept_default.ipp:35)
>>>            stdexcept.o:(std::runtime_error::runtime_error(char const*)) in archive /root/webrtc/lib/armeabi-v7a/libwebrtc.a
>>> defined at stdexcept_default.ipp:35 (/buildbot/src/android/ndk-release-r23/toolchain/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp:35)
>>>            stdexcept.o:(.text._ZNSt13runtime_errorC2EPKc+0x1) in archive /app/android-sdk-linux/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_static.a
```
<p>It appears that libwebrtc.a for Android includes some libc++ object files and I'm not entirely sure how to successfully link with this library here.</p>
<p>This might be coming down to the libwebrtc.a being compiled with Google's own patched libc++ (Based on what I've read online I believe Google contributes patches to upstream libc++ but they don't wait for the patches to go in - rather they use their fully patched version of libc++ for building WebRTC, Chrome, etc).</p>
<p>When compiling for Linux I actually use the exact versions of clang & libc++ that were downloaded & used in building the static library & I suspect I might need to be doing something similar here - I'm just not entirely sure how given the need to use the Android CMake toolchain.</p>
<p>I've put together a minimal example project on GitHub with Dockerfile that can be used to easily reproduce the above issue.</p>
<p>Does anyone have an idea how I can successfully link the library on Android?</p>
<p>For completeness the source files of interest are:</p>
<p><strong>CMakeLists.txt</strong></p>
```cmake_minimum_required(VERSION 3.23)
project(AndroidWebRTC)

set(CMAKE_CXX_STANDARD 17)

add_executable(AndroidWebRTC src/main.cpp)
target_link_libraries(AndroidWebRTC PRIVATE ${WEBRTC_LIBRARY})
add_compile_definitions(WEBRTC_POSIX WEBRTC_ANDROID WEBRTC_LINUX)
include_directories(
        ${WEBRTC_INCLUDE_DIR}
        ${WEBRTC_INCLUDE_DIR}/third_party/abseil-cpp
        ${WEBRTC_INCLUDE_DIR}/third_party/boringssl/src/include
        ${WEBRTC_INCLUDE_DIR}/third_party/libyuv/include
        ${WEBRTC_INCLUDE_DIR}/third_party/zlib
)

```
<p><strong>Dockerfile</strong></p>
```# I explicitly specify an amd64 platform as I often build on Apple Silicon
# machines where the default of arm64 breaks things. I believe the alternative
# (and possibly better option) is to use NDK 24 and above, see:
# https://stackoverflow.com/a/69541958
FROM  --platform=linux/amd64 ubuntu:20.04 AS build

ENV ANDROID_SDK_ROOT /app/android-sdk-linux

WORKDIR /app

# Install dependencies to build the project
# include apt-get --no-install-recommends
RUN apt-get update && \
    apt-get -y upgrade && \
    apt-get --no-install-recommends -y install tzdata && \
    echo 'Europe/London' > /etc/timezone && \
    dpkg-reconfigure -f noninteractive tzdata

RUN apt-get --no-install-recommends -y install git lsb-release python rsync \
    emacs wget build-essential sudo pkg-config clang unzip openjdk-8-jdk ant  \
    android-sdk-platform-tools-common libncurses5 curl

RUN mkdir ${ANDROID_SDK_ROOT}

# ------------------------------------------------------
# --- Android SDK
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip && \
    unzip commandlinetools-linux-7583922_latest.zip && \
    mkdir ${ANDROID_SDK_ROOT}/cmdline-tools/ &&\
    mv cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest && \
    rm commandlinetools-linux-7583922_latest.zip

ENV PATH ${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin

RUN yes | sdkmanager --licenses

RUN touch /root/.android/repositories.cfg

# Platform tools
RUN yes | sdkmanager "platform-tools"

RUN yes | sdkmanager --update --channel=0

# Keep all sections in descending order!
RUN yes | sdkmanager \
    "platforms;android-30" \
    "build-tools;31.0.0" \
    "ndk;23.1.7779620" \
    "extras;android;m2repository" \
    "extras;google;m2repository" \
    "extras;google;google_play_services" \
    "add-ons;addon-google_apis-google-24"

ENV ANDROID_HOME ${ANDROID_SDK_ROOT}
ENV ANDROID_NDK_HOME=${ANDROID_SDK_ROOT}/ndk/23.1.7779620
ENV PATH ${PATH}:${ANDROID_NDK_HOME}:${ANDROID_HOME}/build-tools/31.0.0/

# Get CMake
COPY scripts/get_cmake.sh scripts/get_cmake.sh
RUN ./scripts/get_cmake.sh "3.25.1" linux /root
ENV PATH "/root/cmake/bin:$PATH"

# Get WebRTC
COPY scripts/get_webrtc.sh scripts/get_webrtc.sh
RUN ./scripts/get_webrtc.sh 108.5359.5.0 android /root /root

## Copy resources
COPY src src
COPY CMakeLists.txt ./

RUN cmake -B build  \
    -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \
    -DANDROID_ABI=armeabi-v7a \
    -DANDROID_NATIVE_API_LEVEL=16 \
    -DBUILD_SHARED_LIBS=OFF \
    -DWEBRTC_INCLUDE_DIR=/root/webrtc/include \
    -DWEBRTC_LIBRARY=/root/webrtc/lib/armeabi-v7a/libwebrtc.a \
    -DCMAKE_BUILD_TYPE=Release

RUN cmake --build build --config Release --parallel $(nproc) --target AndroidWebRTC
```
<p><strong>src/main.cpp</strong></p>
<pre class="lang-cpp prettyprint-override"><code>#include <iostream>

#include <api/create_peerconnection_factory.h>

int main() {
    auto googleSessionDescription = webrtc::CreateSessionDescription(
            webrtc::SdpType::kOffer, "sdp");
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

</code>```

scripts/get_webrtc.sh

#!/bin/bash

if [ $# -lt 4 ]; then
  echo "$0 <webrtc_build_version> <package_name> <output_dir> <source_dir>"
  exit 1
fi

WEBRTC_BUILD_VERSION=$1
PACKAGE_NAME=$2
OUTPUT_DIR=$3
SOURCE_DIR=$4

set -ex

if [ ! -e $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz ]; then
  curl -Lo $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz https://github.com/shiguredo-webrtc-build/webrtc-build/releases/download/m${WEBRTC_BUILD_VERSION}/webrtc.${PACKAGE_NAME}.tar.gz
fi

pushd $OUTPUT_DIR
  tar xf $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz
popd
```
<p><strong>scripts/get_cmake.sh</strong></p>
<pre class="lang-bash prettyprint-override"><code>#!/bin/bash

# <platform> には Linux か Darwin を指定する
# <output_dir>/cmake に CMake が配置される
if [ $# -lt 3 ]; then
  echo "$0 <cmake_version> <platform> <output_dir>"
  exit 1
fi

CMAKE_VERSION=$1
PLATFORM=$2
OUTPUT_DIR=$3

set -ex

pushd $OUTPUT_DIR
  curl -LO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
  tar xf cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
  rm cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
  rm -rf cmake
  mv cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64 cmake
popd
</code>```

Body:
Building WebRTC directly is somewhat painful (& rather time consuming so not ideal in paid for CI environments) so I've opted to use some excellent precompiled static libraries released on GitHub to speed things up. This has worked perfectly for all platforms I'm targetting (Windows, MacOS, iOS, Apple TVOS, linux...) except for Android.

When linking the binary on Android I encounter several duplicate symbol errors related to the std libary:

ld: error: duplicate symbol: std::logic_error::logic_error(char const*)
>>> defined at stdexcept_default.ipp:24 (../../../../../_source/android/webrtc/src/buildtools/third_party/libc++/trunk/src/support/runtime/stdexcept_default.ipp:24)
>>>            stdexcept.o:(std::logic_error::logic_error(char const*)) in archive /root/webrtc/lib/armeabi-v7a/libwebrtc.a
>>> defined at stdexcept_default.ipp:24 (/buildbot/src/android/ndk-release-r23/toolchain/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp:24)
>>>            stdexcept.o:(.text._ZNSt11logic_errorC2EPKc+0x1) in archive /app/android-sdk-linux/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_static.a

...

ld: error: duplicate symbol: std::runtime_error::runtime_error(char const*)
>>> defined at stdexcept_default.ipp:35 (../../../../../_source/android/webrtc/src/buildtools/third_party/libc++/trunk/src/support/runtime/stdexcept_default.ipp:35)
>>>            stdexcept.o:(std::runtime_error::runtime_error(char const*)) in archive /root/webrtc/lib/armeabi-v7a/libwebrtc.a
>>> defined at stdexcept_default.ipp:35 (/buildbot/src/android/ndk-release-r23/toolchain/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp:35)
>>>            stdexcept.o:(.text._ZNSt13runtime_errorC2EPKc+0x1) in archive /app/android-sdk-linux/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_static.a

It appears that libwebrtc.a for Android includes some libc++ object files and I'm not entirely sure how to successfully link with this library here.

This might be coming down to the libwebrtc.a being compiled with Google's own patched libc++ (Based on what I've read online I believe Google contributes patches to upstream libc++ but they don't wait for the patches to go in - rather they use their fully patched version of libc++ for building WebRTC, Chrome, etc).

When compiling for Linux I actually use the exact versions of clang & libc++ that were downloaded & used in building the static library & I suspect I might need to be doing something similar here - I'm just not entirely sure how given the need to use the Android CMake toolchain.

I've put together a minimal example project on GitHub with Dockerfile that can be used to easily reproduce the above issue.

Does anyone have an idea how I can successfully link the library on Android?

For completeness the source files of interest are:

CMakeLists.txt

cmake_minimum_required(VERSION 3.23)
project(AndroidWebRTC)

set(CMAKE_CXX_STANDARD 17)

add_executable(AndroidWebRTC src/main.cpp)
target_link_libraries(AndroidWebRTC PRIVATE ${WEBRTC_LIBRARY})
add_compile_definitions(WEBRTC_POSIX WEBRTC_ANDROID WEBRTC_LINUX)
include_directories(
        ${WEBRTC_INCLUDE_DIR}
        ${WEBRTC_INCLUDE_DIR}/third_party/abseil-cpp
        ${WEBRTC_INCLUDE_DIR}/third_party/boringssl/src/include
        ${WEBRTC_INCLUDE_DIR}/third_party/libyuv/include
        ${WEBRTC_INCLUDE_DIR}/third_party/zlib
)

Dockerfile

# I explicitly specify an amd64 platform as I often build on Apple Silicon
# machines where the default of arm64 breaks things. I believe the alternative
# (and possibly better option) is to use NDK 24 and above, see:
# https://stackoverflow.com/a/69541958
FROM  --platform=linux/amd64 ubuntu:20.04 AS build

ENV ANDROID_SDK_ROOT /app/android-sdk-linux

WORKDIR /app

# Install dependencies to build the project
# include apt-get --no-install-recommends
RUN apt-get update && \
    apt-get -y upgrade && \
    apt-get --no-install-recommends -y install tzdata && \
    echo 'Europe/London' > /etc/timezone && \
    dpkg-reconfigure -f noninteractive tzdata

RUN apt-get --no-install-recommends -y install git lsb-release python rsync \
    emacs wget build-essential sudo pkg-config clang unzip openjdk-8-jdk ant  \
    android-sdk-platform-tools-common libncurses5 curl

RUN mkdir ${ANDROID_SDK_ROOT}

# ------------------------------------------------------
# --- Android SDK
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip && \
    unzip commandlinetools-linux-7583922_latest.zip && \
    mkdir ${ANDROID_SDK_ROOT}/cmdline-tools/ &&\
    mv cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest && \
    rm commandlinetools-linux-7583922_latest.zip

ENV PATH ${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin

RUN yes | sdkmanager --licenses

RUN touch /root/.android/repositories.cfg

# Platform tools
RUN yes | sdkmanager "platform-tools"

RUN yes | sdkmanager --update --channel=0

# Keep all sections in descending order!
RUN yes | sdkmanager \
    "platforms;android-30" \
    "build-tools;31.0.0" \
    "ndk;23.1.7779620" \
    "extras;android;m2repository" \
    "extras;google;m2repository" \
    "extras;google;google_play_services" \
    "add-ons;addon-google_apis-google-24"

ENV ANDROID_HOME ${ANDROID_SDK_ROOT}
ENV ANDROID_NDK_HOME=${ANDROID_SDK_ROOT}/ndk/23.1.7779620
ENV PATH ${PATH}:${ANDROID_NDK_HOME}:${ANDROID_HOME}/build-tools/31.0.0/

# Get CMake
COPY scripts/get_cmake.sh scripts/get_cmake.sh
RUN ./scripts/get_cmake.sh "3.25.1" linux /root
ENV PATH "/root/cmake/bin:$PATH"

# Get WebRTC
COPY scripts/get_webrtc.sh scripts/get_webrtc.sh
RUN ./scripts/get_webrtc.sh 108.5359.5.0 android /root /root

## Copy resources
COPY src src
COPY CMakeLists.txt ./

RUN cmake -B build  \
    -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \
    -DANDROID_ABI=armeabi-v7a \
    -DANDROID_NATIVE_API_LEVEL=16 \
    -DBUILD_SHARED_LIBS=OFF \
    -DWEBRTC_INCLUDE_DIR=/root/webrtc/include \
    -DWEBRTC_LIBRARY=/root/webrtc/lib/armeabi-v7a/libwebrtc.a \
    -DCMAKE_BUILD_TYPE=Release

RUN cmake --build build --config Release --parallel $(nproc) --target AndroidWebRTC

src/main.cpp

#include <iostream>

#include <api/create_peerconnection_factory.h>

int main() {
    auto googleSessionDescription = webrtc::CreateSessionDescription(
            webrtc::SdpType::kOffer, "sdp");
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

scripts/get_webrtc.sh

#!/bin/bash

if [ $# -lt 4 ]; then
  echo "$0 <webrtc_build_version> <package_name> <output_dir> <source_dir>"
  exit 1
fi

WEBRTC_BUILD_VERSION=$1
PACKAGE_NAME=$2
OUTPUT_DIR=$3
SOURCE_DIR=$4

set -ex

if [ ! -e $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz ]; then
  curl -Lo $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz https://github.com/shiguredo-webrtc-build/webrtc-build/releases/download/m${WEBRTC_BUILD_VERSION}/webrtc.${PACKAGE_NAME}.tar.gz
fi

pushd $OUTPUT_DIR
  tar xf $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz
popd

scripts/get_cmake.sh

#!/bin/bash

# <platform> には Linux か Darwin を指定する
# <output_dir>/cmake に CMake が配置される
if [ $# -lt 3 ]; then
  echo "$0 <cmake_version> <platform> <output_dir>"
  exit 1
fi

CMAKE_VERSION=$1
PLATFORM=$2
OUTPUT_DIR=$3

set -ex

pushd $OUTPUT_DIR
  curl -LO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
  tar xf cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
  rm cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
  rm -rf cmake
  mv cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64 cmake
popd


来源: stackexchange

问:
How to import Microstrategy dossier mstr file
I'm not sure if it's my access or not, but do you know how to import a dossier (.mstr) file into Microstrategy?</p>

ContentLicense: CC BY-SA 4.0


问:
How can I pass arguments to a program at runtime?
For example, I have a cyclical script that makes a request to the Api every 10 minutes. I want to change the parameters of the next request without stopping it.

Cmd is blocked at run time.

Reading arguments from a environment file or a database doesn't seem safe to me. I think it's possible that while variables are being changed, the script may access them when they are not yet ready and cause errors.

Any thoughts?
Thanks


问:
flutter and getstream.io: the messages flickering
I am currently working on a Flutter project where there is a chat made with getstream.io.

The problem is that the chat messages flicker and sometimes are not displayed at all.

Here is my Chatpage:

```<code>
class ChannelPage extends StatelessWidget {
  const ChannelPage({
    Key? key,
    required this.channel,
  }) : super(key: key);

  final Channel channel;

  @override
  // ignore: prefer_expression_function_bodies
  Widget build(BuildContext context) {
    final name = channel.name?.replaceAll('| frozen', '') ?? '';
    final shortenName = name.length > 23 ? '${name.substring(0, 23)}...' : name;

    return Scaffold(
      backgroundColor: Theme.of(context).canvasColor,
      appBar: StreamChannelHeader(
        title: Text(
          shortenName,
          style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
        ),
        subtitle: Container(),
        actions: [
          Padding(
            padding: const EdgeInsets.only(right: 10),
            child: Center(
              child: CustomStreamChannelAvatar(
                channel: channel,
              ),
            ),
          )
        ],
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            child: _buildChat(),
          ),
          StreamMessageInput(showCommandsButton: false),
        ],
      ),
    );
  }

  Widget _buildChat() {
    return StreamMessageListView(
      messageBuilder: (context, details, messages, defaultMessage) {
        return defaultMessage.copyWith(
          showFlagButton: false,
          showEditMessage: false,
          showCopyMessage: false,
          showDeleteMessage: false,
          showReplyMessage: false,
          showThreadReplyMessage: false,
          showPinButton: false,
          showReactions: false,
        );
      },
    );
  }
}

</code>```

The whole thing was unfortunately implemented by other developers and I have to fix it now, this is also the first time I work with GetStream.

However, I don't think there is an error here, I think it will be somewhere else, maybe someone of you has an idea what could be the reason. Thank you!

Body:
I am currently working on a Flutter project where there is a chat made with getstream.io.

The problem is that the chat messages flicker and sometimes are not displayed at all.

Here is my Chatpage:

class ChannelPage extends StatelessWidget {
  const ChannelPage({
    Key? key,
    required this.channel,
  }) : super(key: key);

  final Channel channel;

  @override
  // ignore: prefer_expression_function_bodies
  Widget build(BuildContext context) {
    final name = channel.name?.replaceAll('| frozen', '') ?? '';
    final shortenName = name.length > 23 ? '${name.substring(0, 23)}...' : name;

    return Scaffold(
      backgroundColor: Theme.of(context).canvasColor,
      appBar: StreamChannelHeader(
        title: Text(
          shortenName,
          style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
        ),
        subtitle: Container(),
        actions: [
          Padding(
            padding: const EdgeInsets.only(right: 10),
            child: Center(
              child: CustomStreamChannelAvatar(
                channel: channel,
              ),
            ),
          )
        ],
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            child: _buildChat(),
          ),
          StreamMessageInput(showCommandsButton: false),
        ],
      ),
    );
  }

  Widget _buildChat() {
    return StreamMessageListView(
      messageBuilder: (context, details, messages, defaultMessage) {
        return defaultMessage.copyWith(
          showFlagButton: false,
          showEditMessage: false,
          showCopyMessage: false,
          showDeleteMessage: false,
          showReplyMessage: false,
          showThreadReplyMessage: false,
          showPinButton: false,
          showReactions: false,
        );
      },
    );
  }
}

The whole thing was unfortunately implemented by other developers and I have to fix it now, this is also the first time I work with GetStream.

However, I don't think there is an error here, I think it will be somewhere else, maybe someone of you has an idea what could be the reason. Thank you!


问:
Salesforce Flow running fine in debug, but when executing in sandbox nothing is happening
Apologies in advance for my lack in SF verbiage I am currently trying to learn!

I currently have 2 different asset record types, Network equipment and Sim Card. In the Networking equipment record I have a lookup field named Sim Card ID which links the Sim Card record to the Networking equipment record for tracking purposes. In both records there is an Account lookup field . I want to link the Account field to both of the record types so that when I add a new Sim Card to the Networking Equipment the Sim card account will update automatically according to the Networking Equipment Account. I am currently using a record triggered flow setup below,Outline of my current flow

Thought process,

Whenever the network equipment has the Sim Card ID field changed then trigger flow start.

Start Condition Element

I will then create an assignment element. This will create the GetHotspotLocation which will take the record Account ID. Next the GEtSimCardRecordID variable will be assigned the Sim Card Record ID.

Variable Assignment Element

Finally I will update the Sim Card record type with the new Account ID. This is done by filtering record types by the GetSimCardRecordID variable from the assignment element. Then the AccountID will be assigned the GetHotSpotLocation.

Update Records Element

I ran debug and all seemed to work out properly. However after activation and testing in the sandbox the flow is not updating the account field. I know that debug runs in sort of a vacuum. So I looked at the dev console after updating the Networking Equipment record type with a new Sim Card. I saw that the flow ran and no other flow was acting upon the Record. I am unsure of where to look to make the correction.


问:
Overscroll in Safari produces an incorrect scroll direction when bouncing back
I've found this code online to add a class to the header when scrolling up and down. On Chrome etc. everything works fine, but Safari has a feature to scroll above the content.

The problem is that in Safari on a Mac is that you can "overscroll" the content, you can scroll further up than the content, which results into the viewport bouncing back and activating the scrolling down event. Which then results in having the "header invisible" state while being at the top of the page.

```<code>var lastScrollTop = 0;
$(window).scroll(function(event){
    var st = $(this).scrollTop();
    if (st > lastScrollTop){
        $('.header').addClass("header-invisible");
    } else {
        $('.header').removeClass("header-invisible");
    }
    lastScrollTop = st;
});
</code>```

My question is how to solve this, or do i have to re-write this piece of code to make it work in safari?

i've tried searching for CSS solutions to disable the overscroll on a browser, but have failed getting an answer.

Body:
I've found this code online to add a class to the header when scrolling up and down. On Chrome etc. everything works fine, but Safari has a feature to scroll above the content.

The problem is that in Safari on a Mac is that you can "overscroll" the content, you can scroll further up than the content, which results into the viewport bouncing back and activating the scrolling down event. Which then results in having the "header invisible" state while being at the top of the page.

var lastScrollTop = 0;
$(window).scroll(function(event){
    var st = $(this).scrollTop();
    if (st > lastScrollTop){
        $('.header').addClass("header-invisible");
    } else {
        $('.header').removeClass("header-invisible");
    }
    lastScrollTop = st;
});

My question is how to solve this, or do i have to re-write this piece of code to make it work in safari?

i've tried searching for CSS solutions to disable the overscroll on a browser, but have failed getting an answer.


问:
Unity pixel art glitch
I'm new to Unity and I'm still learning how to use it. I'm trying to make a pixel 2D game and my character is glithy around the edges and I don't know how to fix it. Thanks for the help!

I tried and watched a lot of tutorials but none of them had the same problem as mine.

Title: Unity pixel art glitch


问:
APIs for scheduling immunization appointments at a pharmacy
I want to explore if it's possible to use an API to schedule an immunization appointment at major pharmacies - CVS, Walgreens, Walmart and Costco. CVS and Walgreens seem to have a comprehensive API catalog for prescription drugs but it's unclear to me if they service APIs that support immunizations.

I tried to look into CVS's Immunizations Product API and it looks like it's possible to integrate. Walgreens launched the Clinic Scheduler API in 2015 but I'm not able to find any tech specs about it on the dev portal. Walmart Pharmacy does not seem to have any APIs at all.


问:
AfterUpdate() Recordset edit leads to "No current Record 3021"
I'm using a form to enter a component ID (CID).

After entering the Number in the Field I use the AfterUpdate() function with CID to look up a corresponding Prod ID in another Table.

The Matching Prod ID from the other Table will then be entered automatically into the field. The field is a multivalued Field.

Private Sub Form_AfterUpdate()

Dim rst As DAO.Recordset
Dim rstChld As DAO.Recordset2

Dim tmpVar

If Me.Dirty Then
    Me.Dirty = False
End If

If StrComp(Me.Part, "Device") = 0 Then
    tmpVar = DLookup("[Device Prod]", "subLookTblCIDDevice", "[CID Device] = '" & Me.CIDDevice & "'")

    Set rst = Me.Recordset

    If Me.Recordset.RecordCount = 0 Then
        rst.MoveFirst
    End If

    If Not (rst.BOF And rst.EOF) Then
        If rst.Updatable Then
            rst.Edit
            Set rstChld = rst!Prod.Value
            rstChld.AddNew
            rstChld.Fields(0) = tmpVar
            rstChld.Update
            rst.Update

            Me.Bookmark = rst.LastModified

            Set rst = Nothing
            Set rstChld = Nothing
        End If
    End If
End If
End Sub
```
<p>If the record exists and I'm changing the CID the corresponding field gets its correct corresponding ID.</p>
<p>If it is a new Record and the first of the recordset I get the error message</p>
<blockquote>
<p>No Current Record - 3021</p>
</blockquote>
<p>It can be mitigated by adding</p>
<pre class="lang-vb prettyprint-override"><code>If Me.Recordset.RecordCount = 0 Then
    rst.MoveFirst
End If
</code>```

But if it is a new Record and not the first record it changes the previous record.

I tried .AddNew instead of .Edit. This will create a new record after the one which has been updated.

I don't understand why it is jumping before or after the record.

Body:
I'm using a form to enter a component ID (CID).

After entering the Number in the Field I use the AfterUpdate() function with CID to look up a corresponding Prod ID in another Table.

The Matching Prod ID from the other Table will then be entered automatically into the field. The field is a multivalued Field.

Private Sub Form_AfterUpdate()

Dim rst As DAO.Recordset
Dim rstChld As DAO.Recordset2

Dim tmpVar

If Me.Dirty Then
    Me.Dirty = False
End If

If StrComp(Me.Part, "Device") = 0 Then
    tmpVar = DLookup("[Device Prod]", "subLookTblCIDDevice", "[CID Device] = '" & Me.CIDDevice & "'")

    Set rst = Me.Recordset

    If Me.Recordset.RecordCount = 0 Then
        rst.MoveFirst
    End If

    If Not (rst.BOF And rst.EOF) Then
        If rst.Updatable Then
            rst.Edit
            Set rstChld = rst!Prod.Value
            rstChld.AddNew
            rstChld.Fields(0) = tmpVar
            rstChld.Update
            rst.Update

            Me.Bookmark = rst.LastModified

            Set rst = Nothing
            Set rstChld = Nothing
        End If
    End If
End If
End Sub

If the record exists and I'm changing the CID the corresponding field gets its correct corresponding ID.

If it is a new Record and the first of the recordset I get the error message

No Current Record - 3021

It can be mitigated by adding

If Me.Recordset.RecordCount = 0 Then
    rst.MoveFirst
End If

But if it is a new Record and not the first record it changes the previous record.

I tried .AddNew instead of .Edit. This will create a new record after the one which has been updated.

I don't understand why it is jumping before or after the record.


问:
How to Conditionally format cells based on if the most recent weekday (e.g. a Monday) is present as a date out of a list of dates

I want to make a box for each day of the week automatically turn green or red depending upon if a event occurred on a corresponding day.

So far I've found the formula '=date- WEEKDAY (date - 2)'

Ideally I want to be able to specify per person. and had a green/red button for each day of the week for each person.

Can anyone help me please?

I've tried everything I can think of


问:
PHP mpdf error in PHP 8.0 (imagecreatefromstring())
mpdf package worked well for generating PDF on below PHP 7.4 without any issue. I upgraded the PHP version on my local and when I run the project, I am getting this error. I didn't use PNG file for generating PDF. I upgraded the images from PNGs to JPG after I got this error, but I am getting the same error.

This is error message. Could you help me if you faced this kind of issue. Thanks.

Warning: imagecreatefromstring(): gd-png: libpng warning: iCCP: known incorrect sRGB profile in C:\xampp\htdocs\fasttestnow\vendor\mpdf\mpdf\src\Image\ImageProcessor.php on line 552


问:
iMX6Q IPU Changing Address of Display Buffers
Using an iMX6 Quad in a bare metal application. No cameras or other video devices attached - just graphics from main memory. I'm trying to determine when it is safe to change the buffer addresses in the CPMEM (EBA0 and EBA1) to show a completely different "screen" on the display. In other words, is it safe to change these addresses once the "old" frame has started to be processed? Or do I have to stop processing altogether, switch the addresses in the CPMEM, then start processing again?

Haven't got far enough to try anything yet.


问:
useRouter does not push inside other composables
I am creating a basic login screen with Nuxt.js3. I have a useFirebaseAuth() composable function that uses the Firebase Auth to sign in and sign out the user. Here is my code below:

import { signInWithEmailLink, signOut } from "@firebase/auth"

export default function() {
  const { $auth } = useNuxtApp() // retrieved from plugin

  const verifyEmailLinkSignIn = async () => {
    ...
    const result = await signInWithEmailLink($auth, email, window.location.href)
    if (result) {
      useRouter().push("/home") // <- DOES NOT PUSH TO HOME
    }
  }

  const signOutUser = async () => {
    await signOut($auth)
    useRouter().push("/login") // <- DOES NOT PUSH TO LOGIN
  }

  return {
    ...,
    verifyEmailLinkSignIn,
    signOutUser
  }
}
```

When the user has successfully used the link in the email to sign in, they should be automatically redirected to the home page. However, they need to refresh the page to do so (I have redirects enabled in both pages, so it works on refresh). How do I automatically redirect them to the required page?

Body:
I am creating a basic login screen with Nuxt.js3. I have a useFirebaseAuth() composable function that uses the Firebase Auth to sign in and sign out the user. Here is my code below:

import { signInWithEmailLink, signOut } from "@firebase/auth"

export default function() {
  const { $auth } = useNuxtApp() // retrieved from plugin

  const verifyEmailLinkSignIn = async () => {
    ...
    const result = await signInWithEmailLink($auth, email, window.location.href)
    if (result) {
      useRouter().push("/home") // <- DOES NOT PUSH TO HOME
    }
  }

  const signOutUser = async () => {
    await signOut($auth)
    useRouter().push("/login") // <- DOES NOT PUSH TO LOGIN
  }

  return {
    ...,
    verifyEmailLinkSignIn,
    signOutUser
  }
}

When the user has successfully used the link in the email to sign in, they should be automatically redirected to the home page. However, they need to refresh the page to do so (I have redirects enabled in both pages, so it works on refresh). How do I automatically redirect them to the required page?


问:
Attempt to read property "id" on null
Need Support
When user going to subscribe, follow link: https://royaleg.co/account/packages/3/subscribe

test user here:
https://royaleg.co/login

user: test           pass: 123456

I created admin account for you: https://royaleg.co/admin

login: helper         pass: 123456

you can find the Currencies setting @ left side->Real Estate->Setting
"Don't worry about data, it's not super admin"

/home/ssmkngbx/domains/royaleg.co/public_html/platform/plugins/real-estate/src/Providers/HookServiceProvider.php
                        app(TransactionInterface::class)->createOrUpdate([
                            'user_id' => 0,
                            'account_id' => $payment->customer_id,
                            'credits' => $package->number_of_listings,
                            'payment_id' => $payment ? $payment->id : null,
                        ]);
                    }
                }, 123, 2);
            }

            if (defined('PAYMENT_FILTER_PAYMENT_DATA')) {
                add_filter(PAYMENT_FILTER_PAYMENT_DATA, function (array $data, Request $request) {
                    $orderIds = [session('subscribed_packaged_id')];

                    $package = $this->app->make(PackageInterface::class)
                        ->findById(Arr::first($orderIds));

                    $products = [
                        [
                          'id' => $package->id,
                            'name' => $package->name,
                            'price' => $package->price,
                            'price_per_order' => $package->price,
                            'qty' => 1,
                        ],
                    ];

                    $account = auth('account')->user();

                    $address = [
                        'name' => $account->name,
                        'email' => $account->email,
                        'phone' => $account->phone,
                        'country' => null,
                        'state' => null,
                        'city' => null,
                        'address' => null,
                        'zip' => null,
                    ];

Arguments
"Attempt to read property "id" on null"```

enter image description here

Title: Attempt to read property "id" on null

Body:
Need Support
When user going to subscribe, follow link: https://royaleg.co/account/packages/3/subscribe

test user here:
https://royaleg.co/login

user: test           pass: 123456

I created admin account for you: https://royaleg.co/admin

login: helper         pass: 123456

you can find the Currencies setting @ left side->Real Estate->Setting
"Don't worry about data, it's not super admin"

/home/ssmkngbx/domains/royaleg.co/public_html/platform/plugins/real-estate/src/Providers/HookServiceProvider.php
                        app(TransactionInterface::class)->createOrUpdate([
                            'user_id' => 0,
                            'account_id' => $payment->customer_id,
                            'credits' => $package->number_of_listings,
                            'payment_id' => $payment ? $payment->id : null,
                        ]);
                    }
                }, 123, 2);
            }

            if (defined('PAYMENT_FILTER_PAYMENT_DATA')) {
                add_filter(PAYMENT_FILTER_PAYMENT_DATA, function (array $data, Request $request) {
                    $orderIds = [session('subscribed_packaged_id')];

                    $package = $this->app->make(PackageInterface::class)
                        ->findById(Arr::first($orderIds));

                    $products = [
                        [
                          'id' => $package->id,
                            'name' => $package->name,
                            'price' => $package->price,
                            'price_per_order' => $package->price,
                            'qty' => 1,
                        ],
                    ];

                    $account = auth('account')->user();

                    $address = [
                        'name' => $account->name,
                        'email' => $account->email,
                        'phone' => $account->phone,
                        'country' => null,
                        'state' => null,
                        'city' => null,
                        'address' => null,
                        'zip' => null,
                    ];

Arguments
"Attempt to read property "id" on null"

enter image description here


问:
difficulty exporting visuals in Jupyter
I am working on task and have completed it but having issues exporting my charts. I have tried many different variations and I am getting all kinds of errors.
My code for the bar chart is

```<code>orders_products_merged['order_day_of_week'].value_counts().plot.bar()
</code>```

some codes i have tried that haven't worked are

```<code>orders_products_merged.plot.figure.savefig('order_day_of_weeky.png')
orders_products_merged['order_day_of_week.png'].plot.bar(bins=500.get_figure().savefig)
</code>```

some errors i have gotten are

```<code>AttributeError: 'PlotAccessor' object has no attribute 'figure'

SyntaxError: invalid syntax
</code>```

and many more. Any help would be appreciated.
Thanks

Title: difficulty exporting visuals in Jupyter

Body:
I am working on task and have completed it but having issues exporting my charts. I have tried many different variations and I am getting all kinds of errors.
My code for the bar chart is

orders_products_merged['order_day_of_week'].value_counts().plot.bar()

some codes i have tried that haven't worked are

orders_products_merged.plot.figure.savefig('order_day_of_weeky.png')
orders_products_merged['order_day_of_week.png'].plot.bar(bins=500.get_figure().savefig)

some errors i have gotten are

AttributeError: 'PlotAccessor' object has no attribute 'figure'

SyntaxError: invalid syntax

and many more. Any help would be appreciated.
Thanks


问:
IMAP Oauth2 login not working even with the valid access token
[GitHub source code] (https://github.com/lekhnath-parajuli/oauth2_imap_smtp_implementation.git)

I tried to authenticate with the generated token using

```<code>openssl s_client -showcerts -connect outlook.office365.com:993 -servername outlook.office365.com -crlf
</code>```

but it only takes maximum 1024 characters, but the token i got was around 4k to 5k characters.
not sure if it's character length of the token that is causing the IMAP authentication issue or anything else. because the token received worked fine on Microsoft Graph api but not in IMAP server.

```<code>Traceback (most recent call last):
  File "/Users/uttam/Documents/work/fast-api/imap_synching/.env/lib/python3.10/site-packages/imapclient/imapclient.py", line 415, in oauth2_login
    return self._command_and_check("authenticate", mech, lambda x: auth_string)
  File "/Users/uttam/Documents/work/fast-api/imap_synching/.env/lib/python3.10/site-packages/imapclient/imapclient.py", line 1738, in _command_and_check
    typ, data = meth(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/imaplib.py", line 444, in authenticate
    raise self.error(dat[-1].decode('utf-8', 'replace'))
imaplib.IMAP4.error: AUTHENTICATE failed.
</code>```

so, someone please help me with this

Body:
[GitHub source code] (https://github.com/lekhnath-parajuli/oauth2_imap_smtp_implementation.git)

I tried to authenticate with the generated token using

openssl s_client -showcerts -connect outlook.office365.com:993 -servername outlook.office365.com -crlf

but it only takes maximum 1024 characters, but the token i got was around 4k to 5k characters.
not sure if it's character length of the token that is causing the IMAP authentication issue or anything else. because the token received worked fine on Microsoft Graph api but not in IMAP server.

Traceback (most recent call last):
  File "/Users/uttam/Documents/work/fast-api/imap_synching/.env/lib/python3.10/site-packages/imapclient/imapclient.py", line 415, in oauth2_login
    return self._command_and_check("authenticate", mech, lambda x: auth_string)
  File "/Users/uttam/Documents/work/fast-api/imap_synching/.env/lib/python3.10/site-packages/imapclient/imapclient.py", line 1738, in _command_and_check
    typ, data = meth(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/imaplib.py", line 444, in authenticate
    raise self.error(dat[-1].decode('utf-8', 'replace'))
imaplib.IMAP4.error: AUTHENTICATE failed.

so, someone please help me with this


问:
Android - instanceof can get derivated type of a generic type interface that inherit from a base interface
I have a RecyclerView Adapter that can act in 2 or more different ways depending on the case of the fragment that uses it.

The adapter has a callback that is a generic type determined on his instantiation because it has some callback methods shared between the types and others that are type specific.
I though and I tried to determine the type of the adapter using "instance of callback" instead of making a property for the type.

So this is an example of my adapter:

```<code>public class MyAdapter<T extends MyAdapter.IBaseCallback> extends BaseAdapter<MyViewHolder, MyItem>{

public interface IBaseCallback {
        void onFirstMethod(MyItem item);
        void onSecondMethod(MyItem item);
    }

    public interface ICallbackOne extends IBaseCallback {
        void onOneFirstMethod(MyItem item);
    }

    public interface ICallbackTwo extends IBaseCallback {
        void onTwoFirstMethod(MyItem item);
    }

private T mCallback;

public MyAdapter(Context context, T callback){
        super(context);
        mCallback = callback;
    }

}
</code>```

But when I try to do, for example:

```<code>if(mCallback instanceof ICallbackOne){
     .....
}
</code>```

It doesn't recognize the correct type of the callback interface. I think it see the callback as a "IBaseCallback" interface.

So in the end I had to add a property to specify the type of the adapter.

Is there a way so I can avoid to add it and use "mCallback instanceof ICallback..." to determine the type of the adapter?
Or because it's a generic type it can't determine the right instance of the callback?

Thank you!

Body:
I have a RecyclerView Adapter that can act in 2 or more different ways depending on the case of the fragment that uses it.

The adapter has a callback that is a generic type determined on his instantiation because it has some callback methods shared between the types and others that are type specific.
I though and I tried to determine the type of the adapter using "instance of callback" instead of making a property for the type.

So this is an example of my adapter:

public class MyAdapter<T extends MyAdapter.IBaseCallback> extends BaseAdapter<MyViewHolder, MyItem>{

public interface IBaseCallback {
        void onFirstMethod(MyItem item);
        void onSecondMethod(MyItem item);
    }

    public interface ICallbackOne extends IBaseCallback {
        void onOneFirstMethod(MyItem item);
    }

    public interface ICallbackTwo extends IBaseCallback {
        void onTwoFirstMethod(MyItem item);
    }

private T mCallback;

public MyAdapter(Context context, T callback){
        super(context);
        mCallback = callback;
    }

}

But when I try to do, for example:

if(mCallback instanceof ICallbackOne){
     .....
}

It doesn't recognize the correct type of the callback interface. I think it see the callback as a "IBaseCallback" interface.

So in the end I had to add a property to specify the type of the adapter.

Is there a way so I can avoid to add it and use "mCallback instanceof ICallback..." to determine the type of the adapter?
Or because it's a generic type it can't determine the right instance of the callback?

Thank you!


问:
How do I reference and manipulate a targeted object from a called function outside the function's scope?
I am trying to create a program (chess) such that div elements created via JS dom can be dragged with your cursor. However I have it setup so I add an event listener to each piece created which calls a function adding an event listener to the window which then calls the function to move each piece. I can't reference "this" since the target of the movement function is the window and not the piece with the "mousedown" event. Can I reference the intended target from a completely different function?

I'd tried to do var targetedPiece=this.targetedPiece in the "mouseDown" function
Followed by targetedPiece.style.left=cursor.x+'px' in the "movePiece" function but to no avail.

//Basic chess board creation, creating elements with DOM
var board = document.getElementById('gameBoard');
var newSquare = document.createElement('div');
var newPiece = document.createElement('div');
newPiece.addEventListener('mousedown', mouseDown, false);
newSquare.appendChild(newPiece);
board.appendChild(newSquare);

//Assigns cursor position to cursor.x & cursor.y respectively
function getCursorPos(e) {
  let cursor = {
    x: e.pageX - board.offsetLeft,
    y: e.pageY - board.offsetTop
  };
}

//Registers last mouseup/mousedown actions
function mouseDown(targetedPiece) {
  window.addEventListener('mousemove', movePiece, true);
  //This is the function I'm calling with the piece
}

function mouseUp() {
  window.removeEventListener('mousemove', movePiece, true);
}

//Function for actually moving pieces with cursor
function movePiece() {
  //What do I put here? The targeted piece calls mouseDown, can I reference it in this function?
  //The idea is targetedPiece.style.left=cursor.x & targetedPiece.style.top=cursor.y
}

board.addEventListener('mousemove', getCursorPos, true);
window.addEventListener('mouseup', mouseUp, false);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div id='gameBoard'></div></code>```


问:
How to setup WebStorm IDE as Git core default editor in Windows?
So that I can use git commit in terminal and it opens the commit message file in WebStorm and wait for it to close?

Tried --wait flag as I used it with VS Code editor in ~/.gitconfig file. My current content of ~/.gitconfig is:

```<code>[core]
#   editor = code --wait
#   It worked with VS Code

    editor = webstorm64 --wait
# Not working! Environment Variable is set correctly.
</code>```

While, I try to ammend commit with git commit --amend, it shows this in terminal:

```<code>hint: Waiting for your editor to close the file... error: There was a problem with the editor 'webstorm64 --wait'.
Please supply the message using either -m or -F option.
</code>```

Body:
So that I can use git commit in terminal and it opens the commit message file in WebStorm and wait for it to close?

Tried --wait flag as I used it with VS Code editor in ~/.gitconfig file. My current content of ~/.gitconfig is:

[core]
#   editor = code --wait
#   It worked with VS Code

    editor = webstorm64 --wait
# Not working! Environment Variable is set correctly.

While, I try to ammend commit with git commit --amend, it shows this in terminal:

hint: Waiting for your editor to close the file... error: There was a problem with the editor 'webstorm64 --wait'.
Please supply the message using either -m or -F option.


问:
Spring Boot validation throws BindException insted of MethodArgumentNotValid Exception
I switched to Spring Boot 3 and setup a simple project.
This contains input validation. I created a simple model and annotated the fields

```<code>@Data
@NoArgsConstructor
public class DemoUserCreateDto {
    @Email(message = "email must be valid")
    private String emailContentCreator;
    @NotNull(message = "must not be null")
    private String emailContentConsumer;

}
</code>```

On my Controller level I have a simple endpoint:

```<code>@PostMapping(value = "/users", consumes = MediaType.APPLICATION_JSON_VALUE)
public String createUsers(@RequestBody @Valid DemoUserCreateDto demoUserCreateDto) {
    return "DONE";
}
</code>```

pom.xml:

```<code><dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</code>```

PROBLEM:

The validation is done on the @NotNull field. The @Email field does not have any effect.

import is:

import jakarta.validation.constraints.Email;

import jakarta.validation.constraints.NotNull;

The exception thrown on the NotNull validation is:

org.springframework.validation.BindException

but I was expecting a

MethodArgumentNotValidException

WHAT I'VE TRIED:

I tried to annotate my controller with @Validated. No success.

The thing is that I've set this up in previous projects with spring boot 2.x.

I've seen that in termins of validator libraries, jakarta is used instead of javax.

Has something changed in the implementation? I've also read that there is a change in the latest lombok version, where they force you to use the validation statement on the getter method of the attribute. I've reset to a minor version, but nothing changed.

Body:
I switched to Spring Boot 3 and setup a simple project.
This contains input validation. I created a simple model and annotated the fields

@Data
@NoArgsConstructor
public class DemoUserCreateDto {
    @Email(message = "email must be valid")
    private String emailContentCreator;
    @NotNull(message = "must not be null")
    private String emailContentConsumer;

}

On my Controller level I have a simple endpoint:

@PostMapping(value = "/users", consumes = MediaType.APPLICATION_JSON_VALUE)
public String createUsers(@RequestBody @Valid DemoUserCreateDto demoUserCreateDto) {
    return "DONE";
}

pom.xml:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

PROBLEM:

The validation is done on the @NotNull field. The @Email field does not have any effect.

import is:

import jakarta.validation.constraints.Email;

import jakarta.validation.constraints.NotNull;

The exception thrown on the NotNull validation is:

org.springframework.validation.BindException

but I was expecting a

MethodArgumentNotValidException

WHAT I'VE TRIED:

I tried to annotate my controller with @Validated. No success.

The thing is that I've set this up in previous projects with spring boot 2.x.

I've seen that in termins of validator libraries, jakarta is used instead of javax.

Has something changed in the implementation? I've also read that there is a change in the latest lombok version, where they force you to use the validation statement on the getter method of the attribute. I've reset to a minor version, but nothing changed.


问:
Sending templates through Mailgun Java API returns 400 despite following spec
I am trying to use the mailgun Java API for my kotlin project and want to send emails using templates. I believe I have followed the docs but I am getting a 400 Bad Request response.

My kotlin code looks like:

```<code>val client = MailgunClient.config("https://api.eu.mailgun.net/", "<raw-api-key>")
        .logLevel(Logger.Level.HEADERS)
        .createApi<MailgunMessagesApi>(MailgunMessagesApi::class.java)

val message = Message.builder()
  .from("Sender name <sender@domain1.com>")
  .to("receiver@domain2.com")
  .template("template_name")
  .subject("Hello")
  .mailgunVariables(
    mapOf(Pair("param1": "Hello"), Pair("param2": "world"), Pair("param3": "2020-01-01"))
  .build()

client.sendMessageFeignResponse(domain, message)
</code>```

The response logging I get says:

```<code>HTTP/1.1 400 Bad Request
access-control-allow-credentials: true
access-control-allow-origin: *
cache-control: no-store
content-length: 78
content-type: application/json;
date: Thu, 22 Dec 2022 00:54:29 GMT
strict-transport-security:
x-xss-protection: 1; mode=block
{}
feign.Response$ByteArrayBody@1744d3cb
</code>```

I have tried the following and it works in the command line:

```<code>curl -s --user 'api:<raw-api-key>' \
    https://api.eu.mailgun.net/v3/<user-domain>/messages \
    -F from='Sender name <sender@domain1.com>' \
    -F to=receiver@domain2.com \
    -F template='template_name' \
    -F subject='Hello' \
    -F t:variables='{"param1": "Hello", "param2": "world", "param3": "2020-01-01"}'
</code>```

Body:
I am trying to use the mailgun Java API for my kotlin project and want to send emails using templates. I believe I have followed the docs but I am getting a 400 Bad Request response.

My kotlin code looks like:

val client = MailgunClient.config("https://api.eu.mailgun.net/", "<raw-api-key>")
        .logLevel(Logger.Level.HEADERS)
        .createApi<MailgunMessagesApi>(MailgunMessagesApi::class.java)

val message = Message.builder()
  .from("Sender name <sender@domain1.com>")
  .to("receiver@domain2.com")
  .template("template_name")
  .subject("Hello")
  .mailgunVariables(
    mapOf(Pair("param1": "Hello"), Pair("param2": "world"), Pair("param3": "2020-01-01"))
  .build()

client.sendMessageFeignResponse(domain, message)

The response logging I get says:

HTTP/1.1 400 Bad Request
access-control-allow-credentials: true
access-control-allow-origin: *
cache-control: no-store
content-length: 78
content-type: application/json;
date: Thu, 22 Dec 2022 00:54:29 GMT
strict-transport-security:
x-xss-protection: 1; mode=block
{}
feign.Response$ByteArrayBody@1744d3cb

I have tried the following and it works in the command line:

curl -s --user 'api:<raw-api-key>' \
    https://api.eu.mailgun.net/v3/<user-domain>/messages \
    -F from='Sender name <sender@domain1.com>' \
    -F to=receiver@domain2.com \
    -F template='template_name' \
    -F subject='Hello' \
    -F t:variables='{"param1": "Hello", "param2": "world", "param3": "2020-01-01"}'


问:
How to efficiently implement a kernel-based outlier detection on 2D arrays that includes a condition in Python?
I have a satellite image which is quite noisy. I wanted to try a Water Anomaly Filter proposed here. It is straight-foreword and appears to be suited for my use case, as it expects that the "real" structures on the ground are much larger than the noise, which appears only in isolated pixels. The proposed algorithm works as follow:

let a 5x5 pixel kernel run over the input image

calculate the mean and standard deviation (SD) of each kernel subset, but exclude the center pixel

remove outliers (i.e. outside mean +/- 1 SD) and do step 3 again to calculate mean and SD without outliers (mean_wo and SD_wo)

if the value of the pixel in the center of the kernel is outside mean_wo +/- 1 SD_wo, replace it by mean_wo. Else keep the original value.

This may sound complicated, but it keeps as many original data values as possible, which is crucial for me.

The original algorithm is implemented in IDL, but I need it in Python. My data are in netCDF-files and I usually work with xarray. I already looked into xarray.DataArray.rolling and xarray.apply_ufunc, but I didn't found a way to implement this algorithm with its kernel and if-statement. I'm also open to solutions with other packges, but I also had no success to implement an if-condition into a kernel with numpy and scipy so far.

Of course, I could implement the algorithm with brute force and let the kernel run over the image with two for loops and  so on, but since I have a few satellite images, each with thousands x thousands pixels and with several bands, I would like to find a faster solution.

import xarray as xr
import numpy as np
np.random.seed(42)

# define sample data
data = np.random.rand(25).reshape(5, 5)
data[1,1] = data[3,3] = 5
xds = xr.DataArray(data, dims=['y', 'x'], name='raster')
print(xds)

#<xarray.DataArray 'raster' (y: 5, x: 5)>
#array([[0.37454012, 0.95071431, 0.73199394, 0.59865848, 0.15601864],
#       [0.15599452, 5.        , 0.86617615, 0.60111501, 0.70807258],
#       [0.02058449, 0.96990985, 0.83244264, 0.21233911, 0.18182497],
#       [0.18340451, 0.30424224, 0.52475643, 5.        , 0.29122914],
#       [0.61185289, 0.13949386, 0.29214465, 0.36636184, 0.45606998]])
#Dimensions without coordinates: y, x

# apply rolling to apply a mean filter. For sake of simplicity only with a 3x3 kernel size
print(xds.rolling({"x": 3, "y": 3}, center = True).mean())

#<xarray.DataArray 'raster' (y: 5, x: 5)>
#array([[       nan,        nan,        nan,        nan,        nan],
#       [       nan, 1.10026178, 1.19592772, 0.54318239,        nan],
#       [       nan, 0.98416787, 1.59010905, 1.02421734,        nan],
#       [       nan, 0.43098129, 0.96018785, 0.90635209,        nan],
#       [       nan,        nan,        nan,        nan,        nan]])
#Dimensions without coordinates: y, x

# However, I which to implement the filter described above, which should yield (again with a kernel size of 3x3):
#<xarray.DataArray 'raster' (y: 5, x: 5)>
#array([[       nan,        nan,        nan,        nan,        nan],
#       [       nan, 0.61279450, 0.86617615, 0.60111501,        nan],
#       [       nan, 0.96990985, 0.83244264, 0.21233911,        nan],
#       [       nan, 0.30424224, 0.52475643, 0.39464610,        nan],
#       [       nan,        nan,        nan,        nan,        nan]])
#Dimensions without coordinates: y, x

```


问:
Queries on implementing postgres logical replication for production?

Will there be any situation where the replication gets failed? If so
how to manage that failover?

Is there any queries to identify the no.of pending records to be replicated?

How to manage failover/DR like situation?

Can we do publication/subscription setup from a read only DB?


问:
Why can't my gcc inline assembly work as expected?
```<code>#include <cstdio>
int main() {
    int a, b, c;
    const char* str = "hello world";
    asm volatile (
     R"(mov   %0, 1
        mov   %1, 2
        mov   %2, 3
        call  puts)"
        :"=&r"(a),
         "=&r"(b),
         "=&r"(c)
        :"D"(str)
        :"cc","memory"
    );
    printf("%d, %d, %d\n", a, b, c);
}
</code>```

and the complier result is like this(by gcc12.2, the options are -O3 -masm=intel)

```<code>.LC0:
        .string "hello world"
.LC1:
        .string "%d, %d, %d\n"
main:
        sub     rsp, 8
        mov     edi, OFFSET FLAT:.LC0
        mov   esi, 1
        mov   edx, 2
        mov   ecx, 3
        call  puts
        mov     edi, OFFSET FLAT:.LC1
        xor     eax, eax
        call    printf
        xor     eax, eax
        add     rsp, 8
        ret
</code>```

the values (1, 2, 3 in this code) were not saved to memory from the register and they were not successfully passed to printf as well, even if when I turned off the optimization.

so the output is like this, which is obviously undefined-behaviour.

```<code>hello world
4202511, 0, 4096
</code>```

Why does this problem occur?

```<code>#include <cstdio>
int main() {
    int a, b, c;
    const char* str = "hello world";
    asm volatile (
     R"(mov     %0, 1
        mov     %1, 2
        mov     %2, 3
        call    puts)"
        :"=&m"(a),
         "=&m"(b),
         "=&m"(c)
        :"D"(str)
        :"cc","memory"
    );
    printf("%d, %d, %d\n", a, b, c);
}
</code>```

If I change the code from "=&r" to "=&m", it can work well as expected. but is there any possibility to solve this problem while passing the a, b, c through register?

the short link of the code above is https://godbolt.org/z/W6xYcdd9c and https://godbolt.org/z/9dceGrfM1

Body:
#include <cstdio>
int main() {
    int a, b, c;
    const char* str = "hello world";
    asm volatile (
     R"(mov   %0, 1
        mov   %1, 2
        mov   %2, 3
        call  puts)"
        :"=&r"(a),
         "=&r"(b),
         "=&r"(c)
        :"D"(str)
        :"cc","memory"
    );
    printf("%d, %d, %d\n", a, b, c);
}

and the complier result is like this(by gcc12.2, the options are -O3 -masm=intel)

.LC0:
        .string "hello world"
.LC1:
        .string "%d, %d, %d\n"
main:
        sub     rsp, 8
        mov     edi, OFFSET FLAT:.LC0
        mov   esi, 1
        mov   edx, 2
        mov   ecx, 3
        call  puts
        mov     edi, OFFSET FLAT:.LC1
        xor     eax, eax
        call    printf
        xor     eax, eax
        add     rsp, 8
        ret

the values (1, 2, 3 in this code) were not saved to memory from the register and they were not successfully passed to printf as well, even if when I turned off the optimization.

so the output is like this, which is obviously undefined-behaviour.

hello world
4202511, 0, 4096

Why does this problem occur?

#include <cstdio>
int main() {
    int a, b, c;
    const char* str = "hello world";
    asm volatile (
     R"(mov     %0, 1
        mov     %1, 2
        mov     %2, 3
        call    puts)"
        :"=&m"(a),
         "=&m"(b),
         "=&m"(c)
        :"D"(str)
        :"cc","memory"
    );
    printf("%d, %d, %d\n", a, b, c);
}

If I change the code from "=&r" to "=&m", it can work well as expected. but is there any possibility to solve this problem while passing the a, b, c through register?

the short link of the code above is https://godbolt.org/z/W6xYcdd9c and https://godbolt.org/z/9dceGrfM1


问:
Detecting when an iframe has changed
I'm writting a Chrome extension.
The page have two iframes, iframe 2 load a different page some times after clicking on a link in the iframe 1. (Crazy right? tha page is a mess thats why I'm trying to fix it a bit).

I need to detect when this iFrame2 load a different page in order to inject my CSS and JS to this new page.

Any ideas on how I can achieve that?

I tried injecting the CSS and JS in all frames using the manifiest.json

```<code>"content_scripts": [
    {
      "all_frames" : true,
      "matches": [
        "https://ieweb.wsu.ac.za/*"
      ],
      "css": [
        "content/css/content.css",
        "content/css/login.css",
        "content/css/frame2.css"
      ],
      "js": [
        "content/content.js"

      ]
    }
  ]
</code>```

But it only insert the files on the top page, not in each individual iframe

Title: Detecting when an iframe has changed

Body:
I'm writting a Chrome extension.
The page have two iframes, iframe 2 load a different page some times after clicking on a link in the iframe 1. (Crazy right? tha page is a mess thats why I'm trying to fix it a bit).

I need to detect when this iFrame2 load a different page in order to inject my CSS and JS to this new page.

Any ideas on how I can achieve that?

I tried injecting the CSS and JS in all frames using the manifiest.json

"content_scripts": [
    {
      "all_frames" : true,
      "matches": [
        "https://ieweb.wsu.ac.za/*"
      ],
      "css": [
        "content/css/content.css",
        "content/css/login.css",
        "content/css/frame2.css"
      ],
      "js": [
        "content/content.js"

      ]
    }
  ]

But it only insert the files on the top page, not in each individual iframe


问:
R Markdown not finding dataframe when knitting
Revisiting an issue that appears to have been asked before, but the answers aren't quite helping with the issue I'm experiencing.

I have a Markdown file that I'm trying to knit, with a code chunk of:

```<code>colnames(spreadspoke_scores)
</code>```

When I attempt to knit the file, I get the below error:

Error in is.data.frame(x) : object(spreadspoke_scores) not found

This makes no sense to me since I can run the colnames function off this dataframe in the console.

I tried to knit a file with the below code just for fun:

```<code>colnames(cars)
</code>```

And this ran just fine.  So I'm confused, is there an intermediate step that needs to be taken to get R Markdown to recognize the dataframe?

Added:  I added the below to the YAML section:

params:
data: "spreadspoke_scores"

Which gets the knit to run, but then it comes back with #NULL results, so I don't think this is helping the issue.

Body:
Revisiting an issue that appears to have been asked before, but the answers aren't quite helping with the issue I'm experiencing.

I have a Markdown file that I'm trying to knit, with a code chunk of:

colnames(spreadspoke_scores)

When I attempt to knit the file, I get the below error:

Error in is.data.frame(x) : object(spreadspoke_scores) not found

This makes no sense to me since I can run the colnames function off this dataframe in the console.

I tried to knit a file with the below code just for fun:

colnames(cars)

And this ran just fine.  So I'm confused, is there an intermediate step that needs to be taken to get R Markdown to recognize the dataframe?

Added:  I added the below to the YAML section:

params:
data: "spreadspoke_scores"

Which gets the knit to run, but then it comes back with #NULL results, so I don't think this is helping the issue.


问:
Unable to remove legends from seaborn subplots created by iteration and create one, overarching legend
I have a data set that looks similar to the below, but is much longer:

```<code>   Sample Name Treatment Replicate  Time Congener  Concentration (ng/L)
0     Blank-1     Blank         1     0   PbTx-1                     0
1      Ctrl-1      Ctrl         1     0   PbTx-1                  8800
2      Ctrl-2      Ctrl         2     0   PbTx-1                  7500
3      Ctrl-3      Ctrl         3     0   PbTx-1                  9100
4     10ppm-1     10ppm         1     0   PbTx-1                  9800
</code>```

I am attempting to create a group (array?) of subplots that shows each time period in a different plot, comparing each treatment, with each congener represented, that has a single legend for the entire plot with 4 columns below the "treatment" x-label.

This link goes to the almost perfect graph, except all the legends are visible

This is the code I used to generate the nearly perfect graph, but with visible legends:

```<code>#Setting the variables outside of the actual arguments to improve readability
first_dimension = "Treatment"
second_dimension = "Concentration (ng/L)"
third_dimension = "Congener"

#Setting the y-axis limit for toxin
ylim_toxin = td['Concentration (ng/L)'].max() * 1.05

#This gets the total number of subplots
num_plots = len(treatments)
fig, axes = plt.subplots(ncols = num_plots, sharey=True, sharex=True, figsize = (5*num_plots,5))

#Removes the space between the plots, so they share an X and are lined up nicely by time the sample was taken
fig.subplots_adjust(hspace=0, wspace=0)

#Set overarching title based on previously input project name
fig.suptitle(f'{pdate}', fontweight='bold')
fig.supxlabel(f'Treatment')

#Create a bar plot of the data using seaborn, looping through the treatments list and each axis using count
count = 0
for ax in axes:
    axes[count].set_title(f"T = {treatments[count]}")
    treat = treatments[count]
    tdtreat = td.loc[td['Time'] == treat]
    sns.barplot(
                x = first_dimension ,
                y = second_dimension ,
                hue = third_dimension ,
                data = tdtreat ,
                capsize = 0.05 ,
                errwidth = '1' ,
                errcolor = '0' ,
                edgecolor="0" ,
                errorbar = 'sd',
                ax = ax)
    count = count + 1

ax.set(xlabel=None)
ax.set(ylabel=None)

#Setting a y-label with supylabel created a y label that was far to the left, simply labelling the first y-axis
axes[0].set_ylabel("Concentration (ng/L)", fontsize = 12)
</code>```

I managed to get the following graph, with the one legend moved to the bottom and stretched out perfectly into four columns, but the other legends are still visible:

Graph with one legend in correct location

I have attempted setting the legend equal to False to remove all legends, then add one back in, but it says " 'Rectangle' object has no property 'legend'":

```<code>sns.barplot(x = first_dimension ,
            y = second_dimension ,
            hue = third_dimension ,
            data = tdtreat ,
            capsize = 0.05 ,
            errwidth = '1' ,
            errcolor = '0' ,
            edgecolor="0" ,
            errorbar = 'sd',
            ax = ax,
            legend = False)
</code>```

I have attempted adding "ax.legend_.set_visible(False)", but I get the error "'NoneType' object has no attribute 'set_visible'":

```<code>count = 0
for ax in axes:
    axes[count].set_title(f"T = {treatments[count]}")
    ax.legend_.set_visible(False)
    treat = treatments[count]
    tdtreat = td.loc[td['Time'] == treat]
    sns.barplot(x = first_dimension ,
                y = second_dimension ,
                hue = third_dimension ,
                data = tdtreat ,
                capsize = 0.05 ,
                errwidth = '1' ,
                errcolor = '0' ,
                edgecolor="0" ,
                errorbar = 'sd',
                ax = ax)
    count = count + 1

ax.set(xlabel=None)
ax.set(ylabel=None)
</code>```

I have tried updating the seaborn package, along with all other packages in the anaconda terminal, yet it still produces these errors.

As mentioned in this prior question on how to remove matplotlib legends, I attempted "ax.get_legend().remove()" and yet  I got "'NoneType' object has no attribute 'remove'" as an error.

This question addressed the none type, "You have a variable that is equal to None and you're attempting to access an attribute of it called 'something'."

I'm not sure why the axis would be "None" when the axis appears to be there..

Thank you very much.

Body:
I have a data set that looks similar to the below, but is much longer:

   Sample Name Treatment Replicate  Time Congener  Concentration (ng/L)
0     Blank-1     Blank         1     0   PbTx-1                     0
1      Ctrl-1      Ctrl         1     0   PbTx-1                  8800
2      Ctrl-2      Ctrl         2     0   PbTx-1                  7500
3      Ctrl-3      Ctrl         3     0   PbTx-1                  9100
4     10ppm-1     10ppm         1     0   PbTx-1                  9800

I am attempting to create a group (array?) of subplots that shows each time period in a different plot, comparing each treatment, with each congener represented, that has a single legend for the entire plot with 4 columns below the "treatment" x-label.

This link goes to the almost perfect graph, except all the legends are visible

This is the code I used to generate the nearly perfect graph, but with visible legends:

#Setting the variables outside of the actual arguments to improve readability
first_dimension = "Treatment"
second_dimension = "Concentration (ng/L)"
third_dimension = "Congener"

#Setting the y-axis limit for toxin
ylim_toxin = td['Concentration (ng/L)'].max() * 1.05

#This gets the total number of subplots
num_plots = len(treatments)
fig, axes = plt.subplots(ncols = num_plots, sharey=True, sharex=True, figsize = (5*num_plots,5))

#Removes the space between the plots, so they share an X and are lined up nicely by time the sample was taken
fig.subplots_adjust(hspace=0, wspace=0)

#Set overarching title based on previously input project name
fig.suptitle(f'{pdate}', fontweight='bold')
fig.supxlabel(f'Treatment')

#Create a bar plot of the data using seaborn, looping through the treatments list and each axis using count
count = 0
for ax in axes:
    axes[count].set_title(f"T = {treatments[count]}")
    treat = treatments[count]
    tdtreat = td.loc[td['Time'] == treat]
    sns.barplot(
                x = first_dimension ,
                y = second_dimension ,
                hue = third_dimension ,
                data = tdtreat ,
                capsize = 0.05 ,
                errwidth = '1' ,
                errcolor = '0' ,
                edgecolor="0" ,
                errorbar = 'sd',
                ax = ax)
    count = count + 1

ax.set(xlabel=None)
ax.set(ylabel=None)

#Setting a y-label with supylabel created a y label that was far to the left, simply labelling the first y-axis
axes[0].set_ylabel("Concentration (ng/L)", fontsize = 12)

I managed to get the following graph, with the one legend moved to the bottom and stretched out perfectly into four columns, but the other legends are still visible:

Graph with one legend in correct location

I have attempted setting the legend equal to False to remove all legends, then add one back in, but it says " 'Rectangle' object has no property 'legend'":

sns.barplot(x = first_dimension ,
            y = second_dimension ,
            hue = third_dimension ,
            data = tdtreat ,
            capsize = 0.05 ,
            errwidth = '1' ,
            errcolor = '0' ,
            edgecolor="0" ,
            errorbar = 'sd',
            ax = ax,
            legend = False)

I have attempted adding "ax.legend_.set_visible(False)", but I get the error "'NoneType' object has no attribute 'set_visible'":

count = 0
for ax in axes:
    axes[count].set_title(f"T = {treatments[count]}")
    ax.legend_.set_visible(False)
    treat = treatments[count]
    tdtreat = td.loc[td['Time'] == treat]
    sns.barplot(x = first_dimension ,
                y = second_dimension ,
                hue = third_dimension ,
                data = tdtreat ,
                capsize = 0.05 ,
                errwidth = '1' ,
                errcolor = '0' ,
                edgecolor="0" ,
                errorbar = 'sd',
                ax = ax)
    count = count + 1

ax.set(xlabel=None)
ax.set(ylabel=None)

I have tried updating the seaborn package, along with all other packages in the anaconda terminal, yet it still produces these errors.

As mentioned in this prior question on how to remove matplotlib legends, I attempted "ax.get_legend().remove()" and yet  I got "'NoneType' object has no attribute 'remove'" as an error.

This question addressed the none type, "You have a variable that is equal to None and you're attempting to access an attribute of it called 'something'."

I'm not sure why the axis would be "None" when the axis appears to be there..

Thank you very much.


问:
.net standard 2.0 project shows net48 net6.0 and net7.0 Dependencies and does not compile
UPDATED

The following fixed my issue and I really dont know why

https://stackoverflow.com/a/74358346/72792

ORIGINAL

I have .net standard 2.0 project that fails to compile with this error

```<code>NETSDK1013  The TargetFramework value '' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.
</code>```

My csproj has the TargetFramework tag defined as follows

```<code><PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</code>```

But the project has a blue warning icon

and they also show these dependencies

which do not make any kind of sense

I've tried closing VS restarting the PC, all these issues started happening after I added a SourceGenerator project to the solution.

Also when I click on the project properties I am presented with this error

Thanks in advance!

Body:
UPDATED

The following fixed my issue and I really dont know why

https://stackoverflow.com/a/74358346/72792

ORIGINAL

I have .net standard 2.0 project that fails to compile with this error

NETSDK1013  The TargetFramework value '' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.

My csproj has the TargetFramework tag defined as follows

<PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

But the project has a blue warning icon

and they also show these dependencies

which do not make any kind of sense

I've tried closing VS restarting the PC, all these issues started happening after I added a SourceGenerator project to the solution.

Also when I click on the project properties I am presented with this error

Thanks in advance!


问:
apple tv crashing whit Focus item does not provide a parentFocusEnvironment
in tvOS 16 or higher, i am getting this error.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Focus item <golplustv.TvPagerViewCell: 0x7fba3bab6460> does not provide a parentFocusEnvironment.'
terminating with uncaught exception of type NSException
CoreSimulator 857.14 - Device: Apple TV (2B02A89D-BCCD-42DB-A4E6-04BD8A09CE60) - Runtime: tvOS 16.1 (20K67) - DeviceType: Apple TV

Someone faced this problem yet? i don't know why this is happening now and the earlier versions works well

My cell didUpdateFocus: (i don't know if the problem is here)

```<code>public override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {

    if (context.nextFocusedView == self) {

        if let viewController = context.nextFocusedView?.parentViewController as? MainViewController {

            viewController.pagerView.scrollToItem(at: index, animated: true)

            NotificationCenter.default.post(name: ConstantsHelper.pagerViewChanged, object: index)
        }
    }
}
</code>```

Body:
in tvOS 16 or higher, i am getting this error.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Focus item <golplustv.TvPagerViewCell: 0x7fba3bab6460> does not provide a parentFocusEnvironment.'
terminating with uncaught exception of type NSException
CoreSimulator 857.14 - Device: Apple TV (2B02A89D-BCCD-42DB-A4E6-04BD8A09CE60) - Runtime: tvOS 16.1 (20K67) - DeviceType: Apple TV

Someone faced this problem yet? i don't know why this is happening now and the earlier versions works well

My cell didUpdateFocus: (i don't know if the problem is here)

public override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {

    if (context.nextFocusedView == self) {

        if let viewController = context.nextFocusedView?.parentViewController as? MainViewController {

            viewController.pagerView.scrollToItem(at: index, animated: true)

            NotificationCenter.default.post(name: ConstantsHelper.pagerViewChanged, object: index)
        }
    }
}


问:
Chrome Extension: Get element from page and show it in the popup
Im making my first chrome extension.

I want to get this meta tag from a page:

<meta property="og:description" content="Description text...">

But im getting this error: TypeError: Cannot read properties of null (reading 'getAttribute')

The problem is not the element but the popup.js. I dont have the acces to the DOM of the page unlike content.js. So my question: how to get data from the DOM and pass it to my popup.html?

This is what I tried:

popup.js

```<code>document.addEventListener('DOMContentLoaded', (event) => {
    chrome.tabs.query({currentWindow: true, active: true}, function (tabs) {
        desc = document.querySelector("meta[property='og:description']").getAttribute('content')
        console.log = desc;
    });
});
</code>```

popup.html

```<code><html lang="en">
    <body>
        <p id="desc">N/A</p>
    </body>

    <!-- scripts -->
    <script type="text/javascript" src="popup.js"></script>
</html>
</code>```

manifest.json

```<code>{
    "update_url": "https://clients2.google.com/service/update2/crx",
    "manifest_version": 3,
    "name": "Test",
    "version": "0.0.1",
    "content_scripts": [
        {
            "matches": [
                "<all_urls>"
            ],
            "js": [
                "popup.js"
            ]
        }
    ],
    "action": {
        "default_popup": "popup.html"
    },
    "permissions": [
        "tabs",
        "<all_urls>"
    ]
}
</code>```

Body:
Im making my first chrome extension.

I want to get this meta tag from a page:

<meta property="og:description" content="Description text...">

But im getting this error: TypeError: Cannot read properties of null (reading 'getAttribute')

The problem is not the element but the popup.js. I dont have the acces to the DOM of the page unlike content.js. So my question: how to get data from the DOM and pass it to my popup.html?

This is what I tried:

popup.js

document.addEventListener('DOMContentLoaded', (event) => {
    chrome.tabs.query({currentWindow: true, active: true}, function (tabs) {
        desc = document.querySelector("meta[property='og:description']").getAttribute('content')
        console.log = desc;
    });
});

popup.html

N/A

manifest.json

{
    "update_url": "https://clients2.google.com/service/update2/crx",
    "manifest_version": 3,
    "name": "Test",
    "version": "0.0.1",
    "content_scripts": [
        {
            "matches": [
                "<all_urls>"
            ],
            "js": [
                "popup.js"
            ]
        }
    ],
    "action": {
        "default_popup": "popup.html"
    },
    "permissions": [
        "tabs",
        "<all_urls>"
    ]
}


问:
How to access message trigger from another tab using PostMessage?
I have a scenario when in my React app I have to do social login on following steps :

Click Google Login button

It'll open a new window with 'backend api' and redirect to google auth page

Login and submit => It'll again navigate invoke BE call which then return an HTMl page with script

This script will do "window.postMessage({TOKEN OR SUCCESS message})" and close the window

Back to main app window, it has a "message" event handler which should be triggered on postMessage from other window.

I tried to use window.postMessage and window.opener.postMessage but didn't work as window.opener is null.

Can anyone help why window.opener is null here OR any other way to get the token in App from Authentication window ?


问:
How to generate a mongodb _id from document payload unique value, while insert?
I have some documents to insert into a collection, and I'd like to set the _id for each document.

Let's assume my original document is like

```<code>   items = [
     {
       somedata: {
        //unknown
       },
       someUniqueId:"a not standard hex long string e.g. 69Al0MOMXEC8ZPhSf6JJ8w"
     }
   ]
</code>```

I am doing then something like this before invoking insertMany

```<code>        const toInsert = items.map((el) => {
        const hashedHexElId = md5(
          el.someUniqueId
        ).substring(0, 24); // <--- I dont like this but it's needed since it wont accept >24 chars

        const _id = new ObjectId(hashedHexElId);

        return {
          ...el,
          ...{ _id }, // Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer
        };
         await db.insertMany(toInsert);
</code>```

Any best practice  to obtain this?

Note that I'm doing this since I'd like to sync data from another remote resource into my Collection in a way drop-insert (wipe and insert back all)

But also I'd like to relate mongodb collection id to the document's internal primaryKey, which is not a string of 12 bytes or a string of 24 hex characters or an integer

Body:
I have some documents to insert into a collection, and I'd like to set the _id for each document.

Let's assume my original document is like

   items = [
     {
       somedata: {
        //unknown
       },
       someUniqueId:"a not standard hex long string e.g. 69Al0MOMXEC8ZPhSf6JJ8w"
     }
   ]

I am doing then something like this before invoking insertMany

        const toInsert = items.map((el) => {
        const hashedHexElId = md5(
          el.someUniqueId
        ).substring(0, 24); // <--- I dont like this but it's needed since it wont accept >24 chars

        const _id = new ObjectId(hashedHexElId);

        return {
          ...el,
          ...{ _id }, // Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer
        };
         await db.insertMany(toInsert);

Any best practice  to obtain this?

Note that I'm doing this since I'd like to sync data from another remote resource into my Collection in a way drop-insert (wipe and insert back all)

But also I'd like to relate mongodb collection id to the document's internal primaryKey, which is not a string of 12 bytes or a string of 24 hex characters or an integer


问:
C++ Application crashes when QTWidgets is included
I am using conan to install qt, and cmake to build my application. My platform is Windows, and my compiler is MSVC 16. I am using cmake and conan because I do not wish to rely on QT's build system (qmake) and QT's way of installing the package, since I wish other devs can directly clone my repository and use cmake+conan to install dependencies and build my application.

My conanfile.txt is as follows:

```<code>[requires]
qt/6.4.1

[generators]
cmake_find_package
cmake_paths

[options]
qt:shared=True
qt:opengl=dynamic
</code>```

I create a directory called build and inside that directory I do:

```<code>conan install .. -s build_type=Debug
</code>```

Then from my project root directory I do

```<code>cmake -Bbuild

cd build

cmake --build . -j 12 --target helloworld --config Debug
</code>```

Contents of root CMakeLists.txt:

```<code>cmake_minimum_required(VERSION 3.16)

project(helloworld VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(${CMAKE_BINARY_DIR}/conan_paths.cmake)

find_package(Qt6 REQUIRED COMPONENTS Widgets)
qt_standard_project_setup()

add_executable(helloworld
    src/main.cpp
)

target_link_libraries(helloworld PRIVATE Qt6::Widgets)
</code>```

Contents of src/main.cpp:

```<code>#include <QtWidgets>
#include <iostream>

int main(int argc, char *argv[])
{
    std::cout << "Hello World!" << std::endl;
    return 0;
}
</code>```

When I run the executable, nothing is printed to stdout, and it exits with the exit code -1073741515

If I comment out #include <QtWidgets>, and rebuild my executable, then it runs as expected.

EDIT:

It seems this is due to dll not found errors. So I added the following line to my conanfile.txt so that the DLL files are copied to the correct location

```<code>[imports]
bin, *.dll -> ./Debug
</code>```

Now all the DLL files are copied, and when I add a simple QApplication with a QPushButton, and run the the program, I get the following error:

```<code>qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
</code>```

EDITv2:

Now I ran into this page: https://doc.qt.io/qt-6/windows-deployment.html, and ran windeployqt.exe located in the installation location of qt in the conan cache, which copied over some DLLs, presumably the windows plugin dll over into the exe directory

Now my application runs fine.
But I cannot automate this process, because the location of windeployqt.exe is in a folder inside the conan cache, and it has a random name like 7065d7, which I only figured out by manual inspection.

Body:
I am using conan to install qt, and cmake to build my application. My platform is Windows, and my compiler is MSVC 16. I am using cmake and conan because I do not wish to rely on QT's build system (qmake) and QT's way of installing the package, since I wish other devs can directly clone my repository and use cmake+conan to install dependencies and build my application.

My conanfile.txt is as follows:

[requires]
qt/6.4.1

[generators]
cmake_find_package
cmake_paths

[options]
qt:shared=True
qt:opengl=dynamic

I create a directory called build and inside that directory I do:

conan install .. -s build_type=Debug

Then from my project root directory I do

cmake -Bbuild

cd build

cmake --build . -j 12 --target helloworld --config Debug

Contents of root CMakeLists.txt:

cmake_minimum_required(VERSION 3.16)

project(helloworld VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(${CMAKE_BINARY_DIR}/conan_paths.cmake)

find_package(Qt6 REQUIRED COMPONENTS Widgets)
qt_standard_project_setup()

add_executable(helloworld
    src/main.cpp
)

target_link_libraries(helloworld PRIVATE Qt6::Widgets)

Contents of src/main.cpp:

#include <QtWidgets>
#include <iostream>

int main(int argc, char *argv[])
{
    std::cout << "Hello World!" << std::endl;
    return 0;
}

When I run the executable, nothing is printed to stdout, and it exits with the exit code -1073741515

If I comment out #include <QtWidgets>, and rebuild my executable, then it runs as expected.

EDIT:

It seems this is due to dll not found errors. So I added the following line to my conanfile.txt so that the DLL files are copied to the correct location

[imports]
bin, *.dll -> ./Debug

Now all the DLL files are copied, and when I add a simple QApplication with a QPushButton, and run the the program, I get the following error:

qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

EDITv2:

Now I ran into this page: https://doc.qt.io/qt-6/windows-deployment.html, and ran windeployqt.exe located in the installation location of qt in the conan cache, which copied over some DLLs, presumably the windows plugin dll over into the exe directory

Now my application runs fine.
But I cannot automate this process, because the location of windeployqt.exe is in a folder inside the conan cache, and it has a random name like 7065d7, which I only figured out by manual inspection.


问:
Postlogs Solr with Basic Authentification
I use the Solr version 9.1.0. And I try to use the Postlogs tool. My command that I run in the Solr folder is

```<code>bin/postlogs https://admin:my-password@myurl/solr/collection /path-to-logs/
</code>```

The Postlogs tool works fine without authentification. But if I set up security.json and have an admin user with password than I can't run Postlogs and I get an error:

```<code>Batch sending failed: IOException occurred when talking to server at: *my-url*
org.apache.solr.client.solrj.SolrServerException: IOException occurred when talking to server at: *my-url*
        at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:727)
        at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:233)
        at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:214)
        at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:234)
        at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:249)
        at org.apache.solr.util.SolrLogPostTool.sendBatch(SolrLogPostTool.java:124)
        at org.apache.solr.util.SolrLogPostTool.main(SolrLogPostTool.java:113)
Caused by: org.apache.http.client.ClientProtocolException
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
        at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:576)
        ... 6 more
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:225)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
</code>```

I have also tried to set up PreemptiveBasicAuthClientBuilderFactory in solr.in.sh with Basic Authentification. But that didn't help. Please does anyone have a solution for this?

Body:
I use the Solr version 9.1.0. And I try to use the Postlogs tool. My command that I run in the Solr folder is

bin/postlogs https://admin:my-password@myurl/solr/collection /path-to-logs/

The Postlogs tool works fine without authentification. But if I set up security.json and have an admin user with password than I can't run Postlogs and I get an error:

Batch sending failed: IOException occurred when talking to server at: *my-url*
org.apache.solr.client.solrj.SolrServerException: IOException occurred when talking to server at: *my-url*
        at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:727)
        at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:233)
        at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:214)
        at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:234)
        at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:249)
        at org.apache.solr.util.SolrLogPostTool.sendBatch(SolrLogPostTool.java:124)
        at org.apache.solr.util.SolrLogPostTool.main(SolrLogPostTool.java:113)
Caused by: org.apache.http.client.ClientProtocolException
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
        at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:576)
        ... 6 more
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:225)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)

I have also tried to set up PreemptiveBasicAuthClientBuilderFactory in solr.in.sh with Basic Authentification. But that didn't help. Please does anyone have a solution for this?