问:
Compile OpenGL with GCC 64-bit
I have a project that compiles with GCC 32-bit. I have been trying to migrate to GCC 64-bit on my native Windows machine (not through a VM). To do this I have downloaded w64devkit from https://github.com/skeeto/w64devkit/releases. My 32-bit install comes from https://sourceforge.net/projects/mingw/.

NOTE: Both installs cannot be active at the same time. Since the 32-bit version makes it into the path before we can add the 64-bit version through the environment variables, I modify the 32-bit MinGW folder name so that when the 64-bit version of GCC tries to use as.exe and ld.exe through the path, it will find the correct versions.

I have also downloaded glm, glew, and glfw for this project, and added folders to the path to get at least the 32-bit version working.

The working command line to compile the 32-bit version is as follows:

g++ -std=c++11 -O3 -ggdb src/main.cpp -o build/main -lopengl32 -L. -I"C:\lib\glm" -I"C:\lib\glew-2.1.0-win32\include" -I"C:\lib\glfw-3.3.8.bin.WIN32\include"  "C:\lib\glfw-3.3.8.bin.WIN32\lib\libglfw3dll.a" "C:\lib\glew-2.1.0-win32\lib\Release\Win32\glew32.lib"

The following command line to compile the 64-bit version also works:

g++ -std=c++11 -O0 -ggdb src/main.cpp -o build/main -lopengl32 -L. -I"C:\lib\glm" -I"C:\lib\glew-2.1.0-win32\include" -I"C:\lib\glfw-3.3.8.bin.WIN64\include"  "C:\lib\glfw-3.3.8.bin.WIN64\lib-mingw-w64\libglfw3dll.a" "C:\lib\glew-2.1.0-win32\lib\Release\x64\glew32.lib"

However whenever I try to run the executables, the 32-bit version runs and the 64-bit version gives me an error in a pop-up window. "The application was unable to start correctly (0xc000007b). Click OK to close the application."

When I try to run it in one of my debuggers I get a "Error: 32-bit processes are not supported". Another debugger says "During startup program exited with code 0xc000007b".

Clearly something is going horribly wrong, but I don't know what or where.

Title: Compile OpenGL with GCC 64-bit


来源: stackexchange

问:
How to SELECT & do a GROUP BY with two columns from a dataframe in PySPARK
Currently this how the dataframe looks like and it basically contains all the customer numbers, the months they've made the purchases and the growth perecentage.

I'm unable to like group by customer and month to show the growth percentage for each customer every month. The expected output dataframe should look similar to this.

As you can see in the above image, it displays each customer for every month  and the growth percentage. This is what I'm unable to achieve.

But whenever I do a WHERE clause for a single customer number Im able to see for all the months.

Any help could be appreciated.

ContentLicense: CC BY-SA 4.0


问:
Similarity matrix for big row-based transactional data?
I have a relatively large set of data called ratings, with shape (31.7 million, 2) on the form

customer_id
article_id

x
a

y
b

...
...

Where there are 1.3 million unique customer_id and about 105k unique article_id. It's safe to assume the data is sparse. I want to compute a similarity matrix based on the customer_ids, e.g. with Pearson correlation as metric. The following method works perfectly fine for small amounts of data,

```<code>ratings["rating"] = 1
(pd.pivot_table(
    transactions.head(100),
    values="rating",
    index="article_id",
    columns="customer_id")
    .fillna(0)
    .corr()
    )
</code>```

But does not work for the entire data (due to overflow in the pandas unstack method). Is there any way to solve this for larger data sets?

I've tried looking into scipy.sparse.csr_matrix with sklearn cosine_similarity, but this expects data on the form of the pivot table which I'm not able to make, i.e.

customer_x
customer_y
...

article_a
0.1
0.1
...

article_b
0.1
0.1
...

...
...
...
...

Body:
I have a relatively large set of data called ratings, with shape (31.7 million, 2) on the form

customer_id
article_id

x
a

y
b

...
...

Where there are 1.3 million unique customer_id and about 105k unique article_id. It's safe to assume the data is sparse. I want to compute a similarity matrix based on the customer_ids, e.g. with Pearson correlation as metric. The following method works perfectly fine for small amounts of data,

ratings["rating"] = 1
(pd.pivot_table(
    transactions.head(100),
    values="rating",
    index="article_id",
    columns="customer_id")
    .fillna(0)
    .corr()
    )

But does not work for the entire data (due to overflow in the pandas unstack method). Is there any way to solve this for larger data sets?

I've tried looking into scipy.sparse.csr_matrix with sklearn cosine_similarity, but this expects data on the form of the pivot table which I'm not able to make, i.e.

customer_x
customer_y
...

article_a
0.1
0.1
...

article_b
0.1
0.1
...

...
...
...
...


问:
Updated data is not getting reflected in the grid in Telerik blazor
Trying to show the updated data in the grid using ObservableCollection for that i have created a loop in that i am calling the service method which holds all the data then assigning this data to the instance of the ObservableCollection. Binded this instance to the data parameter of the grid. Updated records are present in the data but in the UI it is not reflecting also used StateHasChanged but still this does not works.

Without using Rebind need to update the list


问:
QuickStep launcher (com.android.launcher3) doesn't start after un-hiding through device admin
I have a custom kisok app and a device admin app (device policy manager) running in android 10. When the kiosk app launches, the device-admin app disable various components of the system. One of the components that is disabled is the built-in android launcher. It is disabled through:

```<code>devicePolicyManager.setApplicationHidden(adminComponent, "com.android.launcher3", true)
</code>```

The problem I face is when I exit from the kiosk mode application and then enable the built-in launcher:

```<code>devicePolicyManager.setApplicationHidden(adminComponent, "com.android.launcher3", false)
</code>```

After, this, when the default launcher tries to open, it crashes saying that various permissions are missing:

```<code>11-23 16:30:57.660   750  1962 W ActivityManager: Permission Denial: setShelfHeight() from pid=9846, uid=10091 requires android.permission.STATUS_BAR
11-23 16:30:57.662  9846  9870 E AndroidRuntime: FATAL EXCEPTION: UiThreadHelper
11-23 16:30:57.662  9846  9870 E AndroidRuntime: Process: com.android.launcher3, PID: 9846
11-23 16:30:57.662  9846  9870 E AndroidRuntime: java.lang.SecurityException: Permission Denial: setShelfHeight() from pid=9846, uid=10091 requires android.permission.STATUS_BAR
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Parcel.createException(Parcel.java:2071)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:2039)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:1987)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.view.IWindowManager$Stub$Proxy.setShelfHeight(IWindowManager.java:3717)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.systemui.shared.system.WindowManagerWrapper.setShelfHeight(WindowManagerWrapper.java:148)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.launcher3.uioverrides.RecentsUiFactory.lambda$static$0(RecentsUiFactory.java:62)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.launcher3.uioverrides.-$$Lambda$RecentsUiFactory$kLTnyxU1D0UyyR3cYPdkjFJ_dRk.execute(Unknown Source:0)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.launcher3.util.UiThreadHelper$UiCallbacks.handleMessage(UiThreadHelper.java:88)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:103)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:214)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.HandlerThread.run(HandlerThread.java:67)
11-23 16:30:57.662  9846  9870 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace:
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.am.ActivityManagerService.enforceCallingPermission(ActivityManagerService.java:6016)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.am.ActivityManagerService$LocalService.enforceCallingPermission(ActivityManagerService.java:18224)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.wm.ActivityTaskManagerService.enforceCallerIsRecentsOrHasPermission(ActivityTaskManagerService.java:3542)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.wm.ActivityTaskManagerService.access$500(ActivityTaskManagerService.java:307)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.wm.ActivityTaskManagerService$LocalService.enforceCallerIsRecentsOrHasPermission(ActivityTaskManagerService.java:6321)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:
11-23 16:30:57.672   750  9923 I DropBoxManagerService: add tag=system_app_crash isTagEnabled=true flags=0x2
11-23 16:30:57.672   750  2052 W ActivityManager: Permission Denial: registerTaskStackListener() from pid=9846, uid=10091 requires android.permission.MANAGE_ACTIVITY_STACKS
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners: Failed to call registerTaskStackListener
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners: java.lang.SecurityException: Permission Denial: registerTaskStackListener() from pid=9846, uid=10091 requires android.permission.MANAGE_ACTIVITY_STACKS
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Parcel.createException(Parcel.java:2071)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Parcel.readException(Parcel.java:2039)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Parcel.readException(Parcel.java:1987)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.app.IActivityTaskManager$Stub$Proxy.registerTaskStackListener(IActivityTaskManager.java:5903)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.systemui.shared.system.TaskStackChangeListeners.addListener(TaskStackChangeListeners.java:63)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.systemui.shared.system.ActivityManagerWrapper.registerTaskStackListener(ActivityManagerWrapper.java:367)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.quickstep.views.RecentsView.onAttachedToWindow(RecentsView.java:408)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.View.dispatchAttachedToWindow(View.java:19642)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2103)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1791)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7867)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.Choreographer.doCallbacks(Choreographer.java:791)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.Choreographer.doFrame(Choreographer.java:726)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Handler.handleCallback(Handler.java:883)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Handler.dispatchMessage(Handler.java:100)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Looper.loop(Looper.java:214)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.app.ActivityThread.main(ActivityThread.java:7386)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at java.lang.reflect.Method.invoke(Native Method)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
11-23 16:30:57.673   750  2053 W ActivityTaskManager:   Force finishing activity com.android.launcher3/.Launcher
</code>```

Also, the launcher3 application has not declared those missing permissions in its AndroidManifest.

So, the question is, how can I unhide the package in such a way that those permission requirements are met?

Body:
I have a custom kisok app and a device admin app (device policy manager) running in android 10. When the kiosk app launches, the device-admin app disable various components of the system. One of the components that is disabled is the built-in android launcher. It is disabled through:

devicePolicyManager.setApplicationHidden(adminComponent, "com.android.launcher3", true)

