问:
Angular Material Table including nested tables
I am to plot table on the nested data source. I am trying with calling API. Its fails with the error Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays. although it works for the static source.

    displayedColumns: string[] = ['title'];
    importFileCluster() {
        fetch('./assets/cluster-windows.json')
            .then(res => res.json())
            .then((jsonData: AllTabs[]) => {
                const folders: Array<AllTabs> = jsonData;
                this.allImportedSections = new MatTableDataSource<AllTabs>(folders);
            });
    }
```
<pre class="lang-html prettyprint-override"><code><mat-accordion class="example-headers-align">
        <mat-expansion-panel *ngFor="let item of allImportedSections">
            <mat-expansion-panel-header>
                <mat-panel-title>
                    {{ item.title }}
                </mat-panel-title>
            </mat-expansion-panel-header>

            <ng-container *ngIf="item.tabs.length > 0">
                <table [dataSource]="item.tabs" class="text-list" mat-table>
                    <ng-container matColumnDef="title">
                        <th *matHeaderCellDef mat-header-cell> title</th>
                        <td *matCellDef="let row" mat-cell> {{row.title}}</td>
                    </ng-container>

<!--                    <ng-container matColumnDef="hostname">
                        <th *matHeaderCellDef mat-header-cell> hostname</th>
                        <td *matCellDef="let row" mat-cell> {{row.hostname}}</td>
                    </ng-container>
-->
                    <tr *matHeaderRowDef="displayedColumns; sticky:true" mat-header-row></tr>
                    <tr *matRowDef="let row; columns: displayedColumns" mat-row></tr>
                </table>
            </ng-container>
        </mat-expansion-panel>
    </mat-accordion>
</code>```

[
   {
      "title":"GC FLAGS",
      "tabs":[
         {
            "url":"https://github.com/fortytw2/leaktest",
            "title":"fortytw2/leaktest: Goroutine Leak Detector",
            "hostname":"github.com"
         },
         {
            "url":"https://rakyll.org/go-tool-flags/",
            "title":"Go tooling essentials · rakyll.org",
            "hostname":"rakyll.org"
         }
      ]
   }
]
```

Body:
I am to plot table on the nested data source. I am trying with calling API. Its fails with the error Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays. although it works for the static source.

    displayedColumns: string[] = ['title'];
    importFileCluster() {
        fetch('./assets/cluster-windows.json')
            .then(res => res.json())
            .then((jsonData: AllTabs[]) => {
                const folders: Array<AllTabs> = jsonData;
                this.allImportedSections = new MatTableDataSource<AllTabs>(folders);
            });
    }

<mat-accordion class="example-headers-align">
        <mat-expansion-panel *ngFor="let item of allImportedSections">
            <mat-expansion-panel-header>
                <mat-panel-title>
                    {{ item.title }}
                </mat-panel-title>
            </mat-expansion-panel-header>

            <ng-container *ngIf="item.tabs.length > 0">

                    <ng-container matColumnDef="title">
                         title
                         {{row.title}}
                    </ng-container>

            </ng-container>
        </mat-expansion-panel>
    </mat-accordion>

[
   {
      "title":"GC FLAGS",
      "tabs":[
         {
            "url":"https://github.com/fortytw2/leaktest",
            "title":"fortytw2/leaktest: Goroutine Leak Detector",
            "hostname":"github.com"
         },
         {
            "url":"https://rakyll.org/go-tool-flags/",
            "title":"Go tooling essentials · rakyll.org",
            "hostname":"rakyll.org"
         }
      ]
   }
]


来源: stackexchange

ContentLicense: CC BY-SA 4.0

Title: unexpected results with np.hstack and np.c_ with regard to decimal points

Body:
I have a matrix (3x3) of

matrix = [[-8.51871377e-01 -5.22712676e-01  3.29641828e-02]
          [ 5.22321761e-01 -8.52508933e-01 -2.02118648e-02]
          [ 3.86672578e-02 -6.20947349e-10  9.99252295e-01]]

and I have a vector (3x1) of

vector = [[0.28407955]
          [0.681005  ]
          [4.12974119]]

When I concatenate the matrix with the vector via np.hstack or np.c_ then I get the following concatenation:

concat = [[-8.51871377e-01 -5.22712676e-01  3.29641828e-02  2.84079552e-01]
           [ 5.22321761e-01 -8.52508933e-01 -2.02118648e-02  6.81005001e-01]
           [ 3.86672578e-02 -6.20947349e-10  9.99252295e-01  4.12974119e+00]]

and not as expected:

concat = [[-8.51871377e-01 -5.22712676e-01  3.29641828e-02  0.28407955...]
           [ 5.22321761e-01 -8.52508933e-01 -2.02118648e-02  0.681005...]
          [ 3.86672578e-02 -6.20947349e-10  9.99252295e-01  4.12974119e+00]]

On the very right side of the concatenation it seems that the 0.'s are ignored in 0.28407955 and 0.681005 which means that the decimal point is shifted one place to the right and this leads to 2.84079552e-01 and 6.81005001e-01. Why is this happening and how can I get my expected results?


问:
Save Django Website State across all browsers the app is accessed at
I have created a Django webiste which fetches data on a realtime basis through view and renders to the Html Template, I am already running serveral ajax queries to refresh my specific views to render and display data every second, but now i have a bigger problem which is to maintain the same state of the template accross all the browsers the Django server is accessed at. For example If user 'A' logs in  and do certain operations on the webiste which changes the states of tables in my pstgres, and after an hour user 'B' logs in with same credentials he should be able to see the same operations running but right only the raw template is visible to user 'B'. I have created the middleware using postgres.

I am not getting the solution to this since a long time now. I tries using ajax to call every view once but i don't think this solution is a long term because as more views get added more and more ajax calls will slow down the system.


问:
Datar - summarise count python using the datar package(dplyr)
I cant seem to find a way to summarise count on a dataframe

```<code>from datar.all import *

df = tibble(a=c("a","b","a","b","a"),b=c(1,1,None,1,2))

df >> group_by(f.a) >> summarise(distinct=n_distinct(f.b) ,total_by_group=n())

         a  distinct  total_by_group
  <object>   <int64>         <int64>
0        a         2               3
1        b         1               2
</code>```

However when i tried to do a count on the same column I m getting an error, where I m would expect to see the value count excluding the None - using n() only gives the row count which I m not interested about

```<code>    df >> group_by(f.a) >> summarise(count(f.b))
NotImplementedByCurrentBackendError: 'count' (data type: SeriesGroupBy, backends: numpy, pandas)
</code>```

What i would like to see is

```<code>         a  distinct  total_by_group count
  <object>   <int64>         <int64> <int64>
