Named Sub Qbjects

Using Celigo, I’m trying to create a transform that’s coded in Javascript. The input data has multiple records that I’m attempting to reformat. To that effect, I’ve created two arrays. One is called LOADS which will contain all of the records and a second per record array called load. I’m trying to use Loads.push(load) to create an array where the smaller array object is called load. Instead of getting load as the name of the array though I’m just getting two unnamed arrays.

[
  {
    load:[
      {
        "Depositorcode":"VEN02",
        ...
      },
      {
        "Depositorcode":"BAS18",
        ...
      }
    ]
  }
]

What I’m getting instead is

[
  {
    [
      {
        "Depositorcode":"VEN02"
      },
      {
        "Depositorcode":"BAS18"
      }
    ]
  }
]

What am I missing?

sum in every bar

Goal:
Each bar should have a total sum on top of the bar. For instance, Bike’s total sum is 23.

enter image description here

Problem:
Is it possible to do it in this chartjs?

Other:
https://jsbin.com/leduqarini/edit?html,output

<head>
    <title>ChartJS Stacked Bar Chart Example</title>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
</head>

<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    
    <h3>Chart JS Stacked Chart </h3>
    
    <div>
        <canvas id="stackedChartID"></canvas>
    </div>

    <script>

        // Get the drawing context on the canvas
        var ctx = document.getElementById("stackedChartID").getContext('2d');
        var myChart = new Chart(ctx, {
            plugins: [ChartDataLabels],
            type: 'bar',
            data: {
                labels: ["bike", "car", "scooter", "truck", "auto", "Bus"],
                datasets: [{
                    label: 'worst',
                    backgroundColor: "blue",
                    data: [17, 16, 4, 11, 8, 9],
                    datalabels: {
                      align: "center",
                      anchor: "center",
                      font:{
                        size: "10px",
                      },
                      padding: "0px",
                      color: "#000",
                    },
                }, {
                    label: 'Okay',
                    backgroundColor: "green",
                    data: [14, 2, 10, 6, 12, 16],
                    datalabels: {
                      align: "center",
                      anchor: "center",
                      font:{
                        size: "10px",
                      },
                      padding: "0px",
                      color: "#000",
                    },
                }, {
                    label: 'bad',
                    backgroundColor: "red",
                    data: [2, 21, 13, 3, 24, 7],
                    datalabels: {
                      align: "center",
                      anchor: "center",
                      font:{
                        size: "10px",
                      },
                      padding: "0px",
                      color: "#000",
                    },
                }],
            },
            options: {
                plugins: {
                    title: {
                        display: true,
                        text: 'Stacked Bar chart for pollution status'
                    },
                },
                scales: {
                    x: {
                        stacked: true,
                    },
                    y: {
                        stacked: true
                    }
                }
            }
        });
    </script>
</body>

</html>

I asked ChatGPT to help me “Check if file exists”

ChatGPT suggested me to use this method

async function checkFileExists(path) {
    try {
        const response = await fetch(path, { method: 'HEAD' });

        return response.ok;
    } catch (error) {
        console.error('Error checking file existence:', error);

        return false;
    }
}

Theoretically, the ChatGPT solution is clean and logical and should have worked. However, it overlooked the fact that using method: ‘HEAD’ could trigger CORS errors.

If you can think of a better, more robust solution, please let me know. Also, if you have a better way to prompt ChatGPT, I would love to know as well!

Angular material tab

How can I modify angular tab is like that? I couldn’t make the borders like this.I can do it normally but I couldn’t do it for mat-tab. If there are more than 2, how can I do it to support the middle one?

    <mat-tab-group>
    <mat-tab label="tab 1">

    </mat-tab>
    <mat-tab label="tab 2">

    </mat-tab>
</mat-tab-group>

Desired Output

enter image description here

I have problem with git hub push. I keep getting storage error and various errors. I need assitance fixing it [duplicate]

I get the below error whenever i try pushing my work to github. I’ve bee stuck here for weeks. I’ll appreciate professional advice on what how i can resolve this. note:I’m using a windows system

C:UsersTAIWO PCDesktopUFLCD app> git push -u origin main
>>
Uploading LFS objects: 100% (28/28), 135 MB | 0 B/s, done.
Enumerating objects: 175, done.
Counting objects: 100% (175/175), done.
Delta compression using up to 4 threads
Compressing objects: 100% (122/122), done.
Writing objects: 100% (175/175), 346.27 MiB | 98.66 MiB/s, done.
Total 175 (delta 54), reused 154 (delta 45), pack-reused 0 (from 0)
error: RPC failed; HTTP 400 curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL 
(err 8)
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date

I get the above error whenever i try pushing my work to github. I’ve bee stuck here for weeks. I’ll appreciate professional advice on what how i can resolve this. note:I’m using a windows system.
I have tried deleting and tracking large files.
I have also tried pushing in chunks

how to build a proxy website to visit blocked website [closed]

I want to create a proxy website. for this I need a proxy server.

there will be a input box where user input the website link which is blocked in his area. After click enter the URL will connect with proxy server.

reference website croxyproxy

Q-1) How to create a proxy server in hosting server?

Q-2) **How to connect the proxy server with website to visit the blocked website? **

how to connect the server with website, and how to create a proxy server in hosting server.

firestore rules across multiple databases returning permission denied

I am trying to configure firestore rules so that a user can only access information in a collection in a secondary database, when that collection’s path contains an id stored in the (default) database.

The default database contains the following document:

users/abcd:
{ 
  companyId: 'efgh'
}

If I configure my rules in the secondary database to be:

rules_version = '2';