The problem I face is when I exit from the kiosk mode application and then enable the built-in launcher:

devicePolicyManager.setApplicationHidden(adminComponent, "com.android.launcher3", false)

After, this, when the default launcher tries to open, it crashes saying that various permissions are missing:

11-23 16:30:57.660   750  1962 W ActivityManager: Permission Denial: setShelfHeight() from pid=9846, uid=10091 requires android.permission.STATUS_BAR
11-23 16:30:57.662  9846  9870 E AndroidRuntime: FATAL EXCEPTION: UiThreadHelper
11-23 16:30:57.662  9846  9870 E AndroidRuntime: Process: com.android.launcher3, PID: 9846
11-23 16:30:57.662  9846  9870 E AndroidRuntime: java.lang.SecurityException: Permission Denial: setShelfHeight() from pid=9846, uid=10091 requires android.permission.STATUS_BAR
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Parcel.createException(Parcel.java:2071)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:2039)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:1987)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.view.IWindowManager$Stub$Proxy.setShelfHeight(IWindowManager.java:3717)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.systemui.shared.system.WindowManagerWrapper.setShelfHeight(WindowManagerWrapper.java:148)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.launcher3.uioverrides.RecentsUiFactory.lambda$static$0(RecentsUiFactory.java:62)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.launcher3.uioverrides.-$$Lambda$RecentsUiFactory$kLTnyxU1D0UyyR3cYPdkjFJ_dRk.execute(Unknown Source:0)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.launcher3.util.UiThreadHelper$UiCallbacks.handleMessage(UiThreadHelper.java:88)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:103)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:214)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at android.os.HandlerThread.run(HandlerThread.java:67)
11-23 16:30:57.662  9846  9870 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace:
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.am.ActivityManagerService.enforceCallingPermission(ActivityManagerService.java:6016)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.am.ActivityManagerService$LocalService.enforceCallingPermission(ActivityManagerService.java:18224)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.wm.ActivityTaskManagerService.enforceCallerIsRecentsOrHasPermission(ActivityTaskManagerService.java:3542)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.wm.ActivityTaskManagerService.access$500(ActivityTaskManagerService.java:307)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:    at com.android.server.wm.ActivityTaskManagerService$LocalService.enforceCallerIsRecentsOrHasPermission(ActivityTaskManagerService.java:6321)
11-23 16:30:57.662  9846  9870 E AndroidRuntime:
11-23 16:30:57.672   750  9923 I DropBoxManagerService: add tag=system_app_crash isTagEnabled=true flags=0x2
11-23 16:30:57.672   750  2052 W ActivityManager: Permission Denial: registerTaskStackListener() from pid=9846, uid=10091 requires android.permission.MANAGE_ACTIVITY_STACKS
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners: Failed to call registerTaskStackListener
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners: java.lang.SecurityException: Permission Denial: registerTaskStackListener() from pid=9846, uid=10091 requires android.permission.MANAGE_ACTIVITY_STACKS
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Parcel.createException(Parcel.java:2071)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Parcel.readException(Parcel.java:2039)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Parcel.readException(Parcel.java:1987)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.app.IActivityTaskManager$Stub$Proxy.registerTaskStackListener(IActivityTaskManager.java:5903)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.systemui.shared.system.TaskStackChangeListeners.addListener(TaskStackChangeListeners.java:63)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.systemui.shared.system.ActivityManagerWrapper.registerTaskStackListener(ActivityManagerWrapper.java:367)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.quickstep.views.RecentsView.onAttachedToWindow(RecentsView.java:408)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.View.dispatchAttachedToWindow(View.java:19642)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2103)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1791)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7867)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.Choreographer.doCallbacks(Choreographer.java:791)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.Choreographer.doFrame(Choreographer.java:726)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Handler.handleCallback(Handler.java:883)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Handler.dispatchMessage(Handler.java:100)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.os.Looper.loop(Looper.java:214)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at android.app.ActivityThread.main(ActivityThread.java:7386)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at java.lang.reflect.Method.invoke(Native Method)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
11-23 16:30:57.673  9846  9846 W TaskStackChangeListeners:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
11-23 16:30:57.673   750  2053 W ActivityTaskManager:   Force finishing activity com.android.launcher3/.Launcher

Also, the launcher3 application has not declared those missing permissions in its AndroidManifest.

So, the question is, how can I unhide the package in such a way that those permission requirements are met?


问:
Salesforce related Question : How to cover PAUSE Elements from Process Builder Or Flows?
I have to write a test class for a Process Builder which sends a notification to user at certain time which is equal to a date and time field (scheduled Date and Time)in Opportunity so there is a scheduled action which will trigger the notification at that scheduled Date and Time so how can I cover all the elements after that scheduled action.

I have tried Using below code but it's not working

```<code>DateTime start = System.Now();

while(System.Now().getTime()\< start.getTime()+2000){}
</code>```

Body:
I have to write a test class for a Process Builder which sends a notification to user at certain time which is equal to a date and time field (scheduled Date and Time)in Opportunity so there is a scheduled action which will trigger the notification at that scheduled Date and Time so how can I cover all the elements after that scheduled action.

I have tried Using below code but it's not working

DateTime start = System.Now();

while(System.Now().getTime()\< start.getTime()+2000){}


问:
Why is there a "SocketException: Connection reset" when not closing client's output stream?
In a simple Server Client communication I always get the "java.net.SocketException: Connection reset" on the serverside, if the client does not close the outputstream of it's socket directly after sending out the data via BufferedWriter.
If I close the client's outputstream everything works fine.
But obviously the client wants eventually to send more than one String (then the server needs to handle the connection in a new Thread). But I don't even get that far, because ofe the problem above...

Thanks for helping!!

Here is some condensed code to show the problem.

This is the server class:

```<code>public class TestServerCharacterStream {

    public static void main(String[] args) {
        System.out.println("### Started");
        TestServerCharacterStream testServerCharacterStream = new TestServerCharacterStream(9498);
        testServerCharacterStream.waitForData();
        System.out.println("### Terminated");
    }

    private int port;
    private ServerSocket serverSocket;
    private BufferedReader in;

    public TestServerCharacterStream(int port) {
        this.port = port;
        try {
            this.serverSocket = new ServerSocket(port);
            System.out.println("[SERVER] :   Server started!");
        } catch (IOException e) {
            System.err.println("Cannot open new server socket!");
            e.printStackTrace();
        }

    }

    public void waitForData() {
        Socket clientSocket = null;
        try {
            System.out.println("[SERVER] :   Wait for data on port " + port + " ...");
            clientSocket = serverSocket.accept();

            in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            String incoming = in.readLine();
            System.out.println("[SERVER] :   Incoming message: " + incoming);
        } catch (IOException e) {
            System.err.println("Error while accepting connection or reading input!");
            closeStreamAndSocket(clientSocket, in);
            closeServerSocket();
            e.printStackTrace();
        }
    }

    private void closeStreamAndSocket(Socket socket, BufferedReader in) {
        try {
            if (in != null) {
                in.close();
            }
            if (socket != null) {
                socket.close();
            }
        } catch (IOException e) {
            System.err.println("Cannot close stream or socket.");
            e.printStackTrace();
        }
    }

    private void closeServerSocket() {
        try {
            if (serverSocket != null) {
                serverSocket.close();
            }
        } catch (IOException e) {
            System.err.println("Cannot close serverSocket.");
            e.printStackTrace();
        }
    }

}
</code>```

This is the Client Class:
As mentioned, it works if closing the outputstream (see the comment). To use flush() or not does not make any difference. The only way to solve it is out.close();
But I want to use the BufferedWriter again, withot connect always again to the server.

```<code>public class TestClientCharacterStream {

    public static void main(String[] args) {
        System.out.println("### Started");
        TestClientCharacterStream testClientCharacterStream = new TestClientCharacterStream("localhost", 9498);
        testClientCharacterStream.sendData("Hello!!!");
        System.out.println("### Terminated");
    }

    private InetSocketAddress adress;
    private Socket clientSocket;
    private BufferedWriter out;

    public TestClientCharacterStream(String serverIp, int port) {
        this.adress = new InetSocketAddress(serverIp, port);
        try {
            clientSocket = new Socket();
            clientSocket.connect(adress, 10000);
            this.out = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
        } catch (IOException e) {
            System.err.println("Something went wrong on instantiating a new TestClientCharacterStream");
            e.printStackTrace();
        }
    }

    public void sendData(String string) {
        try {
            out.write(string);
            System.out.println("[CLIENT] :   Sent new message: " + string);
                        out.flush();
            out.close(); // If I don't close the stream, I'm going to get a "java.net.SocketException: Connection reset" on the server
        } catch (IOException e) {
            closeStreamAndSocket(clientSocket, out);
            e.printStackTrace();
        }
    }

    private void closeStreamAndSocket(Socket socket, BufferedWriter out) {
        try {
            if (out != null) {
                out.close();
            }
            if (socket != null) {
                socket.close();
            }
        } catch (IOException e) {
            System.err.println("Cannot close stream or socket.");
            e.printStackTrace();
        }
    }
}

</code>```

The servers Output:

```<code>### Started
[SERVER] :   Server started!
[SERVER] :   Wait for data on port 9498 ...
Error while accepting connection or reading input!
java.net.SocketException: Connection reset
    at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:323)
    at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
    at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
    at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
    at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:270)
    at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:313)
    at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188)
    at java.base/java.io.InputStreamReader.read(InputStreamReader.java:177)
    at java.base/java.io.BufferedReader.fill(BufferedReader.java:162)
    at java.base/java.io.BufferedReader.readLine(BufferedReader.java:329)
    at java.base/java.io.BufferedReader.readLine(BufferedReader.java:396)
    at TestServerCharacterStream.waitForData(TestServerCharacterStream.java:40)
    at TestServerCharacterStream.main(TestServerCharacterStream.java:12)
### Terminated
</code>```