0        a         2               3 2
1        b         1               2 2
</code>```

Body:
I cant seem to find a way to summarise count on a dataframe

from datar.all import *

df = tibble(a=c("a","b","a","b","a"),b=c(1,1,None,1,2))

df >> group_by(f.a) >> summarise(distinct=n_distinct(f.b) ,total_by_group=n())

         a  distinct  total_by_group
  <object>   <int64>         <int64>
0        a         2               3
1        b         1               2

However when i tried to do a count on the same column I m getting an error, where I m would expect to see the value count excluding the None - using n() only gives the row count which I m not interested about

    df >> group_by(f.a) >> summarise(count(f.b))
NotImplementedByCurrentBackendError: 'count' (data type: SeriesGroupBy, backends: numpy, pandas)

What i would like to see is

         a  distinct  total_by_group count
  <object>   <int64>         <int64> <int64>
0        a         2               3 2
1        b         1               2 2


问:
PM2 ecosystem.config.js ignore_watch restarting
Running my app with pm2 start index.js --watch functions as expected. I would like to use the config to ignore_watch.

ecosystem.config.js

```<code>module.exports = {
  apps : [{
    name   : "appname",
    script : "./index.js",
    watch  : true,
    max_mamory_restart : "1G",
    ignore_watch : "\.bash(rc|_(history|logout)),\.(cache|config|gitignore|lesshst|local|npm|pm2|profile|sudo_as_admin_successful|vscode_server),.*swp,snap,.*config.js,package-lock.json,node_modules,jira,logs"
  }]
}
</code>```

When I run pm2 start ecosystem.config.js, my app runs, but constantly restarts with Change detected on path .pm2/.......

I thought that maybe I am not writing the ignore_watch correctly, so I tried

```<code>ignore_watch : [
    ".pm2",
    "\.bash(rc|_(history|logout))",
    "\.cache|config|gitignore|lesshst|local|npm|pm2|profile|sudo_as_admin_successful|vscode_server)",
    ".*swp",
    "snap",
    ".*config.js,package-lock.json,node_modules,jira,logs"
]
</code>```

which then gives me constant restarts with Change detected on path .vscode_server/.......

I then tried the same thing by editing ignore_watch to:

```<code>ignore_watch : [
    ".vscode_server",
    ".pm2",
</code>```

but this still restarts with with Change detected on path .vscode_server/.......

I don't understand how the ignore_watch is working, especially where the original pm2 start index.js --watch doesn't appear to watch these folders and its not constantly restarting.

Body:
Running my app with pm2 start index.js --watch functions as expected. I would like to use the config to ignore_watch.

ecosystem.config.js

module.exports = {
  apps : [{
    name   : "appname",
    script : "./index.js",
    watch  : true,
    max_mamory_restart : "1G",
    ignore_watch : "\.bash(rc|_(history|logout)),\.(cache|config|gitignore|lesshst|local|npm|pm2|profile|sudo_as_admin_successful|vscode_server),.*swp,snap,.*config.js,package-lock.json,node_modules,jira,logs"
  }]
}

When I run pm2 start ecosystem.config.js, my app runs, but constantly restarts with Change detected on path .pm2/.......

I thought that maybe I am not writing the ignore_watch correctly, so I tried

ignore_watch : [
    ".pm2",
    "\.bash(rc|_(history|logout))",
    "\.cache|config|gitignore|lesshst|local|npm|pm2|profile|sudo_as_admin_successful|vscode_server)",
    ".*swp",
    "snap",
    ".*config.js,package-lock.json,node_modules,jira,logs"
]

which then gives me constant restarts with Change detected on path .vscode_server/.......

I then tried the same thing by editing ignore_watch to:

ignore_watch : [
    ".vscode_server",
    ".pm2",

but this still restarts with with Change detected on path .vscode_server/.......

I don't understand how the ignore_watch is working, especially where the original pm2 start index.js --watch doesn't appear to watch these folders and its not constantly restarting.


问:
reactjs-saga login with 2fa otp
have a completed React application and I want to enable two-factor authentication in it

I did all the required things regarding this feature in terms of the back end and the front end

Activate the feature for the user - Scan the code with the phone application and verify it - Verify the otp code .. etc

Of course the user who did not activate this feature in his account can login

the Backend when trying to login and after verifying the user name and password

it will return the user information with the token

so I will know if the user has activated the feature Here I have to convert it to a page to verify the otp code and then complete it on the dashboard

this login

```<code>    function* loginUser({ payload: { user, history } }) {
  try {
      const response = yield call(postJwtLogin, {
        username: user.email,
        password: user.password,
      });
      if(response.data.token){
        sessionStorage.setItem("authUser", JSON.stringify(response));
      }
      if (response.status === "SUCCESS") {
        yield put(loginSuccess(response));
/*
         Here the conversion takes place to the verification page
         but of course there will be an error in the logic,
         which is that the user can skip the page
*/
        if (response.data.Is2FA === true){
          window.location.href = '/auth-twostep-cover';
        }

        window.location.href = '/dashboard';
      } else {
        yield put(apiError(response));
      }

  } catch (error) {
    yield put(apiError(error));
    toast.error(error, { autoClose: 6000 });
  }
}
</code>```

this Verifyotp

```<code>function* onVerifyOTP({ payload: otp }) {
    try {

        const response = yield call(VerifyOTPApi, otp);

        yield put(VerifyOTPSuccess(response.data));
       // toast.success("", { autoClose: 3000 });
    } catch (error) {
        yield put(VerifyOTPFail(error));
     toast.error(error, { autoClose: 6000 });

    }
}
</code>```

Title: reactjs-saga login with 2fa otp

Body:
have a completed React application and I want to enable two-factor authentication in it

I did all the required things regarding this feature in terms of the back end and the front end

Activate the feature for the user - Scan the code with the phone application and verify it - Verify the otp code .. etc

Of course the user who did not activate this feature in his account can login

the Backend when trying to login and after verifying the user name and password

it will return the user information with the token

so I will know if the user has activated the feature Here I have to convert it to a page to verify the otp code and then complete it on the dashboard

this login

    function* loginUser({ payload: { user, history } }) {
  try {
      const response = yield call(postJwtLogin, {
        username: user.email,
        password: user.password,
      });
      if(response.data.token){
        sessionStorage.setItem("authUser", JSON.stringify(response));
      }
      if (response.status === "SUCCESS") {
        yield put(loginSuccess(response));
/*
         Here the conversion takes place to the verification page
         but of course there will be an error in the logic,
         which is that the user can skip the page
*/
        if (response.data.Is2FA === true){
          window.location.href = '/auth-twostep-cover';
        }

        window.location.href = '/dashboard';
      } else {
        yield put(apiError(response));
      }

  } catch (error) {
    yield put(apiError(error));
    toast.error(error, { autoClose: 6000 });
  }
}

this Verifyotp

function* onVerifyOTP({ payload: otp }) {
    try {

        const response = yield call(VerifyOTPApi, otp);

        yield put(VerifyOTPSuccess(response.data));
       // toast.success("", { autoClose: 3000 });
    } catch (error) {
        yield put(VerifyOTPFail(error));
     toast.error(error, { autoClose: 6000 });

    }
}


问:
Run Karate-Gatling Performance test with Blazmeter or Taurus tool
As far as I know, we can integrate Gatling with Blazemeter using Taurus yml file but when I tried to run gatling test simulation file using Taurus I'm getting this error:

object intuit is not a member of package com import com.intuit.karate.gatling.PreDef.karateFeature.

So is there any way how to run Karate Gatling Performance Test using Taurus?


问:
Detected implicit cartesian product for INNER join between logical plans Aggregate
I have below join condition,

```<code>df_data = df1.join(df2, df1.value == df2.value, "inner").select(df1['*'], df2['column'])
</code>```

This join is causing,
AnalysisException: "Detected implicit cartesian product for INNER join between logical plans\nAggregate

Any suggestion will be helpful

Body:
I have below join condition,

df_data = df1.join(df2, df1.value == df2.value, "inner").select(df1['*'], df2['column'])

This join is causing,
AnalysisException: "Detected implicit cartesian product for INNER join between logical plans\nAggregate

Any suggestion will be helpful


问:
Colorama doesn't color in tabulators
I was trying to color in every other row of my table, but I noticed that colorama doesn't color tabulators ('\t'). Is there a way to fix this?

Title: Colorama doesn't color in tabulators


问:
'Kotlin not configured' in Maven project after doing git rebase
I created a new branch and checked out some keys to that branch and then committed it to main. I then switched to a branch called 'feature' where I was working on some other code, and changed the passwords there too so it would work.

I then did a git rebase to eliminate the files from my commit because they are already committed to main. As soon as I did this I started getting a whole host of red syntax highlighting on all my files, including all pom.xml files.

However when I run mvn test I get build successful. How do I resolve this issue?


问:
onResponse from RequestHook (testcafe) doesn't work
I use testcafe with Cucumber.
After update testcafe version to 1.20.0 some requests doesn't get response.
I implement a request hook like this:

```<code>class CustomRequestHook extends RequestHook {
    constructor(requestFilterRules, responseEventConfigureOpts) {
        super(requestFilterRules, responseEventConfigureOpts);
        this.requests = {};
    }

    async onRequest(event) {
        let requestInfo = event._requestInfo;
        this.requests[requestInfo.requestId] = {
            url: requestInfo.url,
            method: requestInfo.method,
            contentType: requestInfo.headers['content-type'],
            body: requestInfo.body,
            startTime: process.hrtime(),
            startDate: new Date().toUTCString()
        };
    }

    async onResponse(event) {
        let request = this.requests[event.requestId];
        const diffArray = process.hrtime(request.startTime);
        request.duration = Math.ceil(diffArray[0] * 1000 + diffArray[1] / 1000000);
        request.statusCode = event.statusCode;
    }

    getRequests() {
        return Object.values(this.requests);
    }
}
</code>```

In the end of scenario I write info about requests to a file, but statusCode and duration are undefined for some requests. So the ui page doesn't loaded and test fails. This is a floating bug. For the same requests in different scenarios, the response may or may not recieved.
For testcafe 14.0.0 it works ok.
Has anyone encountered a similar problem?

I tried to update tescafe version to 2.2.0, but it did not help

Body:
I use testcafe with Cucumber.
After update testcafe version to 1.20.0 some requests doesn't get response.
I implement a request hook like this:

class CustomRequestHook extends RequestHook {
    constructor(requestFilterRules, responseEventConfigureOpts) {
        super(requestFilterRules, responseEventConfigureOpts);
        this.requests = {};
    }

    async onRequest(event) {
        let requestInfo = event._requestInfo;
        this.requests[requestInfo.requestId] = {
            url: requestInfo.url,
            method: requestInfo.method,
            contentType: requestInfo.headers['content-type'],
            body: requestInfo.body,
            startTime: process.hrtime(),
            startDate: new Date().toUTCString()
        };
    }

    async onResponse(event) {
        let request = this.requests[event.requestId];
        const diffArray = process.hrtime(request.startTime);
        request.duration = Math.ceil(diffArray[0] * 1000 + diffArray[1] / 1000000);
        request.statusCode = event.statusCode;
    }

    getRequests() {
        return Object.values(this.requests);
    }
}

In the end of scenario I write info about requests to a file, but statusCode and duration are undefined for some requests. So the ui page doesn't loaded and test fails. This is a floating bug. For the same requests in different scenarios, the response may or may not recieved.
For testcafe 14.0.0 it works ok.
Has anyone encountered a similar problem?

I tried to update tescafe version to 2.2.0, but it did not help


问:
RegisterRext.exe errors when trying to configure R with SQL Server 2022
I have been following the steps at this site to configure R 4.2.2 to work with a named instance of SQL Server 2022:

https://learn.microsoft.com/en-us/sql/machine-learning/install/sql-machine-learning-services-windows-install-sql-2022?view=sql-server-ver16&viewFallbackFrom=sql-server-ver16%27

I installed RTools, R, Microsoft R client, and installed the R packages specified on the link above.  When I try to configure RegisterRext.exe with this command:

```<code>.\RegisterRext.exe /configure /rhome:"%ProgramFiles%\R\R-4.2.2" /instance:"SQL2022"
</code>```

I get this error:

```<code>Wrong or missing command
Error: Wrong or missing command.
Usage: RegisterRExt.exe <command> [/instance:name] [/user:username] [/password:*|password] [/database:databasename].
The commands are :
/install - copies the launcher binaries to the right location for a SQL server instance.
/uninstall - removes the launcher binaries from the SQL server instance.
/installpkgmgmt - installs package management support for given SQL server instance and database also if specified.
/uninstallpkgmgmt - uninstalls package management support from given SQL server instance and database also if specified.
/installrts - installs real time scoring support for given SQL server instance and database.
/uninstallrts - uninstalls real time scoring support for given SQL server instance and database.
Arguments are :
/instance:value is an optional parameter, the <value> specified will be used as the instance name else the commands are performed on the default instance.
/user:username is an optional parameter, the <username> specified will be used to connect via the SQL authentication mode. Note that once this parameter is specified, /password:<value> is a required parameter.
/password:*|<password> is a required parameter once /user parameter is provided. Use /password:* to type the password when asked to by the tool instead of providing in clear as a parameter. Note that providing the password without the user is ignored.
/appcontainer is an optional parameter, if specified indicates that appcontainer feature is enabled. Not specified by default.
/flavor is an optional parameter, if specified indicates what kind of installation flavor it is. By default, its value is sql
Windows Authentication is used by default when no user and password is supplied
</code>```

How do you configure the R runtime with SQL Server?

Body:
I have been following the steps at this site to configure R 4.2.2 to work with a named instance of SQL Server 2022:

https://learn.microsoft.com/en-us/sql/machine-learning/install/sql-machine-learning-services-windows-install-sql-2022?view=sql-server-ver16&viewFallbackFrom=sql-server-ver16%27

I installed RTools, R, Microsoft R client, and installed the R packages specified on the link above.  When I try to configure RegisterRext.exe with this command:

.\RegisterRext.exe /configure /rhome:"%ProgramFiles%\R\R-4.2.2" /instance:"SQL2022"

I get this error:

Wrong or missing command
Error: Wrong or missing command.
Usage: RegisterRExt.exe <command> [/instance:name] [/user:username] [/password:*|password] [/database:databasename].
The commands are :
/install - copies the launcher binaries to the right location for a SQL server instance.
/uninstall - removes the launcher binaries from the SQL server instance.
/installpkgmgmt - installs package management support for given SQL server instance and database also if specified.
/uninstallpkgmgmt - uninstalls package management support from given SQL server instance and database also if specified.
/installrts - installs real time scoring support for given SQL server instance and database.
/uninstallrts - uninstalls real time scoring support for given SQL server instance and database.
Arguments are :
/instance:value is an optional parameter, the <value> specified will be used as the instance name else the commands are performed on the default instance.
/user:username is an optional parameter, the <username> specified will be used to connect via the SQL authentication mode. Note that once this parameter is specified, /password:<value> is a required parameter.
/password:*|<password> is a required parameter once /user parameter is provided. Use /password:* to type the password when asked to by the tool instead of providing in clear as a parameter. Note that providing the password without the user is ignored.
/appcontainer is an optional parameter, if specified indicates that appcontainer feature is enabled. Not specified by default.
/flavor is an optional parameter, if specified indicates what kind of installation flavor it is. By default, its value is sql
Windows Authentication is used by default when no user and password is supplied

How do you configure the R runtime with SQL Server?


问:
Can't see the design of other xml files except of the activity_main.xml
Here is my code from the file page2.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  <!-- Main content view -->
  <FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Hello world text -->
    <TextView
        android:id="@+id/text_hello_world"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello world"
        android:textSize="20sp"
        android:layout_gravity="center" />

  </FrameLayout>

  <!-- Side bar menu -->
  <com.google.android.material.navigation.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:menu="@menu/sidebar_menu" />

</androidx.drawerlayout.widget.DrawerLayout>
</code>```

The code must be correct.

When I am moving from activity_main.xml to page2.xml I can see the design for 1-2 seconds

and then it disappears

How can I fix it?

Body:
Here is my code from the file page2.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  <FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/text_hello_world"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello world"
        android:textSize="20sp"
        android:layout_gravity="center" />

  </FrameLayout>

  <com.google.android.material.navigation.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:menu="@menu/sidebar_menu" />

</androidx.drawerlayout.widget.DrawerLayout>

The code must be correct.

When I am moving from activity_main.xml to page2.xml I can see the design for 1-2 seconds

and then it disappears

How can I fix it?


问:
Google Workspace - GAM installation
While trying to install for the first time GAM for our Google Workspace, i'm getting that error
I follow this instruction, of course account i try to use has the superadmin privileges.

```<code>ERROR: [{'@type': 'type.googleapis.com/google.rpc.PreconditionFailure', 'violations': [{'type': 'constraints/iam.disableServiceAccountKeyUpload', 'subject': 'projects/gam-project-6e3-cuw-1iy/serviceAccounts/gam-project-6e3-cuw-1iy@gam-project-6e3-cuw-1iy.iam.gserviceaccount.com?configvalue=gam-project-6e3-cuw-1iy%40gam-project-6e3-cuw-1iy.iam.gserviceaccount.com', 'description': 'Constraint `constraints/iam.disableServiceAccountKeyUpload` violated for service account projects/gam-project-6e3-cuw-1iy/serviceAccounts/gam-project-6e3-cuw-1iy@gam-project-6e3-cuw-1iy.iam.gserviceaccount.com attempting to upload public key.'}]}]
Project creation failed. Trying again. Say N to skip project creation.

GAM is now installed. Are you ready to set up a Google API project for GAM? (yes or no)
</code>```

Tried go delete a created project in GCP and start again.

Title: Google Workspace - GAM installation

Body:
While trying to install for the first time GAM for our Google Workspace, i'm getting that error
I follow this instruction, of course account i try to use has the superadmin privileges.

ERROR: [{'@type': 'type.googleapis.com/google.rpc.PreconditionFailure', 'violations': [{'type': 'constraints/iam.disableServiceAccountKeyUpload', 'subject': 'projects/gam-project-6e3-cuw-1iy/serviceAccounts/gam-project-6e3-cuw-1iy@gam-project-6e3-cuw-1iy.iam.gserviceaccount.com?configvalue=gam-project-6e3-cuw-1iy%40gam-project-6e3-cuw-1iy.iam.gserviceaccount.com', 'description': 'Constraint `constraints/iam.disableServiceAccountKeyUpload` violated for service account projects/gam-project-6e3-cuw-1iy/serviceAccounts/gam-project-6e3-cuw-1iy@gam-project-6e3-cuw-1iy.iam.gserviceaccount.com attempting to upload public key.'}]}]
Project creation failed. Trying again. Say N to skip project creation.

GAM is now installed. Are you ready to set up a Google API project for GAM? (yes or no)

Tried go delete a created project in GCP and start again.


问:
Kafka Streams application terminates unexpectedly on join
I am building a Kakfa streams application with the source topic named csv-input.
It contains 100 fields of type String

```<code>A | B | C | D | ...
</code>```

I have few more mapping topics with columns of type string each with 2 fields each(key, value): lob-segment-mapping, product-family-mapping, etc.

Their fields have data I would like to lookup and replace with in the main source topic and write the output to a final-topic. I am using KTables for these topics. When I run a join after populating csv-input with mapping topics, the application terminates in a few moments. Consumer of the final topic is empty. I have prepopulated the topics, and also tried running the jar when the left topic is streaming. Am I missing something? Secondly, I have to co-partition the csv-input(which is quite large ) with the key of each of the mapping topics every time I join them. Is there an alternative?

This is my code to build the toplogy:

```<code>public class BuildTopology {

    private static final String INPUT_TOPIC = "csv-input";
    private static final String INTR_TOPIC = "lob-segment-mapping";
    private static final String FINAL_TOPIC = "final-topic";

    public static Topology buildTopology() {
        Serde<String> stringSerde = Serdes.String();
        StreamsBuilder builder = new StreamsBuilder();

        KStream<String, CSVData> csvStream = builder
                .stream(INPUT_TOPIC, Consumed.with(stringSerde, JsonSerdes.CSVData()))
                .selectKey((k, v) -> v.getLobSegment());

        KTable<String, LOBSegmentMapping> lobTable = builder.table(INTR_TOPIC,
                Consumed.with(stringSerde, JsonSerdes.LOBSegmentMapping()));

        csvStream.join(lobTable, (csv, lob) -> new FinalOutput(csv, lob)).to(FINAL_TOPIC,
                Produced.with(stringSerde, JsonSerdes.FinalOutput()));

        return builder.build();
    }
}

public class App {

    public static void main(String[] args) {
        /* build the topology */
        Topology topology = BuildTopology.buildTopology();

        System.out.println(topology.describe().toString());

        /* set the required properties for running Kafka Streams */
        Properties props = new Properties();
        props.put(StreamsConfig.APPLICATION_ID_CONFIG, "dev-id");
        props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
        props.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 0);
        props.put(StreamsConfig.STATE_DIR_CONFIG, "/home/test/demo/streams/state");

        /* Build the topology with Kafka streams */
        System.out.println("Starting Application...");
        KafkaStreams streams = new KafkaStreams(topology, props);
        System.out.println("Streaming...");

        /* Close Kafka Streams when the JVM shuts down */
        Runtime.getRuntime().addShutdownHook(new Thread(streams::close));

        /* start streaming!! */
        streams.start();
    }
}
</code>```

The objects are:

```<code>public class FinalOutput {

    @JsonProperty
    CSVData finalData;

    public FinalOutput() {
    }

    public FinalOutput(final CSVData data, final LOBSegmentMapping lobMapping) {
        this.finalData = data;
        finalData.setLobSegment(lobMapping.getRevisedLob());
    }

    @Override
    public String toString() {
        return "FinalOutput [finalData=" + finalData + "]";
    }
}
</code>```

The resulting topology as described is:

```<code>Topologies:
   Sub-topology: 0
    Source: KSTREAM-SOURCE-0000000000 (topics: [csv-input])
      --> KSTREAM-KEY-SELECT-0000000001
    Processor: KSTREAM-KEY-SELECT-0000000001 (stores: [])
      --> KSTREAM-FILTER-0000000006
      <-- KSTREAM-SOURCE-0000000000
    Processor: KSTREAM-FILTER-0000000006 (stores: [])
      --> KSTREAM-SINK-0000000005
      <-- KSTREAM-KEY-SELECT-0000000001
    Sink: KSTREAM-SINK-0000000005 (topic: KSTREAM-KEY-SELECT-0000000001-repartition)
      <-- KSTREAM-FILTER-0000000006

  Sub-topology: 1
    Source: KSTREAM-SOURCE-0000000003 (topics: [lob-segment-mapping])
      --> KTABLE-SOURCE-0000000004
    Source: KSTREAM-SOURCE-0000000007 (topics: [KSTREAM-KEY-SELECT-0000000001-repartition])
      --> KSTREAM-JOIN-0000000008
    Processor: KSTREAM-JOIN-0000000008 (stores: [lob-segment-mapping-STATE-STORE-0000000002])
      --> none
      <-- KSTREAM-SOURCE-0000000007
    Processor: KTABLE-SOURCE-0000000004 (stores: [lob-segment-mapping-STATE-STORE-0000000002])
      --> none
      <-- KSTREAM-SOURCE-0000000003
</code>```

Body:
I am building a Kakfa streams application with the source topic named csv-input.
It contains 100 fields of type String

A | B | C | D | ...

I have few more mapping topics with columns of type string each with 2 fields each(key, value): lob-segment-mapping, product-family-mapping, etc.

Their fields have data I would like to lookup and replace with in the main source topic and write the output to a final-topic. I am using KTables for these topics. When I run a join after populating csv-input with mapping topics, the application terminates in a few moments. Consumer of the final topic is empty. I have prepopulated the topics, and also tried running the jar when the left topic is streaming. Am I missing something? Secondly, I have to co-partition the csv-input(which is quite large ) with the key of each of the mapping topics every time I join them. Is there an alternative?

This is my code to build the toplogy:

public class BuildTopology {

    private static final String INPUT_TOPIC = "csv-input";
    private static final String INTR_TOPIC = "lob-segment-mapping";
    private static final String FINAL_TOPIC = "final-topic";

    public static Topology buildTopology() {
        Serde<String> stringSerde = Serdes.String();
        StreamsBuilder builder = new StreamsBuilder();

        KStream<String, CSVData> csvStream = builder
                .stream(INPUT_TOPIC, Consumed.with(stringSerde, JsonSerdes.CSVData()))
                .selectKey((k, v) -> v.getLobSegment());

        KTable<String, LOBSegmentMapping> lobTable = builder.table(INTR_TOPIC,
                Consumed.with(stringSerde, JsonSerdes.LOBSegmentMapping()));

        csvStream.join(lobTable, (csv, lob) -> new FinalOutput(csv, lob)).to(FINAL_TOPIC,
                Produced.with(stringSerde, JsonSerdes.FinalOutput()));

        return builder.build();
    }
}

public class App {

    public static void main(String[] args) {
        /* build the topology */
        Topology topology = BuildTopology.buildTopology();

        System.out.println(topology.describe().toString());

        /* set the required properties for running Kafka Streams */
        Properties props = new Properties();
        props.put(StreamsConfig.APPLICATION_ID_CONFIG, "dev-id");
        props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
        props.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 0);
        props.put(StreamsConfig.STATE_DIR_CONFIG, "/home/test/demo/streams/state");

        /* Build the topology with Kafka streams */
        System.out.println("Starting Application...");
        KafkaStreams streams = new KafkaStreams(topology, props);
        System.out.println("Streaming...");

        /* Close Kafka Streams when the JVM shuts down */
        Runtime.getRuntime().addShutdownHook(new Thread(streams::close));

        /* start streaming!! */
        streams.start();
    }
}

