问:
Need Help Troubleshooting An Access Query
I'm working in Access 365 for this project. I have a query:

```<code>SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017'
</code>```

Which returns:

inv_no
SalesID

55414
30

I have another query:

```<code>SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName()
</code>```

Which returns:

SalesID

30

Yet when I combine the two:

```<code>SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017' AND SalesID IN (SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName())
</code>```

I get an empty set.

I've used VarType() in test queries to determine that SalesID is vbString in GetOpenItems and vbString in GetSalesStaff, so they are both the same type.

I've tried adding the table names in the query as follows:

```<code>SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017' AND GetOpenItems.SalesID IN (SELECT GetSalesStaff.SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName())
</code>```

I've also tried converting SalesID on both sides of the 'IN' by wrapping in CLng(), same result. If I only wrap one or the other I get the expected type mismatch error, which supports that they are the same type currently.

I cannot for the life of me figure out why it's visually the same value yet somehow not evaluating the IN properly, and it's probably going to be something I'm staring at and glossing over. Any thoughts?

ADDENDUM:

Here is the GetUserName() function (which is really just a get method for a global var):

```<code>Public Function GetUserName() As String
GetUserName = UserName
End Function
</code>```

The portion that sets the global var is inside another big function that is called on applicaton load:

```<code>UserName = Environ("USERNAME")
</code>```

But I'm currently manually using Username = "mmoses" for testing.

That the query using this code returns 30 when run stand-alone makes me believe it should be evaluating to "IN (30)" in the larger query as well, so I don't suspect an issue in this bit...

ADDENDUM 2:

In response to questions in comments:
The immediate window shows 'mmoses' when the query fails and that Debug.Print is run, which is as expected.

mmoses is tied in the GetSalesStaff query to SalesID 30 (which is what SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName() returns).

Additionally, I know it works with SalesID as text/number, but it's not an issue of a global variable losing value because I can immediately run the debug above and it returns the correct global value, and the query used inside the IN () bit runs on its own fine consistently

To test this I also rewrote all global vars to be TempVars and the same result is found.

The issue seems isolated to the odd quirk that:

```<code>SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName()
</code>```

Returns a single value, 30.

SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017' AND SalesID IN (30)

Returns the proper results, yet:

```<code>SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017' AND SalesID IN (SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName())
</code>```

returns nothing, even when all 3 queries are run back to back (and rerunning the previous queries still continues to return the proper results).

Body:
I'm working in Access 365 for this project. I have a query:

SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017'

Which returns:

inv_no
SalesID

55414
30

I have another query:

SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName()

Which returns:

SalesID

30

Yet when I combine the two:

SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017' AND SalesID IN (SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName())

I get an empty set.

I've used VarType() in test queries to determine that SalesID is vbString in GetOpenItems and vbString in GetSalesStaff, so they are both the same type.

I've tried adding the table names in the query as follows:

SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017' AND GetOpenItems.SalesID IN (SELECT GetSalesStaff.SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName())

I've also tried converting SalesID on both sides of the 'IN' by wrapping in CLng(), same result. If I only wrap one or the other I get the expected type mismatch error, which supports that they are the same type currently.

I cannot for the life of me figure out why it's visually the same value yet somehow not evaluating the IN properly, and it's probably going to be something I'm staring at and glossing over. Any thoughts?

ADDENDUM:

Here is the GetUserName() function (which is really just a get method for a global var):

Public Function GetUserName() As String
GetUserName = UserName
End Function

The portion that sets the global var is inside another big function that is called on applicaton load:

UserName = Environ("USERNAME")

But I'm currently manually using Username = "mmoses" for testing.

That the query using this code returns 30 when run stand-alone makes me believe it should be evaluating to "IN (30)" in the larger query as well, so I don't suspect an issue in this bit...

ADDENDUM 2:

In response to questions in comments:
The immediate window shows 'mmoses' when the query fails and that Debug.Print is run, which is as expected.

mmoses is tied in the GetSalesStaff query to SalesID 30 (which is what SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName() returns).

Additionally, I know it works with SalesID as text/number, but it's not an issue of a global variable losing value because I can immediately run the debug above and it returns the correct global value, and the query used inside the IN () bit runs on its own fine consistently

To test this I also rewrote all global vars to be TempVars and the same result is found.

The issue seems isolated to the odd quirk that:

SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName()

Returns a single value, 30.

SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017' AND SalesID IN (30)

Returns the proper results, yet:

SELECT inv_no, SalesID FROM GetOpenItems WHERE cust_id = '28017' AND SalesID IN (SELECT SalesID FROM GetSalesStaff WHERE TRIM(SalesManager)=GetUserName())

returns nothing, even when all 3 queries are run back to back (and rerunning the previous queries still continues to return the proper results).


来源: stackexchange

问:
Woocommerce alert admin area
I'm trying to show an alert in the admin area, whenever a local_pickup order is paid.
so that the staff prepare it as quickly as possible.

the code below is only showing paid orders and is not filtering by shipping method.
Can you help me?
Thanks

```<code>add_action( 'admin_notices', 'wc_admin_notice_local_pickup' );
function wc_admin_notice_local_pickup() {
  $encomendas = wc_get_orders( array(
    'shipping_method' => 'local_pickup:55',
    'status' => 'processing'
  ) );
  if ( ! empty( $encomendas ) ) {
    $message = sprintf( _n( 'Existe %d encomenda para levantamento em loja, aguardam preparação.', 'Existem %d encomendas para levantamento em loja, aguardam preparação', count( $encomendas ), 'woocommerce' ), count( $encomendas ) );
    echo '<div class="notice notice-warning is-dismissible"><p>' . $message . '</p></div>';
  }
}

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

ContentLicense: CC BY-SA 4.0

Title: Woocommerce alert admin area

Body:
I'm trying to show an alert in the admin area, whenever a local_pickup order is paid.
so that the staff prepare it as quickly as possible.

the code below is only showing paid orders and is not filtering by shipping method.
Can you help me?
Thanks

add_action( 'admin_notices', 'wc_admin_notice_local_pickup' );
function wc_admin_notice_local_pickup() {
  $encomendas = wc_get_orders( array(
    'shipping_method' => 'local_pickup:55',
    'status' => 'processing'
  ) );
  if ( ! empty( $encomendas ) ) {
    $message = sprintf( _n( 'Existe %d encomenda para levantamento em loja, aguardam preparação.', 'Existem %d encomendas para levantamento em loja, aguardam preparação', count( $encomendas ), 'woocommerce' ), count( $encomendas ) );
    echo '

' . $message . '

';
  }
}


问:
Error when installing fbprophet on windows 10 using pip
I try to install "fbprophet" on Windows 10, using the following command:

```<code>pip install fbprophet
</code>```

But I get the following error:

```<code>error: Command "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DBOOST_DISABLE_ASSERTS -DBOOST_NO_DECLTYPE -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_RESULT_OF_USE_TR1 -DFUSION_MAX_VECTOR_SIZE=12 -I.\pystan -Ipystan/stan/src -Ipystan/stan/lib/stan_math/ -Ipystan/stan/lib/stan_math/lib/eigen_3.3.3 -Ipystan/stan/lib/stan_math/lib/boost_1.69.0 -Ipystan/stan/lib/stan_math/lib/sundials_4.1.0/include -IC:\Program Files (x86)\python39\V_3.9.8\soft\WPy64\python-3.9.8.amd64\include -IC:\Program Files (x86)\python39\V_3.9.8\soft\WPy64\python-3.9.8.amd64\Include -IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include -IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\ATLMFC\include -IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include /EHsc /Tppystan/_api.cpp /Fobuild\temp.win-amd64-cpython-39\Release\pystan\_api.obj /EHsc -DBOOST_DATE_TIME_NO_LIB /std:c++14" failed with exit status 2
</code>```

Any help is priceless !

Many thanks in advance

Body:
I try to install "fbprophet" on Windows 10, using the following command:

pip install fbprophet

But I get the following error:

error: Command "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DBOOST_DISABLE_ASSERTS -DBOOST_NO_DECLTYPE -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_RESULT_OF_USE_TR1 -DFUSION_MAX_VECTOR_SIZE=12 -I.\pystan -Ipystan/stan/src -Ipystan/stan/lib/stan_math/ -Ipystan/stan/lib/stan_math/lib/eigen_3.3.3 -Ipystan/stan/lib/stan_math/lib/boost_1.69.0 -Ipystan/stan/lib/stan_math/lib/sundials_4.1.0/include -IC:\Program Files (x86)\python39\V_3.9.8\soft\WPy64\python-3.9.8.amd64\include -IC:\Program Files (x86)\python39\V_3.9.8\soft\WPy64\python-3.9.8.amd64\Include -IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include -IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\ATLMFC\include -IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include /EHsc /Tppystan/_api.cpp /Fobuild\temp.win-amd64-cpython-39\Release\pystan\_api.obj /EHsc -DBOOST_DATE_TIME_NO_LIB /std:c++14" failed with exit status 2

Any help is priceless !

Many thanks in advance


问:
python-binance - how to listen for orders?
Is there a way to create a socket to be notified of order status changes?

I'm looking for something similar to start_aggtrade_socket, where a socket can be created to listen for trades. But there does not seem to be anything similar for orders. It seems the only way is to poll the server with get_order. Is there a better way to get notified of orders being fulfilled?


问:
expo-mail-composer error when running in emulator
I have a problem that I'm not sure how to solve, I'm trying to use expo-mail-composer but when trying it on the emulator I get the following error. The problem is solved once I uninstall the package but I need it to send some files to a specific email,Currently only what is necessary for android only

From what I saw, the problem is with the package itself, because if I uninstall it, everything works correctly, I tried different versions and looked in various places for the error but I have no idea, I tried installing the packages that were required in the error, but even so it didn't work


问:
How to close long position in Pine Script v3 with a limit order
I need help with the Pinescript v3 syntax. I want to close the position with a limit order based on the recent High. I cannot convert it to v4 or newer.

Here is the end of my Strategy for buy and sell.

```<code>longCond =  prebuy
if prebuy
    strategy.entry("long", strategy.long, limit=low)