service cloud.firestore {
  match /databases/{database}/documents {
    function getUserCompany() {
        return get(/databases/(default)/documents/users/$(request.auth.uid)).data.companyId;
    }
    
        match /co/{cid}/{documents=**} {
            allow read, write: if getUserCompany() == cid
        }
  }
}

Then authenticate with uid abcd, then

 getDoc('/co/efgh/some/document')

on the secondary database fails with FirebaseError: Missing or insufficient permissions.

If I test this call using the Rules Playground, it succeeds.

If I use that same rule set on the (default) database, then make the same getDoc() call on the (default) database, it succeeds.

It’s only failing when the user is authenticated via the javascript firebase client (10.4.0) and accessing the secondary database.

Should rules like this work across databases?

Fix for Appium-xcuitest-driver not click on elements location

Scenario: Using wdio and appium to run an automated test on a cloud hosted iOS device’s Safari browser.

Observation: the click command is sent without error but the click event is not triggered.

What I have tried:
1.nativeWebTap: true (Only worked for the 1st click)
2. custom JavaScript in on command hook to highlight elements that are clicked (unsuccessfully)

Theory: The element is found but the location that is calculated by xcuitest is incorrect and target element is not clicked/tapped.I have no way to sure though.

What I need:

  1. A way to highlight the element being clicked for debugging.
  2. A fix for appium-xcuitest-driver’s miscalculation.

How to use native and web application type for the same oauth client – Node OIDC Provider

I am using Node OIDC Provider to enable users to SSO into a 3rd party app we’ve integrated with. This works great for the “web” application type, but I also need to support the “native” application type.

My issue is that I’m unable to specify both native and web redirect URI’s. node-oidc-provider throws errors internally, either at start time or at runtime.

A key requirement of this is that I need both web and native to be served by the same client_id. This is something we have no control over, as the client_id is provided by our 3rd party.

Below is an example of what my configuration for clients looks like:

{
  client_id: 'client_1',
  client_secret: 'some secret',
  response_types: ['id_token', 'code', 'code id_token'],
  grant_types: ['authorization_code', 'implicit'],
  scope: 'openid email profile',
  application_type: 'web',
  redirect_uris: [
    'https://example.com/oidc/callback',
  ],
}

I would like to also be able to include a mobile redirect_uri, but when I do so the app returns an error. I’ve looked through the source code, but have been unable to figure out a workaround to this issue.

Error: Cannot find package ‘mongoose’ in Node.js project despite being installed

node:internal/modules/esm/resolve:857
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package ‘mongoose’ imported from C:UsersASUSOneDriveDesktopBOOKSTORE_MERNmodelsbookModel.js
at packageResolve (node:internal/modules/esm/resolve:857:9)
at moduleResolve (node:internal/modules/esm/resolve:926:18)
at defaultResolve (node:internal/modules/esm/resolve:1056:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:586:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)
at ModuleJob._link (node:internal/modules/esm/module_job:135:49) {
code: ‘ERR_MODULE_NOT_FOUND’
}

Node.js v22.13.0
[nodemon] app crashed – waiting for file changes before starting…

Note:My mongoose is installed and in the same directory as package.json still getting this error again

solution for my problem

ôi, ai đó làm ơn, [closed]

Compiled with problems:
×
ERROR in ./src/index.tsx 7:0-24
Module not found: Error: Can’t resolve ‘./App’ in ‘D:My_Home_Documentswebbansach_frontendsrc’

Compiled with problems:
×
ERROR in ./src/index.tsx 7:0-24
Module not found: Error: Can’t resolve ‘./App’ in ‘D:My_Home_Documentswebbansach_frontendsrc’

Tiptap editor getAttribute of a “text” (span) element

Using TipTap Editor I would like to get the attributes of the selected range, however it always gives me the element wrapping my selection.

The editor.getAttribute(nodeType) accepts a node type name.
As per my observation the editor.state.selection.$anchor.node(depth).type.name always returns paragraph or its referred element: <p>. The problem with this that specific styles applied from the editor tools are appended inside that paragraph to a <span> that is referred as text type node.

  • Replacing the paragraph to text in editor.getAttribute(nodeType) the returned attributes are empty.
  • Increasing the node depth level in editor.state.selection.$anchor.node(depth).type.name returns undefined instead of the text node that is supposed to be under paragraph.

In practice I want to get the color attribute of a selected range.
If the selection contains 1 or more text node, I want to get their color attributes.

As an example I am trying to get attributes like this:

editor.on("selectionUpdate", ({ editor, event }) => {
    const selectedElement = editor.state.selection.$anchor.node().type.name; // always "paragraph" while styles I want is appended to its child "text" nodes
    const style = editor.getAttributes(selectedElement);
    console.log({ style });
});

Is there a way or better way than this to return the attributes of a selection range?

Operation Order for Simultaneous Max/Min Search

What are the orders O(n) for the following methods of simultaneously finding the max/min of an array? Which is best? Are there better ways?

If I had to cycle the array beforehand for another reason (eg multiply each element by 10), would it be best to use option 2 and find the max/min at the same time as multiplying each element in the same forEach?

Option 1:

// This is surely 2n
let a = [...Array(1000000)].map(() => Math.round(1000000 * Math.random()));
let max = Math.max(...a);
let min = Math.min(...a);

Option 2:

// What order is this?
let a = [...Array(1000000)].map(() => Math.round(1000000 * Math.random()));
let max = Number.MIN_SAFE_INTEGER, min = Number.MAX_SAFE_INTEGER;
a.forEach(v => {max = Math.max(max, v); min = Math.min(min, v);});

Option 3:

// Is this 3n/2?
let a = [...Array(1000000)].map(() => Math.round(1000000 * Math.random()));
a.sort((x,y) => x - y);
let max = a[a.length - 1];
let min = a[0];