The objects are:

public class FinalOutput {

    @JsonProperty
    CSVData finalData;

    public FinalOutput() {
    }

    public FinalOutput(final CSVData data, final LOBSegmentMapping lobMapping) {
        this.finalData = data;
        finalData.setLobSegment(lobMapping.getRevisedLob());
    }

    @Override
    public String toString() {
        return "FinalOutput [finalData=" + finalData + "]";
    }
}

The resulting topology as described is:

Topologies:
   Sub-topology: 0
    Source: KSTREAM-SOURCE-0000000000 (topics: [csv-input])
      --> KSTREAM-KEY-SELECT-0000000001
    Processor: KSTREAM-KEY-SELECT-0000000001 (stores: [])
      --> KSTREAM-FILTER-0000000006
      <-- KSTREAM-SOURCE-0000000000
    Processor: KSTREAM-FILTER-0000000006 (stores: [])
      --> KSTREAM-SINK-0000000005
      <-- KSTREAM-KEY-SELECT-0000000001
    Sink: KSTREAM-SINK-0000000005 (topic: KSTREAM-KEY-SELECT-0000000001-repartition)
      <-- KSTREAM-FILTER-0000000006

  Sub-topology: 1
    Source: KSTREAM-SOURCE-0000000003 (topics: [lob-segment-mapping])
      --> KTABLE-SOURCE-0000000004
    Source: KSTREAM-SOURCE-0000000007 (topics: [KSTREAM-KEY-SELECT-0000000001-repartition])
      --> KSTREAM-JOIN-0000000008
    Processor: KSTREAM-JOIN-0000000008 (stores: [lob-segment-mapping-STATE-STORE-0000000002])
      --> none
      <-- KSTREAM-SOURCE-0000000007
    Processor: KTABLE-SOURCE-0000000004 (stores: [lob-segment-mapping-STATE-STORE-0000000002])
      --> none
      <-- KSTREAM-SOURCE-0000000003