Body:
In a simple Server Client communication I always get the "java.net.SocketException: Connection reset" on the serverside, if the client does not close the outputstream of it's socket directly after sending out the data via BufferedWriter.
If I close the client's outputstream everything works fine.
But obviously the client wants eventually to send more than one String (then the server needs to handle the connection in a new Thread). But I don't even get that far, because ofe the problem above...

Thanks for helping!!

Here is some condensed code to show the problem.

This is the server class:

public class TestServerCharacterStream {

    public static void main(String[] args) {
        System.out.println("### Started");
        TestServerCharacterStream testServerCharacterStream = new TestServerCharacterStream(9498);
        testServerCharacterStream.waitForData();
        System.out.println("### Terminated");
    }

    private int port;
    private ServerSocket serverSocket;
    private BufferedReader in;

    public TestServerCharacterStream(int port) {
        this.port = port;
        try {
            this.serverSocket = new ServerSocket(port);
            System.out.println("[SERVER] :   Server started!");
        } catch (IOException e) {
            System.err.println("Cannot open new server socket!");
            e.printStackTrace();
        }

    }

    public void waitForData() {
        Socket clientSocket = null;
        try {
            System.out.println("[SERVER] :   Wait for data on port " + port + " ...");
            clientSocket = serverSocket.accept();

            in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            String incoming = in.readLine();
            System.out.println("[SERVER] :   Incoming message: " + incoming);
        } catch (IOException e) {
            System.err.println("Error while accepting connection or reading input!");
            closeStreamAndSocket(clientSocket, in);
            closeServerSocket();
            e.printStackTrace();
        }
    }

    private void closeStreamAndSocket(Socket socket, BufferedReader in) {
        try {
            if (in != null) {
                in.close();
            }
            if (socket != null) {
                socket.close();
            }
        } catch (IOException e) {
            System.err.println("Cannot close stream or socket.");
            e.printStackTrace();
        }
    }

    private void closeServerSocket() {
        try {
            if (serverSocket != null) {
                serverSocket.close();
            }
        } catch (IOException e) {
            System.err.println("Cannot close serverSocket.");
            e.printStackTrace();
        }
    }

}

This is the Client Class:
As mentioned, it works if closing the outputstream (see the comment). To use flush() or not does not make any difference. The only way to solve it is out.close();
But I want to use the BufferedWriter again, withot connect always again to the server.

public class TestClientCharacterStream {

    public static void main(String[] args) {
        System.out.println("### Started");
        TestClientCharacterStream testClientCharacterStream = new TestClientCharacterStream("localhost", 9498);
        testClientCharacterStream.sendData("Hello!!!");
        System.out.println("### Terminated");
    }

    private InetSocketAddress adress;
    private Socket clientSocket;
    private BufferedWriter out;

    public TestClientCharacterStream(String serverIp, int port) {
        this.adress = new InetSocketAddress(serverIp, port);
        try {
            clientSocket = new Socket();
            clientSocket.connect(adress, 10000);
            this.out = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
        } catch (IOException e) {
            System.err.println("Something went wrong on instantiating a new TestClientCharacterStream");
            e.printStackTrace();
        }
    }

    public void sendData(String string) {
        try {
            out.write(string);
            System.out.println("[CLIENT] :   Sent new message: " + string);
                        out.flush();
            out.close(); // If I don't close the stream, I'm going to get a "java.net.SocketException: Connection reset" on the server
        } catch (IOException e) {
            closeStreamAndSocket(clientSocket, out);
            e.printStackTrace();
        }
    }

    private void closeStreamAndSocket(Socket socket, BufferedWriter out) {
        try {
            if (out != null) {
                out.close();
            }
            if (socket != null) {
                socket.close();
            }
        } catch (IOException e) {
            System.err.println("Cannot close stream or socket.");
            e.printStackTrace();
        }
    }
}

The servers Output:

### Started
[SERVER] :   Server started!
[SERVER] :   Wait for data on port 9498 ...
Error while accepting connection or reading input!
java.net.SocketException: Connection reset
    at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:323)
    at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
    at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
    at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
    at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:270)
    at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:313)
    at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188)
    at java.base/java.io.InputStreamReader.read(InputStreamReader.java:177)
    at java.base/java.io.BufferedReader.fill(BufferedReader.java:162)
    at java.base/java.io.BufferedReader.readLine(BufferedReader.java:329)
    at java.base/java.io.BufferedReader.readLine(BufferedReader.java:396)
    at TestServerCharacterStream.waitForData(TestServerCharacterStream.java:40)
    at TestServerCharacterStream.main(TestServerCharacterStream.java:12)
### Terminated


问:
How to keep disabled (n+1)th accordion?
I am making a video playlist. To demonstrate the list I am using Metarial UI accordions. Now I want to know how to disable the accordion if the previous video is not watched fully? The rest accordions should be enable only when the previous video is watched completely.

```<code>watchedVideoList=[] [Initially it will be 0]

coursesVdoList=[list of courses]

// code of accordion
<Box item xs={6} sx={{ marginRight: "2%" }}>
            {coursesVdoList.map((courseVdo, index) => {
              courseVdo["isVdoAdded"] = false

              return (
                <Accordion

                   disabled={coursesVdoList.length === index ? false : true}
                  sx={{ width: "22rem" }} expanded={expanded === `${courseVdo.episode}`} onChange={handleChange(`${courseVdo.episode}`)
                  }>

</code>```

Lets assume I have the list of 10 courses in "coursesVdoList". So my first accordion should be open and other 9 accordion should be disabled in the begining. After completely watching the 1st video "watchedVideoList" array will be updated from backend api and the first 2 accordion should be enabled.

Title: How to keep disabled (n+1)th accordion?

Body:
I am making a video playlist. To demonstrate the list I am using Metarial UI accordions. Now I want to know how to disable the accordion if the previous video is not watched fully? The rest accordions should be enable only when the previous video is watched completely.

watchedVideoList=[] [Initially it will be 0]

coursesVdoList=[list of courses]