sell = close >= Condition1
barcolor(sell? yellow : na, title="bar color")

longClose = sell
if longClose
    strategy.close("long", strategy.long)

strategy.cancel("long", when=sell)
</code>```

The code above works and sells with market order, but I want to sell with a Limit order based on the last High. I changed the sell condition to

```<code>longClose = sell
if longClose
    strategy.close("long", strategy.long, limit=high)
</code>```

Error: Compilation error. Line 402: Cannot call strategy.close with arguments (literal string, const bool, limit=series); available overloads: strategy.close(const string, series[bool]) => void

Not familiar if Pinescript version3 has limitations and won't allow limits on strategy close. It appears it worked on strategy.entry but not on strategy.close.

I tried

```<code>if longClose
    strategy.close("long", strategy.long, limit=high)
</code>```

and it failed.

Body:
I need help with the Pinescript v3 syntax. I want to close the position with a limit order based on the recent High. I cannot convert it to v4 or newer.

Here is the end of my Strategy for buy and sell.

longCond =  prebuy
if prebuy
    strategy.entry("long", strategy.long, limit=low)

sell = close >= Condition1
barcolor(sell? yellow : na, title="bar color")

longClose = sell
if longClose
    strategy.close("long", strategy.long)

strategy.cancel("long", when=sell)

The code above works and sells with market order, but I want to sell with a Limit order based on the last High. I changed the sell condition to

longClose = sell
if longClose
    strategy.close("long", strategy.long, limit=high)

Error: Compilation error. Line 402: Cannot call strategy.close with arguments (literal string, const bool, limit=series); available overloads: strategy.close(const string, series[bool]) => void

Not familiar if Pinescript version3 has limitations and won't allow limits on strategy close. It appears it worked on strategy.entry but not on strategy.close.

I tried

if longClose
    strategy.close("long", strategy.long, limit=high)

and it failed.


问:
Java PowerMock: Mock NewDate whenNew, ava.lang.NoClassDefFoundError: org/powermock/tests/utils/ArrayMerger
I am getting 3 errors below when trying to mock New Date, using PrepareForTest.  How can I fix this?

Reference: https://stackoverflow.com/a/30415404/15435022

java.lang.NoClassDefFoundError: org/powermock/tests/utils/ArrayMerger
at org.powermock.api.mockito.PowerMockito.whenNew(PowerMockito.java:506)

Code below.

```<code>import static org.powermock.api.mockito.PowerMockito.whenNew;
import static org.mockito.BDDMockito.given;

@PrepareForTest({ Product.class })
public class ProductTest {
    ....
    Calendar calendar = Calendar.getInstance();
    calendar.set(2022, 5, 2, 1, 1, 1);
    Date currentDate =  calendar.getTime();
    whenNew(Date.class).withNoArguments().thenReturn(currentDate);
</code>```

POM:

```<code>    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4-rule</artifactId>
        <version>1.4.11</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>*</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito</artifactId>
        <version>1.4.11</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>*</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-support</artifactId>
        <version>1.4.11</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>*</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</code>```

Body:
I am getting 3 errors below when trying to mock New Date, using PrepareForTest.  How can I fix this?

Reference: https://stackoverflow.com/a/30415404/15435022

java.lang.NoClassDefFoundError: org/powermock/tests/utils/ArrayMerger
at org.powermock.api.mockito.PowerMockito.whenNew(PowerMockito.java:506)

Code below.

import static org.powermock.api.mockito.PowerMockito.whenNew;
import static org.mockito.BDDMockito.given;

@PrepareForTest({ Product.class })
public class ProductTest {
    ....
    Calendar calendar = Calendar.getInstance();
    calendar.set(2022, 5, 2, 1, 1, 1);
    Date currentDate =  calendar.getTime();
    whenNew(Date.class).withNoArguments().thenReturn(currentDate);

POM:

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4-rule</artifactId>
        <version>1.4.11</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>*</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito</artifactId>
        <version>1.4.11</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>*</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-support</artifactId>
        <version>1.4.11</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>*</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>


问:
searching for unique usernames in firebase with unity
im trying to find if a username exists in the realtime database on firebase using unity c#

private IEnumerator CheckUsernameExists ( string _username)
{
    var Usernames = DBreference.RootReference.getChild("usernames");

    Usernames.orderByChild("username").equalTo(_username);
    yield return new WaitUntil(predicate: () => Usernames.IsCompleted);
    if (Usernames == null)
    {
        return true;
    }
    else
    {
        return false;
    }
}
```


问:
Give two datatypes to a pyspark schema column
I am reading parquet files using pyspark and transferring them from S3 to Redshift (without creating dataframe for it). I am defining the redshift table schema in the start of my script as

```<code>schema = StructType([ \
        StructField("A",StringType(),True), \
        StructField("B",StringType(),True), \
        StructField("C", LongType(), True), \
        StructField("D", TimestampType(), True) \
    ])
    return schema
</code>```

The column C of the schema is defined as LongType() but the parquet files have sometimes column C as IntegerType().

Is it possible to define the Column C as both LongType() or IntegerType() in the schema ?

Body:
I am reading parquet files using pyspark and transferring them from S3 to Redshift (without creating dataframe for it). I am defining the redshift table schema in the start of my script as

schema = StructType([ \
        StructField("A",StringType(),True), \
        StructField("B",StringType(),True), \
        StructField("C", LongType(), True), \
        StructField("D", TimestampType(), True) \
    ])
    return schema

The column C of the schema is defined as LongType() but the parquet files have sometimes column C as IntegerType().

Is it possible to define the Column C as both LongType() or IntegerType() in the schema ?


问:
How to use Merkle Tree to synchronize data between two nodes?
I am trying to understand how Merkle trees can be used to find inconsistencies and synchronize the data in two peer nodes.

Suppose I have two nodes with data

Node 1 : [1,3,5,7,8, 10]

Node 2 : [2,6]

Now I can generate the Merkle tree of the data on both of these nodes, however, I have two questions

How do we compare these two Merkle trees as they would be of different heights

Even if we consider the Merkle tree of the same height then how do we find the ranges (leaves) that need to be synced.


问:
Use Prisma ORM for computed select between two fields
I have two unsigned int fields in my DB.
I want to run a query that returns a division between those fields using Prisma ORM.

```<code>SELECT CAST (COALESCE(total_1/count_1, 0) + COALESCE(total_2/count_2, 0) AS SIGNED) AS
avg_amount FROM table_name WHERE unrelated_field = x
</code>```

How can I do that?
I also thought of using a MySQL view for that but doesn't look like Prisma supports that either.

Body:
I have two unsigned int fields in my DB.
I want to run a query that returns a division between those fields using Prisma ORM.

SELECT CAST (COALESCE(total_1/count_1, 0) + COALESCE(total_2/count_2, 0) AS SIGNED) AS
avg_amount FROM table_name WHERE unrelated_field = x

How can I do that?
I also thought of using a MySQL view for that but doesn't look like Prisma supports that either.


问:
How do I add a Chevron workspace to Remote Desktop Application?
enter image description here

I need to add a Chevron workspace in order to access Chevron's Global Information Link (GIL) environment. May I ask what the URL is to add this workspace?

I tried email, but that didn't work for me, so I need to try a URL next.


问:
how to remove an alias with multiple values?
how to remove an alias with multiple values in git using cmd?

I've tried "git config --global --unset alias.brd" but I got the message "warning: alias.brd has multiple values"


问:
I tried to Install valet for laravel on Windows
So i run this cmd => composer global require cretueusebiu/valet-windows
but i got :12 packages you are using are looking for funding Use the composer fund command to find out more!


问:
What is the difference between doing Windows syscalls with hand-written wrappers vs. copying machine code from ntdll?
I am wondering what the difference between these two methods of syscalls are.

First method creates an assembly file with the op codes found in the dll and externs a function prototype to call the assembly.

Second method opens the dll, copies the bytes at the start of the function into a RWE buffer, then casts it to function and execute.

First method:
syscall.asm

```<code>.code
    SysNtCreateFile proc
            mov r10, rcx
            mov eax, 55h
            syscall
            ret
    SysNtCreateFile endp
end
</code>```

main.c

```<code>.. includes and other setup
EXTERN_C NTSTATUS SysNtCreateFile(
    PHANDLE FileHandle,
    ACCESS_MASK DesiredAccess,
    POBJECT_ATTRIBUTES ObjectAttributes,
    PIO_STATUS_BLOCK IoStatusBlock,
    PLARGE_INTEGER AllocationSize,
    ULONG FileAttributes,
    ULONG ShareAccess,
    ULONG CreateDisposition,
    ULONG CreateOptions,
    PVOID EaBuffer,
    ULONG EaLength);

We have out function extern and now we can just call it...

SysNtCreateFile(....)
Which calls the assembly.
</code>```

Second method:

```<code>1. Open and read ntdll.dll
2. Locate the function SysNtCreateFile()

char sysntcreatefilebytes[20] = {0};
Set the buffer above to executable

Copy the 20 bytes at the SysNtCreateFile location into the buffer above

NTSTATUS (*SysNtCreateFile)(PHANDLE, ACCESS_MASK, ...)

SysNtCreateFile myfunc = sysntcreatefilebytes;

myfunc(..., ..., ...))
</code>```

Body:
I am wondering what the difference between these two methods of syscalls are.

First method creates an assembly file with the op codes found in the dll and externs a function prototype to call the assembly.

Second method opens the dll, copies the bytes at the start of the function into a RWE buffer, then casts it to function and execute.

First method:
syscall.asm

.code
    SysNtCreateFile proc
            mov r10, rcx
            mov eax, 55h
            syscall
            ret
    SysNtCreateFile endp
end

main.c

.. includes and other setup
EXTERN_C NTSTATUS SysNtCreateFile(
    PHANDLE FileHandle,
    ACCESS_MASK DesiredAccess,
    POBJECT_ATTRIBUTES ObjectAttributes,
    PIO_STATUS_BLOCK IoStatusBlock,
    PLARGE_INTEGER AllocationSize,
    ULONG FileAttributes,
    ULONG ShareAccess,
    ULONG CreateDisposition,
    ULONG CreateOptions,
    PVOID EaBuffer,
    ULONG EaLength);

We have out function extern and now we can just call it...

SysNtCreateFile(....)
Which calls the assembly.

Second method:

1. Open and read ntdll.dll
2. Locate the function SysNtCreateFile()

char sysntcreatefilebytes[20] = {0};
Set the buffer above to executable

Copy the 20 bytes at the SysNtCreateFile location into the buffer above

NTSTATUS (*SysNtCreateFile)(PHANDLE, ACCESS_MASK, ...)

SysNtCreateFile myfunc = sysntcreatefilebytes;

myfunc(..., ..., ...))