问:
How to select the multiple checkbox
I have to select the multiple checkboxes but every time i click the button it takes only once and comes back to button.

```<code> <div class="dropdown-menu mselect" aria-labelledby="dropdownMenuButton">
                                        <div class="dropdown-item " ng-repeat="tagitem in distinctTags">
                                          <div style="margin-right:10px;" ng-click="addRemoveTag(tagitem)" ng-class="isActive(tagitem) ? 'selectedStudent' : 'notSelectedStudent'"></div>
                                          <span class="multi"ng-click="addRemoveTag(tagitem)" >{{tagitem}}</span>
                                        </div>
                                       </div>
                                    </div>
</code>```

js

```<code> $scope.addRemoveTag = function(tagitem){

        if ($scope.selectedTags.includes(tagitem)){
            $scope.selectedTags = $scope.selectedTags.filter(item => item !== tagitem);

        }
        else{

            $scope.selectedTags.push(tagitem);

        }

    }
</code>```

i want to select multiple checkbox and send those values to addRemoveTag function

Title: How to select the multiple checkbox

Body:
I have to select the multiple checkboxes but every time i click the button it takes only once and comes back to button.

                                          {{tagitem}}

js

 $scope.addRemoveTag = function(tagitem){

        if ($scope.selectedTags.includes(tagitem)){
            $scope.selectedTags = $scope.selectedTags.filter(item => item !== tagitem);

        }
        else{

            $scope.selectedTags.push(tagitem);

        }

    }

i want to select multiple checkbox and send those values to addRemoveTag function


问:
how to show a widget when a condition is fulfilled flutter
I have this screen that should show me a listview, witch is between the second select and the red button, when the second select has unless 1 element inside, in the listview there is a listtile that load (it should do it) each one of the elements inside the second select.

this is the scaffold where i make question to call the widget:

```<code>return Scaffold(
  appBar: AppBar(
    title: Center(child: Text("Tareas y Materiales")),
  ),
  body:Column(
    children: [
      _selectTareas(),
      _selectMateriales(),
      _materialesSeleccionados.isEmpty? Column() :  Padding(
        padding: const EdgeInsets.only(top:20, bottom: 20),
        child: listaMateriales(),
      ),

      _buttonFinalizar(context, argumentos['des_id'])
    ],
  )
);
</code>```

this is the listview that should show itself when I select the select's items:

```<code>listaMateriales(){
return Expanded(
  child: SizedBox(
    height: 200.0,
    child: ListView.builder(
                itemCount: _materialesSeleccionados.length,
                itemBuilder: (context, index) {
                  final material1 = _materialesSeleccionados[index];

                  return _listItems (material1);
                }
            ),
  ),
);

}
</code>```

this is the listTile inside the listView:

```<code>Widget _listItems(Material1.Material material) {
//_ZonasEncontradas = optListMenu;

//final List<Widget> optValueWidget = [];
print("Lo que hay en material es");
print (material);

return Padding(
  padding: const EdgeInsets.only(top:20),
  child: ListTile(
          title: Row(
            children: <Widget>[
              Expanded(
                child: Text("")
              ),
              Expanded(
                child: TextField(
                  // your TextField's Content
                ),
              ),
            ],
          ),
        ),
);

}
</code>```

Body:
I have this screen that should show me a listview, witch is between the second select and the red button, when the second select has unless 1 element inside, in the listview there is a listtile that load (it should do it) each one of the elements inside the second select.

this is the scaffold where i make question to call the widget:

return Scaffold(
  appBar: AppBar(
    title: Center(child: Text("Tareas y Materiales")),
  ),
  body:Column(
    children: [
      _selectTareas(),
      _selectMateriales(),
      _materialesSeleccionados.isEmpty? Column() :  Padding(
        padding: const EdgeInsets.only(top:20, bottom: 20),
        child: listaMateriales(),
      ),

      _buttonFinalizar(context, argumentos['des_id'])
    ],
  )
);

this is the listview that should show itself when I select the select's items:

listaMateriales(){
return Expanded(
  child: SizedBox(
    height: 200.0,
    child: ListView.builder(
                itemCount: _materialesSeleccionados.length,
                itemBuilder: (context, index) {
                  final material1 = _materialesSeleccionados[index];

                  return _listItems (material1);
                }
            ),
  ),
);

}

this is the listTile inside the listView:

Widget _listItems(Material1.Material material) {
//_ZonasEncontradas = optListMenu;

//final List<Widget> optValueWidget = [];
print("Lo que hay en material es");
print (material);

return Padding(
  padding: const EdgeInsets.only(top:20),
  child: ListTile(
          title: Row(
            children: <Widget>[
              Expanded(
                child: Text("")
              ),
              Expanded(
                child: TextField(
                  // your TextField's Content
                ),
              ),
            ],
          ),
        ),
);

}


问:
Stop service and remove WindowManager view when it is unfocused
I'm inflating a view using WindowManager inside a service using this code

```<code>windowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager

widgetView = View.inflate(this, R.layout.incoming_call_floating_widget, null)

// My code

windowManager.addView(widgetView, layoutParams)
</code>```

The view is inflated and all the functionalities are working perfectly, but I also want to remove it when the view is not focused i.e. when user expands the notification panel or if an app draw its view over my view.

I've already tried the setOnFocusChangeListener on the view like this -