// code of accordion
<Box item xs={6} sx={{ marginRight: "2%" }}>
            {coursesVdoList.map((courseVdo, index) => {
              courseVdo["isVdoAdded"] = false

              return (
                <Accordion

                   disabled={coursesVdoList.length === index ? false : true}
                  sx={{ width: "22rem" }} expanded={expanded === `${courseVdo.episode}`} onChange={handleChange(`${courseVdo.episode}`)
                  }>

Lets assume I have the list of 10 courses in "coursesVdoList". So my first accordion should be open and other 9 accordion should be disabled in the begining. After completely watching the 1st video "watchedVideoList" array will be updated from backend api and the first 2 accordion should be enabled.


问:
How to incorporate a piece-wise release of a contaminant and solve the diffusion equation over space and time
I have a contamination source that releases for 10 minutes at the centre of a room and then turns off. The 1D diffusion equation with decay over time and space seems reasonable:

$dC/dt = D * d^2C/dx^2 - k * C$

It's easy to solve if the initial and boundary condition C(50)=1 (and looks like the figure below), but how can I get it to have a piece-wise boundary condition?

```<code>import numpy as np

def point_source_pde(C, D, k, dx, dt):
    """Solves the PDE for a continuous point source under diffusion and decay.

    Parameters:
    C (ndarray): Concentration at each location x at time t.
    D (float): Diffusion coefficient.
    k (float): Decay rate.
    dx (float): Spatial discretization step.
    dt (float): Time discretization step.

    Returns:
    ndarray: Concentration at each location x at time t + dt.
    """
    # Number of grid points
    N = C.shape[0]

    # Initialize array for updated concentration values
    C_new = np.zeros(N)

    # Iterate over all grid points
    for i in range(N):
        # Implement finite difference formula for diffusion
        C_diffusion = D * (C[(i+1)%N] - 2*C[i] + C[(i-1)%N]) / dx**2

        # Implement finite difference formula for decay
        C_decay = -k * C[i]

        # Update concentration at each grid point
        C_new[i] = C[i] + dt * (C_diffusion + C_decay)

    return C_new

# Set diffusion coefficient and decay rate
D = 0.1
k = 0.01

# Set spatial and temporal discretization steps
dx = 0.1
dt = 0.001

# Set initial concentration
C = np.zeros(100)
C[50] = 1

# Solve PDE for 1000 time steps
for t in range(1000):
    C = point_source_pde(C, D, k, dx, dt)

#Plot concentration profile
import matplotlib.pyplot as plt
plt.plot(C)
plt.xlabel('Distance [x]')
plt.ylabel('C')
plt.show()
</code>```

Attempt 1:

```<code>    def point_source_pde(C, D, k, dx, dt, t, t_start, t_end):
        """Solves the PDE for a continuous point source under diffusion and decay, with a continuous release of contaminant from t_start to t_end.

    Parameters:
    C (ndarray): Concentration at each location x at time t.
    D (float): Diffusion coefficient.
    k (float): Decay rate.
    dx (float): Spatial discretization step.
    dt (float): Time discretization step.
    t (int): Current time step.
    t_start (int): Start time of contaminant release.
    t_end (int): End time of contaminant release.

    Returns:
    ndarray: Concentration at each location x at time t + dt.
    """
    # Number of grid points
    N = C.shape[0]

    # Initialize array for updated concentration values
    C_new = np.zeros(N)

    # Iterate over all grid points
    for i in range(N):
        # Implement finite difference formula for diffusion
        C_diffusion = D * (C[(i+1)%N] - 2*C[i] + C[(i-1)%N]) / dx**2

        # Implement finite difference formula for decay
        C_decay = -k * C[i]

        # Implement continuous release of contaminant at center
        if t_start <= t < t_end:
            C_release = 1
        else:
            C_release = 0

        # Update concentration at each grid point
        C_new[i] = C[i] + dt * (C_diffusion + C_decay + C_release)

    return C_new

# Set spatial and temporal discretization steps
dx = 0.01
dt = 0.001

t_start=5
t_end=15

# Set initial concentration
C = np.zeros(100)

# Solve PDE for release period
for t in range(t_start, t_end):
    C = point_source_pde(C, D, k, dx, dt, t, t_start, t_end)

# Solve PDE for 1000 time steps after the release period
for t in range(t_end, t_end+1000):
    C = point_source_pde(C, D, k, dx, dt, t, t_start, t_end)
</code>```

Body:
I have a contamination source that releases for 10 minutes at the centre of a room and then turns off. The 1D diffusion equation with decay over time and space seems reasonable:

$dC/dt = D * d^2C/dx^2 - k * C$

It's easy to solve if the initial and boundary condition C(50)=1 (and looks like the figure below), but how can I get it to have a piece-wise boundary condition?

import numpy as np

def point_source_pde(C, D, k, dx, dt):
    """Solves the PDE for a continuous point source under diffusion and decay.

    Parameters:
    C (ndarray): Concentration at each location x at time t.
    D (float): Diffusion coefficient.
    k (float): Decay rate.
    dx (float): Spatial discretization step.
    dt (float): Time discretization step.

    Returns:
    ndarray: Concentration at each location x at time t + dt.
    """
    # Number of grid points
    N = C.shape[0]

    # Initialize array for updated concentration values
    C_new = np.zeros(N)

    # Iterate over all grid points
    for i in range(N):
        # Implement finite difference formula for diffusion
        C_diffusion = D * (C[(i+1)%N] - 2*C[i] + C[(i-1)%N]) / dx**2

        # Implement finite difference formula for decay
        C_decay = -k * C[i]

        # Update concentration at each grid point
        C_new[i] = C[i] + dt * (C_diffusion + C_decay)

    return C_new

# Set diffusion coefficient and decay rate
D = 0.1
k = 0.01

# Set spatial and temporal discretization steps
dx = 0.1
dt = 0.001

# Set initial concentration
C = np.zeros(100)
C[50] = 1

# Solve PDE for 1000 time steps
for t in range(1000):
    C = point_source_pde(C, D, k, dx, dt)

#Plot concentration profile
import matplotlib.pyplot as plt
plt.plot(C)
plt.xlabel('Distance [x]')
plt.ylabel('C')
plt.show()

Attempt 1:

    def point_source_pde(C, D, k, dx, dt, t, t_start, t_end):
        """Solves the PDE for a continuous point source under diffusion and decay, with a continuous release of contaminant from t_start to t_end.

    Parameters:
    C (ndarray): Concentration at each location x at time t.
    D (float): Diffusion coefficient.
    k (float): Decay rate.
    dx (float): Spatial discretization step.
    dt (float): Time discretization step.
    t (int): Current time step.
    t_start (int): Start time of contaminant release.
    t_end (int): End time of contaminant release.

    Returns:
    ndarray: Concentration at each location x at time t + dt.
    """
    # Number of grid points
    N = C.shape[0]

    # Initialize array for updated concentration values
    C_new = np.zeros(N)

    # Iterate over all grid points
    for i in range(N):
        # Implement finite difference formula for diffusion
        C_diffusion = D * (C[(i+1)%N] - 2*C[i] + C[(i-1)%N]) / dx**2

        # Implement finite difference formula for decay
        C_decay = -k * C[i]

        # Implement continuous release of contaminant at center
        if t_start <= t < t_end:
            C_release = 1
        else:
            C_release = 0

        # Update concentration at each grid point
        C_new[i] = C[i] + dt * (C_diffusion + C_decay + C_release)

    return C_new

# Set spatial and temporal discretization steps
dx = 0.01
dt = 0.001

t_start=5
t_end=15

# Set initial concentration
C = np.zeros(100)

# Solve PDE for release period
for t in range(t_start, t_end):
    C = point_source_pde(C, D, k, dx, dt, t, t_start, t_end)

# Solve PDE for 1000 time steps after the release period
for t in range(t_end, t_end+1000):
    C = point_source_pde(C, D, k, dx, dt, t, t_start, t_end)


问:
How to specify the features to forecast in a multivariate time series using Encoder-Decoder LSTM?
I am working on forecasting multi-steps of a multivariate time series using Encoder-Decoder Time Series. The forecasting is done autonomously i.e. each of the input feature is forecasted.
I want to specify the feature that will be forecasted without forecasting other features.
This is because I want to modify some of the features (like inject a set of different data) and make the prediction to see if the forecasting model is able to capture the data modified in a series to make the forecast of the other features (specified) accurately.
I am currently using keras framework for the implementation of the Enc-Dec LSTM. Below is the code snippet:

```<code>n_features = 8
n_steps_in, n_steps_out = 50, 100
model = Sequential()
model.add(LSTM(50, activation='relu', input_shape=(n_steps_in, n_features)))
model.add(RepeatVector(n_steps_out))
model.add(LSTM(50, activation-'relu', return_sequences=True))
model.add(TimeDistributed(Dense(n_features)))
model.compile(optimizer='adam', loss='mse')
train_history = model.fit(X, y,epochs=50, verbose=2, shuffle=False)
</code>```

Can someone help, please?

I have tried introducing another layer before the last layer and change the value of n_features in the last layer, but this only reflects the number of feature to forecast. The problem is I need to specify which feature I am forecasting and which on I am dropping from the predicting process.

model.add(TimeDistributed(Dense(50, activation='relu')))

Body:
I am working on forecasting multi-steps of a multivariate time series using Encoder-Decoder Time Series. The forecasting is done autonomously i.e. each of the input feature is forecasted.
I want to specify the feature that will be forecasted without forecasting other features.
This is because I want to modify some of the features (like inject a set of different data) and make the prediction to see if the forecasting model is able to capture the data modified in a series to make the forecast of the other features (specified) accurately.
I am currently using keras framework for the implementation of the Enc-Dec LSTM. Below is the code snippet:

n_features = 8
n_steps_in, n_steps_out = 50, 100
model = Sequential()
model.add(LSTM(50, activation='relu', input_shape=(n_steps_in, n_features)))
model.add(RepeatVector(n_steps_out))
model.add(LSTM(50, activation-'relu', return_sequences=True))
model.add(TimeDistributed(Dense(n_features)))
model.compile(optimizer='adam', loss='mse')
train_history = model.fit(X, y,epochs=50, verbose=2, shuffle=False)

Can someone help, please?

I have tried introducing another layer before the last layer and change the value of n_features in the last layer, but this only reflects the number of feature to forecast. The problem is I need to specify which feature I am forecasting and which on I am dropping from the predicting process.

model.add(TimeDistributed(Dense(50, activation='relu')))


问:
Getting CS0452 or CS0311 Error When Trying to Create BaseClass Derived From Another Base Class
In my project, there is already a base class named Business. But I can't change or modify this class as it's cannot-be-modified library class. So, I want to create a new class derived from this Business class but I get CS0452 (The type 'TEntity' must be a reference type in order to use it as parameter 'TEntity' in the generic type or method 'IBaseBusiness<TEntity>') or CS0311 (The type 'TEntity' cannot be used as type parameter 'TEntity' in the generic type or method 'IBaseBusiness<TEntity>'. There is no implicit reference conversion from 'TEntity' to 'TBMM.Framework.Data.Domain.IEntity'.) errors. I have tried every method I found in the Internet but I am still getting these two errors.

IEntityclass (Main Entity):

```<code>public interface IEntity
{
    Guid Id { get; }
}
</code>```

IBusinessclass (Main Interface which is retrieved from library):

```<code>public interface IBusiness<T> where T : class, IEntity
{}
</code>```

Businessclass (Main Business class which is retrieved from library):

```<code>public class Business<T> : IBusiness<T> where T : class, IEntity
{
    private readonly IRepository<T> _repository;

    public Business(IRepository<T> repository)
    {
        _repository = repository;
    }
}
</code>```

IBaseBusinessclass (The interface created by me, there is no problem happened here):

```<code>public interface IBaseBusiness<TEntity> : IBusiness<TEntity> where TEntity : class, IEntity
{}
</code>```

And finally, BaseBusiness class. I got two different error when trying to code. The first error is CS0311 error and I got this error when I identify TEntity as class as it's suggested everywhere:

```<code>public class BaseBusiness<TEntity> : Business<TEntity> where TEntity : class, IBaseBusiness<TEntity>
{
    private readonly IRepository<TEntity> _repository;

    public BaseBusiness(IRepository<TEntity> repository) : base(repository)
    {
        _repository = repository;
    }
}
</code>```

And the second error I got is CS0452. I got this error when I identify TEntity as IEntity to avoid getting CS0311 error.

I have tried other combinations but I have failed all the time. The created BaseBusiness doesn't have to be as I've written. All I want to do is creating a new base business class to write my common functions which is not included in Business class like CheckSomething() or GetEveryThingByOtherThing(OtherThing entity) for all my sub-busines classes.

Body:
In my project, there is already a base class named Business. But I can't change or modify this class as it's cannot-be-modified library class. So, I want to create a new class derived from this Business class but I get CS0452 (The type 'TEntity' must be a reference type in order to use it as parameter 'TEntity' in the generic type or method 'IBaseBusiness<TEntity>') or CS0311 (The type 'TEntity' cannot be used as type parameter 'TEntity' in the generic type or method 'IBaseBusiness<TEntity>'. There is no implicit reference conversion from 'TEntity' to 'TBMM.Framework.Data.Domain.IEntity'.) errors. I have tried every method I found in the Internet but I am still getting these two errors.

IEntityclass (Main Entity):

public interface IEntity
{
    Guid Id { get; }
}

IBusinessclass (Main Interface which is retrieved from library):

public interface IBusiness<T> where T : class, IEntity
{}

Businessclass (Main Business class which is retrieved from library):

public class Business<T> : IBusiness<T> where T : class, IEntity
{
    private readonly IRepository<T> _repository;

    public Business(IRepository<T> repository)
    {
        _repository = repository;
    }
}

IBaseBusinessclass (The interface created by me, there is no problem happened here):

public interface IBaseBusiness<TEntity> : IBusiness<TEntity> where TEntity : class, IEntity
{}

And finally, BaseBusiness class. I got two different error when trying to code. The first error is CS0311 error and I got this error when I identify TEntity as class as it's suggested everywhere:

public class BaseBusiness<TEntity> : Business<TEntity> where TEntity : class, IBaseBusiness<TEntity>
{
    private readonly IRepository<TEntity> _repository;

    public BaseBusiness(IRepository<TEntity> repository) : base(repository)
    {
        _repository = repository;
    }
}

And the second error I got is CS0452. I got this error when I identify TEntity as IEntity to avoid getting CS0311 error.

I have tried other combinations but I have failed all the time. The created BaseBusiness doesn't have to be as I've written. All I want to do is creating a new base business class to write my common functions which is not included in Business class like CheckSomething() or GetEveryThingByOtherThing(OtherThing entity) for all my sub-busines classes.


问:
Elastalert ignores the documents that are already processed/seen in previous overlapping query
From elastalert documentation, I found that by default elastalert ignores the documents that are already processed/seen in previous overlapping query.

'already seen' refers to documents that were already counted in a previous overlapping query and will be ignored

Is there any way to override this functionality? Or can someone point out what part of the code filters out these documents?


问:
TypeORM GetRelations() Remove hardcoded relations array
Currently in my services I am hardcoding relations needed for each Entity and if no relations are passed I am returning the specified hardcode relations.

Ideally I am looking for a way to avoid all the hardcoding and call a function which returns any relations in the Entity.

Does anybody know how I would go about creating such a function?


问:
Is it possible to execute query if where clause contains array and array does not contains any value?
```<code>SELECT ticket_list.ticket_id, ticket_list.ticket_contact_name,ticket_list.ticket_account_name, ticket_list.ticket_email, ticket_list.ticket_phone, ticket_list.ticket_subject, ticket_list.ticket_description, ticket_list.ticket_status, ticket_list.ticket_due_date, ticket_list.ticket_language, ticket_list.ticket_priority, ticket_list.ticket_channel, ticket_list.ticket_classification, ticket_list.ticket_addedtime, assign_ticket.agent_id, customer_list.CU_Comp_Name
from ticket_list
INNER JOIN assign_ticket ON ticket_list.ticket_id=assign_ticket.ticket_id
INNER JOIN customer_list ON ticket_list.ticket_account_name=customer_list.cu_user_email
WHERE ticket_list.ticket_status IN('Open')
  AND ticket_list.ticket_priority IN('Medium')
  AND ticket_list.ticket_channel IN('Phone')
  AND (customer_list.CU_Comp_Name IN('') OR customer_list.CU_Comp_Name IS NULL)
  AND assign_ticket.agent_id IN('Ag_5')
  AND ticket_list.deletion ='0'
  AND assign_ticket.deletion ='0'
  AND customer_list.Deletion='0'
</code>```

This is my query. I am able to run it if i include some string in customer_list.CU_Comp_Name but not able to run it with blank.

How to execute query if there is no value in array..

Body:
SELECT ticket_list.ticket_id, ticket_list.ticket_contact_name,ticket_list.ticket_account_name, ticket_list.ticket_email, ticket_list.ticket_phone, ticket_list.ticket_subject, ticket_list.ticket_description, ticket_list.ticket_status, ticket_list.ticket_due_date, ticket_list.ticket_language, ticket_list.ticket_priority, ticket_list.ticket_channel, ticket_list.ticket_classification, ticket_list.ticket_addedtime, assign_ticket.agent_id, customer_list.CU_Comp_Name
from ticket_list
INNER JOIN assign_ticket ON ticket_list.ticket_id=assign_ticket.ticket_id
INNER JOIN customer_list ON ticket_list.ticket_account_name=customer_list.cu_user_email
WHERE ticket_list.ticket_status IN('Open')
  AND ticket_list.ticket_priority IN('Medium')
  AND ticket_list.ticket_channel IN('Phone')
  AND (customer_list.CU_Comp_Name IN('') OR customer_list.CU_Comp_Name IS NULL)
  AND assign_ticket.agent_id IN('Ag_5')
  AND ticket_list.deletion ='0'
  AND assign_ticket.deletion ='0'
  AND customer_list.Deletion='0'

This is my query. I am able to run it if i include some string in customer_list.CU_Comp_Name but not able to run it with blank.

How to execute query if there is no value in array..


问:
Extract root level element from file path in Java
I want to extract the very first part from the file path, lets say

```<code>dev/sda/asset/
dev/sda/asset/media/
dev/sda/asset/media/trancodedvideo/
</code>```

I want to fetch the very first part from all the above paths i,e dev

I have snippet which only works for fixed set of path i,e 3 dev/sda/asset/

```<code>    public static String getRootKey(String key) {
        File f = new File(key);
        Path p = f.toPath();
        int pathElements = p.getNameCount();
        String rootKey = p.getName(pathElements - 3).toString(); // returns dev
        return rootKey;
    }
</code>```

I am looking for more robust solution more preferably in java 8+, because the above approach will be break if the there are hierarchy more than 3.

Please suggest

Body:
I want to extract the very first part from the file path, lets say

dev/sda/asset/
dev/sda/asset/media/
dev/sda/asset/media/trancodedvideo/

I want to fetch the very first part from all the above paths i,e dev

I have snippet which only works for fixed set of path i,e 3 dev/sda/asset/

    public static String getRootKey(String key) {
        File f = new File(key);
        Path p = f.toPath();
        int pathElements = p.getNameCount();
        String rootKey = p.getName(pathElements - 3).toString(); // returns dev
        return rootKey;
    }

I am looking for more robust solution more preferably in java 8+, because the above approach will be break if the there are hierarchy more than 3.

Please suggest


问:
How to resolve "org.eclipse.jetty.websocket.api.MessageTooLargeException" for Java WebSocketStompClient
When I'm running a Java WebSocketStompClient, I got below error:
org.eclipse.jetty.websocket.api.MessageTooLargeException: Text message size [73728] exceeds maximum size [65536]

Sample code:

```<code>import org.apache.log4j.Logger;
import org.springframework.messaging.simp.stomp.StompFrameHandler;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.web.socket.WebSocketHttpHeaders;
import org.springframework.web.socket.client.WebSocketClient;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.messaging.WebSocketStompClient;
import org.springframework.web.socket.sockjs.client.SockJsClient;
import org.springframework.web.socket.sockjs.client.Transport;
import org.springframework.web.socket.sockjs.client.WebSocketTransport;
import org.springframework.web.socket.sockjs.frame.Jackson2SockJsMessageCodec;

import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;

public class HelloClient {

    private static Logger logger = Logger.getLogger(HelloClient.class);

    StompSession session;

    private final static WebSocketHttpHeaders headers = new WebSocketHttpHeaders();

    public ListenableFuture<StompSession> connect() {

        Transport webSocketTransport = new WebSocketTransport(new StandardWebSocketClient());

        List<Transport> transports = Collections.singletonList(webSocketTransport);

        SockJsClient sockJsClient = new SockJsClient(transports);

        sockJsClient.setMessageCodec(new Jackson2SockJsMessageCodec());

        WebSocketStompClient stompClient = new WebSocketStompClient(sockJsClient);

        long[] hb = stompClient.getDefaultHeartbeat();
        boolean en = stompClient.isDefaultHeartbeatEnabled();
        long timeout = stompClient.getReceiptTimeLimit();

        String url = "https://www.test.com";
        return stompClient.connect(url, headers, new MyHandler());
    }

    public void subscribeMsg(StompSession stompSession) throws ExecutionException, InterruptedException {
        stompSession.subscribe("/topic/test", new StompFrameHandler() {
            public Type getPayloadType(StompHeaders stompHeaders) {
                return byte[].class;
            }

            public void handleFrame(StompHeaders stompHeaders, Object o) {
                logger.info("Received message " + new String((byte[]) o));
                String response = new String((byte[]) o);

            }
        });
    }

    private class MyHandler extends StompSessionHandlerAdapter {
        public void afterConnected(StompSession stompSession, StompHeaders stompHeaders) {
            logger.info("Now connected");
            session = stompSession;
        }
    }

    public boolean isConnected() {
        try {
            Thread.sleep(500);
            return session != null && session.isConnected();
        } catch (Exception e) {
            logger.warn("Error happens when checking connection status, ", e);
            return false;
        }
    }

    public static void main(String[] args) throws Exception {
        HelloClient helloClient = new HelloClient();

        ListenableFuture<StompSession> f = helloClient.connect();
        StompSession stompSession = f.get();
        helloClient.subscribeMsg(stompSession);

        while (true) {
            if (!helloClient.isConnected()) {
                logger.info("wss diconnected ");
                logger.info("need re-create ");
            }
        }
    }
}
</code>```

How to increase the limitation for a Java stomp websocket client? I found some not related answers  How can I set max buffer size for web socket client(Jetty) in Java which are not suitable for stomp websocket client.

Also tried stompClient.setInboundMessageSizeLimit(Integer.MAX_VALUE); which doesn't work.

Body:
When I'm running a Java WebSocketStompClient, I got below error:
org.eclipse.jetty.websocket.api.MessageTooLargeException: Text message size [73728] exceeds maximum size [65536]

Sample code:

import org.apache.log4j.Logger;
import org.springframework.messaging.simp.stomp.StompFrameHandler;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.web.socket.WebSocketHttpHeaders;
import org.springframework.web.socket.client.WebSocketClient;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.messaging.WebSocketStompClient;
import org.springframework.web.socket.sockjs.client.SockJsClient;
import org.springframework.web.socket.sockjs.client.Transport;
import org.springframework.web.socket.sockjs.client.WebSocketTransport;
import org.springframework.web.socket.sockjs.frame.Jackson2SockJsMessageCodec;

import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;

public class HelloClient {

    private static Logger logger = Logger.getLogger(HelloClient.class);

    StompSession session;

    private final static WebSocketHttpHeaders headers = new WebSocketHttpHeaders();

    public ListenableFuture<StompSession> connect() {

        Transport webSocketTransport = new WebSocketTransport(new StandardWebSocketClient());

        List<Transport> transports = Collections.singletonList(webSocketTransport);

        SockJsClient sockJsClient = new SockJsClient(transports);

        sockJsClient.setMessageCodec(new Jackson2SockJsMessageCodec());

        WebSocketStompClient stompClient = new WebSocketStompClient(sockJsClient);

        long[] hb = stompClient.getDefaultHeartbeat();
        boolean en = stompClient.isDefaultHeartbeatEnabled();
        long timeout = stompClient.getReceiptTimeLimit();

        String url = "https://www.test.com";
        return stompClient.connect(url, headers, new MyHandler());
    }

    public void subscribeMsg(StompSession stompSession) throws ExecutionException, InterruptedException {
        stompSession.subscribe("/topic/test", new StompFrameHandler() {
            public Type getPayloadType(StompHeaders stompHeaders) {
                return byte[].class;
            }

            public void handleFrame(StompHeaders stompHeaders, Object o) {
                logger.info("Received message " + new String((byte[]) o));
                String response = new String((byte[]) o);

            }
        });
    }

    private class MyHandler extends StompSessionHandlerAdapter {
        public void afterConnected(StompSession stompSession, StompHeaders stompHeaders) {
            logger.info("Now connected");
            session = stompSession;
        }
    }

    public boolean isConnected() {
        try {
            Thread.sleep(500);
            return session != null && session.isConnected();
        } catch (Exception e) {
            logger.warn("Error happens when checking connection status, ", e);
            return false;
        }
    }

    public static void main(String[] args) throws Exception {
        HelloClient helloClient = new HelloClient();

        ListenableFuture<StompSession> f = helloClient.connect();
        StompSession stompSession = f.get();
        helloClient.subscribeMsg(stompSession);

        while (true) {
            if (!helloClient.isConnected()) {
                logger.info("wss diconnected ");
                logger.info("need re-create ");
            }
        }
    }
}

How to increase the limitation for a Java stomp websocket client? I found some not related answers  How can I set max buffer size for web socket client(Jetty) in Java which are not suitable for stomp websocket client.

Also tried stompClient.setInboundMessageSizeLimit(Integer.MAX_VALUE); which doesn't work.


问:
Geopandas and Spyder incompability
I want to run modules of Geopandas in Spyder. Apparently Geopandas is compatible with Sypder 4.2.5, (not with any higher version) and I could run code with this combination. However, in one of my code I had to use "input" command and the problem starts there. Sypder 4.2.5 crashes if I try to run input command. From the internet, I came to know that there was a bug in spyder and it was fixed in Spyder 5.3. Now I have no idea how to fix this problem. If I upgrade Spyder, Geopandas will not work. If I don't upgrade spyder, 'input' will not work.

I was trying to run something like the following code

```<code>def Coditions_R3():
    print("This is R3")
def Coditions_R4():
    print("This is R4")

System = input('Please Enter drone system: \n' )
print(System)

if (System == 'R3'):
    Coditions_R3()

elif (System == 'R4'):
    Coditions_R4()
</code>```
```<code>Can anyone help? is there any way around to run geopandas with higher Spyder versions? or use something else in place of input?
</code>```

Title: Geopandas and Spyder incompability

Body:
I want to run modules of Geopandas in Spyder. Apparently Geopandas is compatible with Sypder 4.2.5, (not with any higher version) and I could run code with this combination. However, in one of my code I had to use "input" command and the problem starts there. Sypder 4.2.5 crashes if I try to run input command. From the internet, I came to know that there was a bug in spyder and it was fixed in Spyder 5.3. Now I have no idea how to fix this problem. If I upgrade Spyder, Geopandas will not work. If I don't upgrade spyder, 'input' will not work.

I was trying to run something like the following code

def Coditions_R3():
    print("This is R3")
def Coditions_R4():
    print("This is R4")

System = input('Please Enter drone system: \n' )
print(System)

if (System == 'R3'):
    Coditions_R3()

elif (System == 'R4'):
    Coditions_R4()

Can anyone help? is there any way around to run geopandas with higher Spyder versions? or use something else in place of input?


问:
How can I locally test cloud function invocation from third-party in Firebase?
I am developing an API for a third-party application not related to Firebase. This API consist of cloud functions to create and add users to database, retrieve user information and so on. These functions are created using the admin SDK. Example of a function that adds a user looks like this:

```<code>
export const getUser = functions.https.onRequest(async (req, res) => {
    res.set('Access-Control-Allow-Origin', '*');
    if (req.method === 'OPTIONS') {
        res.set('Access-Control-Allow-Headers', 'Content-Type');
        res.set('Access-Control-Max-Age', '3600');
        res.status(204).send('');
    } else {

        const utils = ethers.utils;
        const method = req.method;
        const body = req.body;
        const address = body.address;
        const userAddress = utils.getAddress(address);

        let logging = "received address: " + address + " checksum address: " + userAddress;
        let success = false;

        const db = admin.firestore();
        const collectionRef = db.collection('users');

        // Count all matching documents
        const query = collectionRef.where("userAddress", "==", userAddress);
        const snapshot = await query.get();

        // If no documents match, there is no matching user
        console.log(snapshot.docs.length);
        if (snapshot.docs.length != 1) {
            logging += "User does not exist in database.";
            res.send({success: success, logging: logging});
            return;
        }

        const data = snapshot.docs[0].data();

        if (data != undefined) {
            const createdAt = data.createdAt;
            const emailAddress = data.emailAddress;
            const userAddress = data.userAddress;
            const updatedAt = data.updatedAt;
            const userName = data.userName;
            success = true;

            res.send({success: success, createdAt: createdAt, emailAddress: emailAddress, userAddress: userAddress, updatedAt: updatedAt, userName: userName, logging: logging});
        }
    }
});
</code>```

NOTE: These functions are NOT going to be called by the third-party application users, only by the third-party application itself.

I am pretty new at programming so I understand that this may not be the best way to code this functionality and I'm greatful for any tips you might have here as well. Anyway, back to my question. I'm trying to mimic the way that my customer is going to invoke these functions. So to test it, I'm using the following code:

```<code>function runGetUser() {
    // test values
    const address = 'myMetaMaskWalletAddress';
    axios({
        method: 'POST',
        url: 'http://127.0.0.1:5001/cloud-functions/us-central1/user-getUser',
        data: { "address": address },
    }).then((response) => {
        console.log(response.data);
    }).catch((error) => {
      console.log(error);
    });
};
</code>```

This works fine. However, I do not want anyone to be able to invoke these functions when I actually deploy them later. So I have been reading Firebase docs and googling on how to setup proper authentication and authorization measures. What I have found is setting up a service account and using gcloud CLI to download credentials and then invoke the functions with these credentials set. Is there not a way that I could configure this so that I query my API for an authorization token (from the file where the axios request is) that I then put in the axios request and then invoke the function with this? How do I do this in that case? Right now also, since I'm testing locally, on the "cloud function server-side" as you can see in my cloud function example, I'm allowing all requests. How do I filter here so that only the axios request with the proper authorization token/(header?) is authorized to invoke this function?

Thank you for taking the time to read this. Best regards,

Aliz

I tried following the instructions on this page: https://cloud.google.com/functions/docs/securing/authenticating#gcloud where I tried to just invoke the functions from the Gcloud CLI. I followed the instructions and ran the command "gcloud auth login --update-adc", and got the response: "Application default credentials (ADC) were updated." Then I tried to invoke a function I have "helloWorld" to just see that it works with the following command: curl  -H "Authorization: bearer $(gcloud auth print-identity-token)" \http://127.0.0.1:5001/cloud-functions/us-central1/helloWorld", and I got the following response: "curl: (3) URL using bad/illegal format or missing URL". So I don't know what to do more.

Body:
I am developing an API for a third-party application not related to Firebase. This API consist of cloud functions to create and add users to database, retrieve user information and so on. These functions are created using the admin SDK. Example of a function that adds a user looks like this:

export const getUser = functions.https.onRequest(async (req, res) => {
    res.set('Access-Control-Allow-Origin', '*');
    if (req.method === 'OPTIONS') {
        res.set('Access-Control-Allow-Headers', 'Content-Type');
        res.set('Access-Control-Max-Age', '3600');
        res.status(204).send('');
    } else {

        const utils = ethers.utils;
        const method = req.method;
        const body = req.body;
        const address = body.address;
        const userAddress = utils.getAddress(address);

        let logging = "received address: " + address + " checksum address: " + userAddress;
        let success = false;

        const db = admin.firestore();
        const collectionRef = db.collection('users');

        // Count all matching documents
        const query = collectionRef.where("userAddress", "==", userAddress);
        const snapshot = await query.get();

        // If no documents match, there is no matching user
        console.log(snapshot.docs.length);
        if (snapshot.docs.length != 1) {
            logging += "User does not exist in database.";
            res.send({success: success, logging: logging});
            return;
        }

        const data = snapshot.docs[0].data();

        if (data != undefined) {
            const createdAt = data.createdAt;
            const emailAddress = data.emailAddress;
            const userAddress = data.userAddress;
            const updatedAt = data.updatedAt;
            const userName = data.userName;
            success = true;

            res.send({success: success, createdAt: createdAt, emailAddress: emailAddress, userAddress: userAddress, updatedAt: updatedAt, userName: userName, logging: logging});
        }
    }
});

NOTE: These functions are NOT going to be called by the third-party application users, only by the third-party application itself.

I am pretty new at programming so I understand that this may not be the best way to code this functionality and I'm greatful for any tips you might have here as well. Anyway, back to my question. I'm trying to mimic the way that my customer is going to invoke these functions. So to test it, I'm using the following code:

function runGetUser() {
    // test values
    const address = 'myMetaMaskWalletAddress';
    axios({
        method: 'POST',
        url: 'http://127.0.0.1:5001/cloud-functions/us-central1/user-getUser',
        data: { "address": address },
    }).then((response) => {
        console.log(response.data);
    }).catch((error) => {
      console.log(error);
    });
};

This works fine. However, I do not want anyone to be able to invoke these functions when I actually deploy them later. So I have been reading Firebase docs and googling on how to setup proper authentication and authorization measures. What I have found is setting up a service account and using gcloud CLI to download credentials and then invoke the functions with these credentials set. Is there not a way that I could configure this so that I query my API for an authorization token (from the file where the axios request is) that I then put in the axios request and then invoke the function with this? How do I do this in that case? Right now also, since I'm testing locally, on the "cloud function server-side" as you can see in my cloud function example, I'm allowing all requests. How do I filter here so that only the axios request with the proper authorization token/(header?) is authorized to invoke this function?

Thank you for taking the time to read this. Best regards,

Aliz

I tried following the instructions on this page: https://cloud.google.com/functions/docs/securing/authenticating#gcloud where I tried to just invoke the functions from the Gcloud CLI. I followed the instructions and ran the command "gcloud auth login --update-adc", and got the response: "Application default credentials (ADC) were updated." Then I tried to invoke a function I have "helloWorld" to just see that it works with the following command: curl  -H "Authorization: bearer $(gcloud auth print-identity-token)" \http://127.0.0.1:5001/cloud-functions/us-central1/helloWorld", and I got the following response: "curl: (3) URL using bad/illegal format or missing URL". So I don't know what to do more.


问:
BATS test helpers can't be loaded in orb
I'm have a custom orb, and for testing shell scripts I'm using bats orb.

I'm including helpers into my test like in their tutorial.

Here is my orb test job

```<code>  - bats/run:
      formatter: junit
      path: ./src/tests
      timing: true
</code>```

And here is my src/tests/utils.bats

```<code>#!/usr/bin/env bats

setup() {
    load "test_helper/bats-assert/load"

    source "./src/scripts/utils.sh"
}

# 1 Should load file when
@test "1.1: config file given, required tag missing " {
    mkdir -p "/home/circleci/"
    touch "/home/circleci/.test.utils.config "
    config_file="/home/circleci/.test.utils.config"

    echo "NEW_PARAMETER=value" > $config_file

    SourceParameters "${config_file}"

    assert_equal "${NEW_PARAMETER}" "value" # Check for no exit error
}
</code>```

And here is error that I get in cirleci

Body:
I'm have a custom orb, and for testing shell scripts I'm using bats orb.

I'm including helpers into my test like in their tutorial.

Here is my orb test job

  - bats/run:
      formatter: junit
      path: ./src/tests
      timing: true

And here is my src/tests/utils.bats

#!/usr/bin/env bats

setup() {
    load "test_helper/bats-assert/load"

    source "./src/scripts/utils.sh"
}

# 1 Should load file when
@test "1.1: config file given, required tag missing " {
    mkdir -p "/home/circleci/"
    touch "/home/circleci/.test.utils.config "
    config_file="/home/circleci/.test.utils.config"

    echo "NEW_PARAMETER=value" > $config_file

    SourceParameters "${config_file}"

    assert_equal "${NEW_PARAMETER}" "value" # Check for no exit error
}

And here is error that I get in cirleci


问:
React-Native Keyboard not closing problem on Android. How can ı fix this
React-Native Android On the add program page, when I first click on typing and then the clock, the keyboard does not close.

```<code>        <CustomInput3
              maxLength={50}
              value={content}
              onChangeTextUpperCase={text => setContent(text)}
              placeholder="Adı"
            />
</code>```

how can ı fix this?

Body:
React-Native Android On the add program page, when I first click on typing and then the clock, the keyboard does not close.

        <CustomInput3
              maxLength={50}
              value={content}
              onChangeTextUpperCase={text => setContent(text)}
              placeholder="Adı"
            />

how can ı fix this?


问:
My Android library is causing duplicate meta-inf files to be generated
I'm writing a library to be consumed by an app at work.

When I import the library tot he app, the build fails with:

2 files found with path 'META-INF/DEPENDENCIES'.

I don't want my library to force the consuming app to have to write this in the build.gradle:

```<code>    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
</code>```

Because that seems like my library isn't configured correctly (i.e. why should the consuming app need to do this, surely this is something that should be dealt with in the library not the consuming app...)

I've tried setting my libraries module name to something super unique in the kotlinOptions:

```<code>    kotlinOptions {
        jvmTarget = '1.8'
        moduleName = "com.mylibrary.superuniquename"
    }
</code>```

But it is still causing the issue.

Internet searches just show the same answer over and over - the consuming app should add packagingOptions to deal with this, but to me that just seems incorrect. Many Android libraries do not require this, so why should mine?

Body:
I'm writing a library to be consumed by an app at work.

When I import the library tot he app, the build fails with:

2 files found with path 'META-INF/DEPENDENCIES'.

I don't want my library to force the consuming app to have to write this in the build.gradle:

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }

Because that seems like my library isn't configured correctly (i.e. why should the consuming app need to do this, surely this is something that should be dealt with in the library not the consuming app...)

I've tried setting my libraries module name to something super unique in the kotlinOptions:

    kotlinOptions {
        jvmTarget = '1.8'
        moduleName = "com.mylibrary.superuniquename"
    }

But it is still causing the issue.

Internet searches just show the same answer over and over - the consuming app should add packagingOptions to deal with this, but to me that just seems incorrect. Many Android libraries do not require this, so why should mine?


问:
Another Python not working in cron question
Directory: path/to/test

tree:

```<code>.
├── Pipfile
├── test.py
├── test.sh
└── test.txt
</code>```

test.py:

#!/usr/bin/env python3

import datetime

with open("/path/to/test/test.txt", "a") as f:
    f.write(f"{datetime.datetime.now()}\n")

```
<p><code>test.sh</code>:</p>
```#!/bin/zsh

pipenv run python /Users/ayubkeshtmand/Downloads/test/test.py
```
<p><code>crontab -l</code>:</p>
<pre class="lang-bash prettyprint-override"><code>SHELL=/bin/zsh
PATH=/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/python3:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin

* * * * * env > /tmp/env.output                   # works
* * * * * touch /path/to/anothertest.txt          # works
* * * * * python /path/to/test/test.py            # doesn't work
* * * * * python3 /path/to/test/test.py           # doesn't work
* * * * * pipenv run python /path/to/test/test.py # doesn't work
* * * * * zsh /path/to/test/test.sh               # doesn't work
* * * * * /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 /path/to/test/test.py # doesn't work
* * * * * bash -l -c "python /path/to/test.py"    # doesn't work
* * * * * bash -l -c "pipenv run python /path/to/test.py"    # doesn't work
</code>```

/tmp/env.output:

```<code>SHELL=/bin/zsh
PATH=/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/python3:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin
LOGNAME=myusername
USER=myusername
HOME=/path/to
SHLVL=0
PWD=/path/to
OLDPWD=/path/to
_=/usr/bin/env
</code>```

env in regular terminal:

```<code>USER=myusername
MallocNanoZone=0
__CFBundleIdentifier=com.microsoft.VSCode
COMMAND_MODE=unix2003
LOGNAME=myusername
PATH=/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/python3:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.RyAiUT08FA/Listeners
SHELL=/bin/zsh
HOME=/path/to
__CF_USER_TEXT_ENCODING=0x1F6:0:2
TMPDIR=/var/folders/64/wd951s6x3pz3ytpq1wjz5n180000gp/T/
XPC_SERVICE_NAME=0
XPC_FLAGS=0x0
ORIGINAL_XDG_CURRENT_DESKTOP=undefined
SHLVL=1
PWD=/path/to
OLDPWD=/path/to
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
MANPATH=/opt/homebrew/share/man:/usr/share/man:/usr/local/share/man:/opt/homebrew/share/man:
INFOPATH=/opt/homebrew/share/info:/opt/homebrew/share/info:
GITHUB_TOKEN=fwlkehjgowih4t089240btonglkwenkjbalfihoi283
TERM_PROGRAM=vscode
TERM_PROGRAM_VERSION=1.74.1
LANG=en_GB.UTF-8
COLORTERM=truecolor
GIT_ASKPASS=/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh
VSCODE_GIT_ASKPASS_NODE=/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper
VSCODE_GIT_ASKPASS_EXTRA_ARGS=--ms-enable-electron-run-as-node
VSCODE_GIT_ASKPASS_MAIN=/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js
VSCODE_GIT_IPC_HANDLE=/var/folders/64/gowiehg92834hbgobwkgjegp/T/vscode-git-45fnwiuheg284.sock
VSCODE_INJECTION=1
ZDOTDIR=/path/to
USER_ZDOTDIR=/path/to
TERM=xterm-256color
PS1=%n@%m %1~ %#
_=/usr/bin/env
</code>```

No logs in /var/logs and no mail outputted...searched everywhere online nothing works!

Body:
Directory: path/to/test

tree:

.
├── Pipfile
├── test.py
├── test.sh
└── test.txt

test.py:

#!/usr/bin/env python3

import datetime

with open("/path/to/test/test.txt", "a") as f:
    f.write(f"{datetime.datetime.now()}\n")

test.sh:

#!/bin/zsh

pipenv run python /Users/ayubkeshtmand/Downloads/test/test.py

crontab -l:

SHELL=/bin/zsh
PATH=/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/python3:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin

* * * * * env > /tmp/env.output                   # works
* * * * * touch /path/to/anothertest.txt          # works
* * * * * python /path/to/test/test.py            # doesn't work
* * * * * python3 /path/to/test/test.py           # doesn't work
* * * * * pipenv run python /path/to/test/test.py # doesn't work
* * * * * zsh /path/to/test/test.sh               # doesn't work
* * * * * /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 /path/to/test/test.py # doesn't work
* * * * * bash -l -c "python /path/to/test.py"    # doesn't work
* * * * * bash -l -c "pipenv run python /path/to/test.py"    # doesn't work

/tmp/env.output:

SHELL=/bin/zsh
PATH=/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/python3:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin
LOGNAME=myusername
USER=myusername
HOME=/path/to
SHLVL=0
PWD=/path/to
OLDPWD=/path/to
_=/usr/bin/env

env in regular terminal:

USER=myusername
MallocNanoZone=0
__CFBundleIdentifier=com.microsoft.VSCode
COMMAND_MODE=unix2003
LOGNAME=myusername
PATH=/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/python3:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.RyAiUT08FA/Listeners
SHELL=/bin/zsh
HOME=/path/to
__CF_USER_TEXT_ENCODING=0x1F6:0:2
TMPDIR=/var/folders/64/wd951s6x3pz3ytpq1wjz5n180000gp/T/
XPC_SERVICE_NAME=0
XPC_FLAGS=0x0
ORIGINAL_XDG_CURRENT_DESKTOP=undefined
SHLVL=1
PWD=/path/to
OLDPWD=/path/to
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
MANPATH=/opt/homebrew/share/man:/usr/share/man:/usr/local/share/man:/opt/homebrew/share/man:
INFOPATH=/opt/homebrew/share/info:/opt/homebrew/share/info:
GITHUB_TOKEN=fwlkehjgowih4t089240btonglkwenkjbalfihoi283
TERM_PROGRAM=vscode
TERM_PROGRAM_VERSION=1.74.1
LANG=en_GB.UTF-8
COLORTERM=truecolor
GIT_ASKPASS=/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh
VSCODE_GIT_ASKPASS_NODE=/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper
VSCODE_GIT_ASKPASS_EXTRA_ARGS=--ms-enable-electron-run-as-node
VSCODE_GIT_ASKPASS_MAIN=/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js
VSCODE_GIT_IPC_HANDLE=/var/folders/64/gowiehg92834hbgobwkgjegp/T/vscode-git-45fnwiuheg284.sock
VSCODE_INJECTION=1
ZDOTDIR=/path/to
USER_ZDOTDIR=/path/to
TERM=xterm-256color
PS1=%n@%m %1~ %#
_=/usr/bin/env

No logs in /var/logs and no mail outputted...searched everywhere online nothing works!


问:
How to construct a for loop which checks each level of a DataFrame multi-index before creating the output
I am analysing car sales and have 120 different car types sold over the last 5 years. Some were sold 5 years ago (so i have 1,825 days of data for them), and some I only have data that covers the last few days. I want to create three columns to append to a DataFrame which tells me the number of cars sold after 7 days, 30 days, and 365 days. The issue is sometimes day 7, 30, or 365 falls on a day when i have no data, so for day 7 sales I need to take 7 + 1 (or 2, or 3) days to get a sales value. Maybe the value does not exist so I want to leave that field blank. I only want one value per car for each day category but my current approach doesn't address that. Here is an example of the DataFrame (called car_data). Note that the Car and Day columns are the MultiIndex.

Car
Day
Number Sold
Value

Car 1
6
50
750,000

Car 1
7
65
975,000

Car 2
6
100
3,500,000

Car 2
8
120
4,200,000

Car 2
9
140
4,900,000

I have a unique list of all the cars (called car_list) but there are a couple of cars in car_list that do not appear in car_data.

My current attempt creates a list of lists with Car, Number Sold, and Value, which I then merge back to the car_data DataFrame. The loop to create the data for day 7  is as follows:

```<code>day7 = []
for car, day in car_list, np.arange(3):
    if car_data.index.get_level_values(0).str.contains(car) == True and car_data.index.get_level_values(1) == 7 + day:
        car = car
        day = 7 + day
        sales = car_data.loc[(car, day), 'Number Sold']
        value = car_data.loc[(car, day), 'Value']
        temp_list = [car, day, sales, value]
        day7.append(temp_list)
    else:
        continue
</code>```

This produces the following error:

```<code>ValueError: too many values to unpack (expected 2)
</code>```

The desired output is:

Car
Day
Number Sold
Value

Car 1
7
65
975,000

Car 2
8
120
4,200,000

Can anyone help on how to get the loop working, or to do this task more efficiently?

Body:
I am analysing car sales and have 120 different car types sold over the last 5 years. Some were sold 5 years ago (so i have 1,825 days of data for them), and some I only have data that covers the last few days. I want to create three columns to append to a DataFrame which tells me the number of cars sold after 7 days, 30 days, and 365 days. The issue is sometimes day 7, 30, or 365 falls on a day when i have no data, so for day 7 sales I need to take 7 + 1 (or 2, or 3) days to get a sales value. Maybe the value does not exist so I want to leave that field blank. I only want one value per car for each day category but my current approach doesn't address that. Here is an example of the DataFrame (called car_data). Note that the Car and Day columns are the MultiIndex.

Car
Day
Number Sold
Value

Car 1
6
50
750,000

Car 1
7
65
975,000

Car 2
6
100
3,500,000

Car 2
8
120
4,200,000

Car 2
9
140
4,900,000

I have a unique list of all the cars (called car_list) but there are a couple of cars in car_list that do not appear in car_data.

My current attempt creates a list of lists with Car, Number Sold, and Value, which I then merge back to the car_data DataFrame. The loop to create the data for day 7  is as follows:

day7 = []
for car, day in car_list, np.arange(3):
    if car_data.index.get_level_values(0).str.contains(car) == True and car_data.index.get_level_values(1) == 7 + day:
        car = car
        day = 7 + day
        sales = car_data.loc[(car, day), 'Number Sold']
        value = car_data.loc[(car, day), 'Value']
        temp_list = [car, day, sales, value]
        day7.append(temp_list)
    else:
        continue

This produces the following error:

ValueError: too many values to unpack (expected 2)

The desired output is:

Car
Day
Number Sold
Value

Car 1
7
65
975,000

Car 2
8
120
4,200,000

Can anyone help on how to get the loop working, or to do this task more efficiently?


问:
Download data using streamstats R package
I am trying to download the computed basin statistics of a watershed using the computeChars function of the streamstats package of R. The package use the API of the StreamStats service https://streamstats.usgs.gov/docs/streamstatsservices/#/

I am running the following code:

```<code>ws1_par <- computeChars(workspaceID = "VT20221216112716824000", rcode = "VT", includeparameters = "true")
</code>```

obtaining the following output:

```<code>> ws1_par
$parameters
  ID                               name
1  0                          CENTROIDX
2  0                          CENTROIDY
3  0                      Drainage Area
4  0  Percentage of Basin Above 1200 ft
5  0      Percent Storage from NLCD2006
6  0                            OUTLETX
7  0                            OUTLETY
8  0 Mean Annual Precip PRISM 1981 2010
                                                            description       code         unit
1     Basin centroid horizontal (x) location in state plane coordinates  CENTROIDX       meters
2             Basin centroid vertical (y) location in state plane units  CENTROIDY       meters
3                               Area that drains to a point on a stream    DRNAREA square miles
4                     Percentage of basin at or above 1200 ft elevation     EL1200      percent
5 Percentage of water bodies and wetlands determined from the NLCD 2006   LC06STOR      percent
6       Basin outlet horizontal (x) location in state plane coordinates    OUTLETX         feet
7         Basin outlet vertical (y) location in state plane coordinates    OUTLETY         feet
8   Basin average mean annual precipitation for 1981 to 2010 from PRISM PRECPRIS10       inches

$messages
$messages[[1]]
[1] "xmlcount:8"

$messages[[2]]
[1] "From ApFields"

$messages[[3]]
[1] "count: 8"

$messages[[4]]
[1] "DB return count: 8"

attr(,"url")
[1] "https://streamstats.usgs.gov/streamstatsservices/parameters.json?rcode=VT&workspaceID=VT20221216112716824000&includeparameters=true"
</code>```

I got the basin characteristics available, but how is possible to get their values using this package?

Body:
I am trying to download the computed basin statistics of a watershed using the computeChars function of the streamstats package of R. The package use the API of the StreamStats service https://streamstats.usgs.gov/docs/streamstatsservices/#/

I am running the following code:

ws1_par <- computeChars(workspaceID = "VT20221216112716824000", rcode = "VT", includeparameters = "true")

obtaining the following output:

> ws1_par
$parameters
  ID                               name
1  0                          CENTROIDX
2  0                          CENTROIDY
3  0                      Drainage Area
4  0  Percentage of Basin Above 1200 ft
5  0      Percent Storage from NLCD2006
6  0                            OUTLETX
7  0                            OUTLETY
8  0 Mean Annual Precip PRISM 1981 2010
                                                            description       code         unit
1     Basin centroid horizontal (x) location in state plane coordinates  CENTROIDX       meters
2             Basin centroid vertical (y) location in state plane units  CENTROIDY       meters
3                               Area that drains to a point on a stream    DRNAREA square miles
4                     Percentage of basin at or above 1200 ft elevation     EL1200      percent
5 Percentage of water bodies and wetlands determined from the NLCD 2006   LC06STOR      percent
6       Basin outlet horizontal (x) location in state plane coordinates    OUTLETX         feet
7         Basin outlet vertical (y) location in state plane coordinates    OUTLETY         feet
8   Basin average mean annual precipitation for 1981 to 2010 from PRISM PRECPRIS10       inches

$messages
$messages[[1]]
[1] "xmlcount:8"

$messages[[2]]
[1] "From ApFields"

$messages[[3]]
[1] "count: 8"

$messages[[4]]
[1] "DB return count: 8"

attr(,"url")
[1] "https://streamstats.usgs.gov/streamstatsservices/parameters.json?rcode=VT&workspaceID=VT20221216112716824000&includeparameters=true"

I got the basin characteristics available, but how is possible to get their values using this package?


问:
Autodesk Ravit Integration with Jenkins
how can we integrate Autodesk Ravit with Jenkins.

Expecting automate Autodesk data with Jenkins use. so can we try Jenkins Webhook for this puprpose?

Title: Autodesk Ravit Integration with Jenkins