问:
How to make SASL JAAS working on Kafka on Kubernetes?
I'm trying to set up Kafka on kubernetes, I setup 2 listeners and attached SASL PLAIN mechanism for both from JAAS.  JAAS config loaded from k8s Secret.
Somehow, its not accepting credentials and throwing authentication error, I couldn't figure out what's happening. Any input is very much appreciated.

```<code>     containers:
    - env:
        - name: KAFKA_ADVERTISED_LISTENERS
          value: PLAINTEXT://broker-1:29092,azlbip://xxxx:9443
        - name: KAFKA_BROKER_ID
          value: "1"
        - name: KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS
          value: "0"
        - name: KAFKA_JMX_HOSTNAME
          value: localhost
        - name: KAFKA_JMX_PORT
          value: "9101"
        - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
          value: PLAINTEXT:PLAINTEXT,azlbip:SASL_PLAINTEXT
        - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
          value: "1"
        - name: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR
          value: "1"
        - name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR
          value: "1"
        - name: KAFKA_ZOOKEEPER_CONNECT
          value: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
        - name: KAFKA_LISTENER_NAME_azlbip_PLAIN_SASL_JAAS_CONFIG
          valueFrom:
           secretKeyRef:
            name: sasl
            key: sasl
        - name: KAFKA_LISTENER_NAME_azlbip_SASL_ENABLED_MECHANISMS
          value: PLAIN
        - name: KAFKA_LISTENER_NAME_PLAINTEXT_PLAIN_SASL_JAAS_CONFIG
          valueFrom:
           secretKeyRef:
            name: sasl
            key: sasl
        - name: KAFKA_LISTENER_NAME_PLAINTEXT_SASL_ENABLED_MECHANISMS
          value: PLAIN
</code>```

Secret Content :

```<code>org.apache.kafka.common.security.plain.PlainLoginModule required username="broker" password="password" user_test="test-secret";
</code>```

Finally this translates to kafka.properties on pod as

```<code>sh-4.4$ cat /etc/kafka/kafka.properties
listener.name.plaintext_plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="broker" password="password" user_test="test-secret";
jmx.port=9101
transaction.state.log.min.isr=1
group.initial.rebalance.delay.ms=0
jmx.hostname=localhost
listener.name.plaintext.sasl.enabled.mechanisms=PLAIN
advertised.listeners=PLAINTEXT://broker-1:29092,azlbip://xxxx:9443
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,azlbip:SASL_PLAINTEXT
listener.name.azlbip.sasl.enabled.mechanisms=PLAIN
broker.id=1
transaction.state.log.replication.factor=1
listeners=PLAINTEXT://0.0.0.0:29092,azlbip://0.0.0.0:9443
zookeeper.connect=zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
listener.name.azlbip.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="broker" password="password" user_test="test-secret";
log.dirs=/var/lib/kafka/data
offsets.topic.replication.factor=1
sh-4.4$
</code>```

Body:
I'm trying to set up Kafka on kubernetes, I setup 2 listeners and attached SASL PLAIN mechanism for both from JAAS.  JAAS config loaded from k8s Secret.
Somehow, its not accepting credentials and throwing authentication error, I couldn't figure out what's happening. Any input is very much appreciated.

     containers:
    - env:
        - name: KAFKA_ADVERTISED_LISTENERS
          value: PLAINTEXT://broker-1:29092,azlbip://xxxx:9443
        - name: KAFKA_BROKER_ID
          value: "1"
        - name: KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS
          value: "0"
        - name: KAFKA_JMX_HOSTNAME
          value: localhost
        - name: KAFKA_JMX_PORT
          value: "9101"
        - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
          value: PLAINTEXT:PLAINTEXT,azlbip:SASL_PLAINTEXT
        - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
          value: "1"
        - name: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR
          value: "1"
        - name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR
          value: "1"
        - name: KAFKA_ZOOKEEPER_CONNECT
          value: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
        - name: KAFKA_LISTENER_NAME_azlbip_PLAIN_SASL_JAAS_CONFIG
          valueFrom:
           secretKeyRef:
            name: sasl
            key: sasl
        - name: KAFKA_LISTENER_NAME_azlbip_SASL_ENABLED_MECHANISMS
          value: PLAIN
        - name: KAFKA_LISTENER_NAME_PLAINTEXT_PLAIN_SASL_JAAS_CONFIG
          valueFrom:
           secretKeyRef:
            name: sasl
            key: sasl
        - name: KAFKA_LISTENER_NAME_PLAINTEXT_SASL_ENABLED_MECHANISMS
          value: PLAIN

Secret Content :

org.apache.kafka.common.security.plain.PlainLoginModule required username="broker" password="password" user_test="test-secret";

Finally this translates to kafka.properties on pod as

sh-4.4$ cat /etc/kafka/kafka.properties
listener.name.plaintext_plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="broker" password="password" user_test="test-secret";
jmx.port=9101
transaction.state.log.min.isr=1
group.initial.rebalance.delay.ms=0
jmx.hostname=localhost
listener.name.plaintext.sasl.enabled.mechanisms=PLAIN
advertised.listeners=PLAINTEXT://broker-1:29092,azlbip://xxxx:9443
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,azlbip:SASL_PLAINTEXT
listener.name.azlbip.sasl.enabled.mechanisms=PLAIN
broker.id=1
transaction.state.log.replication.factor=1
listeners=PLAINTEXT://0.0.0.0:29092,azlbip://0.0.0.0:9443
zookeeper.connect=zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
listener.name.azlbip.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="broker" password="password" user_test="test-secret";
log.dirs=/var/lib/kafka/data
offsets.topic.replication.factor=1
sh-4.4$


来源: stackexchange

问:
Angular + Spring + wso2 - Authorization Code Flow + PKCE
My application has a login page that contains only a button that redirects to the WSO2 Identity Server Authorization Server.

This redirect is done by the library angular-oauth2-oidc.

Then I have a backend that calls WSO2 SCIM2.O api's.

In my OAuthConfig i specify only the clientId (because i know that the client secret should never be in the front-end) and I've noticied that the library automatically uses the Authorization code with PKCE because in the url it add the parameter code_challenge, and I'm fine with it since i read that this type of flow is good when you don't want to use the client secret.

When I insert my credentials, I'm redirect to the url that I specified in the redirect_uri of the OAuthConfig, then i click on a button to add a new item and this event calls my backend api (which calls the wso2 scim api). And it doesn't work.

But if i specify in the OAuthConfig the clientID AND the clientSecret, then it works.

And i don't understand why since I'm using the flow with PKCE.  I'm guessing that the problem is with the access token that gets generated? Is there any step I'm missing?

ContentLicense: CC BY-SA 4.0


问:
Jdivert java.lang.ClassNotFoundException error when ran
Trying to use this library, but whenever I run it. It gives me the following. I updated my pom file and thought it would be the solution, but I still receive an error.

```<code>Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Pointer
    at org.example.Main.main(Main.java:11)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Pointer
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 1 more

</code>```

Here is my code

```<code>public class Main {
    public static void main(String[] args) throws WinDivertException {
        System.out.println("Hello world!");

        WinDivert w = new WinDivert("tcp.DstPort == 80 and tcp.PayloadLength > 0");

        w.open(); // packets will be captured from now on

        Packet packet = w.recv();  // read a single packet
        System.out.println(packet);
        w.send(packet);  // re-inject the packet into the network stack

        w.close();  // stop capturing packets
    }
}
</code>```

And here is my pom.xml file

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>Glacial1.1</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.github.ffalcinelli</groupId>
            <artifactId>jdivert</artifactId>
            <version>1.1</version>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>18</maven.compiler.source>
        <maven.compiler.target>18</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>
</code>```

Tried updating my pom file and it didn't work

Body:
Trying to use this library, but whenever I run it. It gives me the following. I updated my pom file and thought it would be the solution, but I still receive an error.

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Pointer
    at org.example.Main.main(Main.java:11)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Pointer
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 1 more

Here is my code

public class Main {
    public static void main(String[] args) throws WinDivertException {
        System.out.println("Hello world!");

        WinDivert w = new WinDivert("tcp.DstPort == 80 and tcp.PayloadLength > 0");

        w.open(); // packets will be captured from now on

        Packet packet = w.recv();  // read a single packet
        System.out.println(packet);
        w.send(packet);  // re-inject the packet into the network stack

        w.close();  // stop capturing packets
    }
}

And here is my pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>Glacial1.1</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.github.ffalcinelli</groupId>
            <artifactId>jdivert</artifactId>
            <version>1.1</version>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>18</maven.compiler.source>
        <maven.compiler.target>18</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>

Tried updating my pom file and it didn't work


问:
Blazor Copy BASE64 Image from Variable to Clipboard
Please tell me :

how can I copy a BASE64 image stored into a variable from variable to clipboard ?

how can I save a BASE64 image stored into a variable from variable to a file on disk ?

Is there a free Nuget package for this kind of task ?

I am using Blazor, C# and .NET 6.

Thank You Very Much !


问:
TabIndex property in chrome/ff and jquery not working together?
I'm using jquery 1.6 and want to execute this code in my iframe:

```<code>$(document).bind('keydown', function (e) {
    if (e.which == 9) {
        var tabbie = $(e.target).attr('tabIndex');
        if (tabbie) {
            var el = $("*[tabIndex='" + (parseInt(tabbie) + 1) + "'");
            if (el.length) {
                // do standard action
            }
            else {
                e.preventDefault();
                window.top.focus();
                return false;
            }
        }
    }
});
</code>```

As you can see, what it should do:
On tab-keypress, see if there is an element with a next tabindex value. If so, all is good, let the browser go to it. If there isn't, then give focus to the parent of the iframe.

This works in IE8, but in chrome/FF it doesn't: you cannot tab anything, even though the html has tabindexes:

```<code><div class="row fl-controls-left">
    <input id="username" name="username" tabindex="1" type="text" value="" size="25" autocomplete="false"/>