```<code>widgetView.setOnFocusChangeListener { _, b ->
    if (b) {
        Log.d(FloatingWidgetService::class.simpleName, "hasFocus")
    } else {
        Log.d(FloatingWidgetService::class.simpleName, "FocusRemoved")
    }
}
</code>```

but the listener if not giving any result. Does anyone know how to make it working or any other alternative for this problem?

Body:
I'm inflating a view using WindowManager inside a service using this code

windowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager

widgetView = View.inflate(this, R.layout.incoming_call_floating_widget, null)

// My code

windowManager.addView(widgetView, layoutParams)

The view is inflated and all the functionalities are working perfectly, but I also want to remove it when the view is not focused i.e. when user expands the notification panel or if an app draw its view over my view.

I've already tried the setOnFocusChangeListener on the view like this -

widgetView.setOnFocusChangeListener { _, b ->
    if (b) {
        Log.d(FloatingWidgetService::class.simpleName, "hasFocus")
    } else {
        Log.d(FloatingWidgetService::class.simpleName, "FocusRemoved")
    }
}

but the listener if not giving any result. Does anyone know how to make it working or any other alternative for this problem?


问:
How to clone files from Github to windows VM using Jenkins pipeline?
I'm new to jenkins and I was wondering if you could help me with an example

I'm new to jenkins and I wanted to know if you could help me with an example like I want to clone my repository from git hub in the windows vm on gogle I just think for node does anyone have any examples for windows


问:
Find duplicates inside object in kibana
I have an String in kibana inside "message" field that contains and unique id which is called "uniqueKey", i would like to know how can i filter it to get all documents where the field value is duplicating whitout knowing its exactly value

```<code>2023-01-13 11:01:47.161 DEBUG 1 --- [] i.s.EventProcessor      : Received event '{"type":"MYEVENT","eventData":{"created":"2023-01-13T11:01:47+00:00","user":**"uniqueKey":"ab9c4820933111ed85654f402a6693ed"**}' with headers '{amqp_deliveryTag=33, content-type=application/json, contentType=application/x-java-object;type=com.fasterxml.jackson.databind.JsonNode, timestamp=1673607707161}'
</code>```

I want to get all documents that are repeating this key

UPDATE 1:
Below are a full log in JSON format

```<code>{
  "_index": "filebeat-6.8.23-2023.01.13",
  "_type": "doc",
  "_id": "OqlPq4UBF4YD0y9eW8gi",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2023-01-13T13:26:10.398Z",
    },
    "kubernetes": {
      "pod": {
        "name": "my-ms",
        "uid": "d34548f3d"
      },
      "container": {
        "name": "my-ms",
        "image": "docker2.company.com/my-ms"
      },
    },
    "beat": {
      "version": "6.8.23",
      "name": "filebeat-sqhtm",
      "hostname": "filebeat-sqhtm"
    },
    "host": {
      "name": "filebeat-sqhtm"
    },
    "offset": 6772155,
    "stream": "stdout",
    "message": "2023-01-13 11:01:47.161 DEBUG 1 --- [] i.s.EventProcessor      : Received event '{"type":"MYEVENT","eventData":{"created":"2023-01-13T11:01:47+00:00","user":**"uniqueKey":"ab9c4820933111ed85654f402a6693ed"**}' with headers '{amqp_deliveryTag=33, content-type=application/json, contentType=application/x-java-object;type=com.fasterxml.jackson.databind.JsonNode, timestamp=1673607707161}'",
    "prospector": {
      "type": "docker"
    }
  },
  "fields": {
    "@timestamp": [
      "2023-01-13T13:26:10.398Z"
    ]
  },
  "sort": [
    1673616370398
  ]
}
</code>```

Title: Find duplicates inside object in kibana

Body:
I have an String in kibana inside "message" field that contains and unique id which is called "uniqueKey", i would like to know how can i filter it to get all documents where the field value is duplicating whitout knowing its exactly value

2023-01-13 11:01:47.161 DEBUG 1 --- [] i.s.EventProcessor      : Received event '{"type":"MYEVENT","eventData":{"created":"2023-01-13T11:01:47+00:00","user":**"uniqueKey":"ab9c4820933111ed85654f402a6693ed"**}' with headers '{amqp_deliveryTag=33, content-type=application/json, contentType=application/x-java-object;type=com.fasterxml.jackson.databind.JsonNode, timestamp=1673607707161}'

I want to get all documents that are repeating this key

UPDATE 1:
Below are a full log in JSON format

{
  "_index": "filebeat-6.8.23-2023.01.13",
  "_type": "doc",
  "_id": "OqlPq4UBF4YD0y9eW8gi",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2023-01-13T13:26:10.398Z",
    },
    "kubernetes": {
      "pod": {
        "name": "my-ms",
        "uid": "d34548f3d"
      },
      "container": {
        "name": "my-ms",
        "image": "docker2.company.com/my-ms"
      },
    },
    "beat": {
      "version": "6.8.23",
      "name": "filebeat-sqhtm",
      "hostname": "filebeat-sqhtm"
    },
    "host": {
      "name": "filebeat-sqhtm"
    },
    "offset": 6772155,
    "stream": "stdout",
    "message": "2023-01-13 11:01:47.161 DEBUG 1 --- [] i.s.EventProcessor      : Received event '{"type":"MYEVENT","eventData":{"created":"2023-01-13T11:01:47+00:00","user":**"uniqueKey":"ab9c4820933111ed85654f402a6693ed"**}' with headers '{amqp_deliveryTag=33, content-type=application/json, contentType=application/x-java-object;type=com.fasterxml.jackson.databind.JsonNode, timestamp=1673607707161}'",
    "prospector": {
      "type": "docker"
    }
  },
  "fields": {
    "@timestamp": [
      "2023-01-13T13:26:10.398Z"
    ]
  },
  "sort": [
    1673616370398
  ]
}


问:
npm install not installs package-lock.json
I had the error:

npm error npm ERR! code ELIFECYCLE

I followed the steps, which are described on geeksforgeeks.

npm cache clean --force

delete node_modules

delete package-lock.json

npm install

The node_modules are installed again, but package-lock.json doesen't appears again in the project directory. In the console I have the error:

npm ERR! code EPERM npm ERR! syscall rename npm ERR! path
C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json.4215348391
npm ERR! dest
C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json
npm ERR! errno -4048 npm ERR! Error: EPERM: operation not permitted,
rename
'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json.4215348391'
-> 'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json'
npm ERR!  [OperationalError: EPERM: operation not permitted, rename
'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json.4215348391'
-> 'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json']
{   npm ERR!   cause: [Error: EPERM: operation not permitted, rename
'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json.4215348391'
-> 'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json']
{      npm ERR!     errno: -4048, npm ERR!     code: 'EPERM', npm ERR!
syscall: 'rename', npm ERR!     path:
'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json.4215348391',
npm ERR!     dest:
'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json'
npm ERR!   }, npm ERR!   errno: -4048, npm ERR!   code: 'EPERM', npm
ERR!   syscall: 'rename', npm ERR!   path:
'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json.4215348391',
npm ERR!   dest:
'C:\xampp\htdocs\webshop_ts_mern\frontend\node_modules\react-scripts\package.json',


问:
File not found exceptions regardless of how the file is referenced
I have a String to Img converter for displaying images in a DataGrid based on results of various methods that run, but for a reason I can't get my head around why my code can't find the images.

This is my converter, testing various different paths to PNGs that are all in /img/

```<code>public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    BitmapImage image = null;
    var str = value.ToString();
    //TODO Use new icons
    if (str == "pass")
    {
        image = new BitmapImage(new Uri("pack://application:,,,/img/Icon-Pass.png"));
    }
    if (str == "fail")
    {
        image = new BitmapImage(new Uri("/../img/Icon-Fail.png", UriKind.Relative));
    }
    if (str == "warning")
    {
        image = new BitmapImage(new Uri("../img/Icon-Warning.png", UriKind.Relative));
    }
    if (str == "notapplicable")
    {
        image = new BitmapImage(new Uri(@"/AppName;component/img/Icon-NonApplicable.png", UriKind.Relative));
    }
    return image;
}
</code>```

My project's structure is:

```<code>AppRoot/
├─ Helpers/
│  ├─ ImgConverter.cs
├─ img/
│  ├─ Icon-Pass.png
│  ├─ Icon-Fail.png
│  ├─ Icon-Warning.png
│  ├─ Icon-NonApplicable.png
</code>```

But with all of these I get a mixture of File not found, directory not found and cannot locate resource exceptions

I can only assume I'm missing something dumb obvious, but I think I'm too deep to see it.

Edit - Resolved
For the pack Uris to work, the Buid action for the images must be set to "Resource". Thanks @KlausGütter :)

Body:
I have a String to Img converter for displaying images in a DataGrid based on results of various methods that run, but for a reason I can't get my head around why my code can't find the images.

This is my converter, testing various different paths to PNGs that are all in /img/

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    BitmapImage image = null;
    var str = value.ToString();
    //TODO Use new icons
    if (str == "pass")
    {
        image = new BitmapImage(new Uri("pack://application:,,,/img/Icon-Pass.png"));
    }
    if (str == "fail")
    {
        image = new BitmapImage(new Uri("/../img/Icon-Fail.png", UriKind.Relative));
    }
    if (str == "warning")
    {
        image = new BitmapImage(new Uri("../img/Icon-Warning.png", UriKind.Relative));
    }
    if (str == "notapplicable")
    {
        image = new BitmapImage(new Uri(@"/AppName;component/img/Icon-NonApplicable.png", UriKind.Relative));
    }
    return image;
}

My project's structure is:

AppRoot/
├─ Helpers/
│  ├─ ImgConverter.cs
├─ img/
│  ├─ Icon-Pass.png
│  ├─ Icon-Fail.png
│  ├─ Icon-Warning.png
│  ├─ Icon-NonApplicable.png

But with all of these I get a mixture of File not found, directory not found and cannot locate resource exceptions

I can only assume I'm missing something dumb obvious, but I think I'm too deep to see it.