问:
Flutter Macos run a binary bundled in the app
I have a flutter application that I'm deploying to multiple platform, right now during testing I am running it under macos, the app will bundle a binary that I would like to run on the client, I am using the following code to unpack the binary, set the correct permission and then execute it,

```<code>getApplicationSupportDirectory().then((path) {
      rootBundle.load('assets/livekit-server').then((serverBinaryStream) {
        print(path.path);
        String serverPath = Path.join(path.path, 'livekit-server');

        File serverBinary = File(serverPath);
        if (!serverBinary.existsSync()) {
          print('not exists');
          serverBinary.writeAsBytes(serverBinaryStream.buffer.asUint8List());
          Process.run("chmod", ["+x", serverPath]);
        } else {
          print('exists');
          Process.run("chmod", ["+x", serverPath]);
        }
        pr.runExecutableArguments(serverPath, ['--dev']);
      });
    });
</code>```

The binary is being unpacked and permissions are set correctly, but during execution it spits out this error 'Operation not permitted'

I think this is related to how apps run in a sandbox in MacOs, but I have unpacked it to the Application support directory of the application so shouldn't it work since it has access to that directory?

Body:
I have a flutter application that I'm deploying to multiple platform, right now during testing I am running it under macos, the app will bundle a binary that I would like to run on the client, I am using the following code to unpack the binary, set the correct permission and then execute it,

getApplicationSupportDirectory().then((path) {
      rootBundle.load('assets/livekit-server').then((serverBinaryStream) {
        print(path.path);
        String serverPath = Path.join(path.path, 'livekit-server');

        File serverBinary = File(serverPath);
        if (!serverBinary.existsSync()) {
          print('not exists');
          serverBinary.writeAsBytes(serverBinaryStream.buffer.asUint8List());
          Process.run("chmod", ["+x", serverPath]);
        } else {
          print('exists');
          Process.run("chmod", ["+x", serverPath]);
        }
        pr.runExecutableArguments(serverPath, ['--dev']);
      });
    });

The binary is being unpacked and permissions are set correctly, but during execution it spits out this error 'Operation not permitted'

I think this is related to how apps run in a sandbox in MacOs, but I have unpacked it to the Application support directory of the application so shouldn't it work since it has access to that directory?


问:
Can I get dbutils.fs.cp to have the same behaviour as *nix cp?
If I perform the following on *nix:

mkdir -p a/1
mkdir -p b/2
cp -r b a/
```
<p>I get the following output:</p>
<pre class="lang-bash prettyprint-override"><code>tree a
a
├── 1
└── b
    └── 2
</code>```

I attempted to do the same thing with dbutils:

dbutils.fs.mkdirs('dbfs:/tmp/a/1')
dbutils.fs.mkdirs('dbfs:/tmp/b/2')

dbutils.fs.cp(
  'dbfs:/tmp/b',
  'dbfs:/tmp/a/',
  True)

dbutils.fs.ls('dbfs:/tmp/a')
```
<p>However, I get the following behaviour:</p>
<pre class="lang-bash prettyprint-override"><code>[FileInfo(path='dbfs:/tmp/a/1/', name='1/', size=0, modificationTime=1670871337000),
 FileInfo(path='dbfs:/tmp/a/2/', name='2/', size=0, modificationTime=1670871337000)]
</code>```

Can I get dbutils.fs.cp to have the same behaviour as *nix cp?

Body:
If I perform the following on *nix:

mkdir -p a/1
mkdir -p b/2
cp -r b a/

I get the following output:

tree a
a
├── 1
└── b
    └── 2

I attempted to do the same thing with dbutils:

dbutils.fs.mkdirs('dbfs:/tmp/a/1')
dbutils.fs.mkdirs('dbfs:/tmp/b/2')

dbutils.fs.cp(
  'dbfs:/tmp/b',
  'dbfs:/tmp/a/',
  True)

dbutils.fs.ls('dbfs:/tmp/a')

However, I get the following behaviour:

[FileInfo(path='dbfs:/tmp/a/1/', name='1/', size=0, modificationTime=1670871337000),
 FileInfo(path='dbfs:/tmp/a/2/', name='2/', size=0, modificationTime=1670871337000)]

Can I get dbutils.fs.cp to have the same behaviour as *nix cp?


问:
XINU OS - How can I count number of interrupts handlers that occured?
In DOSBOX XINU operating system; I want to count number of interrupts handlers that occurred in x time.
Is there a global variable to be referenced to?

I think in the header IO.H,

```<code>extern  int nmaps;      /* number of active intmap entries  */
</code>```

since the struct intmaps saves data about every INT in vector table

is responsible for it?

Body:
In DOSBOX XINU operating system; I want to count number of interrupts handlers that occurred in x time.
Is there a global variable to be referenced to?

I think in the header IO.H,

extern  int nmaps;      /* number of active intmap entries  */

since the struct intmaps saves data about every INT in vector table

is responsible for it?


问:
Solved: How to protect a multidomain subdomain with password via htaccess
I hope you can help me again.

I would like to protect a subdomain in a multidomain wordpress (all instances in the same directory) via htaccess if possible.

the .htaccess is in a folder like:

```<code>vwp1234.webpack.hosteurope.de/www/multidomain-wp/.htaccess
</code>```

the subdomains are like

```<code>subdomain1.mydomain.de
dev.mydomain.de
</code>```

both instancen have the same root.

I would like to have a prompt with user = test and password = password only for dev.mydomain.de

thanks for every hint

update:
with the following code I could solve the issue. thank for the hints

```<code><If "req('Host') == 'example2.com'">
AuthUserFile /path/to/htpasswd
AuthType Basic
AuthName "Password Protected"
Require valid-user
</If>
</code>```

Body:
I hope you can help me again.

I would like to protect a subdomain in a multidomain wordpress (all instances in the same directory) via htaccess if possible.

the .htaccess is in a folder like:

vwp1234.webpack.hosteurope.de/www/multidomain-wp/.htaccess

the subdomains are like

subdomain1.mydomain.de
dev.mydomain.de

both instancen have the same root.

I would like to have a prompt with user = test and password = password only for dev.mydomain.de

thanks for every hint

update:
with the following code I could solve the issue. thank for the hints

<If "req('Host') == 'example2.com'">
AuthUserFile /path/to/htpasswd
AuthType Basic
AuthName "Password Protected"
Require valid-user
</If>


问:
"Univariate time series only" error when I try to use ccf for time series analysis
I'm trying to perform a time series analysis on my data set. I have two variables, one of the downsides I have is that the dates are not continuous, i.e. there are months with 4 data, months with 1 data and the date of that data varies from month to month. I found that I could use the zoo function to convert my data set to time series to be able to apply a cross correlation. However, when I convert it to zoo, they are stored as a variable and not as data. I also tried with regular ts, but I get an error when I try to run the correlation.

The data:

structure(list(Fecha prod Internodo = structure(c(967221472.75,
962788545.499, 958355618.249, 953922690.999, 949489763.748, 945056836.498,
940623909.248, 936190981.998, 931758054.747, 927325127.497, 922892200.247,
918459272.996, 914026345.746, 909593418.496, 905160491.245, 900727563.995
class = c("POSIXct",
"POSIXt"), tzone = "UTC"), Tamaño internodo sin tendencia = c(-0.315142936666672,
-0.315973509717394, -0.303983287254609, -0.300810842569604, -0.290796220815116,
-0.291608407715995, -0.285150663885691, -0.272603176465643, -0.249304079186679,
-0.231648899458939, -0.224855258192737, -0.217679237836851, -0.219767182313487

The code looks like this

```<code>a= growthSpain_Cabrera_Es_Castell_5m[c("Fecha prod Internodo", "Tamaño internodo sin tendencia")]
b= growthSpain_Cabrera_Es_Castell_5m[c("Fecha", "Energia")]
a_zoo<-as.zoo(a)
b_zoo<-as.zoo(b)

library(stats)
ccf(a_zoo, b_zoo)
</code>```

Then I get: univariate time series only

The same happens if I try with ts instead of zoo.

I just need to have two sets of data like the one in the image, as time series to be able to run a cross correlation.

Body:
I'm trying to perform a time series analysis on my data set. I have two variables, one of the downsides I have is that the dates are not continuous, i.e. there are months with 4 data, months with 1 data and the date of that data varies from month to month. I found that I could use the zoo function to convert my data set to time series to be able to apply a cross correlation. However, when I convert it to zoo, they are stored as a variable and not as data. I also tried with regular ts, but I get an error when I try to run the correlation.

The data:

structure(list(Fecha prod Internodo = structure(c(967221472.75,
962788545.499, 958355618.249, 953922690.999, 949489763.748, 945056836.498,
940623909.248, 936190981.998, 931758054.747, 927325127.497, 922892200.247,
918459272.996, 914026345.746, 909593418.496, 905160491.245, 900727563.995
class = c("POSIXct",
"POSIXt"), tzone = "UTC"), Tamaño internodo sin tendencia = c(-0.315142936666672,
-0.315973509717394, -0.303983287254609, -0.300810842569604, -0.290796220815116,
-0.291608407715995, -0.285150663885691, -0.272603176465643, -0.249304079186679,
-0.231648899458939, -0.224855258192737, -0.217679237836851, -0.219767182313487

The code looks like this

a= growthSpain_Cabrera_Es_Castell_5m[c("Fecha prod Internodo", "Tamaño internodo sin tendencia")]
b= growthSpain_Cabrera_Es_Castell_5m[c("Fecha", "Energia")]
a_zoo<-as.zoo(a)
b_zoo<-as.zoo(b)

library(stats)
ccf(a_zoo, b_zoo)

Then I get: univariate time series only

The same happens if I try with ts instead of zoo.

I just need to have two sets of data like the one in the image, as time series to be able to run a cross correlation.


问:
How to compare two 2d arrays by several of their columns?
I have two 2D arrays of equal size with 4 columns each. I want to compare both arrays by the values of columns 2 and 3 (ignoring the values of columns 0 and 1 to compare) and get a new array with those rows that the values [2] and [3] match.

array1 = [[0,0,1,7],[0,1,3,5],[1,0,4,2],[1,1,9,3],[2,0,4,2],[2,1,6,3]]

array2 = [[0,0,3,9],[0,1,1,8],[1,0,4,7],[1,1,3,5],[2,0,4,7],[2,1,9,3]]

I need get a new

array3=[[0,1,3,5],[1,1,3,5],[1,1,9,3],[2,1,9,3]]

And finally a new array with the repeating values of columns [2] and [3]

array4 = [[3,5],[9,3]]

What would be the best way to do?
Thanks in advance


问:
2 Col overlapped in a row
My React Native 0.70 app has a list page with items, every item starts with an image, then name, author and such. Every row was divided with Grid and Col from react-native-easy-grid (0.2.2). the page is rendered with FlatList. But the first 2 fields in a row are overlapping sometime and has hard time to stay inside its own col. Here is the render row:

```<code> import { Col, Row, Grid } from 'react-native-easy-grid';
 return(
      <TouchableOpacity onPress={() => {navigation.navigate("Item Detail", {item:{item}})} } >
      <Grid style={styles.grid}>
            <Col size={1.2} >  //<<==size dictates col width compared with other fields
                {sourceUri && sourceAltUri ? <CachedImage source={{uri:sourceUri}} sourceAlt={{uri:sourceAltUri}} style={styles.itemImage} /> : null}. //<<==here is the image
            </Col>
            <Col size={3} style={{fontSize:wp("4.2%"),textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:0}}>
            <Text >
                    {item.name}. //<<==here display the item name
                </Text>
            </Col>

            <Col size={0.6}>
                <TouchableOpacity onPress={() => {if (item.forsale && item.forsale.length>0) navigation.navigate('ListSell', {type:"oneartwork", artwork_id:item.id})}} style={{height:hp("7%")}}>
                <Text style={{fontSize:wp("4.2%"), textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:hp("1.8%")}}>
                        {item.forsale ? item.forsale.length : "0"}
                    </Text>
                </TouchableOpacity>
            </Col>
            <Col size={0.6}>
                <TouchableOpacity onPress={() => {if (item.fortrade && item.fortrade.length>0) navigation.navigate('ListTrade', {type:"oneartwork", artwork_id:item.id})} } style={{height:hp("7%")}}>
                <Text style={{fontSize:wp("4.2%"), textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:hp("1.8%")}}>
                        {item.fortrade ? item.fortrade.length : "0"}
                    </Text>
                </TouchableOpacity>
            </Col>
            <Col size={1}>
                <Text style={{fontSize:wp("4.2%"),position:"absolute", bottom:0,alignContent: 'flex-end', alignItems: 'flex-end'}}>
                    {item.category.category_name}
                </Text>
            </Col>
            {_me.id == item.uploader_id && <Col size={1.8}>
            <TouchableOpacity onPress={() => {navigation.navigate('ListSellTrade', {type:"onetrade", uploader_id:item.uploader_id, title:(item.viewer.uploader_name ? item.viewer.uploader_name : "***"+item.viewer.uploader_cell.substring(item.viewer.uploader_cell.length-4, item.viewer.uploader_cell.length))})} } style={{height:hp("7%")}}>
                <Text style={{fontSize:wp("4.2%"),textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:hp("1.8%")}}>
                    {item.viewer.uploader_name ? item.viewer.uploader_name : "***"+item.viewer.uploader_cell.substring(item.viewer.uploader_cell.length-4, item.viewer.uploader_cell.length)}
                </Text>
                </TouchableOpacity>
            </Col>}
            <Col size={2}>
              <Text style={{fontSize:12, textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:0}}>{item.createdAt.substring(0,10)}</Text>
            </Col>
        </Grid>
        </TouchableOpacity>

    );

styles = StyleSheet.create({
   grid:{
  //width:"90%",
  height:hp("7%"),
  //height:wp("12%"),
  paddingTop:2,
  paddingBottom:2,
  padding:2,
  },
});
</code>```

Here is the snapshot of the page rendered:

[![enter image description here][1]][1]

Here the item name and image was completely overlapped. Is there a way to keep the content within a col field and wrap instead of overlap with its neighbor?
[1]: https://i.stack.imgur.com/WtWDM.png

Title: 2 Col overlapped in a row

Body:
My React Native 0.70 app has a list page with items, every item starts with an image, then name, author and such. Every row was divided with Grid and Col from react-native-easy-grid (0.2.2). the page is rendered with FlatList. But the first 2 fields in a row are overlapping sometime and has hard time to stay inside its own col. Here is the render row:

 import { Col, Row, Grid } from 'react-native-easy-grid';
 return(
      <TouchableOpacity onPress={() => {navigation.navigate("Item Detail", {item:{item}})} } >
      <Grid style={styles.grid}>
            <Col size={1.2} >  //<<==size dictates col width compared with other fields
                {sourceUri && sourceAltUri ? <CachedImage source={{uri:sourceUri}} sourceAlt={{uri:sourceAltUri}} style={styles.itemImage} /> : null}. //<<==here is the image
            </Col>
            <Col size={3} style={{fontSize:wp("4.2%"),textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:0}}>
            <Text >
                    {item.name}. //<<==here display the item name
                </Text>
            </Col>

            <Col size={0.6}>
                <TouchableOpacity onPress={() => {if (item.forsale && item.forsale.length>0) navigation.navigate('ListSell', {type:"oneartwork", artwork_id:item.id})}} style={{height:hp("7%")}}>
                <Text style={{fontSize:wp("4.2%"), textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:hp("1.8%")}}>
                        {item.forsale ? item.forsale.length : "0"}
                    </Text>
                </TouchableOpacity>
            </Col>
            <Col size={0.6}>
                <TouchableOpacity onPress={() => {if (item.fortrade && item.fortrade.length>0) navigation.navigate('ListTrade', {type:"oneartwork", artwork_id:item.id})} } style={{height:hp("7%")}}>
                <Text style={{fontSize:wp("4.2%"), textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:hp("1.8%")}}>
                        {item.fortrade ? item.fortrade.length : "0"}
                    </Text>
                </TouchableOpacity>
            </Col>
            <Col size={1}>
                <Text style={{fontSize:wp("4.2%"),position:"absolute", bottom:0,alignContent: 'flex-end', alignItems: 'flex-end'}}>
                    {item.category.category_name}
                </Text>
            </Col>
            {_me.id == item.uploader_id && <Col size={1.8}>
            <TouchableOpacity onPress={() => {navigation.navigate('ListSellTrade', {type:"onetrade", uploader_id:item.uploader_id, title:(item.viewer.uploader_name ? item.viewer.uploader_name : "***"+item.viewer.uploader_cell.substring(item.viewer.uploader_cell.length-4, item.viewer.uploader_cell.length))})} } style={{height:hp("7%")}}>
                <Text style={{fontSize:wp("4.2%"),textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:hp("1.8%")}}>
                    {item.viewer.uploader_name ? item.viewer.uploader_name : "***"+item.viewer.uploader_cell.substring(item.viewer.uploader_cell.length-4, item.viewer.uploader_cell.length)}
                </Text>
                </TouchableOpacity>
            </Col>}
            <Col size={2}>
              <Text style={{fontSize:12, textAlign:"left", alignContent:"flex-end", alignItems:"flex-end",position:"absolute", bottom:0}}>{item.createdAt.substring(0,10)}</Text>
            </Col>
        </Grid>
        </TouchableOpacity>

    );

styles = StyleSheet.create({
   grid:{
  //width:"90%",
  height:hp("7%"),
  //height:wp("12%"),
  paddingTop:2,
  paddingBottom:2,
  padding:2,
  },
});

Here is the snapshot of the page rendered:

[![enter image description here][1]][1]

Here the item name and image was completely overlapped. Is there a way to keep the content within a col field and wrap instead of overlap with its neighbor?
[1]: https://i.stack.imgur.com/WtWDM.png


问:
Is there a way to make the Opentelemetry Java library trace into Spring EventListeners?
We've got OpenTelemetry Java set up and it works great for most of our Spring app, but we heavily use event listeners using Spring's event publisher and the spans don't seem to continue into the event listeners. Is there a way to turn this on? What would I need to do to trace into the event listeners triggered by the main code flow?</p>


问:
Problem using the pyperclip library on VSCode
I need my program to copy some text to the clipboard. For that, I thought of using the pyperclip library. But every time I run my code an error appears "Pyperclip could not find a copy/paste mechanism for you system."

I´ve experimented doing a simple program of the likes:

import pyperclip

name = input("Enter your name: ")

pyperclip.copy(name)
```

To see if the problem was because of my code, but it turns out the problem still appears. So it must be because of the system/environment. I´m looking for any tips on changing something on VSCode too see if the problem stops.

The error message

I´ve tried logging into VSCode on both PC and Mac and the problem still occurs.

Body:
I need my program to copy some text to the clipboard. For that, I thought of using the pyperclip library. But every time I run my code an error appears "Pyperclip could not find a copy/paste mechanism for you system."

I´ve experimented doing a simple program of the likes:

import pyperclip

name = input("Enter your name: ")

pyperclip.copy(name)

To see if the problem was because of my code, but it turns out the problem still appears. So it must be because of the system/environment. I´m looking for any tips on changing something on VSCode too see if the problem stops.

The error message

I´ve tried logging into VSCode on both PC and Mac and the problem still occurs.


问:
sort stream via. passthrough and pipe in node js
How do I sort stream via. passthrough and pipe in node js?
I am trying to sort from a .fs.readstream and pass it through a passthrough steam that sorts the data from the readstream and pipe it to a writestream.
I am unable to find any examples of this online.</p>


问:
Reducing size of table in R
I am making a presentation in R and the table is too big for the slide.

I have used

{r, echo=FALSE} at the start of my code chunk so that it only produces the table and doesn't print the code but the table is too big for the slide. Does anyone know what code to use to reduce the table size. I have used {r, echo=FALSE, out.width="50%"} but this didn't work

Title: Reducing size of table in R


问:
Regular expression to index observations that match condition
I have a tabe namely USstorms with 902297 obsevations. Where table(USstorms$CROPDMGEXP) returns

```<code>            ?      0      2      B      k      K      m      M
618413      7     19      1      9     21 281832      1   1994
</code>```

I know that I can index to the obersvation where USstorms$CROPDMGEXP=="m" by the code USstorms[USstorms$CROPDMGEXP=="m",].

How to index to all obsevation with both "m" and "M" values in them?
I tried USstorms[USstorms$CROPDMGEXP=="[Mm]",] but it doesnt work.

However, this USstorms[grep("[Mm]",USstorms$CROPDMGEXP),] works well to return all observations that contain "m" and "M". For example count(USstorms[grep("[Mm]",USstorms$CROPDMGEXP),]) returns 1995

Why the regular expression in USstorms[USstorms$CROPDMGEXP=="[Mm]",] does not work?

I tried
count(USstorms[USstorms$CROPDMGEXP=="[Mm]",]) and expect the return 1995 but it returns 0 instead.

Body:
I have a tabe namely USstorms with 902297 obsevations. Where table(USstorms$CROPDMGEXP) returns

            ?      0      2      B      k      K      m      M
618413      7     19      1      9     21 281832      1   1994

I know that I can index to the obersvation where USstorms$CROPDMGEXP=="m" by the code USstorms[USstorms$CROPDMGEXP=="m",].

How to index to all obsevation with both "m" and "M" values in them?
I tried USstorms[USstorms$CROPDMGEXP=="[Mm]",] but it doesnt work.

However, this USstorms[grep("[Mm]",USstorms$CROPDMGEXP),] works well to return all observations that contain "m" and "M". For example count(USstorms[grep("[Mm]",USstorms$CROPDMGEXP),]) returns 1995

Why the regular expression in USstorms[USstorms$CROPDMGEXP=="[Mm]",] does not work?

I tried
count(USstorms[USstorms$CROPDMGEXP=="[Mm]",]) and expect the return 1995 but it returns 0 instead.


问:
Execution failed for task ':launcher:checkDebugDuplicateClasses'
I imported the project from unity to Android Studio, I can run it on the device and everything works fine, but when I try to connect Firebase to the project, I get this error immediately after connecting.

I found similar problems and mostly they advise adding

These two lines, but it doesn't help me.

```<code>android.useAndroidX=true
android.enableJetifier=true
</code>```

I also added the json file from Firebase to the project.

```<code>Duplicate class androidx.annotation.AnimRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.AnimatorRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.AnyRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.AnyThread found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ArrayRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.AttrRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.BinderThread found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.BoolRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.CallSuper found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.CheckResult found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ChecksSdkIntAtLeast found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ColorInt found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ColorLong found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ColorRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ContentView found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.DimenRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.Dimension found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
   ...
    Go to the documentation to learn how to Fix dependency resolution errors.
</code>```

My build.gradle(project)

```<code>allprojects {
    buildscript {
        repositories {
            google()
            jcenter()
        }

        dependencies {
            // If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
            // See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
            // See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
            // To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
            classpath 'com.android.tools.build:gradle:4.0.1'
            classpath 'com.google.gms:google-services:4.3.14'

        }
    }

    repositories {
        google()
        jcenter()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code>```

My build.gradle(module launcher)

```<code>apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

dependencies {
    implementation project(':unityLibrary')
    implementation 'com.google.firebase:firebase-inappmessaging-display:20.2.0'
}

android {
    compileSdkVersion 30
    buildToolsVersion '30.0.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 22
        targetSdkVersion 30
        applicationId 'com.MyCompany.test'
        ndk {
            abiFilters 'armeabi-v7a'
        }
        versionCode 1
        versionName '1.0'
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
            signingConfig signingConfigs.debug
            jniDebuggable true
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
            signingConfig signingConfigs.debug
        }
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
    }

    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}
</code>```

Мой build.gradle (module libary)

```<code>apply plugin: 'com.android.library'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation(name: 'googlemobileads-unity', ext:'aar')
    implementation project('GoogleMobileAdsPlugin.androidlib')

}

android {
    compileSdkVersion 30
    buildToolsVersion '30.0.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 22
        targetSdkVersion 30
        ndk {
            abiFilters 'armeabi-v7a'
        }
        versionCode 1
        versionName '1.0'
        consumerProguardFiles 'proguard-unity.txt'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
    }
}
</code>```

and gradle.properties

```<code>org.gradle.jvmargs=-Xmx4096M
org.gradle.parallel=true
android.enableR8=false
unityStreamingAssets=.json
unityTemplateVersion=3
android.useAndroidX=true
android.enableJetifier=true
</code>```

Body:
I imported the project from unity to Android Studio, I can run it on the device and everything works fine, but when I try to connect Firebase to the project, I get this error immediately after connecting.

I found similar problems and mostly they advise adding

These two lines, but it doesn't help me.

android.useAndroidX=true
android.enableJetifier=true

I also added the json file from Firebase to the project.

Duplicate class androidx.annotation.AnimRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.AnimatorRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.AnyRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.AnyThread found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ArrayRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.AttrRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.BinderThread found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.BoolRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.CallSuper found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.CheckResult found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ChecksSdkIntAtLeast found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ColorInt found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ColorLong found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ColorRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.ContentView found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.DimenRes found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
    Duplicate class androidx.annotation.Dimension found in modules annotation-1.3.0.jar (androidx.annotation:annotation:1.3.0) and jetified-androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar)
   ...
    Go to the documentation to learn how to Fix dependency resolution errors.

My build.gradle(project)

allprojects {
    buildscript {
        repositories {
            google()
            jcenter()
        }

        dependencies {
            // If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
            // See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
            // See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
            // To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
            classpath 'com.android.tools.build:gradle:4.0.1'
            classpath 'com.google.gms:google-services:4.3.14'

        }
    }

    repositories {
        google()
        jcenter()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

My build.gradle(module launcher)

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

dependencies {
    implementation project(':unityLibrary')
    implementation 'com.google.firebase:firebase-inappmessaging-display:20.2.0'
}

android {
    compileSdkVersion 30
    buildToolsVersion '30.0.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 22
        targetSdkVersion 30
        applicationId 'com.MyCompany.test'
        ndk {
            abiFilters 'armeabi-v7a'
        }
        versionCode 1
        versionName '1.0'
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
            signingConfig signingConfigs.debug
            jniDebuggable true
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
            signingConfig signingConfigs.debug
        }
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
    }

    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}

Мой build.gradle (module libary)

apply plugin: 'com.android.library'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation(name: 'googlemobileads-unity', ext:'aar')
    implementation project('GoogleMobileAdsPlugin.androidlib')

}

android {
    compileSdkVersion 30
    buildToolsVersion '30.0.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 22
        targetSdkVersion 30
        ndk {
            abiFilters 'armeabi-v7a'
        }
        versionCode 1
        versionName '1.0'
        consumerProguardFiles 'proguard-unity.txt'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
    }
}

and gradle.properties

org.gradle.jvmargs=-Xmx4096M
org.gradle.parallel=true
android.enableR8=false
unityStreamingAssets=.json
unityTemplateVersion=3
android.useAndroidX=true
android.enableJetifier=true


问:
Scanner hasNextLine is extremely slow for big size lines
Our scanner implementation is very slow. We have an inputStream of one line of 1,9 MB big. It's big, I know, but we want to know why scanner in this example is so slow. With this input it takes around 70 seconds to get the return of scanner.hasNextLine.

```<code>try (Scanner scanner = new Scanner(inputStream, "UTF-8")) {
    while (scanner.hasNextLine()) {
        String line = getSanitizedString(scanner.nextLine()).replaceAll("[\\r\\n\\t]", "");
        if (StringUtils.isNotBlank(line)) {
            batchFileAsString.append(line.trim());
        }
    }
}
</code>```

We see that in the Scanner library this while loop is happening 1000s of time until it's finally reaching the end, but still I don't understand why it's doing that.

In hasNextline it calls findWithinHorizon method. This method has a while loop where it calls findPatternInBuffer. This findPatternInBuffer is, because of the while loop, being called 1000s of times.

```<code>public boolean hasNextLine() {
    saveState();

    modCount++;
    String result = findWithinHorizon(linePattern(), 0);
    ....
</code>```
```<code>public String findWithinHorizon(Pattern pattern, int horizon) {
    ensureOpen();
    if (pattern == null)
        throw new NullPointerException();
    if (horizon < 0)
        throw new IllegalArgumentException("horizon < 0");
    clearCaches();
    modCount++;

    // Search for the pattern
    while (true) {
        if (findPatternInBuffer(pattern, horizon)) {
            matchValid = true;
            return matcher.group();
        }
        if (needInput)
            readInput();
        else
            break; // up to end of input
    }
    return null;
}
</code>```

Anyone knows what is going on here?

Body:
Our scanner implementation is very slow. We have an inputStream of one line of 1,9 MB big. It's big, I know, but we want to know why scanner in this example is so slow. With this input it takes around 70 seconds to get the return of scanner.hasNextLine.

try (Scanner scanner = new Scanner(inputStream, "UTF-8")) {
    while (scanner.hasNextLine()) {
        String line = getSanitizedString(scanner.nextLine()).replaceAll("[\\r\\n\\t]", "");
        if (StringUtils.isNotBlank(line)) {
            batchFileAsString.append(line.trim());
        }
    }
}

We see that in the Scanner library this while loop is happening 1000s of time until it's finally reaching the end, but still I don't understand why it's doing that.

In hasNextline it calls findWithinHorizon method. This method has a while loop where it calls findPatternInBuffer. This findPatternInBuffer is, because of the while loop, being called 1000s of times.

public boolean hasNextLine() {
    saveState();

    modCount++;
    String result = findWithinHorizon(linePattern(), 0);
    ....

public String findWithinHorizon(Pattern pattern, int horizon) {
    ensureOpen();
    if (pattern == null)
        throw new NullPointerException();
    if (horizon < 0)
        throw new IllegalArgumentException("horizon < 0");
    clearCaches();
    modCount++;

    // Search for the pattern
    while (true) {
        if (findPatternInBuffer(pattern, horizon)) {
            matchValid = true;
            return matcher.group();
        }
        if (needInput)
            readInput();
        else
            break; // up to end of input
    }
    return null;
}

Anyone knows what is going on here?


问:
CERT insider threats dataset
I want to use CERT dataset of insider threat to apply my proposed model, I watched so many videos about data preprocessing, but still, I don't understand how can i do it on CERT dataset.

please if you have an example or good sources about preprocessing on a dataset that's closer to the CERT dataset of insider threats,If possible please let me know.Thanks

Title: CERT insider threats dataset


问:
Get a comma number from a string
I have a string like:

```<code>$string = "P 1 BNN-01 HV A7weg letsel (Auto) A7 Re 138,3 HASKERHORNE.";
</code>```

I want to get the "138,3" part to use as variable like $number = "138,3". I think I can use preg_match_all and then use the matches array, but I cant find the correct regex for it.

So the string can contain multiple numbers, but I need only the one with a comma in it. It can contain a maximum of 3 numbers before the comma, and only one after.

```<code>$pattern = "^-?\d+(,\d+)*(\.\d+(e\d+)?)?$";
if(preg_match_all($pattern, $string, $matches, PREG_PATTERN_ORDER)) {
    print_r($matches);
}
</code>```

Title: Get a comma number from a string

Body:
I have a string like:

$string = "P 1 BNN-01 HV A7weg letsel (Auto) A7 Re 138,3 HASKERHORNE.";

I want to get the "138,3" part to use as variable like $number = "138,3". I think I can use preg_match_all and then use the matches array, but I cant find the correct regex for it.

So the string can contain multiple numbers, but I need only the one with a comma in it. It can contain a maximum of 3 numbers before the comma, and only one after.

$pattern = "^-?\d+(,\d+)*(\.\d+(e\d+)?)?$";
if(preg_match_all($pattern, $string, $matches, PREG_PATTERN_ORDER)) {
    print_r($matches);
}


问:
How to run > gradle tasks | command without help tasks?
I am learning gradle from these videos: bit.ly/3Hyo6OL but when I ran > gradle tasks | command I got this output: https://i.stack.imgur.com/QAjA7.jpg
How to get output without help tasks?</p>


问:
How to get the exact value of this problem using loop and condition statement?
My aim is to calculate the accurate value of I_a using python as given in Flow chart. I initially assume that the value of I_a=42 degree and f = 1. The value of (i) is between 0 to 100. My expected result should be I_a=43.53 degree approximately.</p>
```<code>import numpy as np
import scipy.integrate as integrate
from numpy import sqrt, pi,tan
i=0
f=1
R_a=1.93
I_a=42+i
x1=2*f*tan(I_a * pi / 180)+R_a
x2=2*f*tan(I_a * pi / 180)-R_a
l= lambda x:sqrt(1+(x/2*f)**2)
k = integrate.quad(l, x2, 2*f)
m = integrate.quad(l,2*f,x1)
v=k[0]-m[0]
for i in np.arange(0, 100,0.001):
 if (v<=0.01):
  print(I_a)
 else:
    i += 0.001
</code>```

Body:
My aim is to calculate the accurate value of I_a using python as given in Flow chart. I initially assume that the value of I_a=42 degree and f = 1. The value of (i) is between 0 to 100. My expected result should be I_a=43.53 degree approximately.

import numpy as np
import scipy.integrate as integrate
from numpy import sqrt, pi,tan
i=0
f=1
R_a=1.93
I_a=42+i
x1=2*f*tan(I_a * pi / 180)+R_a
x2=2*f*tan(I_a * pi / 180)-R_a
l= lambda x:sqrt(1+(x/2*f)**2)
k = integrate.quad(l, x2, 2*f)
m = integrate.quad(l,2*f,x1)
v=k[0]-m[0]
for i in np.arange(0, 100,0.001):
 if (v<=0.01):
  print(I_a)
 else:
    i += 0.001


问:
Cannot find oracleserviceORCL in window service
I cannot connect to the database. I checked for oracleserviceORCL in windows service,its not there.

during oracle 12C  installation,installation stucked at 100% for hours and some configuration failed and I kepts the installation and it was successful but some DBCA failed.I did several times,install and uninstall. my system is window 11,64 bits .

See below,attempt to database connection

Microsoft Windows [Version 10.0.17763.1039]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\kahar>sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 26 10:05:33 2020

Copyright (c) 1982, 2016, Oracle. All rights reserved.

SQL> connect /as sysdba
ERROR:
ORA-12560: TNS:protocol adapter errorSQL>

I cannot connect to the database. I checked for oracleserviceORCL in windows service,its not there ,please answer me !


问:
conda broke: nothings works anymore and new strange enviroment is the base enviroment
so basically, somehow this new enviroment that i have never seen in my life happens to be the new  base anaconda enviroment and of course nothing works. Do you know how to remove that enviroment?
ps no, that path doesnt even exist. I have no idea how this happened.


问:
How to find all elements with text react-test-renderer
I have a component that makes a GET request and sends users their information. I need to test whether there is such an "li" with a certain text using a test. Now in my code the error is "promise returned from findByType query must be handled". How can I solve it?

describe("List Component", () => {
  it("find li", () => {
    const wrapper = renderer.create(<List />);
    const testInstance = wrapper.root;
    expect(testInstance.findByType("li")).toBeTruthy();
  });
});```
</div>
</div>
</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>class List extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  async componentDidMount() {
    getUser(this.props.user)
      .then((response) => {
        this.setState(response.data);
      })
      .catch((error) => {
        this.setState({ error: "request error" });
      });
  }

  render() {
    return (
      <div>
        <ul>
          {Object.keys(this.state).map((i) => (
            <li key={i}>
              {i}: {this.state[i]}
            </li>
          ))}
        </ul>
      </div>
    );
  }
}</code>```

Body:
I have a component that makes a GET request and sends users their information. I need to test whether there is such an "li" with a certain text using a test. Now in my code the error is "promise returned from findByType query must be handled". How can I solve it?

describe("List Component", () => {
  it("find li", () => {
    const wrapper = renderer.create(<List />);
    const testInstance = wrapper.root;
    expect(testInstance.findByType("li")).toBeTruthy();
  });
});

class List extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  async componentDidMount() {
    getUser(this.props.user)
      .then((response) => {
        this.setState(response.data);
      })
      .catch((error) => {
        this.setState({ error: "request error" });
      });
  }

  render() {
    return (

          {Object.keys(this.state).map((i) => (

              {i}: {this.state[i]}

          ))}

    );
  }
}


问:
Postgresql where clause return wrong results
I would get theses datas :

"roads" between 1156 (end_buffer) and 1296 (start_point)

others datas like "Town" or "Discoveries" between 1156 (end_buffer) and 1296 (start_buffer)

```<code>   WHERE
   ( destination.poitable_type <> 'Road'
     AND destination_to_paris > origin.end_buffer AND destination_to_paris < origin.start_buffer
   OR
     destination.poitable_type = 'Road'
     AND destination_to_paris  BETWEEN origin.start_buffer AND origin.start_point
    )
</code>```

But the first two results are wrong

poitable_type
start_point
start_buffer
end_buffer
destination_to_paris

"Road"
1296
1196
1156
1498

"Road"
1296
1196
1156
1396

"Road"
1296
1196
1156
1280

"Town"
1296
1196
1156
1256

"Discoveries"
1296
1196
1156
1246

Body:
I would get theses datas :

"roads" between 1156 (end_buffer) and 1296 (start_point)

others datas like "Town" or "Discoveries" between 1156 (end_buffer) and 1296 (start_buffer)

   WHERE
   ( destination.poitable_type <> 'Road'
     AND destination_to_paris > origin.end_buffer AND destination_to_paris < origin.start_buffer
   OR
     destination.poitable_type = 'Road'
     AND destination_to_paris  BETWEEN origin.start_buffer AND origin.start_point
    )

But the first two results are wrong

poitable_type
start_point
start_buffer
end_buffer
destination_to_paris

"Road"
1296
1196
1156
1498

"Road"
1296
1196
1156
1396

"Road"
1296
1196
1156
1280

"Town"
1296
1196
1156
1256

"Discoveries"
1296
1196
1156
1246


问:
JavaScript keeps saying "cannot read properties of undefined" but I don't understand why its undefined
I was writing a snake game in JavaScript but whenever I press any WASD keys it returns this error:

```<code>Uncaught TypeError: Cannot read properties of undefined (reading 'set_direction')
    at HTMLDocument.on_key_press (snake.js:66:28)
</code>```

Here is my code, the constructor and draw functions work fine, the only problem is when pressing keys. The code continues running after the error is called but the snake does not change direction.:

```<code>class Snake {

    constructor() {

        this.position = [[2, 2], [1, 2]];
        this.direction = 2;

    }

    draw(){

        var canvas = document.getElementById("game_display_canvas");
        var ctx = canvas.getContext("2d");

        ctx.fillStyle = "#FFFFFF";

        for(let i = 0; i < this.position.length - 1; i++) {
            ctx.fillRect(this.position[i][0] * 10, this.position[i][1] * 10, 10, 10);
        }

    }

    move() {

        const directions = [[0, -1], [1, 0], [0, 1], [-1, 0]];
        let next_cell = this.position[this.position.length - 1];

        next_cell = [next_cell[0] + directions[this.direction][0], next_cell[1] + directions[this.direction][1]];
        this.position.push(next_cell);

    }

    set_direction(direction) {
        this.direction = direction;
    }
}

class GameManager {

    constructor(snake) {
        this.snake = snake;
    }

    on_key_press(event) {

        const W_KEY = 87;
        const A_KEY = 65;
        const S_KEY = 83;
        const D_KEY = 68;

        let keyPressed = event.keyCode;

        switch(keyPressed) {
            case W_KEY:
                this.snake.direction = 0;
                break;
            case A_KEY:
                this.snake.set_direction(3);
                break;
            case S_KEY:
                this.snake.set_direction(2);
                break;
            case D_KEY:
                this.snake.set_direction(1);
                break;
        }

    }
}

function main() {

    const snake = new Snake()

    const manager = new GameManager(snake);
    running = true;

    document.addEventListener("keydown", manager.on_key_press);

    gameLoop(manager, running)

}

function gameLoop(manager, running) {
    setTimeout(function onTick() {
        manager.snake.move();
        manager.snake.draw();

        if (running) {
            gameLoop(manager, running);
        }
    }, 100)
}
</code>```

I tried both setting the attribute directly and using a set function within the snake class, but both cause the same error.

Edit: I can't figure out how to mark this as answered, but this answer from Titus what worked for me:

"Use something like this: document.addEventListener("keydown", manager.on_key_press.bind(manager)) – Titus"

Body:
I was writing a snake game in JavaScript but whenever I press any WASD keys it returns this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'set_direction')
    at HTMLDocument.on_key_press (snake.js:66:28)

Here is my code, the constructor and draw functions work fine, the only problem is when pressing keys. The code continues running after the error is called but the snake does not change direction.:

class Snake {

    constructor() {

        this.position = [[2, 2], [1, 2]];
        this.direction = 2;

    }

    draw(){

        var canvas = document.getElementById("game_display_canvas");
        var ctx = canvas.getContext("2d");

        ctx.fillStyle = "#FFFFFF";

        for(let i = 0; i < this.position.length - 1; i++) {
            ctx.fillRect(this.position[i][0] * 10, this.position[i][1] * 10, 10, 10);
        }

    }

    move() {

        const directions = [[0, -1], [1, 0], [0, 1], [-1, 0]];
        let next_cell = this.position[this.position.length - 1];

        next_cell = [next_cell[0] + directions[this.direction][0], next_cell[1] + directions[this.direction][1]];
        this.position.push(next_cell);

    }

    set_direction(direction) {
        this.direction = direction;
    }
}

class GameManager {

    constructor(snake) {
        this.snake = snake;
    }

    on_key_press(event) {

        const W_KEY = 87;
        const A_KEY = 65;
        const S_KEY = 83;
        const D_KEY = 68;

        let keyPressed = event.keyCode;

        switch(keyPressed) {
            case W_KEY:
                this.snake.direction = 0;
                break;
            case A_KEY:
                this.snake.set_direction(3);
                break;
            case S_KEY:
                this.snake.set_direction(2);
                break;
            case D_KEY:
                this.snake.set_direction(1);
                break;
        }

    }
}

function main() {

    const snake = new Snake()

    const manager = new GameManager(snake);
    running = true;

    document.addEventListener("keydown", manager.on_key_press);

    gameLoop(manager, running)

}

function gameLoop(manager, running) {
    setTimeout(function onTick() {
        manager.snake.move();
        manager.snake.draw();

        if (running) {
            gameLoop(manager, running);
        }
    }, 100)
}

I tried both setting the attribute directly and using a set function within the snake class, but both cause the same error.

Edit: I can't figure out how to mark this as answered, but this answer from Titus what worked for me:

"Use something like this: document.addEventListener("keydown", manager.on_key_press.bind(manager)) – Titus"


问:
Fast Phrase Matching Algorithm
Say I have a list containing the following sentences.

The party was a huge success.

Sadie made a list of things she needs to buy.

Mom made me a sandwich.

I want to do phrase matching, possibly ignoring some mistakes. So

it was a success -> The party was a huge success.

she made a list from things -> Sadie made a list of things she needs to buy.

Mom made sandwich -> Mom made me a sandwich.

I have already done typo fixing using a trie, so I can assume that all the words are already correct, it's just about their order and being missed or redundant.
I assume that this problem can be represented as a substring search algorithm, where I deal with words instead of letters. Can you suggest a good algorithm that would be an efficient match for this scenario?

Title: Fast Phrase Matching Algorithm


问:
How to give two different input files with different extensions for loop script?
I am writing a for loop to run the loop over list of files. I am using basename to define two different input files but I am getting error like no file or folder found.
I am using the following code and tried shellcheck and no issues detected. I don't know where it is going wrong.

```<code>for file1 in assemblies/*.fastq; do
   basename=${file1%.fastq}
   file2="$basename"_assembly.fasta
   minimap2 -ax map-ont "$file2" "$file1"  > "$basename"_aln.sam

done
</code>```

I was unable find the mistake in the code.The error is unable to open hour01_assembly.fasta. But I have the file with the same name in the directory. Help me with the issue

modified code

```<code>#!/usr/bin/bash

#set -x

for file1 in assemblies/*.fastq; do
   basename="${file1%.fastq}"
   basename="${basename##*/}"
   file2=assemblies/"$basename"_assembly.fasta
   [ $file2 ] || continue
   echo "f1=$file1", "f2=$file2"
   minimap2 -ax map-ont "$file2" "$file1"  > "$basename"_aln.sam

done
</code>```

It is working now after debugging. Thanks for your useful comments which made the code works.
Thank you

Body:
I am writing a for loop to run the loop over list of files. I am using basename to define two different input files but I am getting error like no file or folder found.
I am using the following code and tried shellcheck and no issues detected. I don't know where it is going wrong.

for file1 in assemblies/*.fastq; do
   basename=${file1%.fastq}
   file2="$basename"_assembly.fasta
   minimap2 -ax map-ont "$file2" "$file1"  > "$basename"_aln.sam

done

I was unable find the mistake in the code.The error is unable to open hour01_assembly.fasta. But I have the file with the same name in the directory. Help me with the issue

modified code

#!/usr/bin/bash

#set -x

for file1 in assemblies/*.fastq; do
   basename="${file1%.fastq}"
   basename="${basename##*/}"
   file2=assemblies/"$basename"_assembly.fasta
   [ $file2 ] || continue
   echo "f1=$file1", "f2=$file2"
   minimap2 -ax map-ont "$file2" "$file1"  > "$basename"_aln.sam

done

It is working now after debugging. Thanks for your useful comments which made the code works.
Thank you


问:
How do you do Integration Tests in ASP.NET Boilerplate if your application requires authentication from a third party single sign on authorizer?
I am using ASP.NET Boilerplate with ASP.NET MVC, not Core.  How do I test an MVC Controller where my application requires authentication first from a Single Sign On third party?

I can't find anything, so I have no code other than to reproduce basic Unit Tests (which aren't integration tests), but it's only copy and paste with nothing to do with this question.  I don't use any async or spa, etc.  Regular old ASP.NET MVC 4.6.


问:
C# Error - Request stopped: somehow closed the connection
I was getting data from the site with the codes I created with C#. The code I created ran for a while, then System.Net.WebException: 'Request aborted: Connection closed unexpectedly.'
I started getting the error. I would be grateful if you help. Thank you.</p>
```<code>private void button1_Click(object sender, EventArgs e)
        {

            WebRequest SiteyeBaglantiTalebi = HttpWebRequest.Create("https://www.url.com");
            WebResponse GelenCevap = SiteyeBaglantiTalebi.GetResponse();
            StreamReader CevapOku = new StreamReader(GelenCevap.GetResponseStream());
            string KaynakKodlar = CevapOku.ReadToEnd();
</code>```

Body:
I was getting data from the site with the codes I created with C#. The code I created ran for a while, then System.Net.WebException: 'Request aborted: Connection closed unexpectedly.'
I started getting the error. I would be grateful if you help. Thank you.

private void button1_Click(object sender, EventArgs e)
        {

            WebRequest SiteyeBaglantiTalebi = HttpWebRequest.Create("https://www.url.com");
            WebResponse GelenCevap = SiteyeBaglantiTalebi.GetResponse();
            StreamReader CevapOku = new StreamReader(GelenCevap.GetResponseStream());
            string KaynakKodlar = CevapOku.ReadToEnd();


问:
Extra padding only on mobile chrome
I am seeing a strange issue on mobile chrome only. If you go to  https://guestbell.com/ (I have also seen this on other pages) you will notice that only the first time (not after reload) there is extra padding on the top of the page. The moment you scroll (even by one pixel) the padding disappears. I believe it might have something to do with the disappearing address bar - the height of this extra padding seems to be pretty much the same as the address bar. But I still don't understand what is causing this and what fixes it. Any ideas?

This is what it looks like:

Before scroll:

After scroll:

Title: Extra padding only on mobile chrome


问:
Create Array from File Import in C
I am trying to write a program that reads a file formated as below:

city    city    weight

It will be used to create a graph. What I have below isn't working and I don't understand why. I am admittedly pretty shakey when it comes to working with char arrays and arrays of strings.

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

int main() {

```<code>    // Create an empty graph
    graph_t* graph = create_graph();
    // string buffer and tokens

    char buffer[25];
    char* source;
    char* dest;
    char* weight;
    int key, a, b, c, d, e, f;
    char cities[25][25];

    //Open file and Read data from datafile city.dat
    FILE *fp;
    fp = fopen("city.dat","r");

    if(fp==NULL){
       printf("no such file exists\n");
       return 0;
    }
    b = 0;
    while(fgets(buffer, 25, fp)!=NULL){
      printf("inside while loop\n");
      printf("before tokenization\n");
      source = strtok(buffer, " ");
      printf("after tokenization\n");
      char tempSource[40];
      strcpy(tempSource,source);
      printf("tempSource = %s\n", tempSource);
      int size = sizeof(cities)/sizeof(cities[0]);
      printf("size = %d\n", size);

      for(e=0;e<size;e++){
            printf("inside first loop\n");
            char temp[40];
            printf("before strcopy of cities[e]\n");
            printf("%s\n", cities[e]);
            strcpy(temp,cities[e]);
</code>```
```<code>
</code>```

What I am trying to do is add the strings I'm tokenizing to the cities array only if it doesn't already exist. I've been working on this for days and have made no progress and really don't know what to do next. Any help or clarification would be greatly appreciated.

When I print the value of cities[e] I either get a blank or a memory address.

Title: Create Array from File Import in C

Body:
I am trying to write a program that reads a file formated as below:

city    city    weight

It will be used to create a graph. What I have below isn't working and I don't understand why. I am admittedly pretty shakey when it comes to working with char arrays and arrays of strings.

int main() {

    // Create an empty graph
    graph_t* graph = create_graph();
    // string buffer and tokens

    char buffer[25];
    char* source;
    char* dest;
    char* weight;
    int key, a, b, c, d, e, f;
    char cities[25][25];

    //Open file and Read data from datafile city.dat
    FILE *fp;
    fp = fopen("city.dat","r");

    if(fp==NULL){
       printf("no such file exists\n");
       return 0;
    }
    b = 0;
    while(fgets(buffer, 25, fp)!=NULL){
      printf("inside while loop\n");
      printf("before tokenization\n");
      source = strtok(buffer, " ");
      printf("after tokenization\n");
      char tempSource[40];
      strcpy(tempSource,source);
      printf("tempSource = %s\n", tempSource);
      int size = sizeof(cities)/sizeof(cities[0]);
      printf("size = %d\n", size);

      for(e=0;e<size;e++){
            printf("inside first loop\n");
            char temp[40];
            printf("before strcopy of cities[e]\n");
            printf("%s\n", cities[e]);
            strcpy(temp,cities[e]);

What I am trying to do is add the strings I'm tokenizing to the cities array only if it doesn't already exist. I've been working on this for days and have made no progress and really don't know what to do next. Any help or clarification would be greatly appreciated.

When I print the value of cities[e] I either get a blank or a memory address.


问:
io.to(targetSocketID).emit() is there a way to emit to just sender and receiver
I'm trying to create a private messaging functionality using socket.io with React and Node.

I am able to send a message to a particular socket like so:

```<code>io.to(targetSocketID).emit('privateMessage' message)
</code>```

it successfully sends it to that specific user but not the sender. is there a way to just emit a message to sender and the target user to make this simple? From what I can see there is two approaches here.

When a message is created push the sender messages into a messages array setMessages([...messages, senderMessages]) and also push the socket message into that array setMessages([...messages, receivedMessages]). this approach seems sloppy and  like to avoid this route as it can become problematic.

generate a unique room for each user and send the room to the server and join it:

```<code>//server

socket.on('joinRoom', room => {
  socket.join(room)
  socket.on('privateMessage', message => {
    socket.on(room).emit('messageResponse', message)
  })
})
</code>```

I would like to know if there is a better way to do this.
that allows me to emit a message to just sender AND targeted receiver.

Body:
I'm trying to create a private messaging functionality using socket.io with React and Node.

I am able to send a message to a particular socket like so:

io.to(targetSocketID).emit('privateMessage' message)

it successfully sends it to that specific user but not the sender. is there a way to just emit a message to sender and the target user to make this simple? From what I can see there is two approaches here.

When a message is created push the sender messages into a messages array setMessages([...messages, senderMessages]) and also push the socket message into that array setMessages([...messages, receivedMessages]). this approach seems sloppy and  like to avoid this route as it can become problematic.

generate a unique room for each user and send the room to the server and join it:

//server

socket.on('joinRoom', room => {
  socket.join(room)
  socket.on('privateMessage', message => {
    socket.on(room).emit('messageResponse', message)
  })
})

I would like to know if there is a better way to do this.
that allows me to emit a message to just sender AND targeted receiver.


问:
How can I read a newline-delimited line from an OpenSSL connection?
From SSL_read documentation:

The read functions work based on the SSL/TLS records. The data are received in records (with a maximum record size of 16kB). Only when a record has been completely received, can it be processed (decryption and check of integrity). Therefore, data that was not retrieved at the last read call can still be buffered inside the SSL layer and will be retrieved on the next read call. If num is higher than the number of bytes buffered then the read functions will return with the bytes buffered. If no more bytes are in the buffer, the read functions will trigger the processing of the next record. Only when the record has been received and processed completely will the read functions return reporting success. At most the contents of one record will be returned. As the size of an SSL/TLS record may exceed the maximum packet size of the underlying transport (e.g. TCP), it may be necessary to read several packets from the transport layer before the record is complete and the read call can succeed.

I don't understand what a "record" is doing in this process.

Suppose the counterpart socket is sending newline-delimited lines intermittently. How should I read a line at a time?

Say, hello\n is sent, and then some time later goodbye\n is sent:

```<code>SSL * ssl = ...;
char buffer [16*1024*1024];
size_t n_read;

SSL_read_ex (buffer, sizeof(buffer), &n_read);
</code>```

Will I have to wait for a whole "record" which is longer than hello\n? What determines the size of a "record"?

Does the sender have to do anything special (e.g. flush) at the newline to ensure that I will receive hello\n without waiting for goodbye\n?

Body:
From SSL_read documentation:

The read functions work based on the SSL/TLS records. The data are received in records (with a maximum record size of 16kB). Only when a record has been completely received, can it be processed (decryption and check of integrity). Therefore, data that was not retrieved at the last read call can still be buffered inside the SSL layer and will be retrieved on the next read call. If num is higher than the number of bytes buffered then the read functions will return with the bytes buffered. If no more bytes are in the buffer, the read functions will trigger the processing of the next record. Only when the record has been received and processed completely will the read functions return reporting success. At most the contents of one record will be returned. As the size of an SSL/TLS record may exceed the maximum packet size of the underlying transport (e.g. TCP), it may be necessary to read several packets from the transport layer before the record is complete and the read call can succeed.

I don't understand what a "record" is doing in this process.

Suppose the counterpart socket is sending newline-delimited lines intermittently. How should I read a line at a time?

Say, hello\n is sent, and then some time later goodbye\n is sent:

SSL * ssl = ...;
char buffer [16*1024*1024];
size_t n_read;

SSL_read_ex (buffer, sizeof(buffer), &n_read);

Will I have to wait for a whole "record" which is longer than hello\n? What determines the size of a "record"?

Does the sender have to do anything special (e.g. flush) at the newline to ensure that I will receive hello\n without waiting for goodbye\n?