</div>
<div class="row fl-controls-left last">
    <input id="password" name="password" tabindex="2" type="password" value="" size="25" autocomplete="off"/>
</div>
<div class="actions rounded-bottom">
    <a href="javascript:void(window.top.location.href = 'http://localhost/')" tabindex="4">Forgot?</a>
    <div class="row btn-row">
        <input name="submit" value="Aanmelden" tabindex="3" type="submit" />
        <input name="reset" value="leegmaken" tabindex="1000" type="reset" />
    </div>
</div>
</code>```

Anyone know why?

(Why I want this code? To answer my other question Tabindex to skip iframe but not content inside)

Cheers!

ContentLicense: CC BY-SA 3.0

Body:
I'm using jquery 1.6 and want to execute this code in my iframe:

$(document).bind('keydown', function (e) {
    if (e.which == 9) {
        var tabbie = $(e.target).attr('tabIndex');
        if (tabbie) {
            var el = $("*[tabIndex='" + (parseInt(tabbie) + 1) + "'");
            if (el.length) {
                // do standard action
            }
            else {
                e.preventDefault();
                window.top.focus();
                return false;
            }
        }
    }
});

As you can see, what it should do:
On tab-keypress, see if there is an element with a next tabindex value. If so, all is good, let the browser go to it. If there isn't, then give focus to the parent of the iframe.

This works in IE8, but in chrome/FF it doesn't: you cannot tab anything, even though the html has tabindexes:

    <input id="username" name="username" tabindex="1" type="text" value="" size="25" autocomplete="false"/>

    <input id="password" name="password" tabindex="2" type="password" value="" size="25" autocomplete="off"/>

    Forgot?

        <input name="submit" value="Aanmelden" tabindex="3" type="submit" />
        <input name="reset" value="leegmaken" tabindex="1000" type="reset" />

Anyone know why?

(Why I want this code? To answer my other question Tabindex to skip iframe but not content inside)

Cheers!


问:
How to apply a conditional formula or function to columns in dataframe in R?
I am trying to apply a formula across select columns of my dataframe but with different parameters in the formula for different columns... E.g. of my dataframe (DF):

```<code>PptID  SFA   Pot   Crb
X1234  13.7   24    98.3
X1245  2.04   25.3  100
X1285  14     19.9  74.1
X1295  12.4   26.7  82.6
</code>```

If X is each data point / value the formula I need to apply is:

((X - mean) / std) - LL / (UL-LL) where LLis lower quartile and UL is upper quartile (I have separate vectors with quartiles for each column referenced as quant_colname)

However, I need the other parameters to pertain to each column and not the data across the dataset.

I've so far got this but it's (obviously) wrong and very messy so any help would be appreciated:

```<code>DF <- apply(DF[, c(2:4)], 2, function(x) {(((X - average) / std) - LL) / (UL-LL)})
                if colname(DF) == "SFA", average = mean(DF$SFA), std = sd(DF$SFA), LL = quants_SFA[2], UL = quants_SFA[3]
                if else colnames(DF) == "Pot", average = mean(DF$Pot), std = sd(DF$POT), LL = quants_Pot[2], UL = quants_Pot[3]
                if else colnames(DF) == "Crb", average = mean(DF$Crb), std = sd(DF$Crb), LL = quants_Crb[2], UL = quants_Crb[3])
</code>```

Ideally I would be able to expand this further over other columns with different parameters too but currently I'm just practising on fewer columns. Thanks!

Body:
I am trying to apply a formula across select columns of my dataframe but with different parameters in the formula for different columns... E.g. of my dataframe (DF):

PptID  SFA   Pot   Crb
X1234  13.7   24    98.3
X1245  2.04   25.3  100
X1285  14     19.9  74.1
X1295  12.4   26.7  82.6

If X is each data point / value the formula I need to apply is:

((X - mean) / std) - LL / (UL-LL) where LLis lower quartile and UL is upper quartile (I have separate vectors with quartiles for each column referenced as quant_colname)

However, I need the other parameters to pertain to each column and not the data across the dataset.

I've so far got this but it's (obviously) wrong and very messy so any help would be appreciated:

DF <- apply(DF[, c(2:4)], 2, function(x) {(((X - average) / std) - LL) / (UL-LL)})
                if colname(DF) == "SFA", average = mean(DF$SFA), std = sd(DF$SFA), LL = quants_SFA[2], UL = quants_SFA[3]
                if else colnames(DF) == "Pot", average = mean(DF$Pot), std = sd(DF$POT), LL = quants_Pot[2], UL = quants_Pot[3]
                if else colnames(DF) == "Crb", average = mean(DF$Crb), std = sd(DF$Crb), LL = quants_Crb[2], UL = quants_Crb[3])

Ideally I would be able to expand this further over other columns with different parameters too but currently I'm just practising on fewer columns. Thanks!


问:
Division/Bit-shift in Palisade Homomorphic Encryption
I am trying to convert a benchmark to homomorphic domain, and I'm using Palisade library for that due to its support of multiple schemes like BFV, BGV, CKKS.
I am currently using BFV scheme.

There is a line in the code-

```<code>y = x >> 6.
</code>```

This line in my encrypted domain should look something like this, given Enc(x)-

```<code>Enc(y) = Enc(x) >> 6.
</code>```

I see that division is not supported in Palisade, and think this is also the case with Microsoft SEAL library.

Can someone please guide how to go about this operation in Palisade?

I tried this (but this assumes that bits of x are known, which is not the case as we only know Enc(x))-

If the breakup of the input integer into binary bits is known -
Say we are given integer x=233 and its binary representation as 'vector<int64_t> v= {1 1 1 0 1 0 0 1 }'.  We can encrypt this vector into HE domain and get ciphertext1.
Then, say we want to do- x>>6. For this, we can do-

```<code>  Plaintext plaintext1;
  cryptoContext->Decrypt(keyPair.secretKey, ciphertext1, &plaintext1);

  plaintext1->SetLength(v.size()-6);
  vector<int64_t> v_final=plaintext1->GetPackedValue();   // gives {1 1}

</code>```

Body:
I am trying to convert a benchmark to homomorphic domain, and I'm using Palisade library for that due to its support of multiple schemes like BFV, BGV, CKKS.
I am currently using BFV scheme.

There is a line in the code-

y = x >> 6.

This line in my encrypted domain should look something like this, given Enc(x)-

Enc(y) = Enc(x) >> 6.

I see that division is not supported in Palisade, and think this is also the case with Microsoft SEAL library.

Can someone please guide how to go about this operation in Palisade?

I tried this (but this assumes that bits of x are known, which is not the case as we only know Enc(x))-

If the breakup of the input integer into binary bits is known -
Say we are given integer x=233 and its binary representation as 'vector<int64_t> v= {1 1 1 0 1 0 0 1 }'.  We can encrypt this vector into HE domain and get ciphertext1.
Then, say we want to do- x>>6. For this, we can do-

  Plaintext plaintext1;
  cryptoContext->Decrypt(keyPair.secretKey, ciphertext1, &plaintext1);

  plaintext1->SetLength(v.size()-6);
  vector<int64_t> v_final=plaintext1->GetPackedValue();   // gives {1 1}


问:
Need a single width unicode character to indicate a wide character has been shortened for lack of space
I'm looking at formatting a utf8 free text string to fit an exact column width on a terminal. I'm coding various truncation methods (left/middle/right) for long strings however, when the truncation break point lies over a wide character, such as an emoji, the display column counting falls apart. some form of padding is needed for the 'half wide' column placement.

Is there a suitable narrow character to show that indicates we do have valid unicode character, but insufficient display space to show it, as opposed to the special replacement character � usually used for invalid unicode ??

Example: on a fixed spacing terminal fit two smiley emojis into the space that would fit 'aaa'. e.g. "" ! so need a, preferably standardised, substitute character for the second emoji/wide character, e.g. "⋮" to fit that three wide space.

A side issue is trying to work out when decomposed composite characters start and end, (also are there combining prefixes?). It looks like the next code point needs to be read to see if it is still zero width (e.g. 'o' U+006F, then 'umlaut' U+0308, rather than ö U+00F6; don't stop after the plain 'o').


问:
elasticsearch group by stack_trace
I'd like to create some query which result should be error stacktrace and number of ocurrences in given time. Basically I'd like to see how many errors with given stacktrace was there in last day(s).
The problem is that stacktrace is textfield and I don't know how to properly create a query for that or if it's possible. Can somebody give me some advice or example?

I've tried this (even with "field": "stack_trace.raw") but no result was displayed.

{
   "aggs": {
      "by_stack_trace": {
         "terms": {
            "field": "stack_trace",
            "size": 100
         }
      }
   },
   "size": 0,
   "query": {
      "bool": {
         "must": [
            {
               "range": {
                  "@timestamp": {
                     "gte": "2022-12-01T00:00:00",
                     "lt": "2022-12-08T00:00:00"
                  }
               }
            }
         ]
      }
   }
}
```

Title: elasticsearch group by stack_trace


问:
old and new data directory size of postgresql does not match
I am trying to update PostgreSQL 11.2 to PostgreSQL 14.0.

My PG 11 Data directory size is 1.1 GB and my PG 14 data directory is 41 MB before the upgrade.

I am now running my below upgrade command:

```<code>"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --retain

C:\pg_upgrade_log>"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --link --check

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for user-defined encoding conversions              ok
Checking for user-defined postfix operators                 ok
Checking for tables WITH OIDS                               ok
Checking for invalid "sql_identifier" user columns          ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
Checking for new cluster tablespace directories             ok

*Clusters are compatible*

C:\pg_upgrade_log>"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --retain

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for user-defined encoding conversions              ok
Checking for user-defined postfix operators                 ok
Checking for tables WITH OIDS                               ok
Checking for invalid "sql_identifier" user columns          ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
Checking for new cluster tablespace directories             ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_xact to new server                           ok
Setting oldest XID for new cluster                          ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Copying user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok

WARNING:  user-defined tablespace locations should not be inside the data directory, e.g. C:/pgData112/ad/ADG/ADG_ADG7x1_TS
Checking for extension updates                              ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade.
Once you start the new server, consider running:
    C:/Program Files/PostgreSQL/14.0/bin/vacuumdb -U postgres --all --analyze-in-stages

Could not create a script to delete the old cluster's data files
because user-defined tablespaces or the new cluster's data directory
exist in the old cluster directory.  The old cluster's contents must
be deleted manually.

C:\pg_upgrade_log>
</code>```

All the steps are stated as OK and the Upgrade Completed message is displayed.

The same is happening with --link option as well.

Now, why the original PG 11.2 data size does not matched with PG 14 data size? is there any issue happened while upgrade? I dont see any error message also.

Am I doing it the right way?

EDIT:

In our application, say, when we create a record, it creates a custom named directory under PG data folder, and inside some FILE type files are placed. So far, that directory holds about 550MB of data in PG 11.2's C:\pgdata112.

After PG upgrade to PG 14, that directory was not present in PG 14 data folder, C:\pgdata140. But all other remaining directories holds the same size.

Only that custom made directory's files seeems to be missing and so the size difference is seen.

Body:
I am trying to update PostgreSQL 11.2 to PostgreSQL 14.0.

My PG 11 Data directory size is 1.1 GB and my PG 14 data directory is 41 MB before the upgrade.

I am now running my below upgrade command:

"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --retain

C:\pg_upgrade_log>"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --link --check

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for user-defined encoding conversions              ok
Checking for user-defined postfix operators                 ok
Checking for tables WITH OIDS                               ok
Checking for invalid "sql_identifier" user columns          ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
Checking for new cluster tablespace directories             ok

*Clusters are compatible*

C:\pg_upgrade_log>"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --retain

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for user-defined encoding conversions              ok
Checking for user-defined postfix operators                 ok
Checking for tables WITH OIDS                               ok
Checking for invalid "sql_identifier" user columns          ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
Checking for new cluster tablespace directories             ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_xact to new server                           ok
Setting oldest XID for new cluster                          ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Copying user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok

WARNING:  user-defined tablespace locations should not be inside the data directory, e.g. C:/pgData112/ad/ADG/ADG_ADG7x1_TS
Checking for extension updates                              ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade.
Once you start the new server, consider running:
    C:/Program Files/PostgreSQL/14.0/bin/vacuumdb -U postgres --all --analyze-in-stages

Could not create a script to delete the old cluster's data files
because user-defined tablespaces or the new cluster's data directory
exist in the old cluster directory.  The old cluster's contents must
be deleted manually.

C:\pg_upgrade_log>

All the steps are stated as OK and the Upgrade Completed message is displayed.

The same is happening with --link option as well.

Now, why the original PG 11.2 data size does not matched with PG 14 data size? is there any issue happened while upgrade? I dont see any error message also.

Am I doing it the right way?

EDIT:

In our application, say, when we create a record, it creates a custom named directory under PG data folder, and inside some FILE type files are placed. So far, that directory holds about 550MB of data in PG 11.2's C:\pgdata112.

After PG upgrade to PG 14, that directory was not present in PG 14 data folder, C:\pgdata140. But all other remaining directories holds the same size.

Only that custom made directory's files seeems to be missing and so the size difference is seen.


问:
Composer: how know a working version for package
I have a question: I am working in a Laravel project with php7.4. Now I have updated my server to php8.0, but when I do composer update I get several errors like:

```<code>Problem 1
    - Root composer.json requires symfony/translation 4.3.8 -> satisfiable by symfony/translation[v4.3.8].
    - symfony/translation v4.3.8 requires php ^7.1.3 -> your php version (8.0.19) does not satisfy that requirement.
</code>```

What is a good way to detect the minimal working version for all this packages? Now I try to find the Github-packages and try to find the requirements, but thats a lot of work. Is there a smart way to update this packages?

Body:
I have a question: I am working in a Laravel project with php7.4. Now I have updated my server to php8.0, but when I do composer update I get several errors like:

Problem 1
    - Root composer.json requires symfony/translation 4.3.8 -> satisfiable by symfony/translation[v4.3.8].
    - symfony/translation v4.3.8 requires php ^7.1.3 -> your php version (8.0.19) does not satisfy that requirement.

What is a good way to detect the minimal working version for all this packages? Now I try to find the Github-packages and try to find the requirements, but thats a lot of work. Is there a smart way to update this packages?


问:
Cannot decrease runtime
The feat_sum dataframe has a missing_or_unknown column with a list of values for each item in feat_sum['attribute'] that has to be replaced as NaN in the gen_dem dataframe.

I do not have an error in this code. But, I am looking for a better way to execute this code, or perhaps, decrease the run-time? Cause this one took me 36+ minutes to execute.

```<code>import time

# Function to create NaNs from feat_sum codes
def replace_codes(df, summary):
    count = 0
    for x, colname in enumerate(df.columns):
        codes = feat_sum['missing_or_unknown'].iloc[x]
        if codes == '[]':
            print('No missing or unknown values for column: {}'.format(colname))
        else:
            list_codes = codes.strip('[]').split(',')
            for y, row in df.iterrows():
                for code in list_codes:
                    if str(row[colname]) == str(code):
                        df[colname].iloc[y] = np.NaN
                        count += 1
    print('Total NaNs added: {}'.format(count))
    return df

start = time.time()
gen_dem = replace_codes(gen_dem, feat_sum)
end = time.time()
print('Time taken: {} minutes and {} seconds'.format(int((end - start) / 60), int((end - start) % 60)))
</code>```

This code works fine. I am just looking for ways of executing the same solution in a more resource/time efficient manner.

Title: Cannot decrease runtime

Body:
The feat_sum dataframe has a missing_or_unknown column with a list of values for each item in feat_sum['attribute'] that has to be replaced as NaN in the gen_dem dataframe.

I do not have an error in this code. But, I am looking for a better way to execute this code, or perhaps, decrease the run-time? Cause this one took me 36+ minutes to execute.

import time

# Function to create NaNs from feat_sum codes
def replace_codes(df, summary):
    count = 0
    for x, colname in enumerate(df.columns):
        codes = feat_sum['missing_or_unknown'].iloc[x]
        if codes == '[]':
            print('No missing or unknown values for column: {}'.format(colname))
        else:
            list_codes = codes.strip('[]').split(',')
            for y, row in df.iterrows():
                for code in list_codes:
                    if str(row[colname]) == str(code):
                        df[colname].iloc[y] = np.NaN
                        count += 1
    print('Total NaNs added: {}'.format(count))
    return df

start = time.time()
gen_dem = replace_codes(gen_dem, feat_sum)
end = time.time()
print('Time taken: {} minutes and {} seconds'.format(int((end - start) / 60), int((end - start) % 60)))

This code works fine. I am just looking for ways of executing the same solution in a more resource/time efficient manner.


问:
Is there a default font on ubuntu that supports Latin, Greek, and CJK alphabets?
I'm using an azure DevOp pipeline to generate pdf files out of markdown files using pandoc with XeLaTeX. I'm doing so with a bash script on an Ubuntu VM.
Some files contain some non-latin characters and other special characters such us └ for example.
Upon running the pandoc command I get the following error:

```<code>[WARNING] Missing character: There is no 式 (U+5F0F) (U+5F0F) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no 会 (U+4F1A) (U+4F1A) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no 社 (U+793E) (U+793E) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no コ (U+30B3) (U+30B3) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ナ (U+30CA) (U+30CA) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ミ (U+30DF) (U+30DF) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ホ (U+30DB) (U+30DB) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ー (U+30FC) (U+30FC) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ル (U+30EB) (U+30EB) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no デ (U+30C7) (U+30C7) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ィ (U+30A3) (U+30A3) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ン (U+30F3) (U+30F3) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no グ (U+30B0) (U+30B0) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ス (U+30B9) (U+30B9) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no λ (U+03BB) (U+03BB) in font [lmmono10-regular]:!
</code>```

So my question is if there's a dafault ubuntu font I can use instead of lmroman10-regular or any other font I can install that supports these character along with Latin alphabet.

Or any other way to go about this

Body:
I'm using an azure DevOp pipeline to generate pdf files out of markdown files using pandoc with XeLaTeX. I'm doing so with a bash script on an Ubuntu VM.
Some files contain some non-latin characters and other special characters such us └ for example.
Upon running the pandoc command I get the following error:

[WARNING] Missing character: There is no 式 (U+5F0F) (U+5F0F) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no 会 (U+4F1A) (U+4F1A) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no 社 (U+793E) (U+793E) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no コ (U+30B3) (U+30B3) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ナ (U+30CA) (U+30CA) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ミ (U+30DF) (U+30DF) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ホ (U+30DB) (U+30DB) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ー (U+30FC) (U+30FC) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ル (U+30EB) (U+30EB) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no デ (U+30C7) (U+30C7) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ィ (U+30A3) (U+30A3) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ン (U+30F3) (U+30F3) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no グ (U+30B0) (U+30B0) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no ス (U+30B9) (U+30B9) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no λ (U+03BB) (U+03BB) in font [lmmono10-regular]:!

So my question is if there's a dafault ubuntu font I can use instead of lmroman10-regular or any other font I can install that supports these character along with Latin alphabet.

Or any other way to go about this


问:
Winrt API Python getting Bluetooth signal strength
I am trying to measure Bluetooth signal strength using winrt APi in python using winsdk. My workflow is to measure Bluetooth Signal strength of a device that is already connected with my Windows machine. I followed the guideline from Pywinrt documentation found here:

Here is my code snippet:

```<code>import asyncio

import  winsdk.windows.devices.enumeration as e
import winsdk.windows.devices.bluetooth as bl

async def scan():

    sig_strength = "System.Devices.Aep.SignalStrength"
    additionalProperties = [sig_strength]
    watcher = e.DeviceInformation.create_watcher(bl.BluetoothDevice.get_device_selector(), additionalProperties)
    received_queue = asyncio.Queue()

    def added_w(device_watcher, device_info_update):
        if(device_info_update.name == "my_device"):

            print("found!")
            for value, key in enumerate(device_info_update.properties):
                if key == "System.Devices.Aep.SignalStrength":
                    print("signal strength: {}".format(value) )

    def updated_w(device_watcher, device_info_update):
        print("update for {} with kind {}".format(device_info_update.id, device_info_update.kind))

    def removed_w(device_watcher, device_info_update):
        pass

    def stopped_w(device_watcher, device_info_update):
        pass

    received_token = watcher.add_added(
        lambda s, e: event_loop.call_soon_threadsafe(added_w, s, e)
    )
    updated_token = watcher.add_updated(
        lambda s, e: event_loop.call_soon_threadsafe(updated_w, s, e)
    )

    removed_token = watcher.add_removed(
        lambda s, e: event_loop.call_soon_threadsafe(removed_w, s, e)
    )

    event_loop = asyncio.get_running_loop()
    stopped_future = event_loop.create_future()

    def handle_stopped(sender, event_args):
      stopped_future.set_result(event_args)

    try:
        print("scanning...")
        watcher.start()

        # this is the consumer for the received event queue
        async def print_received():
          while True:
            event_args = await received_queue.get()
            print(
                "received:",
                event_args.bluetooth_address.to_bytes(6, "big").hex(":"),
                event_args.raw_signal_strength_in_d_bm, "dBm",
            )

        printer_task = asyncio.create_task(print_received())

        # since the print task is an infinite loop, we have to cancel it when we don't need it anymore
        stopped_future.add_done_callback(printer_task.cancel)

        # scan for 30 seconds or until an unexpected stopped event (due to error)
        done, pending = await asyncio.wait(
            [stopped_future, printer_task], timeout=30, return_when=asyncio.FIRST_COMPLETED
        )

        if stopped_future in done:
            print("unexpected stopped event", stopped_future.result().error)
        else:
            print("stopping...")
            watcher.stop()
            await stopped_future
    finally:
        # event handler are removed in a finally block to ensure we don't leak
        watcher.remove_received(received_token)
        watcher.remove_stopped(handle_stopped)

asyncio.run(scan())

</code>```

However, I only get a fixed RSSI value 8 in my print in added_w function.

Any help on potential solution would be greatly appreciated!

Body:
I am trying to measure Bluetooth signal strength using winrt APi in python using winsdk. My workflow is to measure Bluetooth Signal strength of a device that is already connected with my Windows machine. I followed the guideline from Pywinrt documentation found here:

Here is my code snippet:

import asyncio

import  winsdk.windows.devices.enumeration as e
import winsdk.windows.devices.bluetooth as bl

async def scan():

    sig_strength = "System.Devices.Aep.SignalStrength"
    additionalProperties = [sig_strength]
    watcher = e.DeviceInformation.create_watcher(bl.BluetoothDevice.get_device_selector(), additionalProperties)
    received_queue = asyncio.Queue()

    def added_w(device_watcher, device_info_update):
        if(device_info_update.name == "my_device"):

            print("found!")
            for value, key in enumerate(device_info_update.properties):
                if key == "System.Devices.Aep.SignalStrength":
                    print("signal strength: {}".format(value) )

    def updated_w(device_watcher, device_info_update):
        print("update for {} with kind {}".format(device_info_update.id, device_info_update.kind))

    def removed_w(device_watcher, device_info_update):
        pass

    def stopped_w(device_watcher, device_info_update):
        pass

    received_token = watcher.add_added(
        lambda s, e: event_loop.call_soon_threadsafe(added_w, s, e)
    )
    updated_token = watcher.add_updated(
        lambda s, e: event_loop.call_soon_threadsafe(updated_w, s, e)
    )

    removed_token = watcher.add_removed(
        lambda s, e: event_loop.call_soon_threadsafe(removed_w, s, e)
    )

    event_loop = asyncio.get_running_loop()
    stopped_future = event_loop.create_future()

    def handle_stopped(sender, event_args):
      stopped_future.set_result(event_args)

    try:
        print("scanning...")
        watcher.start()

        # this is the consumer for the received event queue
        async def print_received():
          while True:
            event_args = await received_queue.get()
            print(
                "received:",
                event_args.bluetooth_address.to_bytes(6, "big").hex(":"),
                event_args.raw_signal_strength_in_d_bm, "dBm",
            )

        printer_task = asyncio.create_task(print_received())

        # since the print task is an infinite loop, we have to cancel it when we don't need it anymore
        stopped_future.add_done_callback(printer_task.cancel)

        # scan for 30 seconds or until an unexpected stopped event (due to error)
        done, pending = await asyncio.wait(
            [stopped_future, printer_task], timeout=30, return_when=asyncio.FIRST_COMPLETED
        )

        if stopped_future in done:
            print("unexpected stopped event", stopped_future.result().error)
        else:
            print("stopping...")
            watcher.stop()
            await stopped_future
    finally:
        # event handler are removed in a finally block to ensure we don't leak
        watcher.remove_received(received_token)
        watcher.remove_stopped(handle_stopped)

asyncio.run(scan())

However, I only get a fixed RSSI value 8 in my print in added_w function.

Any help on potential solution would be greatly appreciated!


问:
set up product filter based on multiselection field in Pimcore
Goal

I want to have a product filter based on a multiselection field of my data object.

Current setup

Project based on the official Pimcore Demo Application

Added a new data field to my data object class (type: Multiselection, name: selectionTest)

Manually update index via php bin/console ecommerce:indexservice:bootstrap --update-index

Create a new filter definition and add a FilterMultiSelectFromMultiSelect

Here I can select the field selectionTest, but the Pre Select field keeps empty (see screenshot)

select the filter definition in the product category

when I open now the product category in the shop frontend, I get following exception:

```<code>An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT TRIM(`selectionTest`) as `value`, count(*) as `count` FROM shop_productindex a WHERE active = 1 AND o_virtualProductActive = 1 AND inProductList = 1 AND o_type = 'variant' GROUP BY TRIM(`selectionTest`)':

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'selectionTest' in 'field list'").
</code>```

Body:
Goal

I want to have a product filter based on a multiselection field of my data object.

Current setup

Project based on the official Pimcore Demo Application

Added a new data field to my data object class (type: Multiselection, name: selectionTest)

Manually update index via php bin/console ecommerce:indexservice:bootstrap --update-index

Create a new filter definition and add a FilterMultiSelectFromMultiSelect

Here I can select the field selectionTest, but the Pre Select field keeps empty (see screenshot)

select the filter definition in the product category

when I open now the product category in the shop frontend, I get following exception:

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT TRIM(`selectionTest`) as `value`, count(*) as `count` FROM shop_productindex a WHERE active = 1 AND o_virtualProductActive = 1 AND inProductList = 1 AND o_type = 'variant' GROUP BY TRIM(`selectionTest`)':

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'selectionTest' in 'field list'").


问:
Using Jest with react-native-elements -> cannot use import statement outside a module
Hey i want to start testing my components using jest. Im facing actually with this kind of error:

```<code> /Users/macbookfirmowy/Documents/Vitkac/vitkac-app/node_modules/react-native-elements/src/index.js:7
import Button from './buttons/Button';
^^^^^^

SyntaxError: Cannot use import statement outside a module

  15 |
  16 | // register to React Native Elements
> 17 | import { registerCustomIconType } from 'react-native-elements';
     | ^
  18 |
  19 | Object.keys(merged_icons).forEach((k) => {
  20 |      registerCustomIconType(k, merged_icons[k]);

  at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
  at Object.<anonymous> (utils/config/icons.js:17:1)
</code>```

I have this version of libraries:

"react-native": "^0.67.5"

"react-native-elements": "^2.0.4"

"jest": "^26.6.3"

I know rnelements 2.0.4 is old version but i cant update it right now bcs i have it in many places.
Someone know how to fix this error without package update?

Body:
Hey i want to start testing my components using jest. Im facing actually with this kind of error:

 /Users/macbookfirmowy/Documents/Vitkac/vitkac-app/node_modules/react-native-elements/src/index.js:7
import Button from './buttons/Button';
^^^^^^

SyntaxError: Cannot use import statement outside a module

  15 |
  16 | // register to React Native Elements