Edit - Resolved
For the pack Uris to work, the Buid action for the images must be set to "Resource". Thanks @KlausGütter :)


问:
How is the math calculated in coef_ in the svc model?

and this is my code

```<code>#SVM dengan kernel Linear
model = svm.SVC(kernel='linear', C=1.0).fit(x_train, y_train)
coef = model.coef_

#Print co-efficient dari fitur
for i in range(0, nFeatures):
    print (samples.columns[i],":", coef[0][i])
</code>```

and the result is :

```<code>PAY_0 : 0.22633744855967078
PAY_2 : 0.26406035665294925
PAY_3 : -0.07544581618655694
PAY_4 : -0.11316872427983539
PAY_5 : -0.22633744855967078
PAY_6 : -0.1886145404663923
</code>```

i dont understand how does the coef_ work. Can someone explain me how to calculate the coeficient?

Body:
and this is my code

#SVM dengan kernel Linear
model = svm.SVC(kernel='linear', C=1.0).fit(x_train, y_train)
coef = model.coef_

#Print co-efficient dari fitur
for i in range(0, nFeatures):
    print (samples.columns[i],":", coef[0][i])

and the result is :

PAY_0 : 0.22633744855967078
PAY_2 : 0.26406035665294925
PAY_3 : -0.07544581618655694
PAY_4 : -0.11316872427983539
PAY_5 : -0.22633744855967078
PAY_6 : -0.1886145404663923

i dont understand how does the coef_ work. Can someone explain me how to calculate the coeficient?


问:
First connection does not resolve any data in Socket.io and Nest.js
I am using Nest.Js and Socket.io on a server and React with Next in order to make a chat app.

But the problem is when i try to get some messages from the server i need to reconnect (If I connect for the first time handlers do not emit anything). And I think the problem is in the server (because I tried it also in Postman and the same problem is there).

Here is the code

```<code>async handleConnection(socket: Socket) {
    this.server.once('connection', async (socket) => {
      const token = socket.handshake.auth.token;

      if (!token) {
        socket.disconnect();
        return;
      }

      const user = await this.authService.verifyAndReturnUser(token);

      if (!user) {
        console.log('USER IS NOT VALID');
        socket.disconnect();
        return;
      }
      // Set a userId in socket data
      socket.data.userId = user.id;

      // Get the rooms (chats) of the user
      const userChats = await this.chatService.getUserChats(user.id);
      //Emitting the rooms (chats)
      socket.emit('getChats', userChats);

      socket.on('joinRoom', async (data: { user: string; item?: string }) => {
        // This code does not work on first connect (even the client commits)
        const forwardedId = Number(data.user);
        const forwardedItemId = Number(data.item);

        const isForwardedNaN = Number.isNaN(forwardedId);
        const isItemNan = Number.isNaN(forwardedItemId);

        if (forwardedId == user.id) {
          console.log('disconnect ID IS THE SAME');
          socket.disconnect();
          return;
        }

        if (!forwardedId || isForwardedNaN) {
          console.log(forwardedId);
          socket.disconnect();
          return;
        }

        socket.data.forwardedId = forwardedId;

        // Get forwarded info info
        const getUser = await this.userService.getProfile(forwardedId);
        // Get a time info

        if (!getUser) {
          socket.disconnect();
          return;
        }

        const getCurrentRoom = await this.chatService.getCurrentRoom(
          socket.data.forwardedId,
          user.id,
        );

        if (getCurrentRoom) {
          if (!getUser) {
            socket.disconnect();
            return;
          }
        }

        socket.data.room = getCurrentRoom;

        // Disconnect from all previous rooms
        socket.rooms.forEach(async (room) => {
          if (room) {
            await socket.leave(room);
          }
        });

        await socket.join(String(getCurrentRoom));

        console.log(forwardedItemId, isItemNan);

        // Set item to room
        if (data.item) {
          if (isItemNan) {
            socket.disconnect();
            return;
          }
          const room = await this.chatService.setItemToRoom(
            getCurrentRoom,
            forwardedId,
            forwardedItemId,
          );
          // If there is no room updated disconnect
          if (!room) {
            socket.disconnect();
            return;
          }
          socket.emit('getItem', room.item);
        }

        // Set message to seen when second user connected to socket
        await this.chatService.markSeen(getCurrentRoom, user.id);

        const roomMessages = await this.chatService.getRoomMessages(
          getCurrentRoom,
        );

        // Get the user count in room
        this.clientSize = (
          await this.server.of('/').in(String(getCurrentRoom)).allSockets()
        ).size;

        // Get the previous chat messages
        this.server
          .in(String(getCurrentRoom))
          .emit('getRoomMessages', roomMessages);

        // Get info about forwarded user in a room
        socket.emit('getUser', getUser);
      });
    });
  }
</code>```

Body:
I am using Nest.Js and Socket.io on a server and React with Next in order to make a chat app.

But the problem is when i try to get some messages from the server i need to reconnect (If I connect for the first time handlers do not emit anything). And I think the problem is in the server (because I tried it also in Postman and the same problem is there).

Here is the code

async handleConnection(socket: Socket) {
    this.server.once('connection', async (socket) => {
      const token = socket.handshake.auth.token;

      if (!token) {
        socket.disconnect();
        return;
      }

      const user = await this.authService.verifyAndReturnUser(token);

      if (!user) {
        console.log('USER IS NOT VALID');
        socket.disconnect();
        return;
      }
      // Set a userId in socket data
      socket.data.userId = user.id;

      // Get the rooms (chats) of the user
      const userChats = await this.chatService.getUserChats(user.id);
      //Emitting the rooms (chats)
      socket.emit('getChats', userChats);

      socket.on('joinRoom', async (data: { user: string; item?: string }) => {
        // This code does not work on first connect (even the client commits)
        const forwardedId = Number(data.user);
        const forwardedItemId = Number(data.item);

        const isForwardedNaN = Number.isNaN(forwardedId);
        const isItemNan = Number.isNaN(forwardedItemId);

        if (forwardedId == user.id) {
          console.log('disconnect ID IS THE SAME');
          socket.disconnect();
          return;
        }

        if (!forwardedId || isForwardedNaN) {
          console.log(forwardedId);
          socket.disconnect();
          return;
        }

        socket.data.forwardedId = forwardedId;

        // Get forwarded info info
        const getUser = await this.userService.getProfile(forwardedId);
        // Get a time info

        if (!getUser) {
          socket.disconnect();
          return;
        }

        const getCurrentRoom = await this.chatService.getCurrentRoom(
          socket.data.forwardedId,
          user.id,
        );

        if (getCurrentRoom) {
          if (!getUser) {
            socket.disconnect();
            return;
          }
        }

        socket.data.room = getCurrentRoom;

        // Disconnect from all previous rooms
        socket.rooms.forEach(async (room) => {
          if (room) {
            await socket.leave(room);
          }
        });

        await socket.join(String(getCurrentRoom));

        console.log(forwardedItemId, isItemNan);

        // Set item to room
        if (data.item) {
          if (isItemNan) {
            socket.disconnect();
            return;
          }
          const room = await this.chatService.setItemToRoom(
            getCurrentRoom,
            forwardedId,
            forwardedItemId,
          );
          // If there is no room updated disconnect
          if (!room) {
            socket.disconnect();
            return;
          }
          socket.emit('getItem', room.item);
        }

        // Set message to seen when second user connected to socket
        await this.chatService.markSeen(getCurrentRoom, user.id);

        const roomMessages = await this.chatService.getRoomMessages(
          getCurrentRoom,
        );

        // Get the user count in room
        this.clientSize = (
          await this.server.of('/').in(String(getCurrentRoom)).allSockets()
        ).size;

        // Get the previous chat messages
        this.server
          .in(String(getCurrentRoom))
          .emit('getRoomMessages', roomMessages);

        // Get info about forwarded user in a room
        socket.emit('getUser', getUser);
      });
    });
  }


问:
How to access a property from another aggregate?
I have two aggregates Order and Customer. Order has a identity reference to customer.

```<code>public class Customer
{
   public long CustomerId { get; private set; }
   public string Name { get; private set; }
   public Address Address { get; private set; }
   ...
}

public class Order
{
   public long OrderId { get; private set; }
   public long CustomerId { get; private set; }
   public Date OrderDate { get; private set; }
   ...
   public string CustomerName { get; priate set; } //from Customer Aggregate
   ...

   public void AssignCustomer(Customer customer)
   {
      this.CustomrName = customer.Name
   }
}

</code>```

As you see in Order aggregate I need CustomerName plus identity reference, and for this reason I added a method AssignCustomer to set it from outside of Order aggregate.
Is this approach OK from DDD perspective?

If that's accepted, I have another problem. Suppose in OrderRepository there is a method that returns list of Orders like this :

```<code>public interface IOrderRepository
{
   IList<Order> GetAllOrderWithDate(Date date);
   ...
}
</code>```

Now if I want to set CustomerName for all these orders, the N+1 problem would occur, cause I need to read related Customer for each Order in list.

Is there any proper solution in DDD?

Body:
I have two aggregates Order and Customer. Order has a identity reference to customer.

public class Customer
{
   public long CustomerId { get; private set; }
   public string Name { get; private set; }
   public Address Address { get; private set; }
   ...
}

public class Order
{
   public long OrderId { get; private set; }
   public long CustomerId { get; private set; }
   public Date OrderDate { get; private set; }
   ...
   public string CustomerName { get; priate set; } //from Customer Aggregate
   ...

   public void AssignCustomer(Customer customer)
   {
      this.CustomrName = customer.Name
   }
}

As you see in Order aggregate I need CustomerName plus identity reference, and for this reason I added a method AssignCustomer to set it from outside of Order aggregate.
Is this approach OK from DDD perspective?

If that's accepted, I have another problem. Suppose in OrderRepository there is a method that returns list of Orders like this :

public interface IOrderRepository
{
   IList<Order> GetAllOrderWithDate(Date date);
   ...
}

Now if I want to set CustomerName for all these orders, the N+1 problem would occur, cause I need to read related Customer for each Order in list.

