问:
com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException
I have an application where i'm trying to upload recorded call into google drive folder , but when the code is launched and executed , it throws ax exception that i need remote access consent , i have look up few solutions but did not find anything to help with my issue , if anyone can help me and thank you in advance for that .

This is the code

```<code>
    private void uploadToGoogleDrive(Context context) {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    File tempFile = new File(Environment.getExternalStorageDirectory().toString() + "/Recordings/");
                    String filePath = tempFile + "/100" + ".3gp";
                    if(getDriveService(context) != null){
                        Drive drive = getDriveService(context);
                        File directoryFile = new File(filePath);
                        com.google.api.services.drive.model.File googleDriveFile = new com.google.api.services.drive.model.File();
                        googleDriveFile.setName("Recordings");
                        FileContent fileContent = new FileContent("audio/3gp", directoryFile);

                        assert drive != null;
                        drive.files().create(googleDriveFile, fileContent).execute();
                    }
                } catch (IOException e) {
                    Log.d("TAG","Current Exception " + e.getMessage());
                }
            }
        });
        thread.start();
    }

</code>```

This is the exception throw

Body:
I have an application where i'm trying to upload recorded call into google drive folder , but when the code is launched and executed , it throws ax exception that i need remote access consent , i have look up few solutions but did not find anything to help with my issue , if anyone can help me and thank you in advance for that .

This is the code

    private void uploadToGoogleDrive(Context context) {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    File tempFile = new File(Environment.getExternalStorageDirectory().toString() + "/Recordings/");
                    String filePath = tempFile + "/100" + ".3gp";
                    if(getDriveService(context) != null){
                        Drive drive = getDriveService(context);
                        File directoryFile = new File(filePath);
                        com.google.api.services.drive.model.File googleDriveFile = new com.google.api.services.drive.model.File();
                        googleDriveFile.setName("Recordings");
                        FileContent fileContent = new FileContent("audio/3gp", directoryFile);

                        assert drive != null;
                        drive.files().create(googleDriveFile, fileContent).execute();
                    }
                } catch (IOException e) {
                    Log.d("TAG","Current Exception " + e.getMessage());
                }
            }
        });
        thread.start();
    }

This is the exception throw


来源: stackexchange

问:
How to allow memoization for jobs defined from Dagster assets
I would like to use Memoization for jobs that I am defining from AssetsDefinitions with define_asset_job.

The problem is: define_asset_job does not allow me to set-up a version_strategy.

How can I accomplish this, is there a different way to define jobs from assets which allow me to set up a version_strategy?

ContentLicense: CC BY-SA 4.0


问:
How to model *two* OnetoMany relationships to the same child Model/Entity with quarkus panache?
I have a parent class a TeamModel that references an (unsorted) set of admins and members. Admins and members are both of type UserModel.

TeamModel.java

```<code>class TeamModel extends PanacheEntity {
@OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)  // when a team is loaded also load its admins
  /** Admins of this team */
  @OneToMany
  public Set<UserModel> admins = new HashSet<>();

  /** Members of this team */
  @OneToMany
  public Set<UserModel> members = new HashSet<>();

}
</code>```

UserModel.java

```<code>public class UserModel extends PanacheEntity {
  public String name;

  @NotNull
  @Column(unique = true)
  public String email;
}
</code>```

I have set ´quarkus.hibernate-orm.database.generation=drop-and-create`

What I would expect panache to model is two tables for the two 1:n relationships. teams_admins and teams_users. But what it actually does is

```<code>CREATE TABLE public.teams_users (
    teammodel_id int8 NOT NULL,
    members_id int8 NOT NULL,
    admins_id int8 NOT NULL,
    CONSTRAINT teams_users_pkey PRIMARY KEY (teammodel_id, admins_id),
    CONSTRAINT uk_12a1kue8qf1fxb9yebb61i16c UNIQUE (members_id),
    CONSTRAINT uk_5r90pre4tl76l1rdxbt2pxm9d UNIQUE (admins_id)
);
</code>```

How can I make it create two tables. One for each relation?

Body:
I have a parent class a TeamModel that references an (unsorted) set of admins and members. Admins and members are both of type UserModel.

TeamModel.java

class TeamModel extends PanacheEntity {
@OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)  // when a team is loaded also load its admins
  /** Admins of this team */
  @OneToMany
  public Set<UserModel> admins = new HashSet<>();

  /** Members of this team */
  @OneToMany
  public Set<UserModel> members = new HashSet<>();

}

UserModel.java

public class UserModel extends PanacheEntity {
  public String name;

  @NotNull
  @Column(unique = true)
  public String email;
}

I have set ´quarkus.hibernate-orm.database.generation=drop-and-create`

What I would expect panache to model is two tables for the two 1:n relationships. teams_admins and teams_users. But what it actually does is

CREATE TABLE public.teams_users (
    teammodel_id int8 NOT NULL,
    members_id int8 NOT NULL,
    admins_id int8 NOT NULL,
    CONSTRAINT teams_users_pkey PRIMARY KEY (teammodel_id, admins_id),
    CONSTRAINT uk_12a1kue8qf1fxb9yebb61i16c UNIQUE (members_id),
    CONSTRAINT uk_5r90pre4tl76l1rdxbt2pxm9d UNIQUE (admins_id)
);

How can I make it create two tables. One for each relation?


问:
Accessing a Shared Google Drive Directory in Colab
How do I access a publicly shared google drive directory in Colab? One option is to:

Go to Shared with Me

Right click on the directory and select Add a shortcut to drive

Access the directory the normal way in Colab, inside /content/drive/My Drive/

```<code>from google.colab import drive
drive.mount('/content/drive')
</code>```

But this has the disadvantage that every user who accesses a notebook I share with them has to go through this process. Any way making this simpler?

Body:
How do I access a publicly shared google drive directory in Colab? One option is to:

Go to Shared with Me

Right click on the directory and select Add a shortcut to drive

Access the directory the normal way in Colab, inside /content/drive/My Drive/

from google.colab import drive
drive.mount('/content/drive')

But this has the disadvantage that every user who accesses a notebook I share with them has to go through this process. Any way making this simpler?


问:
Is there a processor to convert prometheus data types?
I admit this may be a bit of a stupid question, however, we're in a bit of a pickle. Essentially, we have a paid web-based application that hosts (what they claim to be) prometheus metrics. There are two metrics that are measuring the number of objects stored in the application database. OpenMetrics principles indicate that this should be a Gauge but the application developers chose to report them as Counters instead. The problem is that, when ingesting these metrics, the values are being recorded as zeroes because our Observability solution treats all counters as deltas (e.g., they don't support cummulative counters). As such, we're in a position where we aren't able to accurately measure these metrics because of downfalls with two different pieces of software that we can't control.

So the question is, does a processor exist that will let us change the type of our metric from Counter to Gauge?

I've found examples for converting numeric data types and changing labels, metric names, etc. but nothing regarding changing the actual metric type.


问:
Setting spans "on-the-go" in EditText using TextWatcher
I want to set spans while user is typing. I have configured interface for choosing which span to apply, but I'm having problems with spans setting.

When I'm setting span on the whole word it works properly, but I can't remove text style by putting on it StyleSpan(NORMAL).

For some strange reasons inserting raw text between two words written with some span makes it "spanned" too.

Inserting long WORDS makes app work so slow that it's not possible to type

I have checked with debugger so I can say that viewModel works properly

Is it possible to solve this bugs still using spans?

```<code>class TextEditor(private val activity: AppCompatActivity) : TextWatcher {
    private var _ignore = true
    private var _backspace = true
    private var inputtedStart = 0
    private var inputtedEnd = 0
    private var inputtedBefore = 0

    val viewModel: TextEditorViewModel =
        ViewModelProvider(activity)[TextEditorViewModel::class.java]

    override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit

    override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
        //checking if some text was deleted not inserted
        _backspace = before <= count
        inputtedStart = start
        inputtedBefore = before
        inputtedEnd = inputtedStart + count
    }

    override fun afterTextChanged(s: Editable) {
        if (_ignore && _backspace) {
            _ignore = false
            if (viewModel.bold && viewModel.italic) {
                s.setSpan(StyleSpan(Typeface.BOLD_ITALIC),
                    inputtedStart,
                    inputtedEnd,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
            } else {
                s.setSpan(StyleSpan(Typeface.NORMAL),
                    inputtedStart,
                    inputtedEnd,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
            }
            if (viewModel.bold) {
                s.setSpan(StyleSpan(Typeface.BOLD),
                    inputtedStart,
                    inputtedEnd,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
            }
            if (viewModel.italic) {
                s.setSpan(StyleSpan(Typeface.ITALIC),
                    inputtedStart,
                    inputtedEnd,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
            }
            _ignore = true
        }
    }
}
</code>```

Body:
I want to set spans while user is typing. I have configured interface for choosing which span to apply, but I'm having problems with spans setting.

When I'm setting span on the whole word it works properly, but I can't remove text style by putting on it StyleSpan(NORMAL).

For some strange reasons inserting raw text between two words written with some span makes it "spanned" too.

Inserting long WORDS makes app work so slow that it's not possible to type

I have checked with debugger so I can say that viewModel works properly

Is it possible to solve this bugs still using spans?

class TextEditor(private val activity: AppCompatActivity) : TextWatcher {
    private var _ignore = true
    private var _backspace = true
    private var inputtedStart = 0
    private var inputtedEnd = 0
    private var inputtedBefore = 0

    val viewModel: TextEditorViewModel =
        ViewModelProvider(activity)[TextEditorViewModel::class.java]

    override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit

    override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
        //checking if some text was deleted not inserted
        _backspace = before <= count
        inputtedStart = start
        inputtedBefore = before
        inputtedEnd = inputtedStart + count
    }

    override fun afterTextChanged(s: Editable) {
        if (_ignore && _backspace) {
            _ignore = false
            if (viewModel.bold && viewModel.italic) {
                s.setSpan(StyleSpan(Typeface.BOLD_ITALIC),
                    inputtedStart,
                    inputtedEnd,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
            } else {
                s.setSpan(StyleSpan(Typeface.NORMAL),
                    inputtedStart,
                    inputtedEnd,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
            }
            if (viewModel.bold) {
                s.setSpan(StyleSpan(Typeface.BOLD),
                    inputtedStart,
                    inputtedEnd,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
            }
            if (viewModel.italic) {
                s.setSpan(StyleSpan(Typeface.ITALIC),
                    inputtedStart,
                    inputtedEnd,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
            }
            _ignore = true
        }
    }
}


问:
SendGrid max string length with ellipsis
I need to truncate a string in my email, say if more than 80 characters and add ellipses, "..."

I've looked at docs and Googled and it seems JS scripts in emails (SendGrid dynamic template to be exact)are disabled - potential security threat?

Anyway, is there any clever "handlebar" or function, trick to apply ellipses on multilines.

I have tried CSS, but works only on one liners :(


问:
Modify void method to get txt file in main
How can i modify a void method that contains System.out.print so that I can write on txt file with PrintWriter in a main method?

I get error void type not allowed here.(PrintWriter)


问:
'URL-safe CSRF tokens are now the default. Use 6.1 defaults or above' warning
I recently upgraded my application from rails 6.1 to 7.0 but I am seeing the below error while running the tests.

```<code>URL-safe CSRF tokens are now the default. Use 6.1 defaults or above.
</code>```

I have already updated the load_defaults in the config/application.rb file but I'm still seeing this error.

```<code>config.load_defaults 7.0
</code>```

Does anyone know what might be causing this?

Body:
I recently upgraded my application from rails 6.1 to 7.0 but I am seeing the below error while running the tests.

URL-safe CSRF tokens are now the default. Use 6.1 defaults or above.

I have already updated the load_defaults in the config/application.rb file but I'm still seeing this error.

config.load_defaults 7.0

Does anyone know what might be causing this?


问:
React Native Firebase Cloud Messaging does not work on Android production
I have a React Native App and using notifee to receive and display messages send via Firebase Cloud Messaging.

Everything works fine on iOS (Dev and Production) and on Android - Development Environment. But after deploying it to my Internal Testers on Android the messages do now show up.

My android/app/build.gradle looks like this:

```<code> buildTypes {
        debug {
            // signingConfig signingConfigs.debug
            if (nativeArchitectures) {
                ndk {
                    abiFilters nativeArchitectures.split(',')
                }
            }

            signingConfig signingConfigs.release
            ndk {
                debugSymbolLevel 'FULL'
            }
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.release
            // minifyEnabled enableProguardInReleaseBuilds
            // proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            ndk {
                debugSymbolLevel 'FULL'
            }
        }
    }
</code>```

So as you see, I can suspected proguard to cause the problems. But I completely commented out Proguard. I even tried

```<code> release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
</code>```

without success.

Does anyone else have an idea how where the problem could be.

Thank you so much in advance.

Body:
I have a React Native App and using notifee to receive and display messages send via Firebase Cloud Messaging.

Everything works fine on iOS (Dev and Production) and on Android - Development Environment. But after deploying it to my Internal Testers on Android the messages do now show up.

My android/app/build.gradle looks like this:

 buildTypes {
        debug {
            // signingConfig signingConfigs.debug
            if (nativeArchitectures) {
                ndk {
                    abiFilters nativeArchitectures.split(',')
                }
            }

            signingConfig signingConfigs.release
            ndk {
                debugSymbolLevel 'FULL'
            }
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.release
            // minifyEnabled enableProguardInReleaseBuilds
            // proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            ndk {
                debugSymbolLevel 'FULL'
            }
        }
    }

So as you see, I can suspected proguard to cause the problems. But I completely commented out Proguard. I even tried

 release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

without success.

Does anyone else have an idea how where the problem could be.

Thank you so much in advance.


问:
Using squash-merge with git subtree
I'm try ing to set up git subtrees ti mage shared utils and TS types in a couple repos. I'm confused on how git handles squash-merges in subtrees and right now I'm runnning into errors.

Let's say I have a repo project and have set up another repo utils I'm using as a subtree. My main project looks like this:

```<code>project/
├── fileOne.ts
├── utils/
│   ├── fileTwo.ts
</code>```

Then I make some changes so my project's commit history appears as follows

```<code>ddddddd (HEAD -> main, origin/main) edit fileTwo
ccccccc edit fileOne
bbbbbbb add fileTwo
aaaaaaa add fileOne
</code>```

I push these up directly to main in project. I also push to a new branch in my utils repo using

```<code>git subtree push -P utils utils-remote my-new-branch
</code>```

The commit history for my-new-branch is

```<code>ggggggg (utils-remote/my-new-branch) edit fileTwo
fffffff add fileTwo
eeeeeee (utils-remote/main) some older commit
</code>```

Then, I squash merge my-new-branch into utils/main so the commit history looks like

```<code>hhhhhhh (utils-remote/main) add and edit fileTwo
eeeeeee some older commit
</code>```

Now the subtree in project and the utils remote have diverged in that the remote contains a squashed commit, but the subtree in project has the 2 original commit. Does git do anything handle this discrepancy? If not how can I as a developer get the subtree in project back into sync with the subtree remote so I can pull new changes?

Using git pull in this case (with or without the squash option) seem to be giving errors.
Can't squash-merge: 'utils' was never added. and fatal: refusing to merge unrelated histories respectively.

Title: Using squash-merge with git subtree

Body:
I'm try ing to set up git subtrees ti mage shared utils and TS types in a couple repos. I'm confused on how git handles squash-merges in subtrees and right now I'm runnning into errors.

Let's say I have a repo project and have set up another repo utils I'm using as a subtree. My main project looks like this:

project/
├── fileOne.ts
├── utils/
│   ├── fileTwo.ts

Then I make some changes so my project's commit history appears as follows

ddddddd (HEAD -> main, origin/main) edit fileTwo
ccccccc edit fileOne
bbbbbbb add fileTwo
aaaaaaa add fileOne

I push these up directly to main in project. I also push to a new branch in my utils repo using

git subtree push -P utils utils-remote my-new-branch

The commit history for my-new-branch is

ggggggg (utils-remote/my-new-branch) edit fileTwo
fffffff add fileTwo
eeeeeee (utils-remote/main) some older commit

Then, I squash merge my-new-branch into utils/main so the commit history looks like

hhhhhhh (utils-remote/main) add and edit fileTwo
eeeeeee some older commit

Now the subtree in project and the utils remote have diverged in that the remote contains a squashed commit, but the subtree in project has the 2 original commit. Does git do anything handle this discrepancy? If not how can I as a developer get the subtree in project back into sync with the subtree remote so I can pull new changes?

Using git pull in this case (with or without the squash option) seem to be giving errors.
Can't squash-merge: 'utils' was never added. and fatal: refusing to merge unrelated histories respectively.


问:
SQL Server Key Value Data Model
I'm currently in a project that involves doing migrations, basically we have a staging table, which is a flat table that will have all the data loaded by an external service, and later all its data will be moved to a normalized database (with several tables) through stored procedures.These normalized tables are system-versioned temporal table where we have the history of them all.

We are thinking of using a hierarchical type of data model because of a problem we are going to have with the current data model. That's why we think the key value data model fits our project. Basically we are thinking of having a table like this:

ID
Key
Value

1
1
Test 1

2
2
Test 2

3
3
Test 3

4
4
Test 4

Then we'll have a table with all the keys:

Key
Table_Name
Name

1
Test_Table
Name

2
Test_Table
Last_Name

3
Test_Table
Address

4
Test_Table
Telephone

Why do we want to try to adopt this solution? Because changes may occur to our data model, for example, we may have to remove a column from one table to put in another or add new columns in a specific table. When this happens we'll have problems in the system-versioned temporal table because once that column is removed and moved to another table we won't have the history of the changes and the same happens if we add a new column...

By using key-value we can add a new column (key) and move it without any problem because we only have to do it in one table and our main table never changes at schema level and we can preserve the history of the table.

I know that these tables are more used for "NoSQL" and I know that maybe it's not a good idea to use this solution (I have read in many places that it is not good practice to use them), that's why I wanted ideas to know what is the best decision to take in this case. If you know solutions to keep the data with the initial solution (normalized) and ways to overcome the fact that new columns can be added as well as moved somewhere else and not messing up the history tables would be perfect.

Title: SQL Server Key Value Data Model


问:
Performance Kafka API Integration
I'm implementing an integration in two softwares. Basically I need to convert records from a database to another database, however, I need to convert the foreign keys, adapting them to the database that will receive it.

To do this i used a debezium connection to generate the producer messages. Apparently that worked fine. The problem is when consuming the messages.

I'm using a node api with typeorm and kafkajs to convert the foreign keys and save the records, but the consumption of messages is much lower than the number of records produced.
I've already tried to increase the number of topic partitions to do parallel processing, it did improve well, but it's still not enough.

await consumer.subscribe({
    topic,
    fromBeginning: true
})

await consumer.run({
    partitionsConsumedConcurrently: 22,
    eachBatch: async ({
        batch,
        resolveOffset,
        heartbeat,
        commitOffsetsIfNecessary
    }) => {
        for (const message of batch.messages) {
            if (message.value) {
                const value = JSON.parse(message.value.toString())
                const payload = value as T
                try {
                    //this line does the logic of converting the foreign keys and saving the record
                    await onMessage({ topic: batch.topic, payload })
                } catch (e) {
                    console.log('error:', (e as Error).message)
                }
            }
            resolveOffset(message.offset)

            await commitOffsetsIfNecessary({
                topics: [
                    {
                        topic: batch.topic,
                        partitions: [
                            {
                                partition: batch.partition,
                                offset: message.offset
                            }
                        ]
                    }
                ]
            })

            await heartbeat()
        }
    }
})
```

Key conversions are currently done per database (select). The database management system is postgresql

consumer lag:

I would like to know how I can improve the performance of the consumer without necessarily increasing my processing power

Title: Performance Kafka API Integration

Body:
I'm implementing an integration in two softwares. Basically I need to convert records from a database to another database, however, I need to convert the foreign keys, adapting them to the database that will receive it.

To do this i used a debezium connection to generate the producer messages. Apparently that worked fine. The problem is when consuming the messages.

I'm using a node api with typeorm and kafkajs to convert the foreign keys and save the records, but the consumption of messages is much lower than the number of records produced.
I've already tried to increase the number of topic partitions to do parallel processing, it did improve well, but it's still not enough.

await consumer.subscribe({
    topic,
    fromBeginning: true
})

await consumer.run({
    partitionsConsumedConcurrently: 22,
    eachBatch: async ({
        batch,
        resolveOffset,
        heartbeat,
        commitOffsetsIfNecessary
    }) => {
        for (const message of batch.messages) {
            if (message.value) {
                const value = JSON.parse(message.value.toString())
                const payload = value as T
                try {
                    //this line does the logic of converting the foreign keys and saving the record
                    await onMessage({ topic: batch.topic, payload })
                } catch (e) {
                    console.log('error:', (e as Error).message)
                }
            }
            resolveOffset(message.offset)

            await commitOffsetsIfNecessary({
                topics: [
                    {
                        topic: batch.topic,
                        partitions: [
                            {
                                partition: batch.partition,
                                offset: message.offset
                            }
                        ]
                    }
                ]
            })

            await heartbeat()
        }
    }
})

Key conversions are currently done per database (select). The database management system is postgresql

consumer lag:

I would like to know how I can improve the performance of the consumer without necessarily increasing my processing power


问:
deploying application using ojdeploy is throwing error
I am having an ADF Web Application (Demo), which has two projects Model and ViewController. I want to deploy this demo app using ojdeploy.

```<code><MWH>/jdeveloper/jdev/bin]$
    ./ojdeploy -profile Demo_application1 /usr/mylocation/jdev/APPS/Demo/Demo.jws
</code>```

On executing the above statement getting error as below

```<code>Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
/usr/mylocation/jdev/MWH/jdeveloper/jdev/bin/../../ide/bin/launcher.sh: line 1705:
file: **command not found**

----build file----
<?xml version = '1.0' standalone = 'yes'?>
<ojdeploy-build basedir="/usr/mylocation/jdev/MWH/jdeveloper/jdev/bin/">
  <defaults/>
    <deploy command="deployToArchive">
       <parameter name="profile" value="Demo_application1"/>
      <parameter name="workspace" value="/usr/mylocation/jdev/APPS/Demo/Demo.jws"/>
    </deploy>
 </ojdeploy-build>
 -----------------
 Dec 19, 2022 7:55:49 PM oracle.security.jps.util.JpsUtil disableAudit
INFO: JpsUtil: isAuditDisabled set to true
[07:55:49 PM] No matching profiles
</code>```

Any ways or workaround to overcome the above mentioned error.

Body:
I am having an ADF Web Application (Demo), which has two projects Model and ViewController. I want to deploy this demo app using ojdeploy.

<MWH>/jdeveloper/jdev/bin]$
    ./ojdeploy -profile Demo_application1 /usr/mylocation/jdev/APPS/Demo/Demo.jws

On executing the above statement getting error as below

Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
/usr/mylocation/jdev/MWH/jdeveloper/jdev/bin/../../ide/bin/launcher.sh: line 1705:
file: **command not found**

----build file----
<?xml version = '1.0' standalone = 'yes'?>
<ojdeploy-build basedir="/usr/mylocation/jdev/MWH/jdeveloper/jdev/bin/">
  <defaults/>
    <deploy command="deployToArchive">
       <parameter name="profile" value="Demo_application1"/>
      <parameter name="workspace" value="/usr/mylocation/jdev/APPS/Demo/Demo.jws"/>
    </deploy>
 </ojdeploy-build>
 -----------------
 Dec 19, 2022 7:55:49 PM oracle.security.jps.util.JpsUtil disableAudit
INFO: JpsUtil: isAuditDisabled set to true
[07:55:49 PM] No matching profiles

Any ways or workaround to overcome the above mentioned error.


问:
Inconsistent result with JPA streams after upgrading to Hibernate 6.x / Spring boot 3
We have an application doing some batch processing, were some statistics are calculated from order history. We fetch around 500k records from a Postgres database when doing this. The data is basically only orders and order details joined to orders like this

```<code>@OneToMany(mappedBy = "createdOrder", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
public Set<OrderDetails> getOrderDetails() {
    return orderDetails;
}
</code>```

We have a query defined like this

```<code>@QueryHints(value = @QueryHint(name = org.hibernate.jpa.QueryHints.HINT_FETCH_SIZE, value = "5000"))
Stream<CreatedOrder> streamAllDistinctByCreatedBetween(long startEpochMillis, long endEpochMillis);
</code>```

We then perform the calculations like this. The flush/clear piece was added to avoid allocating too much memory for the data which we no longer needed for the calculations.

```<code>@Transactional
public void calculateOrderStats() {
    try (Stream<OrderDetails> orderDetailsStream = createdOrderRepository.streamAllDistinctByCreatedBetween(periodStart, periodEnd)) {
        orderDetailsStream.forEach(orderDetails -> {
            //Do calculations..
            if(count % 1000 == 0) {
                entityManager.flush();
                entityManager.clear();
            }
        });
    }
}
</code>```

We have been running this code with Spring boot 2.7.1/Hibernate 5.6.9.Final for quite some time. But after upgrading to Spring boot 3.0.0/Hibernate 6.1.5.Final, we have started seeing different results for these calculations. We basically calculate what items are frequently bought together, and we are getting different results when running the old and the new versions side by side.

After much investigation, we realized that the difference comes from the fact that we are no longer getting the same data from the stream and the only thing we can do to get the same results with with 6.x as with 5.x is to

Remove the stream() and collect all orders straight to a list, increasing memory consumtion by A LOT.
or

Remove the flush/clear piece of code, i.e.

```<code>if(count % 1000 == 0) {
   entityManager.clear();
}
</code>```

Any ideas as to why would the entityManager.clear() work with Hibernate 5.x and cause these issues with 6.x? We haven't been able to find an explanation in the 6.0 migration guide.

Body:
We have an application doing some batch processing, were some statistics are calculated from order history. We fetch around 500k records from a Postgres database when doing this. The data is basically only orders and order details joined to orders like this

@OneToMany(mappedBy = "createdOrder", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
public Set<OrderDetails> getOrderDetails() {
    return orderDetails;
}

We have a query defined like this

@QueryHints(value = @QueryHint(name = org.hibernate.jpa.QueryHints.HINT_FETCH_SIZE, value = "5000"))
Stream<CreatedOrder> streamAllDistinctByCreatedBetween(long startEpochMillis, long endEpochMillis);

We then perform the calculations like this. The flush/clear piece was added to avoid allocating too much memory for the data which we no longer needed for the calculations.

@Transactional
public void calculateOrderStats() {
    try (Stream<OrderDetails> orderDetailsStream = createdOrderRepository.streamAllDistinctByCreatedBetween(periodStart, periodEnd)) {
        orderDetailsStream.forEach(orderDetails -> {
            //Do calculations..
            if(count % 1000 == 0) {
                entityManager.flush();
                entityManager.clear();
            }
        });
    }
}

We have been running this code with Spring boot 2.7.1/Hibernate 5.6.9.Final for quite some time. But after upgrading to Spring boot 3.0.0/Hibernate 6.1.5.Final, we have started seeing different results for these calculations. We basically calculate what items are frequently bought together, and we are getting different results when running the old and the new versions side by side.

After much investigation, we realized that the difference comes from the fact that we are no longer getting the same data from the stream and the only thing we can do to get the same results with with 6.x as with 5.x is to

Remove the stream() and collect all orders straight to a list, increasing memory consumtion by A LOT.
or

Remove the flush/clear piece of code, i.e.

if(count % 1000 == 0) {
   entityManager.clear();
}

Any ideas as to why would the entityManager.clear() work with Hibernate 5.x and cause these issues with 6.x? We haven't been able to find an explanation in the 6.0 migration guide.


问:
How could I output colored print statements in the console in Eclipse with java?
I already tried a seperate way as shown in what I tried, but it didnt output correctly.

```<code>    public static final String ANSI_RESET = "\u001B[0m";
    public static final String ANSI_RED = "\u001B[31m";
    public static final String ANSI_BLUE = "\u001B[34m";

</code>```

After setting up the strings I tried to run it with this line:

```<code>        System.out.println(ANSI_RED + "Connect 4:" + ANSI_RESET);
</code>```

And the output was :

```<code>[31mConnect 4:[0m
</code>```

How could I do this correctly?

Body:
I already tried a seperate way as shown in what I tried, but it didnt output correctly.

    public static final String ANSI_RESET = "\u001B[0m";
    public static final String ANSI_RED = "\u001B[31m";
    public static final String ANSI_BLUE = "\u001B[34m";

After setting up the strings I tried to run it with this line:

        System.out.println(ANSI_RED + "Connect 4:" + ANSI_RESET);

And the output was :

[31mConnect 4:[0m

How could I do this correctly?


问:
Not receiving device token in didRegisterForRemoteNotificationsWithDeviceToken
In my AppDelegate, I'm using the didRegisterForRemoteNotificationsWithDeviceToken method. But despite seeing the success message in my code below in the logs, I'm not seeing the device token get printed or saved into UserDefaults as written in the method.

class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate  {
  func application(_ application: UIApplication,
                   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    FirebaseApp.configure()
    UNUserNotificationCenter.current().delegate = self
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) {(success, error) in
      if success {
        print("Success in APNS registry")
          DispatchQueue.main.async {
            application.registerForRemoteNotifications()
          }
      } else {
        print("error \(error?.localizedDescription ?? "error")")
      }
    }
    NetworkMonitor.shared.startMonitoring()
    return true
  }

  func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let tokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
    let userDefaults = UserDefaults.standard
    print("Token is \(tokenString)")
    userDefaults.set(tokenString, forKey: "deviceToken")
  }
}

```

I've tried a couple of times by deleting the app from my phone and installing again. Every time I accept the prompt, I see the success message but no token is printed. Before I was using Firebase GCM, but I'm now going down a different path and am no longer want to use it. I'm unsure if there's some config for that which I need to remove, there's nothing in the logs though saying I need to remove it.

Body:
In my AppDelegate, I'm using the didRegisterForRemoteNotificationsWithDeviceToken method. But despite seeing the success message in my code below in the logs, I'm not seeing the device token get printed or saved into UserDefaults as written in the method.

class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate  {
  func application(_ application: UIApplication,
                   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    FirebaseApp.configure()
    UNUserNotificationCenter.current().delegate = self
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) {(success, error) in
      if success {
        print("Success in APNS registry")
          DispatchQueue.main.async {
            application.registerForRemoteNotifications()
          }
      } else {
        print("error \(error?.localizedDescription ?? "error")")
      }
    }
    NetworkMonitor.shared.startMonitoring()
    return true
  }

  func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let tokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
    let userDefaults = UserDefaults.standard
    print("Token is \(tokenString)")
    userDefaults.set(tokenString, forKey: "deviceToken")
  }
}

I've tried a couple of times by deleting the app from my phone and installing again. Every time I accept the prompt, I see the success message but no token is printed. Before I was using Firebase GCM, but I'm now going down a different path and am no longer want to use it. I'm unsure if there's some config for that which I need to remove, there's nothing in the logs though saying I need to remove it.


问:
MorphedByMany with String as One Key
I have an issue with a new model I am trying to attach to a MorphedByMany setup. This new model has one problem and that the primary key I currently have to rely on is one generated outside of Laravel and must be a text string.

So currently this is what I have coming from the User model:

```<code>public function donationAccounts(){
    return $this->morphedByMany('App\Models\DonationAccount', 'ownable');
}
</code>```

And in my DonationAccount model I have the following:

```<code>protected $primaryKey = 'Account';

protected $keyType = 'string';

public $incrementing = false;
</code>```

But when I look up the test Donation Accounts I get the following:

```<code>2000 - Correct
2000-01 - Incorrect
2000-02 - Incorrect
</code>```

In the database there is only one entry and that is with 2000. So I am assuming the relationship is almost searching for relations based on a LIKE query, or something of that sort.

How to fix this issue so that it is only pulling the 2000 account number?

Title: MorphedByMany with String as One Key

Body:
I have an issue with a new model I am trying to attach to a MorphedByMany setup. This new model has one problem and that the primary key I currently have to rely on is one generated outside of Laravel and must be a text string.

So currently this is what I have coming from the User model:

public function donationAccounts(){
    return $this->morphedByMany('App\Models\DonationAccount', 'ownable');
}

And in my DonationAccount model I have the following:

protected $primaryKey = 'Account';

protected $keyType = 'string';

public $incrementing = false;

But when I look up the test Donation Accounts I get the following:

2000 - Correct
2000-01 - Incorrect
2000-02 - Incorrect

In the database there is only one entry and that is with 2000. So I am assuming the relationship is almost searching for relations based on a LIKE query, or something of that sort.

How to fix this issue so that it is only pulling the 2000 account number?


问:
Python MSAL Example App - Not configured as multi-tenant application
I am new to oauth and trying to add microsoft oauth login to my Quart (async Flask) app which serves a ReactJS app, for now I am just experimenting with the example app, found here:

git clone https://github.com/Azure-Samples/ms-identity-python-webapp.git

I am configuring my app registration on azure to be single-tenant, for my organization only, which I believe is the problem. But I am not sure what to do in this example app to make it work for this setting.

Here is the error I am receiving after logging in with my microsoft account:

```<code>(Operations) is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.
</code>```

Body:
I am new to oauth and trying to add microsoft oauth login to my Quart (async Flask) app which serves a ReactJS app, for now I am just experimenting with the example app, found here:

git clone https://github.com/Azure-Samples/ms-identity-python-webapp.git

I am configuring my app registration on azure to be single-tenant, for my organization only, which I believe is the problem. But I am not sure what to do in this example app to make it work for this setting.

Here is the error I am receiving after logging in with my microsoft account:

(Operations) is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.


问:
Uncaught TypeError: Cannot read properties of undefined (reading 'draw')
I am writting a JavaScript game Pacman. Butr instead of drawing canvas, this error is shown and nothing happens.

```<code>function pause() {
    return !pacman.madeFirstMove || gameOver || gameWin;
  }

function gameLoop(){
    titleMap.draw(ctx);
    drawGameEnd();
    pacman.draw(ctx, pause(), enemies); //**shows the error is here **
    enemies.forEach((enemy) => enemy.draw(ctx, pause(), pacman));
    checkGameOver();
    checkGameWin();
}
</code>```

Here is the implementation of the draw function:

```<code> draw(ctx, pause, enemies) {
    if (!pause) {
      this.#move();
      this.#animate();
    }
    this.#eatDot();
    this.#eatPowerDot();
    this.#eatGhost(enemies);

    const size = this.tileSize / 2;

    ctx.save();
    ctx.translate(this.x + size, this.y + size);
    ctx.rotate((this.pacmanRotation * 90 * Math.PI) / 180);
    ctx.drawImage(
      this.pacmanImages[this.pacmanImageIndex],
      -size,
      -size,
      this.tileSize,
      this.tileSize
    );

    ctx.restore();

     ctx.drawImage(
       this.pacmanImages[this.pacmanImageIndex],
       this.x,
       this.y,
      this.tileSize,
       this.tileSize
     );
  }
</code>```
```<code>
The pacman is defined like this:

const titleSize=32;
const velocity=2;
const canvas= document.getElementById("gameCanvas");
const ctx = canvas.getContext("2d");
const titleMap= new TheMap(titleSize);

const pacman = titleMap.getPacman(velocity);
</code>```

Please, let me know if you need more about the code to find out what the problem is.

Body:
I am writting a JavaScript game Pacman. Butr instead of drawing canvas, this error is shown and nothing happens.

function pause() {
    return !pacman.madeFirstMove || gameOver || gameWin;
  }

function gameLoop(){
    titleMap.draw(ctx);
    drawGameEnd();
    pacman.draw(ctx, pause(), enemies); //**shows the error is here **
    enemies.forEach((enemy) => enemy.draw(ctx, pause(), pacman));
    checkGameOver();
    checkGameWin();
}

Here is the implementation of the draw function:

 draw(ctx, pause, enemies) {
    if (!pause) {
      this.#move();
      this.#animate();
    }
    this.#eatDot();
    this.#eatPowerDot();
    this.#eatGhost(enemies);

    const size = this.tileSize / 2;

    ctx.save();
    ctx.translate(this.x + size, this.y + size);
    ctx.rotate((this.pacmanRotation * 90 * Math.PI) / 180);
    ctx.drawImage(
      this.pacmanImages[this.pacmanImageIndex],
      -size,
      -size,
      this.tileSize,
      this.tileSize
    );

    ctx.restore();

     ctx.drawImage(
       this.pacmanImages[this.pacmanImageIndex],
       this.x,
       this.y,
      this.tileSize,
       this.tileSize
     );
  }

The pacman is defined like this:

const titleSize=32;
const velocity=2;
const canvas= document.getElementById("gameCanvas");
const ctx = canvas.getContext("2d");
const titleMap= new TheMap(titleSize);

const pacman = titleMap.getPacman(velocity);

Please, let me know if you need more about the code to find out what the problem is.


问:
Compare two Hive partitions
I have a Hive table partitioned by date
I would like to compare data between two partitions by excluding some columns from it.

Example:
Table1
Column1, Column2, Column3, Column4, Column5

This Hive table is loaded with data daily and is partitioned by date.

Approach1:

Thought to create Hive view1 and Hive view2 by excluding columns not needed i.e.
Create Hive view1 with partition1
Create Hive view2 with partition2

Calculate the hash sum as below and compare outputs

```<code>select sum(hash(*)) from Table1;
select sum(hash(*)) from Table2;
</code>```

Not sure if this would work

Approach2:

Any programmatic way or script to achieve this

Title: Compare two Hive partitions

Body:
I have a Hive table partitioned by date
I would like to compare data between two partitions by excluding some columns from it.

Example:
Table1
Column1, Column2, Column3, Column4, Column5

This Hive table is loaded with data daily and is partitioned by date.

Approach1:

Thought to create Hive view1 and Hive view2 by excluding columns not needed i.e.
Create Hive view1 with partition1
Create Hive view2 with partition2

Calculate the hash sum as below and compare outputs

select sum(hash(*)) from Table1;
select sum(hash(*)) from Table2;

Not sure if this would work

Approach2:

Any programmatic way or script to achieve this


问:
Facebook API - error 360 when sending posts with batch
We have a problem when we try to send multi posts to Facebook API.
Here is the use case:

A user has an account with almost 250 pages

He uses our platform to send a post to all his pages

First, we ask the user to accept giving access to our Facebook app

Then we use this access to retrieve pages token and post the content to each page

We are sending posts this way:

```<code>$this->client->createRequest(
            'POST',
            "/{$userPage->getExternalId()}/feed",
            $requestParams,
            $userPage->getPlainToken(),
        );
</code>```

We are batching posts 50 by 50 (maximum authorize by fb documentation).

Unfortunately, an error occurred during the process and almost half of the posts failed:

"message": "Request aborted. This could happen if a dependent request failed or the entire request timed out.",

"code": 960,

We have the same error, even if we are trying to send a post to a total of 250, 150 or even 50 pages.
For 250 we have 150 errors, for 150 -> 70 and for 50 -> 20.

Has someone faced this kind of problem and found a solution?

Body:
We have a problem when we try to send multi posts to Facebook API.
Here is the use case:

A user has an account with almost 250 pages

He uses our platform to send a post to all his pages

First, we ask the user to accept giving access to our Facebook app

Then we use this access to retrieve pages token and post the content to each page

We are sending posts this way:

$this->client->createRequest(
            'POST',
            "/{$userPage->getExternalId()}/feed",
            $requestParams,
            $userPage->getPlainToken(),
        );

We are batching posts 50 by 50 (maximum authorize by fb documentation).

Unfortunately, an error occurred during the process and almost half of the posts failed:

"message": "Request aborted. This could happen if a dependent request failed or the entire request timed out.",

"code": 960,

We have the same error, even if we are trying to send a post to a total of 250, 150 or even 50 pages.
For 250 we have 150 errors, for 150 -> 70 and for 50 -> 20.

Has someone faced this kind of problem and found a solution?


问:
Cannot pass the Id through the URL
I'm learning React now. I have a question.

This is my UserList component. I want to send the id in the selected row with URL, but I cannot get id.

```<code>import React,{useState,useEffect} from 'react'
import { Link } from 'react-router-dom'
import UserService from '../services/UserService'

const UserList = () => {

    const [users,setUsers] = useState([])

    useEffect(() => {
        UserService.findAll().then((response)=>{
            setUsers(response.data)
            console.log(response.data)
        }).catch(error=>{
            console.log(error)
        })
    }, [])
   const [selectedUserId, setSelectedUserId] = useState();

   let deleteButton = "Delete";
   const handleRowClick = (id) => {
    console.log(id);
    setSelectedUserId(id);
    console.log(id);
  }

  return (
    <div className='container'>
        <h2 className='text-center'>Users</h2>

        <table className='table table-bordered table-stripped'>
            <thead>
                <th>First Name</th>
                <th>Last Name</th>
                <th>Email</th>
                <th>Password</th>
            </thead>
            <tbody>
                {
                    users.map(
                        user =>

                        <tr key={user.id} onClick={() => handleRowClick(user.id)} style={{backgroundColor: selectedUserId === user.id ? "lightblue" : ""}}>
                            <td>{user.firstName}</td>
                            <td>{user.lastName}</td>
                            <td>{user.email}</td>
                            <td>{user.password}</td>
                        </tr>
                    )
                }
            </tbody>
        </table>
        <Link to="/users/save" className="btn btn-primary mx-2">Create</Link>
        <Link className="btn btn-primary mx-2" to={'/update/${selectedUserId}'} >Update</Link>
        <Link to="/users/save" className="btn btn-primary mx-2">{deleteButton}</Link>
    </div>
  )
}
export default UserList;
</code>```

I checked the selected row Id It's true.
And this is my Component I want to send id to.

```<code>import React, {useEffect, useState } from 'react'
import UserService from '../services/UserService';
import {Link,useNavigate,useParams} from 'react-router-dom';

const UserCreate = () => {

  const [firstName, setFirstName] = useState('');
  const [lastName, setLastName] = useState('');
  const [email, setEmail] = useState('');
  const [password,setPassword] = useState('');
  const navigate = useNavigate();

  const {id} = useParams();

  const createUser = (e)=>{
    e.preventDefault();
    const user = {firstName,lastName,email,password}

    UserService.createUser(user).then((response)=>{
        console.log(response.data)
        navigate.push("/users/save");
    }).catch(error => {
        console.log(error);
    })
  }
  useEffect(()=>{
    UserService.findUserById(id).then((response)=>{
        setFirstName(response.data.firstName)
        setLastName(response.data.lastName)
        setEmail(response.data.email)
        setPassword(response.data.password)
    }).catch(error => {
        console.log(error);
    })
  },[])

  return (
    <div>
        <br/><br/>
        <div className="container">
            <div className="row">
                <div className = "card col-md-6 offset-md-3 offset-md-3">
                    <h2 className="text-center">Update User</h2>                    <div className="card-body">
                        <form>
                            <div className='form-group mb-2'>
                                <label className='form-label'> First Name</label>
                                <input
                                    type='text'
                                    placeholder='Enter First Name'
                                    name='firstName'
                                    className='form-control'
                                    value={firstName}
                                    onChange={(e)=>setFirstName(e.target.value)}
                                >

                                </input>
                            </div>
                            <div className='form-group mb-2'>
                                <label className='form-label'> Last Name</label>
                                <input
                                    type='text'
                                    placeholder='Enter Last Name'
                                    name='lastName'
                                    className='form-control'
                                    value={lastName}
                                    onChange={(e)=>setLastName(e.target.value)}
                                >

                                </input>
                            </div>
                            <div className='form-group mb-2'>
                                <label className='form-label'> Email </label>
                                <input
                                    type='email'
                                    placeholder='Enter Email'
                                    name='email'
                                    className='form-control'
                                    value={email}
                                    onChange={(e)=>setEmail(e.target.value)}
                                >

                                </input>
                            </div>
                            <div className='form-group mb-2'>
                                <label className='form-label'> Password </label>
                                <input
                                    type='password'
                                    placeholder='Enter Password'
                                    name='password'
                                    className='form-control'
                                    value={password}
                                    onChange={(e)=>setPassword(e.target.value)}
                                >

                                </input>
                            </div>
                            <button className='btn btn-success' onClick={(e)=> createUser(e)}> Actions </button>
                            <Link to ='/' className='btn btn-danger'> Back </Link>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>
  )
}

export default UserCreate
</code>```

For now, I want to get id from url. Where am i wrong?

I tried useParams, I expected it to work. But It was not
const {id} = useParams();

Title: Cannot pass the Id through the URL

Body:
I'm learning React now. I have a question.

This is my UserList component. I want to send the id in the selected row with URL, but I cannot get id.

import React,{useState,useEffect} from 'react'
import { Link } from 'react-router-dom'
import UserService from '../services/UserService'

const UserList = () => {

    const [users,setUsers] = useState([])

    useEffect(() => {
        UserService.findAll().then((response)=>{
            setUsers(response.data)
            console.log(response.data)
        }).catch(error=>{
            console.log(error)
        })
    }, [])
   const [selectedUserId, setSelectedUserId] = useState();

   let deleteButton = "Delete";
   const handleRowClick = (id) => {
    console.log(id);
    setSelectedUserId(id);
    console.log(id);
  }

  return (

Users

                First Name
                Last Name
                Email
                Password

                {
                    users.map(
                        user =>

 handleRowClick(user.id)} style={{backgroundColor: selectedUserId === user.id ? "lightblue" : ""}}>
                            {user.firstName}
                            {user.lastName}
                            {user.email}
                            {user.password}

                    )
                }

        <Link to="/users/save" className="btn btn-primary mx-2">Create</Link>
        <Link className="btn btn-primary mx-2" to={'/update/${selectedUserId}'} >Update</Link>
        <Link to="/users/save" className="btn btn-primary mx-2">{deleteButton}</Link>

  )
}
export default UserList;

I checked the selected row Id It's true.
And this is my Component I want to send id to.

import React, {useEffect, useState } from 'react'
import UserService from '../services/UserService';
import {Link,useNavigate,useParams} from 'react-router-dom';

const UserCreate = () => {

  const [firstName, setFirstName] = useState('');
  const [lastName, setLastName] = useState('');
  const [email, setEmail] = useState('');
  const [password,setPassword] = useState('');
  const navigate = useNavigate();

  const {id} = useParams();

  const createUser = (e)=>{
    e.preventDefault();
    const user = {firstName,lastName,email,password}

    UserService.createUser(user).then((response)=>{
        console.log(response.data)
        navigate.push("/users/save");
    }).catch(error => {
        console.log(error);
    })
  }
  useEffect(()=>{
    UserService.findUserById(id).then((response)=>{
        setFirstName(response.data.firstName)
        setLastName(response.data.lastName)
        setEmail(response.data.email)
        setPassword(response.data.password)
    }).catch(error => {
        console.log(error);
    })
  },[])

  return (

Update User

                        <form>

                                 First Name
                                <input
                                    type='text'
                                    placeholder='Enter First Name'
                                    name='firstName'
                                    className='form-control'
                                    value={firstName}
                                    onChange={(e)=>setFirstName(e.target.value)}
                                >

                                </input>

                                 Last Name
                                <input
                                    type='text'
                                    placeholder='Enter Last Name'
                                    name='lastName'
                                    className='form-control'
                                    value={lastName}
                                    onChange={(e)=>setLastName(e.target.value)}
                                >

                                </input>

                                 Email
                                <input
                                    type='email'
                                    placeholder='Enter Email'
                                    name='email'
                                    className='form-control'
                                    value={email}
                                    onChange={(e)=>setEmail(e.target.value)}
                                >

                                </input>

                                 Password
                                <input
                                    type='password'
                                    placeholder='Enter Password'
                                    name='password'
                                    className='form-control'
                                    value={password}
                                    onChange={(e)=>setPassword(e.target.value)}
                                >

                                </input>

                            <button className='btn btn-success' onClick={(e)=> createUser(e)}> Actions </button>
                            <Link to ='/' className='btn btn-danger'> Back </Link>
                        </form>

  )
}

export default UserCreate

For now, I want to get id from url. Where am i wrong?

I tried useParams, I expected it to work. But It was not
const {id} = useParams();


问:
How to use vstest.console and nmake in CircleCI build?
I'm configuring CircleCI to build my Visual Studio solution that consists of C, C++ and C# code -- all producing .NET assemblies. Apparently, the dotnet command does not work with C++ (C++/CLI) so I have to use the older microsoft tools such as msbuild and vstest.console. And, although I don't have to, I want to use nmake. msbuild is available; runs for command line "msbuild", but neither vstest.console or nmake run; command not found.

Here's a simple config file:

```<code>version: 2.1
orbs:
  windows: circleci/windows@5.0.0
jobs:
  main-job:
    description: Build all
    executor:
      name: windows/default
    steps:
      - checkout
      - run:
          name: "Build"
          command: nmake build
workflows:
  main-workflow:
    jobs:
      - main-job
</code>```

And the resulting error message:

```<code>nmake : The term 'nmake' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
</code>```

How does one setup a circleci environment with both vstest and nmake?

I get the same error (command not found) for vstest.console.

The orb windows@5.0.0 seems to be the latest version of that thing as described here https://circleci.com/developer/orbs/orb/circleci/windows. But... maybe there's a different orb/server that I should use. I don't know how one knows which is the best or even available servers to use.

Body:
I'm configuring CircleCI to build my Visual Studio solution that consists of C, C++ and C# code -- all producing .NET assemblies. Apparently, the dotnet command does not work with C++ (C++/CLI) so I have to use the older microsoft tools such as msbuild and vstest.console. And, although I don't have to, I want to use nmake. msbuild is available; runs for command line "msbuild", but neither vstest.console or nmake run; command not found.

Here's a simple config file:

version: 2.1
orbs:
  windows: circleci/windows@5.0.0
jobs:
  main-job:
    description: Build all
    executor:
      name: windows/default
    steps:
      - checkout
      - run:
          name: "Build"
          command: nmake build
workflows:
  main-workflow:
    jobs:
      - main-job

And the resulting error message:

nmake : The term 'nmake' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.

How does one setup a circleci environment with both vstest and nmake?

I get the same error (command not found) for vstest.console.

The orb windows@5.0.0 seems to be the latest version of that thing as described here https://circleci.com/developer/orbs/orb/circleci/windows. But... maybe there's a different orb/server that I should use. I don't know how one knows which is the best or even available servers to use.


问:
Navbar search function doesn't work when navbar is imported onto multiple pages
I am new to coding so please forgive me if I am using incorrect terminology.

I have a search function within the navbar that works when the script is independently included on every page. But as soon as I tried to get the navbar using javascript from nav.html which contains all of the html, css and js onto other pages, while the navbar does get inserted and the links all work, the search function breaks.

I tried to include the search function javascript on the separate pages where I want the navbar. I have tried rearranging the js vs html in case it's the order that made it not work. But nothing worked.

Does anyone know why?

const fmobile = document.getElementById('form-mobile');
const qmobile = document.getElementById('query-mobile');
const google = 'https://www.google.com/search?q=site%3A';
const site = 'stackoverflow.com';

function submittedmobile(eventmobile) {
  eventmobile.preventDefault();
  const urlmobile = google + site + '+' + qmobile.value;
  const winmobile = window.open(urlmobile, '_blank');
  winmobile.focus();
}

fmobile.addEventListener('submit', submittedmobile);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<nav class="top-nav">
  <input id="menu-toggle" type="checkbox" />
  <label class="menu-button-container" for="menu-toggle">
    <div class="menu-button"></div>
  </label>
  <ul class="menu">
    <li class="m1">Home</li>
    <li class="m2">Services</li>
    <li class="m3">Our Clients</li>
    <li class="m4">About Us</li>
    <li class="m5">Careers</li>
    <li class="m6">Contact Us</li>
    <li id="search-form">
      <form role="search" class="form-inline my-2 my-lg-0" id="form-mobile">
        <input class="form-control mr-sm-2" type="search" id="query-mobile" name="qmobile" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button></form>
    </li>
  </ul>
</nav></code>```

//this is javascript that I have added to each page to insert the navbar (which breaks the search function)

    window.onload = function() {
      "use strict";
      //$("#nav").load("nav.html");
      $.get("nav.html", function(data) {
        document.getElementById("navbar").innerHTML = data;
      });
    };```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<nav id="navbar"></nav>

<!--then here is where I add the javascript to import the navbar--></code>```

Body:
I am new to coding so please forgive me if I am using incorrect terminology.

I have a search function within the navbar that works when the script is independently included on every page. But as soon as I tried to get the navbar using javascript from nav.html which contains all of the html, css and js onto other pages, while the navbar does get inserted and the links all work, the search function breaks.

I tried to include the search function javascript on the separate pages where I want the navbar. I have tried rearranging the js vs html in case it's the order that made it not work. But nothing worked.

Does anyone know why?

const fmobile = document.getElementById('form-mobile');
const qmobile = document.getElementById('query-mobile');
const google = 'https://www.google.com/search?q=site%3A';
const site = 'stackoverflow.com';

function submittedmobile(eventmobile) {
  eventmobile.preventDefault();
  const urlmobile = google + site + '+' + qmobile.value;
  const winmobile = window.open(urlmobile, '_blank');
  winmobile.focus();
}

fmobile.addEventListener('submit', submittedmobile);

  <input id="menu-toggle" type="checkbox" />

Home

Services

Our Clients

About Us

Careers

Contact Us

      <form role="search" class="form-inline my-2 my-lg-0" id="form-mobile">
        <input class="form-control mr-sm-2" type="search" id="query-mobile" name="qmobile" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button></form>

//this is javascript that I have added to each page to insert the navbar (which breaks the search function)

    window.onload = function() {
      "use strict";
      //$("#nav").load("nav.html");
      $.get("nav.html", function(data) {
        document.getElementById("navbar").innerHTML = data;
      });
    };


问:
Visual Artifact/glitching with chartjs-node-canvas
I spent 5 hours yesterday debugging the "canvas.node is not a valid win 32 application" bug.
This was occurring because I was deploying to a Windows server, but using a pipeline running on Ubuntu.

Then, I had to deal with "Error: The module ...canvas.node'was compiled against a different Node.js version usingNODE_MODULE_VERSION 93. This version of Node.js requiresNODE_MODULE_VERSION 83. Please try re-compiling..."

I managed to fix this by forcing my pipeline to run Node 14 instead of 16.

I've got an Azure DevOps pipeline that deploys a NestJS (Node) app to a Windows server.
Part of this app is an API which has an endpoint that renders a chart into a PDF.
This works fine locally.

Once I finished fixing this bug and getting my app to deploy, this is what the PDF looks like:

This is what the exact same code looks like running locally:

I've been using ChartJS for 3 years and I've never seen this. Granted I never rendered them server side, but considering this is working fine locally I am stumped.

On my machine, I run Node 12.22.1 on Mac OS big sur (M1)
For the pipeline build agent, I am using Node 12.22.1
My package.json has chart.js version 3.9.1 and chartjs-node-canvas version 4.1.6

My actual deployment server is running Node 12.21.0 on Windows (Azure App Service)

I've tried messing around with versions of node, chartjs, and chartjs-node-canvas, but it is very, very easy to trigger the error "The module was compiled against a different node version...". My best idea so far was to make sure my local machine, pipeline, and deployment server were all running Node 12. I then downgraded both dependencies, but continued receiving the different node version error mentioned above.

Does anyone familiar with this package have any idea why this is happening? It's so weird. This is delaying a very important release.


问:
Is it firstChild that I need?
I am changing the theme of a wordPress site.

Javascript that works on the old site, does not work on the new (test) site because the structure of the dom is different.
The old HTML dom just included:

```<code><img src="http://somewhereRemoved.jpg" class="header-img" />

</code>```

So the old script to change the img was:

```<code>var img = document.getElementsByClassName("header-img");    // there IS only ONE! in this class
img[0].src = "http://somewhereRemoved.gif"+"?a="+Math.random();
</code>```

The new dom/customization only allows me to set Class & Id for the parent element, not the image:

```<code><figure class="wp-block-image size-large v12-OurHeroImage" id="V12-OurHeroImage">
   <img decoding="async" width="1024" height="341" src="http://somewhereRemoved-1024x341.jpg" alt="" class="wp-image-1045" srcset="http://somewhereRemoved-1024x341.jpg 1024w, http:/somewhereRemoved-600x200.jpg 600w, http://somewhereRemoved-300x100.jpg 300w, http://somewhereRemoved-768x256.jpg 768w, http://somewhereRemoved-240x80.jpg 240w, http://somewhereRemoved.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" />
</figure>
</code>```

Initially, I tried:

```<code>var img = document.getElementById('wp-image-1045');    // I hope there is only ONE instance?
img[0].src = "http://somewhereRemoved.gif"+"?a="+Math.random();
</code>```

But got the following error:

Uncaught TypeError: Cannot set properties of undefined (setting 'src')

Why the error?

But if class "wp-image-1045" cannot be guaranteed to be unique, would I be better referencing the parent element (for which I can set the class & id):

```<code>let content = document.getElementsByClassName('v12-OurHeroImage');
let firstChild = content.firstChild.nodeName;
img[0].src = "http://somewhereRemoved.gif"+"?a="+Math.random();
</code>```

But I get the error:

Uncaught TypeError: Cannot read properties of undefined (reading
'nodeName')

Where have I gone wrong?

nb. real file references have been replaced with "somewhereRemoved" to protect the innocent

---------Additional info---------

Even when using @This Guy 's corrections, I'm still having problems saying e.g. scr is undefined.  The complete html is given below.  Is the new problem  because of src & srcset?

```<code><figure class="wp-block-image size-large v12-OurHeroImage" id="V12-OurHeroImage">
   <img decoding="async" width="1024" height="341" src="http://somewhereRemoved-1024x341.jpg" alt="" class="wp-image-1045" srcset="http://somewhereRemoved-1024x341.jpg 1024w, http://somewhereRemoved-600x200.jpg 600w, http://somewhereRemoved-300x100.jpg 300w, http://somewhereRemoved-768x256.jpg 768w, http://somewhereRemoved-240x80.jpg 240w, http://somewhereRemoved.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px">
</figure>

var img = document.getElementsByClassName("wp-image-1045");    // there is only ONE????
    img[0].src = "http://somewhereRemoved.gif"+"?a="+Math.random();
</code>```

Gives the error: Uncaught TypeError: Cannot set properties of undefined (setting 'src')

Title: Is it firstChild that I need?

Body:
I am changing the theme of a wordPress site.

Javascript that works on the old site, does not work on the new (test) site because the structure of the dom is different.
The old HTML dom just included:

So the old script to change the img was:

var img = document.getElementsByClassName("header-img");    // there IS only ONE! in this class
img[0].src = "http://somewhereRemoved.gif"+"?a="+Math.random();

The new dom/customization only allows me to set Class & Id for the parent element, not the image:

Initially, I tried:

var img = document.getElementById('wp-image-1045');    // I hope there is only ONE instance?
img[0].src = "http://somewhereRemoved.gif"+"?a="+Math.random();

But got the following error:

Uncaught TypeError: Cannot set properties of undefined (setting 'src')

Why the error?

But if class "wp-image-1045" cannot be guaranteed to be unique, would I be better referencing the parent element (for which I can set the class & id):

let content = document.getElementsByClassName('v12-OurHeroImage');
let firstChild = content.firstChild.nodeName;
img[0].src = "http://somewhereRemoved.gif"+"?a="+Math.random();

But I get the error:

Uncaught TypeError: Cannot read properties of undefined (reading
'nodeName')

Where have I gone wrong?

nb. real file references have been replaced with "somewhereRemoved" to protect the innocent

---------Additional info---------

Even when using @This Guy 's corrections, I'm still having problems saying e.g. scr is undefined.  The complete html is given below.  Is the new problem  because of src & srcset?

var img = document.getElementsByClassName("wp-image-1045");    // there is only ONE????
    img[0].src = "http://somewhereRemoved.gif"+"?a="+Math.random();

Gives the error: Uncaught TypeError: Cannot set properties of undefined (setting 'src')


问:
How can I create a MARKET order with SL/TP in Bybit using CCXT?
I need to make this code works for MARKET orders, I can't find how to get it.</p>
```<code>exchange.create_order(
   symbol='ADA/USDT:USDT',
   type='market',
   side='sell',
   amount=60,
   params={
       'leverage': 1,
       'stopLossPrice': SL_PRICE,
       'takeProfitPrice': TP_PRICE,
   },
)
</code>```

Body:
I need to make this code works for MARKET orders, I can't find how to get it.

exchange.create_order(
   symbol='ADA/USDT:USDT',
   type='market',
   side='sell',
   amount=60,
   params={
       'leverage': 1,
       'stopLossPrice': SL_PRICE,
       'takeProfitPrice': TP_PRICE,
   },
)


问:
'setImageBitmap(android.graphics.Bitmap)' in 'android.widget.ImageView' cannot be applied to '(android.widget.ImageView)' Error
I'm making a card game. But I can't use images. I retrieve base64 string images from FirestoreDatabase and convert to image.

```<code>

private Bitmap convertBase64(String base64) {
    String imageDataBytes = base64.substring(base64.indexOf(",") + 1);
    InputStream inputStream = new ByteArrayInputStream(Base64.decode(imageDataBytes.getBytes(), Base64.DEFAULT));
    return BitmapFactory.decodeStream(new BufferedInputStream(inputStream));
}
</code>```

`

```<code>DocumentReference docRef = FirebaseFirestore.getInstance().collection("Resimler").document("q7YmpzGVBKhPJnboqwcO");
docRef.get().addOnCompleteListener(task -> {
    if (task.isSuccessful()) {
        DocumentSnapshot document = task.getResult();
        if (document.exists()) {
            base64harry = document.getString("HarryPotter");
            imageViewCard11.setImageBitmap(convertBase64(base64harry));
            imageViewCard21.setImageBitmap(convertBase64(base64harry));
            base64ronweasley = document.getString("RonWeasley");
            imageViewCard12.setImageBitmap(convertBase64(base64ronweasley));
            imageViewCard22.setImageBitmap(convertBase64(base64ronweasley));
        }
    }
});
</code>```
```<code>private void doStuff(ImageView img, int kart) {
    if (cards[kart] == 101) {
        img.setImageBitmap(imageViewCard11);
    } else if (cards[kart] == 102) {
        img.setImageBitmap(imageViewCard12);
    } else if (cards[kart] == 201) {
        img.setImageBitmap(imageViewCard21);
    } else if (cards[kart] == 202) {
        img.setImageBitmap(imageViewCard22);
    }
</code>```

I tried to convert setImageResources to setImageBitmap. I watched this game's code on youtube. His code like

```<code>private void doStuff(ImageView img, int kart) {
    if (cards[kart] == 101) {
        img.setImageResources(image101);

private void frontOfCardResources(){
image101= R.drawable. bla bla
</code>```

}

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

the problem is i have error " 'setImageBitmap(android.graphics.Bitmap)' in 'android.widget.ImageView' cannot be applied to '(android.widget.ImageView)'. I cant use bitmap image.

Body:
I'm making a card game. But I can't use images. I retrieve base64 string images from FirestoreDatabase and convert to image.

private Bitmap convertBase64(String base64) {
    String imageDataBytes = base64.substring(base64.indexOf(",") + 1);
    InputStream inputStream = new ByteArrayInputStream(Base64.decode(imageDataBytes.getBytes(), Base64.DEFAULT));
    return BitmapFactory.decodeStream(new BufferedInputStream(inputStream));
}

`

DocumentReference docRef = FirebaseFirestore.getInstance().collection("Resimler").document("q7YmpzGVBKhPJnboqwcO");
docRef.get().addOnCompleteListener(task -> {
    if (task.isSuccessful()) {
        DocumentSnapshot document = task.getResult();
        if (document.exists()) {
            base64harry = document.getString("HarryPotter");
            imageViewCard11.setImageBitmap(convertBase64(base64harry));
            imageViewCard21.setImageBitmap(convertBase64(base64harry));
            base64ronweasley = document.getString("RonWeasley");
            imageViewCard12.setImageBitmap(convertBase64(base64ronweasley));
            imageViewCard22.setImageBitmap(convertBase64(base64ronweasley));
        }
    }
});

private void doStuff(ImageView img, int kart) {
    if (cards[kart] == 101) {
        img.setImageBitmap(imageViewCard11);
    } else if (cards[kart] == 102) {
        img.setImageBitmap(imageViewCard12);
    } else if (cards[kart] == 201) {
        img.setImageBitmap(imageViewCard21);
    } else if (cards[kart] == 202) {
        img.setImageBitmap(imageViewCard22);
    }

I tried to convert setImageResources to setImageBitmap. I watched this game's code on youtube. His code like

private void doStuff(ImageView img, int kart) {
    if (cards[kart] == 101) {
        img.setImageResources(image101);

private void frontOfCardResources(){
image101= R.drawable. bla bla

}

the problem is i have error " 'setImageBitmap(android.graphics.Bitmap)' in 'android.widget.ImageView' cannot be applied to '(android.widget.ImageView)'. I cant use bitmap image.


问:
Android - High tx data consumption
We have an Android application with over 10 000 monthly users.
We recently started receiving feedbacks from users complaining about a concerning data usage (2 to 20GB consumed within a month).

Here is a screenshot coming from one of our users (total, foreground and background data consumption).

I developed a small app that uses NetworkStatsManager to get more insights about how the data was consumed and found out that most of the data consumption were tied to the NetworkStats.Bucket.txBytes.

Our application don't upload much (we do have some services that POST / PUT / PATCH data to our servers, but nothing that would justify such a high data consumption) so I changed this "sampling" application to measure data consumption from Chrome first downloading a 512MB file then uploading it back : as expected, I noticed that it was updating the right rx and tx bucket information.

Aside of querying our backend, our application don't do much and we don't do have any network intensive process (no image / video upload, no heavy local database synchronization, etc...). We first looked for an endless loop trying to do some HTTP calls but after looking at both our local logs plus backend metrics, it seemed like a dead end.

We're using two third-party libraries that could lead to data consumption :

Firebase Cloud Messaging : we're basically receiving a few pushes a day (~10-20 pushes, leading to an asynchronous GET request retrieving data from our servers),

Countly : an on-premise analytics service that allow us to track user events, crashes, performances, etc...

We tried running our app through a proxy looking for the culprit, but it didn't lead anywhere (only HTTP calls we noticed were legitimate and data consumption seemed normal).

It feels like this issue happens once in a while, and the only time we got in touch with on of our impacted users, we could only notice that he had the issue, but he wasn't anymore.

Have you ever faced this issue or do you have any idea that could lead us to get better insight on how the data is used within our application (we have the ability to provide remote-controlled feature flags to our app, but we don't really know what to start with) ?

Title: Android - High tx data consumption


问:
How can I import an csv file into SQLite3 from within Python using subprocess
I'm currently running legacy code that attempts to convert a csv file into a SQL database from within Python. The file is too big for Pandas, so the code is running sqlite3 in a Python subprocess like this:

```<code>    result = subprocess.run(["sqlite3", str(db_name), '-cmd', ".mode csv",
                             '.import '+str(csv).replace('\\','\\\\')
                             +'_nohead ships'], shell=True, capture_output=True)
</code>```

However, things seem to hang when running this statement. I've checked its progress from the shell using:

```<code>ps -ef| egrep "sqlite3|PID"
UID          PID    PPID  C STIME TTY          TIME CMD
smg       583476  583406  0 12:31 pts/3    00:00:00 /bin/sh -c sqlite3 /media/me/Fortress/ais.db -cmd .mode csv .import /media/me/Fortress/ais/AIS_2016_03_Zone10.csv_nohead ships
</code>```

But it's been running almost 3 hours so far, which seems incorrect. Is there something wrong with the command created by this subprocess, or for a 3.3GB file, should I just expect it to take that long?

===== EDIT =========

I just tried with a csv file that I reduced to 10 lines and it still hangs !!????

This is legacy code, this much of it should still work. What am I failing to understand here?

Body:
I'm currently running legacy code that attempts to convert a csv file into a SQL database from within Python. The file is too big for Pandas, so the code is running sqlite3 in a Python subprocess like this:

    result = subprocess.run(["sqlite3", str(db_name), '-cmd', ".mode csv",
                             '.import '+str(csv).replace('\\','\\\\')
                             +'_nohead ships'], shell=True, capture_output=True)

However, things seem to hang when running this statement. I've checked its progress from the shell using:

ps -ef| egrep "sqlite3|PID"
UID          PID    PPID  C STIME TTY          TIME CMD
smg       583476  583406  0 12:31 pts/3    00:00:00 /bin/sh -c sqlite3 /media/me/Fortress/ais.db -cmd .mode csv .import /media/me/Fortress/ais/AIS_2016_03_Zone10.csv_nohead ships

But it's been running almost 3 hours so far, which seems incorrect. Is there something wrong with the command created by this subprocess, or for a 3.3GB file, should I just expect it to take that long?

===== EDIT =========

I just tried with a csv file that I reduced to 10 lines and it still hangs !!????

This is legacy code, this much of it should still work. What am I failing to understand here?


问:
List of SonarLint rules
I'm using Sonarlint to control bugs/code smells from a list of codes, by extracting each output from VS Code and creating some graphs with Python/Pandas. Even though we can find the rules in https://rules.sonarsource.com/c/RSPEC-3936, I couldn't find a list of all code numbers with respective category, be it minor, major etc.

Since we can find rule descriptions like "switch statements should cover all cases (c:S3562), Major" in VsCode itself, I still think it is quite possible to find some sort of CSV/xlsx file which contains that information. Does anyone know if is there any?

Title: List of SonarLint rules


问:
How to add label to ggplot2 shapefile plot points?
The R code I have written below takes the "site_longitude" and "site_latitude" from my given .csv file, converting them into coordinates and plotting them as points on the "England_utla_2022.shp" shapefile I have read as the "uk" object.

```<code>library(sf)
library(ggplot2)

uk <- st_read("England_utla_2022.shp")

Aggregate_Mutation_Data <- read.csv("aggregate_mutation_data.csv")

d_points <- data.frame(long = Aggregate_Mutation_Data$site_longitude,
                       lat  = Aggregate_Mutation_Data$site_latitude,
                       site = Aggregate_Mutation_Data$site) %>%
  st_as_sf(coords = c("long", "lat"), crs = 4326)

ggplot(uk) +
  geom_sf()+ geom_sf(data = d_points,
                     color = "red", size = 2, alpha = 0.5) +
  theme_minimal()
</code>```

My issue with this comes from attempting to add labels to each of the points plotted using another column in my .csv file, "site". I have tried to do this using the geom_text() and geom_label() functions, however I have not yet had any success with this. What would be the most straightforward way to add these labels? Thanks in advance!

Body:
The R code I have written below takes the "site_longitude" and "site_latitude" from my given .csv file, converting them into coordinates and plotting them as points on the "England_utla_2022.shp" shapefile I have read as the "uk" object.

library(sf)
library(ggplot2)

uk <- st_read("England_utla_2022.shp")

Aggregate_Mutation_Data <- read.csv("aggregate_mutation_data.csv")

d_points <- data.frame(long = Aggregate_Mutation_Data$site_longitude,
                       lat  = Aggregate_Mutation_Data$site_latitude,
                       site = Aggregate_Mutation_Data$site) %>%
  st_as_sf(coords = c("long", "lat"), crs = 4326)

ggplot(uk) +
  geom_sf()+ geom_sf(data = d_points,
                     color = "red", size = 2, alpha = 0.5) +
  theme_minimal()

My issue with this comes from attempting to add labels to each of the points plotted using another column in my .csv file, "site". I have tried to do this using the geom_text() and geom_label() functions, however I have not yet had any success with this. What would be the most straightforward way to add these labels? Thanks in advance!


问:
Arkime Viewer Project fails to run locally
I download this project of Arkime from here:
https://github.com/arkime/arkime

And I installed everything that was needed.

But when I do npm run wise:start (to run the project locally) - I get the following error:

```<code>ERROR - Couldn't open config file '../config.ini' maybe use the -c <configfile> option
</code>```

What can I do?

Thank You!

Body:
I download this project of Arkime from here:
https://github.com/arkime/arkime

And I installed everything that was needed.

But when I do npm run wise:start (to run the project locally) - I get the following error:

ERROR - Couldn't open config file '../config.ini' maybe use the -c <configfile> option

What can I do?

Thank You!


问:
Error: " MSVCCompiler' object has no attribute 'compiler_so " Appears whenver I try to compile a GitHub library
Good Afternoon,

I'm currently trying to create a program that utilizes Python language to run Microsoft's Azure Kinect camera (https://learn.microsoft.com/en-us/azure/kinect-dk/)

The camera utilizes C++ to run it's developer kits. However, I recently discovered a GitHub library online that converts the C++ toolkit into Python (https://github.com/jrterven/KinZ-Python)

However, every time I try to run the pip install . command to implement the GitHub library, I'm met with an error that states:

```<code>AttributeError: 'MSVCCompiler' object has no attribute 'compiler_so'
</code>```

Along with an extremely long paragraph of errors (which I can post if necessary).

The GitHub library (KinZ) states that you need to have a computer with CUDA (in which you NEED an Nvidia GPU for). But the error still occurs.

Supposedly, the reason is due to the compiler_so not supported on Windows and it doesn't matter as much if you have CUDA with the right Nvidia GPU to run it. (Yes, I do have an NVidia GPU)

So I don't know what to do from here...

Body:
Good Afternoon,

I'm currently trying to create a program that utilizes Python language to run Microsoft's Azure Kinect camera (https://learn.microsoft.com/en-us/azure/kinect-dk/)

The camera utilizes C++ to run it's developer kits. However, I recently discovered a GitHub library online that converts the C++ toolkit into Python (https://github.com/jrterven/KinZ-Python)

However, every time I try to run the pip install . command to implement the GitHub library, I'm met with an error that states:

AttributeError: 'MSVCCompiler' object has no attribute 'compiler_so'

Along with an extremely long paragraph of errors (which I can post if necessary).

The GitHub library (KinZ) states that you need to have a computer with CUDA (in which you NEED an Nvidia GPU for). But the error still occurs.

Supposedly, the reason is due to the compiler_so not supported on Windows and it doesn't matter as much if you have CUDA with the right Nvidia GPU to run it. (Yes, I do have an NVidia GPU)

So I don't know what to do from here...


问:
Is there a method to dynamically calculate bin ranges so that record counts are equivalent for all bins (Excel)?
I work with higher education data and my company is looking for a way to automate bin sizing. We receive individual records of students and their GPA, and "rank" them accordingly. MRE:

GPA Points
Record Count

0
130

1.0
200

2.0
480

3.0
27

4.0
100

5.0
59

Total:
997

Is there a way to automatically shift the "GPA Points" so that the amount in "Record Count" is about equal for all bins? This would need to be done through Excel, as my work operates with Access, Excel, and Tableau.

Please let me know what you think!

I've tried Sorting algorithms, Visual aids (histograms), and manual sorting. These options work fine, but they're time consuming and sometimes difficult when a university has a 100-point scale GPA.