> 17 | import { registerCustomIconType } from 'react-native-elements';
     | ^
  18 |
  19 | Object.keys(merged_icons).forEach((k) => {
  20 |      registerCustomIconType(k, merged_icons[k]);

  at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
  at Object.<anonymous> (utils/config/icons.js:17:1)

I have this version of libraries:

"react-native": "^0.67.5"

"react-native-elements": "^2.0.4"

"jest": "^26.6.3"

I know rnelements 2.0.4 is old version but i cant update it right now bcs i have it in many places.
Someone know how to fix this error without package update?


问:
Entity field nullable=true but can not be null. (Symfony)
I have some entities and when I find an interaction (CRUD) for each of them I stock the action in a Logs entity.
My Logs entity has FK to some other entities, and these FK fields can be null.
When I create my new Logs it says:

Expected type 'App\Entity\Client'. Found 'null'.

For the precision, everything works perfectly without the Logs part so I need to fix it to have the result I want.

My Logs entity on where I get the error:

```<code>    #[ORM\ManyToOne(inversedBy: 'logs', cascade: ['persist'])]
    #[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
    private ?Client $client = null;
</code>```

My Client entity:

```<code>    #[ORM\OneToMany(mappedBy: 'client', targetEntity: Logs::class, orphanRemoval:false, cascade: ['persist'])]
    private Collection $logs;
</code>```

PS: I want the logs to not be deleted in cascade while deleting the stuff it refers to.

EDIT:

In my Group entity:

```<code>public function getClient(): ?Client
{
    return $this->client;
}
</code>```

In my Client entity:

```<code> /**
 * @return Collection<int, Group>
 */
public function getGroups(): Collection
{
    return $this->groups;
}
</code>```

Here is where I get the error:

```<code>    #[Route('/new', name: 'app_user_new', methods: ['GET', 'POST'])]
public function new(Request $request, UserPasswordHasherInterface $userPasswordHasher, UserRepository $userRepository, LogsRepository $logsRepository, GroupRepository $groupRepository, SiteRepository $siteRepository, ClientRepository $clientRepository): Response
{
    $user = new User();
    $form = $this->createForm(UserType::class, $user);
    $form->handleRequest($request);

    if ($form->isSubmitted() && $form->isValid()) {
            // encode the plain password
            $user->setPassword(
                $userPasswordHasher->hashPassword(
                    $user,
                    $form->get('password')->getData()
                )
            );
            $userRepository->save($user, true);

            // take all needed information
            $now = new DateTime('now');
            $action = 'Create "'.$user->getMail().'" user';
            $result = 'SUCCESS';
            $gw_interaction = 'none';
            $client = $clientRepository->clientToCreateAndDelete($clientRepository);
            $group = $groupRepository->groupToCreateAndDelete($client, $groupRepository);
            $site = $siteRepository->siteToCreateAndDelete($group, $siteRepository);

            // write this action on the logs
            $logsRepository->createANewLog($now, $action, $result, $gw_interaction, $user, $client, $site);

            // delete the factice client
            // $groupRepository->remove($group, true);
            $clientRepository->remove($client, true);

            return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER);
    }

    return $this->renderForm('user/new.html.twig', [
        'user' => $user,
        'form' => $form,
    ]);
}
</code>```

I can't put null as a value so I tried to create the needed entities, add the log and then remove the entities but it also doesn't work. It says I can't delete a parent row before children's (I have a group a child of a client) But if I delete the group and then delete the client, I still have this error. This is why I just want to be able to give a null at the beginning so I do not need to create and delete useless entities.

My function looks like this:

```<code>public function createANewLog(DateTime $now, String $action, String $result, String $gw_interaction, User $user)
{
    $logs = new Logs();

    $logs->setDatetime($now);
    $logs->setAction($action);
    $logs->setResultat($result);
    $logs->setGwInteraction($gw_interaction);
    $logs->setHisUser($user);

    $this->save($logs, true);
}
</code>```

One possible solution:

Because I cannot solve this I found another way to save my values. Now, I deleted client and site columns in Logs:

-> when I need them to be null I just do nothing.

-> when I need them to have a value, I wrote the values in the action:

-> before action had for example: "Create site siteName"

-> now action is for example: "Create site siteName from group
GroupName"

Body:
I have some entities and when I find an interaction (CRUD) for each of them I stock the action in a Logs entity.
My Logs entity has FK to some other entities, and these FK fields can be null.
When I create my new Logs it says:

Expected type 'App\Entity\Client'. Found 'null'.

For the precision, everything works perfectly without the Logs part so I need to fix it to have the result I want.

My Logs entity on where I get the error:

    #[ORM\ManyToOne(inversedBy: 'logs', cascade: ['persist'])]
    #[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
    private ?Client $client = null;

My Client entity:

    #[ORM\OneToMany(mappedBy: 'client', targetEntity: Logs::class, orphanRemoval:false, cascade: ['persist'])]
    private Collection $logs;

PS: I want the logs to not be deleted in cascade while deleting the stuff it refers to.

EDIT:

In my Group entity:

public function getClient(): ?Client
{
    return $this->client;
}

In my Client entity:

 /**
 * @return Collection<int, Group>
 */
public function getGroups(): Collection
{
    return $this->groups;
}

Here is where I get the error:

    #[Route('/new', name: 'app_user_new', methods: ['GET', 'POST'])]
public function new(Request $request, UserPasswordHasherInterface $userPasswordHasher, UserRepository $userRepository, LogsRepository $logsRepository, GroupRepository $groupRepository, SiteRepository $siteRepository, ClientRepository $clientRepository): Response
{
    $user = new User();
    $form = $this->createForm(UserType::class, $user);
    $form->handleRequest($request);

    if ($form->isSubmitted() && $form->isValid()) {
            // encode the plain password
            $user->setPassword(
                $userPasswordHasher->hashPassword(
                    $user,
                    $form->get('password')->getData()
                )
            );
            $userRepository->save($user, true);

            // take all needed information
            $now = new DateTime('now');
            $action = 'Create "'.$user->getMail().'" user';
            $result = 'SUCCESS';
            $gw_interaction = 'none';
            $client = $clientRepository->clientToCreateAndDelete($clientRepository);
            $group = $groupRepository->groupToCreateAndDelete($client, $groupRepository);
            $site = $siteRepository->siteToCreateAndDelete($group, $siteRepository);

            // write this action on the logs
            $logsRepository->createANewLog($now, $action, $result, $gw_interaction, $user, $client, $site);

            // delete the factice client
            // $groupRepository->remove($group, true);
            $clientRepository->remove($client, true);

            return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER);
    }

    return $this->renderForm('user/new.html.twig', [
        'user' => $user,
        'form' => $form,
    ]);
}

I can't put null as a value so I tried to create the needed entities, add the log and then remove the entities but it also doesn't work. It says I can't delete a parent row before children's (I have a group a child of a client) But if I delete the group and then delete the client, I still have this error. This is why I just want to be able to give a null at the beginning so I do not need to create and delete useless entities.

My function looks like this:

public function createANewLog(DateTime $now, String $action, String $result, String $gw_interaction, User $user)
{
    $logs = new Logs();

    $logs->setDatetime($now);
    $logs->setAction($action);
    $logs->setResultat($result);
    $logs->setGwInteraction($gw_interaction);
    $logs->setHisUser($user);

    $this->save($logs, true);
}

One possible solution:

Because I cannot solve this I found another way to save my values. Now, I deleted client and site columns in Logs:

-> when I need them to be null I just do nothing.

-> when I need them to have a value, I wrote the values in the action:

-> before action had for example: "Create site siteName"

-> now action is for example: "Create site siteName from group
GroupName"


问:
Testing WebRTC stream with Janus and GStreamer
First of all I want to say that I'm begginer with WebRTC testing, and Janus, GStreamer etc.
I have Janus getaway that provides WebRTC traffic to particular mobile client.
The task at hand is to capture WebRTC from Janus and get some metrics: Bitrate, framerate, Video and Audio delay, and actual frame to compare it. for using them in python autotests.

So a couple of question appeared during the investigation:

Is GStreamer suitable tool for capturing WebRTC from Janus, and for further analysis?

What alternatives to GStreamer are there?(FFmpeg)or maybe some other approaches for this kind of testing;

Could I get Bitrate, framerate, Video and Audio delay from Janus using GStreamer -> OpenCV python


问:
FacebookMessengerShareButton from react share npm
Cant figure out how to add FacebookMessengerShareButton from react share.
FacebookShareButton works with no issues, but i need Messenger button.
According to docs

https://www.npmjs.com/package/react-share

I need to add

appId (string): Facebook application id

however, i am not sure what id can i put there since page will be shared by other users.

Demo doesnt work as well. This is the error message:

Sorry, this content isn't available at the moment

Has anyone succeeded in adding facebook messenger share button?
Cheers!


Title: How to prevent RabbitMQ to deadletter messages on connection loss

Body:
we use RabbitMQ to communicate between our components. For some reason some components could not communicate with the server any more tonight. On the server the issue looked like that:

...
=ERROR EVENT==== Tue, 06 Dec 2022 21:18:15 GMT ===
2022-12-06 21:18:15.144351+00:00 [erro] <0.9186.1093> closing AMQP connection <0.9186.1093> (123.123.123.123:26688 -> 234.234.234.234:5671 - rabbitConnectionFactory#1f48fa72:0):
2022-12-06 21:18:15.144351+00:00 [erro] <0.9186.1093> missed heartbeats from client, timeout: 60s

=ERROR EVENT==== Tue, 06 Dec 2022 21:18:17 GMT ===
2022-12-06 21:18:17.549345+00:00 [erro] <0.4340.1090> closing AMQP connection <0.4340.1090> (123.123.123.123:39360 -> 234.234.234.234:5671 - rabbitConnectionFactory#e4348c0:0):
2022-12-06 21:18:17.549345+00:00 [erro] <0.4340.1090> missed heartbeats from client, timeout: 60s

=ERROR EVENT==== Tue, 06 Dec 2022 21:18:27 GMT ===
2022-12-06 21:18:27.177133+00:00 [erro] <0.5137.403> closing AMQP connection <0.5137.403> (123.123.123.123:39360 -> 234.234.234.234:5671 - rabbitConnectionFactory#6f071d0c:0):
2022-12-06 21:18:27.177133+00:00 [erro] <0.5137.403> missed heartbeats from client, timeout: 60s

=ERROR EVENT==== Tue, 06 Dec 2022 21:18:31 GMT ===
2022-12-06 21:18:31.701088+00:00 [erro] <0.25212.1093> closing AMQP connection <0.25212.1093> (123.123.123.123:30528 -> 234.234.234.234:5671 - some-component):
2022-12-06 21:18:31.701088+00:00 [erro] <0.25212.1093> missed heartbeats from client, timeout: 60s

=ERROR EVENT==== Tue, 06 Dec 2022 21:18:36 GMT ===
2022-12-06 21:18:36.922101+00:00 [erro] <0.10334.685> closing AMQP connection <0.10334.685> (123.123.123.123:24960 -> 234.234.234.234:5671 - SpringAMQP#1a61721e:0):
2022-12-06 21:18:36.922101+00:00 [erro] <0.10334.685> missed heartbeats from client, timeout: 60s
...

The components reconnected, and continued their operation, though for one queue some messages were deadlettered. Which took me some time to find out why they were deadlettered and are delayed in the processing by a few hours as they were manually shoveled back to the in-queue after the investigation.

I assume that these deadlettered messages might have been unacked at the time of the disconnect.

My quesion, how can I prevent that behaviour, so that the messages are reqeued and then processed normally (either by some other instance that has still a connection or the same instance when it reestablishes the connection) (Analog if the consumer would nack the message with requeue=true?


问:
ScreenToWorld point on 2d scale without affecting the Z position
I'm creating a draggable item but whenever I drag it's z position would become 47 and I wanted it to retain to 0.</p>
```<code>using UnityEngine;
using UnityEngine.EventSystems;

public class draggableItem : MonoBehaviour, IBeginDragHandler, IDragHandler , IEndDragHandler
{

Transform setParentAferDrag;

public void OnBeginDrag(PointerEventData eventData)
{
    setParentAferDrag = transform.parent;
    transform.SetParent(transform.root);
    transform.SetAsLastSibling();
}

public void OnDrag(PointerEventData eventData)
{
    var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    transform.position = mousePos;
}

public void OnEndDrag(PointerEventData eventData)
{
    transform.SetParent(setParentAferDrag);
}
}
</code>```

Body:
I'm creating a draggable item but whenever I drag it's z position would become 47 and I wanted it to retain to 0.

using UnityEngine;
using UnityEngine.EventSystems;

public class draggableItem : MonoBehaviour, IBeginDragHandler, IDragHandler , IEndDragHandler
{

Transform setParentAferDrag;

public void OnBeginDrag(PointerEventData eventData)
{
    setParentAferDrag = transform.parent;
    transform.SetParent(transform.root);
    transform.SetAsLastSibling();
}

public void OnDrag(PointerEventData eventData)
{
    var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    transform.position = mousePos;
}

public void OnEndDrag(PointerEventData eventData)
{
    transform.SetParent(setParentAferDrag);
}
}


问:
React with Keycloak Authentication loop refresh
This issue says that I should do checkLoginIframe: false
this is my keycloak instance:

```<code>import Keycloak from 'keycloak-js';
const keycloak = Keycloak({
  url: 'http://xxx.xxxx.xxxx:8080/auth',
  realm: "master",
  clientId: "react",
});

keycloak.init ({
  checkLoginIframe: false,
})

export default keycloak;
</code>```

But when I set checkLoginIFrame to false, I login in the keycloak, as soon as I redirect to the page, the page refreshes every second with a different state parameter:
For example:

http://localhost:3000/#state=e29ea8b6-4420-4c2a-8685-c35e90f5f327&session_state=b52275d0-c00b-4bbf-9a49-f9c584a43fab&code=f5fa2e91-f958-4bb4-bdb2-8510545ed061.b52275d0-c00b-4bbf-9a49-f9c584a43fab.752a5dc8-d0a2-4147-8ac2-17ef6537d234

After one second

http://localhost:3000/#state=efc3bcfa-d85d-4594-9a07-d3458112a4bd&session_state=b52275d0-c00b-4bbf-9a49-f9c584a43fab&code=ed6afb49-de8f-4cc9-bba9-d7ed984358a6.b52275d0-c00b-4bbf-9a49-f9c584a43fab.752a5dc8-d0a2-4147-8ac2-17ef6537d234

And so one

Before setting checkLoginIframe to false, it did not loop refresh, but it logout after 5s

How to get rid of the loop refresh?

```<code>   "@react-keycloak/web": "^3.4.0",
    "keycloak-js": "^9.0.2",
</code>```

Body:
This issue says that I should do checkLoginIframe: false
this is my keycloak instance:

import Keycloak from 'keycloak-js';
const keycloak = Keycloak({
  url: 'http://xxx.xxxx.xxxx:8080/auth',
  realm: "master",
  clientId: "react",
});

keycloak.init ({
  checkLoginIframe: false,
})

export default keycloak;

But when I set checkLoginIFrame to false, I login in the keycloak, as soon as I redirect to the page, the page refreshes every second with a different state parameter:
For example:

http://localhost:3000/#state=e29ea8b6-4420-4c2a-8685-c35e90f5f327&session_state=b52275d0-c00b-4bbf-9a49-f9c584a43fab&code=f5fa2e91-f958-4bb4-bdb2-8510545ed061.b52275d0-c00b-4bbf-9a49-f9c584a43fab.752a5dc8-d0a2-4147-8ac2-17ef6537d234

After one second

http://localhost:3000/#state=efc3bcfa-d85d-4594-9a07-d3458112a4bd&session_state=b52275d0-c00b-4bbf-9a49-f9c584a43fab&code=ed6afb49-de8f-4cc9-bba9-d7ed984358a6.b52275d0-c00b-4bbf-9a49-f9c584a43fab.752a5dc8-d0a2-4147-8ac2-17ef6537d234

And so one

Before setting checkLoginIframe to false, it did not loop refresh, but it logout after 5s

How to get rid of the loop refresh?

   "@react-keycloak/web": "^3.4.0",
    "keycloak-js": "^9.0.2",


问:
Databricks SparkR can't create spark DataFrame from large R data.frame
I have a local R data.frame with 16 Million records in databricks. When I try to load it into a spark DataFrame I receive an error after circa 5 minutes every time.

```<code>sparkR.session()
spark_data_frame <- createDataFrame(local_r_data_frame, numPartitions=500)
</code>```

The error:

```<code> RserveException: eval failed
</code>```

I have tried with up to 10000 paritions and the same error is received after the same amount of processing time.

Body:
I have a local R data.frame with 16 Million records in databricks. When I try to load it into a spark DataFrame I receive an error after circa 5 minutes every time.

sparkR.session()
spark_data_frame <- createDataFrame(local_r_data_frame, numPartitions=500)

The error:

 RserveException: eval failed

I have tried with up to 10000 paritions and the same error is received after the same amount of processing time.


问:
React Native, Axios returns an empty array from Yelp API call
I'm very new to react native and working with APIs. I'm trying to build an app that gets nearby restaurant data from the Yelp API and displays to the user. However, the data won't seem to save correctly to my array cause it only shows up as an empty array in the console window. However, my call to the api shows that I'm retrieving data, I just don't think I'm storing it right.

yelp.js:

```<code>function searchBusinesses(param) {
  let opt = {
  method: 'GET',
  url: searchURI.concat('search'),
  params: (param)? param : defaultParameters,
  headers: authHeader
}
axios.request(opt)
.then((response) => {
    console.log('Restaurants', response.data.businesses);
    console.log(response.status);
    return response.data.businesses;
  })
  .catch((err) => {
  console.error(err);
  });
 }
} export default { searchBusinesses };`
</code>```

SearchRestaurants.js:

```<code>class PickRestaurants extends Component {
constructor(props) {
  super(props);
  this.state = store.getState();
  this.state = {...this.state
  restaurant: [],
 };
};

componentDidMount() {
  let results = YelpAPI.searchBusinesses();
  this.setState({restaurant: results});
  console.log('RESULTS:', this.state);
 }

render() { const config = { velocityThreshold: 0.3,
   directionalOffsetThreshold: 80
};

return (
 <View style={[styles.container, chooseButtons.container]}>
   <View style={chooseButtons.restaurantContianer}>
    <Text> restaurant info: { this.state.restaurant.name } </Text>
    <Text> Img URL: {this.state.restaurant.image_url}  </Text>
   </View>
  </View>
 );
}
</code>```

All I see on console is: RESULTS [] and nothing displays in the app either.

I want the data to store in the array so I can print it in my app.

Thank you

Body:
I'm very new to react native and working with APIs. I'm trying to build an app that gets nearby restaurant data from the Yelp API and displays to the user. However, the data won't seem to save correctly to my array cause it only shows up as an empty array in the console window. However, my call to the api shows that I'm retrieving data, I just don't think I'm storing it right.

yelp.js:

function searchBusinesses(param) {
  let opt = {
  method: 'GET',
  url: searchURI.concat('search'),
  params: (param)? param : defaultParameters,
  headers: authHeader
}
axios.request(opt)
.then((response) => {
    console.log('Restaurants', response.data.businesses);
    console.log(response.status);
    return response.data.businesses;
  })
  .catch((err) => {
  console.error(err);
  });
 }
} export default { searchBusinesses };`

SearchRestaurants.js:

class PickRestaurants extends Component {
constructor(props) {
  super(props);
  this.state = store.getState();
  this.state = {...this.state
  restaurant: [],
 };
};

componentDidMount() {
  let results = YelpAPI.searchBusinesses();
  this.setState({restaurant: results});
  console.log('RESULTS:', this.state);
 }

render() { const config = { velocityThreshold: 0.3,
   directionalOffsetThreshold: 80
};

return (
 <View style={[styles.container, chooseButtons.container]}>
   <View style={chooseButtons.restaurantContianer}>
    <Text> restaurant info: { this.state.restaurant.name } </Text>
    <Text> Img URL: {this.state.restaurant.image_url}  </Text>
   </View>
  </View>
 );
}

All I see on console is: RESULTS [] and nothing displays in the app either.

I want the data to store in the array so I can print it in my app.

Thank you


问:
Is there a way to show emoji flags in a plotly go table?
I'm tring to plot a table with a column to show the flags of some countries based on emoji flag sequence. I only get the letters as a result.

Here is a simple example code:

```<code>import pandas as pd
from plotly import graph_objects as go

df = pd.DataFrame({'flag':['','',''], 'country_name':['European Union', 'Brazil','United States']})

fig = go.Figure(data=go.Table(header=dict(values=df.columns),cells=dict(values=[df['flag'],df['country_name']])))
fig.update_layout(width=500)
fig.show()
</code>```

I expected to have the actual flag image instead of flag sequence! I'm using Windows11 with Microsoft Edge.

Body:
I'm tring to plot a table with a column to show the flags of some countries based on emoji flag sequence. I only get the letters as a result.

Here is a simple example code:

import pandas as pd
from plotly import graph_objects as go

df = pd.DataFrame({'flag':['','',''], 'country_name':['European Union', 'Brazil','United States']})

fig = go.Figure(data=go.Table(header=dict(values=df.columns),cells=dict(values=[df['flag'],df['country_name']])))
fig.update_layout(width=500)
fig.show()

I expected to have the actual flag image instead of flag sequence! I'm using Windows11 with Microsoft Edge.


问:
Sonar-Gerrit integration shows error in Jenkins
There is a Jenkins freestyle job that is triggered by some Gerrit events.In response to triggers, it downloads the changes and runs a Sonarqube Analysis. The Sonarqube comments detailing the results are to be posted on Gerrit after the analysis is complete.This is the expected behaviour.

As of now, In Jenkins, the Sonarqube execution is success. But the build is failed mentioning the error " *ERROR: Build step failed with exception java.lang.IllegalArgumentException: Gerrit change number is empty*

Could anyone please help on this?

Reference:https://plugins.jenkins.io/sonar-gerrit/
Followed the same steps as mentioned in the above document.

Jenkins console output

Expected: The Sonarqube should post the comments to the respective Gerrit change,whether the Sonar-verified is +1/-1.


问:
Torchvision: Import model error (SIGSEGV error)
Using a Mac and Pycharm (Python 3.10 environment), I would like to run the following lines of code without receiving a segmentation error:

```<code>from torchvision import models
from torchvision.models import ResNet50_Weights, ResNet18_Weights
model_main = models.resnet18(weights=ResNet18_Weights.DEFAULT)

OUT: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
</code>```

There is unfortunately not other information than this one.

Body:
Using a Mac and Pycharm (Python 3.10 environment), I would like to run the following lines of code without receiving a segmentation error:

from torchvision import models
from torchvision.models import ResNet50_Weights, ResNet18_Weights
model_main = models.resnet18(weights=ResNet18_Weights.DEFAULT)

OUT: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

There is unfortunately not other information than this one.


问:
Rest Template multipart request working for jpg but not for png
I am request server to upload doc through resttemplate api

```<code>RestTemplate restTemplate = new RestTemplate(factory);
MultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>();

map.add("formFields", "");
    //map.add("outputDir", OUTPUT_DIR.propValue() + Constants.TX_DETAILS_PATH);
map.add("tableFields", "");
 map.add("roiModelName", "word-detect-v4");

 map.add("file", new FileSystemResource(new File("F://us_invoice1.png")));
ResponseEntity<String> reponse = null;

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
reponse = restTemplate.exchange("http://ip/api/nlp/get-sorted-roi", HttpMethod.POST, new HttpEntity<>(map, headers), String.class);
</code>```

It is working with jpg image but not for png image but
url is working for png image as well from postman

Postman HTTP request response
POST /api/nlp/get-sorted-roi HTTP/1.1
Host: {{ip}}
Content-Length: 298
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="/F:/us_invoice1.png"
Content-Type: image/png

(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW

Body:
I am request server to upload doc through resttemplate api

RestTemplate restTemplate = new RestTemplate(factory);
MultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>();

map.add("formFields", "");
    //map.add("outputDir", OUTPUT_DIR.propValue() + Constants.TX_DETAILS_PATH);
map.add("tableFields", "");
 map.add("roiModelName", "word-detect-v4");

 map.add("file", new FileSystemResource(new File("F://us_invoice1.png")));
ResponseEntity<String> reponse = null;

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
reponse = restTemplate.exchange("http://ip/api/nlp/get-sorted-roi", HttpMethod.POST, new HttpEntity<>(map, headers), String.class);

It is working with jpg image but not for png image but
url is working for png image as well from postman

Postman HTTP request response
POST /api/nlp/get-sorted-roi HTTP/1.1
Host: {{ip}}
Content-Length: 298
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="/F:/us_invoice1.png"
Content-Type: image/png

(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW


问:
Multiple multivariate time series forecasting with deep learning models like LSTM
The picture below is a multiple multivariate time series forecasting problem. I want to forecast the value at certain time step of C based on values at previous time steps of A, B, C. For example, the inputs are values at T0, T1, T2 of A, B, C, the output is the value at T4 of C. Let say N=100 so we have 100 samples, and 80 samples for training, 20 samples for testing. Within one sample I think it is a common multivariate LSTM time series forecasting problem with 3D input. But how to deal with such a multiple multivariate time series situation with 4D(?) input using LSTM or other suitable deep learing models? Are there any available tools/references? Thank you!


问:
ckeditor5 in cypress giving error: CKEditorError: Cannot read properties of null (reading 'root')

So I have a ckeditor on a page I'm testing, a very straightforward test that was working, but it started giving me errors all of a sudden. It has a toolbar and a ckeditor where you can type different types of headings, paragraphs, bullet points, add tables, embed videos and images and a few more things. I've added a snippet of the ckeditor code (I'm using ckeditor5 with angular) and snippets of my tests that are suddenly failing. There haven't been any significant changes to the code or upgrades that I'm aware of

```<code>afterEach(() => {
     cy.get('ckeditor').find('div.ck-editor__editable').clear();
 });

    it('should type heading 1 and show it on the side', () => {
        cy.get('.ck-heading-dropdown').click();
        cy.get('.ck-list__item').contains('Heading 1').click();
        cy.intercept('PATCH', '**/endpoint').as('endpoint');
        cy.get('.ck-editor__editable').type('heading 1');
        cy.wait('@endpoint').then(xhr => {
          expect(xhr.response.body.data).to.include('<h1>heading1</h1>');
          expect(xhr.response.statusCode).to.equal(200);
        });
        // assert value showing on the side
        cy.get('[data-cy="display"] > ul > li')
          .should('contain.text', 'heading1');
    )}
</code>```

And the error I'm getting:

I've looked at the page cypress is suggesting (https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html), but haven't found anything relevant

I also tried adding this, but it did nothing:

```<code>    Cypress.on(
  'uncaught:exception',
  (err) => !err.message.includes('CKEditorError')
);
</code>```

Body:
So I have a ckeditor on a page I'm testing, a very straightforward test that was working, but it started giving me errors all of a sudden. It has a toolbar and a ckeditor where you can type different types of headings, paragraphs, bullet points, add tables, embed videos and images and a few more things. I've added a snippet of the ckeditor code (I'm using ckeditor5 with angular) and snippets of my tests that are suddenly failing. There haven't been any significant changes to the code or upgrades that I'm aware of

afterEach(() => {
     cy.get('ckeditor').find('div.ck-editor__editable').clear();
 });

    it('should type heading 1 and show it on the side', () => {
        cy.get('.ck-heading-dropdown').click();
        cy.get('.ck-list__item').contains('Heading 1').click();
        cy.intercept('PATCH', '**/endpoint').as('endpoint');
        cy.get('.ck-editor__editable').type('heading 1');
        cy.wait('@endpoint').then(xhr => {
          expect(xhr.response.body.data).to.include('
heading1
');
          expect(xhr.response.statusCode).to.equal(200);
        });
        // assert value showing on the side
        cy.get('[data-cy="display"] > ul > li')
          .should('contain.text', 'heading1');
    )}

And the error I'm getting:

I've looked at the page cypress is suggesting (https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html), but haven't found anything relevant

I also tried adding this, but it did nothing:

    Cypress.on(
  'uncaught:exception',
  (err) => !err.message.includes('CKEditorError')
);


问:
disable navigation if some condition [react-native-router-flux]
I'm in some  component where user can provide some data. If user clicks any button or swipes or do anything to navigate to some different Scene I want to detect if he provided some changes he didn't save and if yes, I want him to stay on the current screen, not navigate, and finally probably show some modal with warning. How can I achieve that with react-native-router-flex?

I've tried many approaches with onExit function f.e but failed to make any use of it...


问:
Login view keeps showing up again and again
I have a login in view, I check the username and password from UserDefaults, if they match I go to FirstView

However I an getting thrown back to Login in view after successful login, on restart of app all works well, can any one please suggest

I am trying to keep it as simple as possible , but just do not seem to know where to make the change

my file with @main

```<code>@main
struct demoApp: App {
    @StateObject var dataController =  DataController.shared
    init() {
        UserDefaults.standard.register(defaults: [
            "username": "test@test.com", "password": "demo", "logData": false
        ])
    }
    let userInfo = UserDefaults.standard.bool(forKey: "logData")
    var body: some Scene {
        WindowGroup {

            ContentView(data: dataController)
                .environment(\.managedObjectContext, dataController.container.viewContext)

        }
    }

}
</code>```

my login file

```<code>struct LoginPage: View {
    @State var username: String = ""
    @State var password: String = ""
    let userData = UserDefaults.standard.string(forKey: "username")
    let userPassword = UserDefaults.standard.string(forKey: "password")
    @State var credStatus = false
    @State var showerroralert = false
    @ObservedObject var data: DataController

    var body: some View {
        NavigationStack {
            VStack {
                Text("Welcome")
                    .font(.title)
                Image("carbg")
                    .resizable()
                    .cornerRadius(20)

                    .frame(width: 150, height: 150)
                TextField("Username", text: $username)
                    .padding()

                    .cornerRadius(5.0)
                    .padding(.bottom, 20)
                SecureField("Password", text: $password)
                    .padding()

                    .cornerRadius(5.0)
                    .padding(.bottom, 20)

                Button("Login") {
                    if (userData == username && userPassword == password) {
                        credStatus = true
                        UserDefaults.standard.set(true, forKey: "logData")

                    } else {
                        showerroralert = true
                    }
                }
                .buttonStyle(.borderedProminent)
                .alert("Wrong data", isPresented: $showerroralert) {

                }
            }
            .navigationDestination(isPresented: $credStatus) {
                ContentView(data: data)
            }
        }
    }
}
</code>```

my content file

```<code>struct ContentView: View {
    @ObservedObject var data: DataController
    @State var userInfo = UserDefaults.standard.bool(forKey: "logData")

    var body: some View {
        if userInfo {
            FirstView()
        } else {
            LoginPage(data: data)
        }

    }

}
</code>```

UPDATED LOGIN PAGE

```<code>struct LoginPage: View {
    @State var usernameTemp: String = ""
    @State var passwordTemp: String = ""
   // let userData = UserDefaults.standard.string(forKey: "username")
    //let userPassword = UserDefaults.standard.string(forKey: "password")
    @State var credStatus = false
    @State var showerroralert = false
    @ObservedObject var data: DataController

    @AppStorage("username") var username: String = "test@demo.tech"
    @AppStorage("password") var password: String = "demo"
    @AppStorage("logData") var logData: Bool = false

    var body: some View {
        NavigationStack {
            VStack {
                Text("Welcome")
                    .font(.title)
                Image("carbg")
                    .resizable()
                    .cornerRadius(20)

                    .frame(width: 150, height: 150)
                TextField("Username", text: $usernameTemp)
                    .padding()

                    .cornerRadius(5.0)
                    .padding(.bottom, 20)
                SecureField("Password", text: $passwordTemp)
                    .padding()

                    .cornerRadius(5.0)
                    .padding(.bottom, 20)

                Button("Login") {
                    if (usernameTemp == username && passwordTemp == password) {
                        credStatus = true
                        logData = true

                    } else {
                        showerroralert = true
                    }
                }
                .buttonStyle(.borderedProminent)
                .alert("Wrong data", isPresented: $showerroralert) {

                }
            }
            .navigationDestination(isPresented: $credStatus) {
                ContentView(data: data)
            }
        }
    }
}
</code>```

Body:
I have a login in view, I check the username and password from UserDefaults, if they match I go to FirstView

However I an getting thrown back to Login in view after successful login, on restart of app all works well, can any one please suggest

I am trying to keep it as simple as possible , but just do not seem to know where to make the change

my file with @main

@main
struct demoApp: App {
    @StateObject var dataController =  DataController.shared
    init() {
        UserDefaults.standard.register(defaults: [
            "username": "test@test.com", "password": "demo", "logData": false
        ])
    }
    let userInfo = UserDefaults.standard.bool(forKey: "logData")
    var body: some Scene {
        WindowGroup {

            ContentView(data: dataController)
                .environment(\.managedObjectContext, dataController.container.viewContext)

        }
    }

}

my login file

struct LoginPage: View {
    @State var username: String = ""
    @State var password: String = ""
    let userData = UserDefaults.standard.string(forKey: "username")
    let userPassword = UserDefaults.standard.string(forKey: "password")
    @State var credStatus = false
    @State var showerroralert = false
    @ObservedObject var data: DataController

    var body: some View {
        NavigationStack {
            VStack {
                Text("Welcome")
                    .font(.title)
                Image("carbg")
                    .resizable()
                    .cornerRadius(20)

                    .frame(width: 150, height: 150)
                TextField("Username", text: $username)
                    .padding()

                    .cornerRadius(5.0)
                    .padding(.bottom, 20)
                SecureField("Password", text: $password)
                    .padding()

                    .cornerRadius(5.0)
                    .padding(.bottom, 20)

                Button("Login") {
                    if (userData == username && userPassword == password) {
                        credStatus = true
                        UserDefaults.standard.set(true, forKey: "logData")

                    } else {
                        showerroralert = true
                    }
                }
                .buttonStyle(.borderedProminent)
                .alert("Wrong data", isPresented: $showerroralert) {

                }
            }
            .navigationDestination(isPresented: $credStatus) {
                ContentView(data: data)
            }
        }
    }
}

my content file

struct ContentView: View {
    @ObservedObject var data: DataController
    @State var userInfo = UserDefaults.standard.bool(forKey: "logData")

    var body: some View {
        if userInfo {
            FirstView()
        } else {
            LoginPage(data: data)
        }

    }

}

UPDATED LOGIN PAGE

struct LoginPage: View {
    @State var usernameTemp: String = ""
    @State var passwordTemp: String = ""
   // let userData = UserDefaults.standard.string(forKey: "username")
    //let userPassword = UserDefaults.standard.string(forKey: "password")
    @State var credStatus = false
    @State var showerroralert = false
    @ObservedObject var data: DataController

    @AppStorage("username") var username: String = "test@demo.tech"
    @AppStorage("password") var password: String = "demo"
    @AppStorage("logData") var logData: Bool = false

    var body: some View {
        NavigationStack {
            VStack {
                Text("Welcome")
                    .font(.title)
                Image("carbg")
                    .resizable()
                    .cornerRadius(20)

                    .frame(width: 150, height: 150)
                TextField("Username", text: $usernameTemp)
                    .padding()

                    .cornerRadius(5.0)
                    .padding(.bottom, 20)
                SecureField("Password", text: $passwordTemp)
                    .padding()

                    .cornerRadius(5.0)
                    .padding(.bottom, 20)

                Button("Login") {
                    if (usernameTemp == username && passwordTemp == password) {
                        credStatus = true
                        logData = true

                    } else {
                        showerroralert = true
                    }
                }
                .buttonStyle(.borderedProminent)
                .alert("Wrong data", isPresented: $showerroralert) {

                }
            }
            .navigationDestination(isPresented: $credStatus) {
                ContentView(data: data)
            }
        }
    }
}


问:
Nginx proxy_pass rule based on $host
I am trying to create a proxy_pass rule that needs only to remove the -internal piece of an rule and proxy_pass to it. For instance:

https://mysuperservice-internal.niceserver.com >> proxy_pass_to >> https://mysuperservice.niceserver.com

So, all I need to do is to get the $host variable and remove the -internal from it, but I am unable to make it work. Any hint?

```<code>map $uri $internalUrl {
  default                  invalid;
  ~^mysuperservice-internal.*        https://mysuperservice.niceserver.com;
}
server {
  listen 8080;
  server_name  "";
  sendfile on;
  location / {
    proxy_pass_request_headers      on;
    proxy_pass $internalUrl;
    }
}
</code>```

Title: Nginx proxy_pass rule based on $host

Body:
I am trying to create a proxy_pass rule that needs only to remove the -internal piece of an rule and proxy_pass to it. For instance:

https://mysuperservice-internal.niceserver.com >> proxy_pass_to >> https://mysuperservice.niceserver.com

So, all I need to do is to get the $host variable and remove the -internal from it, but I am unable to make it work. Any hint?

map $uri $internalUrl {
  default                  invalid;
  ~^mysuperservice-internal.*        https://mysuperservice.niceserver.com;
}
server {
  listen 8080;
  server_name  "";
  sendfile on;
  location / {
    proxy_pass_request_headers      on;
    proxy_pass $internalUrl;
    }
}


问:
Migrate data using AWS SCT CLI
I need to migrate Oracle db to Aurora MySQL, AWS recommended AWS SCT tool.

Fro security reasons the databases in private subnets and I can't reach them with my AWS SCT tool on local machine, so I am searching for a way to configure the AWS SCT on Linux and run the migration in interactive mode.

Please advise.

Thanks

Title: Migrate data using AWS SCT CLI


问:
WooCommerce: Replace price of productvariation by productattribute
i'm looking for a snippet that gives me the option of replacing the price with the text "Price on request" for a product variant from WooCommerce that already exists.

I'm not a developer or anything like that.
I tried to make something out of different snippets but nada.

On businessbloomer.com i found the following snippet:

```<code>add_action( 'woocommerce_variable_add_to_cart', 'bbloomer_update_price_with_variation_price' );

function bbloomer_update_price_with_variation_price() {
   global $product;
   $price = $product->get_price_html();
   wc_enqueue_js( "
      $(document).on('found_variation', 'form.cart', function( event, variation ) {
         if(variation.price_html) $('.summary > p.price').html(variation.price_html);
         $('.woocommerce-variation-price').hide();
      });
      $(document).on('hide_variation', 'form.cart', function( event, variation ) {
         $('.summary > p.price').html('" . $price . "');
      });
   " );
}
</code>```

Then I searched for the hook for product attributes and found this: $product_attributes

But as already mentioned, I can't get it together

Would be cool if someone could help me.I

Body:
i'm looking for a snippet that gives me the option of replacing the price with the text "Price on request" for a product variant from WooCommerce that already exists.

I'm not a developer or anything like that.
I tried to make something out of different snippets but nada.

On businessbloomer.com i found the following snippet:

add_action( 'woocommerce_variable_add_to_cart', 'bbloomer_update_price_with_variation_price' );

function bbloomer_update_price_with_variation_price() {
   global $product;
   $price = $product->get_price_html();
   wc_enqueue_js( "
      $(document).on('found_variation', 'form.cart', function( event, variation ) {
         if(variation.price_html) $('.summary > p.price').html(variation.price_html);
         $('.woocommerce-variation-price').hide();
      });
      $(document).on('hide_variation', 'form.cart', function( event, variation ) {
         $('.summary > p.price').html('" . $price . "');
      });
   " );
}

Then I searched for the hook for product attributes and found this: $product_attributes

But as already mentioned, I can't get it together

Would be cool if someone could help me.I