Is there any proper solution in DDD?


问:
getting valueerror too many values to unpack (expected 2) in send_mass_mail
```<code>from django.core.mail import send_mail, send_mass_mail
from django.template.loader import render_to_string
from django.utils.html import strip_tags
class SendMailViews(APIView):
    def post(self, request, format=None):
        html_message = render_to_string('email/test.html')
        plain_message = strip_tags(html_message)
        message1 = ("subject", plain_message, 'rahulsha24445@gmail.com',
                   ['sharmaviraj300@gmail.com'], html_message)
        message2 = ("subject", plain_message, 'rahulsha24445@gmail.com',
                   ['abhijeetlaal7899@gmail.com'], html_message)
        emailList = [message1, message2]
        send_mass_mail(emailList, fail_silently=False)
        return Response({"status": True})
</code>```

I want to send HTML based email to a mass recipient in Django.

Body:
from django.core.mail import send_mail, send_mass_mail
from django.template.loader import render_to_string
from django.utils.html import strip_tags
class SendMailViews(APIView):
    def post(self, request, format=None):
        html_message = render_to_string('email/test.html')
        plain_message = strip_tags(html_message)
        message1 = ("subject", plain_message, 'rahulsha24445@gmail.com',
                   ['sharmaviraj300@gmail.com'], html_message)
        message2 = ("subject", plain_message, 'rahulsha24445@gmail.com',
                   ['abhijeetlaal7899@gmail.com'], html_message)
        emailList = [message1, message2]
        send_mass_mail(emailList, fail_silently=False)
        return Response({"status": True})

I want to send HTML based email to a mass recipient in Django.


问:
argoCD ApplicationSet - repository not accessible
I am getting subjected error while deploying helm using argoCD applicationSet with gitHubActions. Below is yaml. repoURL is correct.

Error :

InvalidSpecError: repository not accessible: repo client error while testing repository: rpc error: code = Unknown desc = error testing repository connectivity: repository "" cannot be initialized: repo URL is invalid"

Interesting thing is its working with argoCD application.yaml with same config.

Can someone please suggest the issue?

```<code>apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: test
  namespace: argocd
spec:
  generators:
  - list:
      elements:
      - prefix: app1
        url: test1
      - prefix: app2
        url: test2
      - prefix: app3
        url: test3
  template:
    metadata:
      name: '{{prefix}}'
    spec:
      project: test
      source:
        repoURL: https://github.com/organisation/ABCDEF.git
        targetRevision: HEAD
        path: test/test
        helm:
          values: |
            image:
              repository: nginx
              pullPolicy: IfNotPresent
              tag: "1.23.3"
      destination:
        server: '{{url}}'
        namespace: test
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true
</code>```

Body:
I am getting subjected error while deploying helm using argoCD applicationSet with gitHubActions. Below is yaml. repoURL is correct.

Error :

InvalidSpecError: repository not accessible: repo client error while testing repository: rpc error: code = Unknown desc = error testing repository connectivity: repository "" cannot be initialized: repo URL is invalid"

Interesting thing is its working with argoCD application.yaml with same config.

Can someone please suggest the issue?

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: test
  namespace: argocd
spec:
  generators:
  - list:
      elements:
      - prefix: app1
        url: test1
      - prefix: app2
        url: test2
      - prefix: app3
        url: test3
  template:
    metadata:
      name: '{{prefix}}'
    spec:
      project: test
      source:
        repoURL: https://github.com/organisation/ABCDEF.git
        targetRevision: HEAD
        path: test/test
        helm:
          values: |
            image:
              repository: nginx
              pullPolicy: IfNotPresent
              tag: "1.23.3"
      destination:
        server: '{{url}}'
        namespace: test
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true


问:
Changed backend service hosting api url for a react app deployed with github actions but it still uses older api url
Previously I have been using heroku for deploying my Node.js app's backend but recently I moved to render.com for the same.

I have been using firebase for hosting the frontend part of the app which is set to automatically deploy on github pushes with the help of github actions.

There is an environment variable for storing the endpoint of the backend api which was previously the url address which heroku gives on deployment and now I have changed the variable value on github secrets for it and pushed the changes to github which should deploy the whole app automatically with new backend host but the app on launch throughs some errors which on console seems like the app is still using older heroku api url for all its api requests

as shown below are the secrets in my github repo of which I have updated the REACT_APP_API's value to its new value

this is my github actions workflow file to deploy the frontend automatically on push

these are some of the errors on the console which are printing urls with older api of heroku

I have no Idea why its not taking the new secret value for the api url for the frontend.
Any help is appreciated.


问:
WPF MediaElement not streaming while on lower bandwidth connection
I am working on WPF application running on .NET 6. Recently I encountered really strange  behaviour with MediaElement control.

I have the backend service able to stream files, for instance videos. I want to embed a video player within the frontend (WPF) application with the streaming capability. I have already achieved this with libvlcsharp although it doesn't meet all the requirements (mainly performance) and is being left out as side/additional feature. I want to be able to stream multiple videos at the same time (in the same window as well) similar to youtube/instagram reels. For that purpose I decided to go with MediaElement control. I succesfully embeded multiple MediaElements but there are some issues.

I have confirmed that MediaElement doesn't work properly while on low bandwidth connection. While I am on my optic fiber 900+ Mbps connection everything works fine, the videos are being streamed with no issues. While on lower bandwidth (tested on two cellular networks with <20 Mbps) the Player is not loading/buffering/starting at all.

I could not find any related documentation.
I believe it is not related to the file format and file size as I tested the same files on both networks. Files ranging from a few KB to a few GB.

User control:

```<code><UserControl x:Class="Peernet.Browser.WPF.Controls.EmbededPluginsControl">
   <Grid>
      <MediaElement Grid.Row="0" Name="Player" LoadedBehavior="Manual" UnloadedBehavior="Stop" Stretch="Fill" />
   </Grid>
</UserControl>
</code>```

Code behind:

```<code>public partial class EmbededPluginsControl : UserControl
{
    public static readonly DependencyProperty FileProperty =
        DependencyProperty.Register("File", typeof(ApiFile),
    typeof(EmbededPluginsControl), null);

    public EmbededPluginsControl()
    {
        InitializeComponent();
        Loaded += EmbededPluginsControl_Loaded;
    }

    private void EmbededPluginsControl_Loaded(object sender, RoutedEventArgs e)
    {
        var settings = App.ServiceProvider.GetService(typeof(ISettingsManager)) as ISettingsManager;
        Player.Source = GetFileSource(settings, File);
    }

    public ApiFile File
    {
        get => (ApiFile)GetValue(FileProperty);
        set => SetValue(FileProperty, value);
    }

    public static Uri GetFileSource(ISettingsManager settingsManager, ApiFile file)
    {
        var parameters = new Dictionary<string, string>
        {
            ["hash"] = Convert.ToHexString(file.Hash),
            ["node"] = Convert.ToHexString(file.NodeId),
            ["format"] = "14",
            ["k"] = settingsManager.ApiKey
        };

        var uriBase = $"{settingsManager.ApiUrl}/file/view";

        var requestMessage = HttpHelper.PrepareMessage(uriBase, HttpMethod.Get, parameters, null);
        return requestMessage.RequestUri;
    }
}
</code>```

By default all Players are stopped, there is no issue such as that I try to run all at once and it is killing the network or something. There are buttons dedicated for Player as simple as:

```<code>            <Image x:Name="PlayButton" Height="20" Width="20" MouseDown="OnMouseDownPlayMedia" Margin="5">
                <Image.Style>
                    <Style TargetType="{x:Type Image}">
                        <Setter Property="Source" Value="{StaticResource PlayImage}" />
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Source" Value="{StaticResource PlayImage_MouseOver}" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Image.Style>
            </Image>
</code>```

and

```<code>    void OnMouseDownPlayMedia(object sender, MouseButtonEventArgs args)
    {
        Player.Play();
    }
</code>```

I also don't manipulate programatically the Player stream, buffering, etc.

Do I have to reset the stream while connection drops or something? I am running out of ideas.

Body:
I am working on WPF application running on .NET 6. Recently I encountered really strange  behaviour with MediaElement control.

I have the backend service able to stream files, for instance videos. I want to embed a video player within the frontend (WPF) application with the streaming capability. I have already achieved this with libvlcsharp although it doesn't meet all the requirements (mainly performance) and is being left out as side/additional feature. I want to be able to stream multiple videos at the same time (in the same window as well) similar to youtube/instagram reels. For that purpose I decided to go with MediaElement control. I succesfully embeded multiple MediaElements but there are some issues.

I have confirmed that MediaElement doesn't work properly while on low bandwidth connection. While I am on my optic fiber 900+ Mbps connection everything works fine, the videos are being streamed with no issues. While on lower bandwidth (tested on two cellular networks with <20 Mbps) the Player is not loading/buffering/starting at all.

I could not find any related documentation.
I believe it is not related to the file format and file size as I tested the same files on both networks. Files ranging from a few KB to a few GB.

User control:

<UserControl x:Class="Peernet.Browser.WPF.Controls.EmbededPluginsControl">
   <Grid>
      <MediaElement Grid.Row="0" Name="Player" LoadedBehavior="Manual" UnloadedBehavior="Stop" Stretch="Fill" />
   </Grid>
</UserControl>

Code behind:

public partial class EmbededPluginsControl : UserControl
{
    public static readonly DependencyProperty FileProperty =
        DependencyProperty.Register("File", typeof(ApiFile),
    typeof(EmbededPluginsControl), null);

    public EmbededPluginsControl()
    {
        InitializeComponent();
        Loaded += EmbededPluginsControl_Loaded;
    }

    private void EmbededPluginsControl_Loaded(object sender, RoutedEventArgs e)
    {
        var settings = App.ServiceProvider.GetService(typeof(ISettingsManager)) as ISettingsManager;
        Player.Source = GetFileSource(settings, File);
    }

    public ApiFile File
    {
        get => (ApiFile)GetValue(FileProperty);
        set => SetValue(FileProperty, value);
    }

    public static Uri GetFileSource(ISettingsManager settingsManager, ApiFile file)
    {
        var parameters = new Dictionary<string, string>
        {
            ["hash"] = Convert.ToHexString(file.Hash),
            ["node"] = Convert.ToHexString(file.NodeId),
            ["format"] = "14",
            ["k"] = settingsManager.ApiKey
        };

        var uriBase = $"{settingsManager.ApiUrl}/file/view";

        var requestMessage = HttpHelper.PrepareMessage(uriBase, HttpMethod.Get, parameters, null);
        return requestMessage.RequestUri;
    }
}

By default all Players are stopped, there is no issue such as that I try to run all at once and it is killing the network or something. There are buttons dedicated for Player as simple as:

            <Image x:Name="PlayButton" Height="20" Width="20" MouseDown="OnMouseDownPlayMedia" Margin="5">
                <Image.Style>

                    </Style>
                </Image.Style>
            </Image>

and

    void OnMouseDownPlayMedia(object sender, MouseButtonEventArgs args)
    {
        Player.Play();
    }

I also don't manipulate programatically the Player stream, buffering, etc.

Do I have to reset the stream while connection drops or something? I am running out of ideas.


问:
How to install cinnamon desktop on Ubuntu 22.04?
I can't find the gear icon on lock screen after installing cinnamon desktop.

I tried these steps:

```<code>sudo apt update
sudo apt install cinnamon-desktop-environment
sudo reboot
</code>```

I expected to find a gear icon on lock screen to change the desktop but I can't find it after rebooting.

How can I change the desktop now?

Body:
I can't find the gear icon on lock screen after installing cinnamon desktop.

I tried these steps:

sudo apt update
sudo apt install cinnamon-desktop-environment
sudo reboot

I expected to find a gear icon on lock screen to change the desktop but I can't find it after rebooting.

How can I change the desktop now?


问:
How to make TabItem's text ellipsize and singleline?
I need to make my TabLayout use all available space, so I use app:tabMode="fixed",    app:tabGravity="fill". I want titles of my TabItems be singleline and if the titles cannot be shown in full, a part is replaced by ... (android:ellipsize = "end" behavior). I want something like this  .

I try to gain it usings styles but failed.

Part of my fragment layout
`

```<code><com.google.android.material.tabs.TabLayout
    android:id="@+id/credit_details_tab_layout"
    style="@style/CreditDetailsTabLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/margin_horizontal"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/credit_details_text_deposit_up_to"
    app:tabMode="fixed"
    app:tabGravity="fill"
    android:maxWidth="0dp"
    app:tabPaddingStart="0dp"
    app:tabPaddingEnd="0dp"
    android:layout_marginHorizontal="@dimen/spacing_M">
    <com.google.android.material.tabs.TabItem
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/information"/>
    <com.google.android.material.tabs.TabItem
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/history"/>
    <com.google.android.material.tabs.TabItem
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/management"/>
</com.google.android.material.tabs.TabLayout>
</code>```

`
from styles

```<code><style name="CreditDetailsTabLayout" parent="Widget.Design.TabLayout">
    <item name="background">@color/black_for_tabs</item>
    <item name="tabRippleColor">@android:color/transparent</item>
    <item name="android:textAlignment">center</item>
    <item name="tabBackground">@color/white</item>
    <item name="tabTextAppearance">@style/CreditDetailsTabLayoutTextAppearance</item>
</style>

<style name="CreditDetailsTabLayoutTextAppearance" parent="TextAppearance.Design.Tab">
    <item name="android:textSize">16sp</item>
    <item name="textAllCaps">false</item>
    <item name="singleLine">true</item>
    <item name="textColor">@color/black_for_tabs</item>
    <item name="android:ellipsize">end</item>
    <item name="maxLines">1</item>
</code>```

and finally screen

Can I achieve this without using CustomView ?

Body:
I need to make my TabLayout use all available space, so I use app:tabMode="fixed",    app:tabGravity="fill". I want titles of my TabItems be singleline and if the titles cannot be shown in full, a part is replaced by ... (android:ellipsize = "end" behavior). I want something like this  .

I try to gain it usings styles but failed.

Part of my fragment layout
`

<com.google.android.material.tabs.TabLayout
    android:id="@+id/credit_details_tab_layout"
    style="@style/CreditDetailsTabLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/margin_horizontal"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/credit_details_text_deposit_up_to"
    app:tabMode="fixed"
    app:tabGravity="fill"
    android:maxWidth="0dp"
    app:tabPaddingStart="0dp"
    app:tabPaddingEnd="0dp"
    android:layout_marginHorizontal="@dimen/spacing_M">
    <com.google.android.material.tabs.TabItem
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/information"/>
    <com.google.android.material.tabs.TabItem
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/history"/>
    <com.google.android.material.tabs.TabItem
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/management"/>
</com.google.android.material.tabs.TabLayout>

`
from styles


问:
I am getting weird data as a response
I am trying to get some details of mail that I have sended using google-api. I am using messageId that I have received after sending email. I am expection the data to be in json format.

Here is the Nodejs code for reading sended mail:

```<code>app.post("/readMail", async (req, res)=>{
  let messageId = req.body.messageId;

  try {
    const oAuth2Client = new google.auth.OAuth2(
      properties.GOOGLE_CLIENT_ID,
      properties.GOOGLE_CLIENT_SECRET,
    );

    oAuth2Client.setCredentials({ refresh_token: properties.REFRESH_TOKEN });
    const { token } = await oAuth2Client.getAccessToken();

    const generateConfig = (url, accessToken) => {
      return {
        method: "get",
        url: url,
        headers: {
          Authorization: `Bearer ${accessToken} `,
          "Content-type": "application/json",
        },
      };
    };

    const url = `https://gmail.googleapis.com/gmail/v1/users/Abhisek721@gmail.com/messages/${messageId}`;

    const config = generateConfig(url, token);
    const response = await axios(config);

    let data = await response.data;
    res.json(data);
  } catch (error) {
    res.send(error);
  }
})
</code>```

And This the response:

```<code>"\u001f\ufffd\b\u0000\u0000\u0000\u0000\u0000\u0002\ufffd\ufffdUmo\ufffd:\u0014\ufffd\ufffd_a\ufffdu\ufffds\u0012^\ufffdN\ufffd\u0006\t/a\ufffd2\ufffd\ufffd\ufffdީr\u0012\ufffd\u0018\ufffd8rLB6\ufffd\ufffd_'P\ufffdݱ\ufffd^]\ufffd\ufffd\ufffd\ufffd\ufffd=\ufffd\ufffd\ufffd\u000e\ufffd\n\ufffd*\ufffd\ufffd\ufffd\ufffdu\ufffd:\\75\ufffd]C\ufffdrU\ufffdD\ufffd1\ufffdW4(r0\ufffd\ufffdDj\ufffd%\ufffd\ufffdd\ufffd\u0019\ufffd*\ufffd\ufffdR\ufffdD$\ufffd\ufffd(\u0000:!\"\u0014\ufffd8r\ufffd\ufffd\ufffd!\ufffd8\u0004$Nv!"
</code>```

I was expecting to get something like json data.

Title: I am getting weird data as a response

Body:
I am trying to get some details of mail that I have sended using google-api. I am using messageId that I have received after sending email. I am expection the data to be in json format.

Here is the Nodejs code for reading sended mail:

app.post("/readMail", async (req, res)=>{
  let messageId = req.body.messageId;

  try {
    const oAuth2Client = new google.auth.OAuth2(
      properties.GOOGLE_CLIENT_ID,
      properties.GOOGLE_CLIENT_SECRET,
    );

    oAuth2Client.setCredentials({ refresh_token: properties.REFRESH_TOKEN });
    const { token } = await oAuth2Client.getAccessToken();

    const generateConfig = (url, accessToken) => {
      return {
        method: "get",
        url: url,
        headers: {
          Authorization: `Bearer ${accessToken} `,
          "Content-type": "application/json",
        },
      };
    };

    const url = `https://gmail.googleapis.com/gmail/v1/users/Abhisek721@gmail.com/messages/${messageId}`;

    const config = generateConfig(url, token);
    const response = await axios(config);

    let data = await response.data;
    res.json(data);
  } catch (error) {
    res.send(error);
  }
})

And This the response:

"\u001f\ufffd\b\u0000\u0000\u0000\u0000\u0000\u0002\ufffd\ufffdUmo\ufffd:\u0014\ufffd\ufffd_a\ufffdu\ufffds\u0012^\ufffdN\ufffd\u0006\t/a\ufffd2\ufffd\ufffd\ufffdީr\u0012\ufffd\u0018\ufffd8rLB6\ufffd\ufffd_'P\ufffdݱ\ufffd^]\ufffd\ufffd\ufffd\ufffd\ufffd=\ufffd\ufffd\ufffd\u000e\ufffd\n\ufffd*\ufffd\ufffd\ufffd\ufffdu\ufffd:\\75\ufffd]C\ufffdrU\ufffdD\ufffd1\ufffdW4(r0\ufffd\ufffdDj\ufffd%\ufffd\ufffdd\ufffd\u0019\ufffd*\ufffd\ufffdR\ufffdD$\ufffd\ufffd(\u0000:!\"\u0014\ufffd8r\ufffd\ufffd\ufffd!\ufffd8\u0004$Nv!"

I was expecting to get something like json data.


问:
Vue Vite and Wordpress hosted on the same server
I'm twinkering around in a hobby project and would like to know, is it possible to host a Wordpress backend as my headless CMS and my  frontend Vue Vite on the same server?

I would like to achieve this, because when I have Wordpress on another server completely, it takes about 800-1000ms for the API to load the content (Rest Api cache enabled with plugin), even when its like 6 posts each containing 1 midsize (around 1000x1000) image and 100-200 words?

Or should I look for another solution, eg. completely move to another CMS like buttercms?

If the latter, can I host that CMS on the same server to cut down loading/response times of rest api requests?

Thank you for your time,
Have a nice one!