โŒ

Reading view

There are new articles available, click to refresh the page.

nodejs array doesn't remove item and googleapis throws error Invalid values[2][0]: list_value

I have the below code for a DELETE route on my app's server. I'm facing two majors problems from this :

1. Unable to remove item from array

This section of the code is supposed to remove friend from friendsArray. But it doesn't work as intended. The output of console.log("Modified Friends Array",friendsArray) is:

Modified Friends Array [
  'friend1',
  'friend2',
  'friend3'
]

The value for friend was given as friend2 in the query parameters. Which still exists even after the given instructions:

// removing friend from array
const friendsArray = await fetchFriends(email);
console.log("Friends array: "+friendsArray)   
console.log("Friends array type: "+ typeof friendsArray)       
console.log("Friend to be removed: "+friend)
delete friendsArray[friend]
JSON.stringify(friendsArray)
console.log("Modified Friends Array",friendsArray)

Note: the output of console.log("Friends array type: "+ typeof friendsArray) is Friends array type: object

2. googleapis error while updating values

I receive this error from googleapis:

 error: undefined,
  status: 400,
  code: 400,
  errors: [
    {
      message: 'Invalid values[2][0]: list_value {\n' +
        '  values {\n' +
        '    string_value: "friend1"\n' +
        '  }\n' +
        '  values {\n' +
        '    string_value: "friend2"\n' +
        '  }\n' +
        '  values {\n' +
        '    string_value: "friend3"\n' +
        '  }\n' +
        '}\n',
      domain: 'global',
      reason: 'badRequest'
    }
  ]
}

I tried setting the updating values from values: [[friendsArray]] to values: [friendsArray] and even values: [[[friendsArray]]] but that didn't work either...

Here is my entire file:

require("dotenv").config()

const axios = require('axios')

const { google } = require("googleapis")
const sheets = google.sheets({ version: 'v4' })
const creds = './credentials.json'

module.exports = {
    route: "users/profile/friends",
    method: "DELETE",
    run: async (req, res) => {

        async function fetchFriends(email) {
            try {
                const response = await axios.get(require('../api')('Profiles'))
                const [headerRow, ...rows] = response.data.values;

                const Data = rows.map(row => {
                    const obj = {};
                    headerRow.forEach((key, index) => {
                        obj[key] = row[index];
                    });
                    return obj;
                });
                const result = Data.filter(user => user.email === email)
                return JSON.parse(result[0].friends)
            } catch (e) {
                console.log(e)
                throw e
            }
        }

        const { email, friend } = req.query

        try {
            // removing friend from array
            const friendsArray = await fetchFriends(email);
            console.log("Friends array: "+friendsArray)   
            console.log("Friends array type: "+ typeof friendsArray)       
            console.log("Friend to be removed: "+friend)
            delete friendsArray[friend]
            JSON.stringify(friendsArray)
            console.log("Modified Friends Array",friendsArray)

            const auth = await google.auth.getClient({
                keyFile: creds,
                scopes: ['https://www.googleapis.com/auth/spreadsheets']
            })
            const spreadsheetId = process.env.DATABASE_ID

            const rowReq = {
                spreadsheetId,
                range: 'Profiles!A:D',
                auth
            }
            const rowRes = await sheets.spreadsheets.values.get(rowReq)
            const rows = rowRes.data.values
            const rowIndex = rows.findIndex(row => row[0] === email)

            const Index = rows[0].indexOf("friends")
            const Column = String.fromCharCode(Index + 65)
            const Range = `Profiles!${Column}${rowIndex + 1}`

            const frndsUpdateRequest = {
                auth,
                spreadsheetId,
                range: Range,
                valueInputOption: 'RAW',
                resource: {
                    values: [[friendsArray]],
                },
            }

            const response = await sheets.spreadsheets.values.update(frndsUpdateRequest)

            res.status(200).send(response)
        } catch (e) {
            console.log("Error removing friend: ", e)
            res.status(500).send("Error removing friend: " + e.message);
        }
    }
}

How to create selector with parameters like in NGRX signalStore like `createSelector` in NGXS?

I'm refactoring the code and I started to moving code to the signalStore, but I was stuck while creating custom selector with some property to make it like signal computed value.

NGXS Code:

interface Permission { 
   name: string;
}

interface UserStateModel {
   permissions: Permission[];
}

const DEFAULT_STATE: UserStateModel= {  
    permissions: []
};

@State<UserStateModel>({
    name: 'user_state',
    defaults: DEFAULT_STATE,
})
@Injectable()
export class UserState {
    @Selector()
    static permissions(state: UserStateModel): Permission[] {
        return state.permissions;
    }

    static permission(spermissionName: string) {
       return createSelector(
           [UserState.permissions], 
           (permissions) => permissions.find(x => x.name === permissionName)
        })

     }
}

As you can see, I can use UserState.permission('myPermissionName') and do any action if this position change.

export type UserStoreModel = {
    permissions: Permission[;
};

const DEFAULT_STATE: UserStoreModel = {
    permissions: [],
};

export const UserStore = signalStore(
    withState(DEFAULT_STATE),
    withComputed(store => {
        return {
            permissions: computed(() => store.permissions() ?? []),
        };
    }),
);

It should be a method which return Signals? Maybe there is something like createSelector which I can use here with Signals?

Thanks for help.

I did a research but I can't find any valid solution for this.

I'm expecting I will be able to make selector with Signals using ngrx signalStore.

Example usage of this:

/// My view

const hasAccessPermissions = computed(() => {
   const result = this.userStore.hasAccess('MyPermission');   //<--- this should be reactive
   return result;
});

private readonly userStore = inject(UserStore);

Using IF THEN function to calculate a rolling number in a dataframe

I am in need of help trying to create a calculated metric. I am trying to create an RSI calculation for a stock dataset. To do so I want to look at the last 14 days and find the average gain for all days where the stock price was up. I then will have to do the same for all days the stock market is down. I am doing these calculations across multiple stocks, so I created a dictionary which I then concatenate. Here is the code:

stocklist=["^SPX", "^DJI"]
d={}
def averageGain14(dailyGain):
    if dailyGain>= 0:
        gain = dailyGain
    return gain
for name in stocklist:
    d[name]= pd.DataFrame()
    data = yf.Ticker(name)
    data = data.history(start=myStart, end=myEnd)
    d[name]= pd.DataFrame(data)
    d[name]["Daily Gain"]=d[name]["Close"].diff()
    d[name]['Average Gain'] = d[name]["Daily Gain"].apply(averageGain14)
    d[name] = d[name].add_prefix(name)
modelData = pd.concat(d.values(), axis=1)

As you can see, I try to define a function for averagegain14 at the top, which is not currently doing anything yet but returning the gain value if the day was up (step 1 of getting this working). In the For loop, I am trying to set the "Average Gain" Column to a calculated field that applies the function to the "Daily Gain" column, but I seem to be running into an error.

I tried a few approaches, but to no avail. First I tried d[name]['Average Gain'] = d[name].rolling(14).mean().where(d[name]['Daily Gain'] >= 0, 0)

That returned an error regarding the Daily Gain value being a list and not a single value. I then tried appending the daily gain call with .values, but that didn't work either. I then tried this approach above that is not working. I think to add complexity, I need this to also be a rolling average based on the last 14 days, so to not only calculate add up the positive days, but to also then find the average gain for those days (know the denominator of how many days were up in the 14 day window). Hopefully this is making sense and someone can point me in the right direction.

Can an analyzer send Rejected results via LIS interface

I am developing a link between our LIMS and a medical biochemical analyzer that has LIS protocol supported.

For various reasons we would like all of the results to be channeled to the system, also the ones marked automatically or manually rejected.

I am sending a Request message to the instrument which looks like this: <STX>2Q|1|^ALL^^||^^^^|R|||||||<CR><ETX>51<CR><LF> and in my mind is supposed to mean "give me everything you have".

I then do receive everything that is on the instrument's "deck" (i.e. all the current results, before they are archived at the end of the day) - except the rejected ones. If I export the data to a CSV file, everything is exported, with appropriate statuses (AA, MA, AR, MR for automatically or manually accepted, automatically or manually rejected). I do not however know how to get the rejected results over LIS - is it at all possible?

Thank you for any possible insights!

How to typecheck for Constructor Signatures vs a regular function in Typescript?

My factory function below should accept both calls:

const instance1 = factory( MyClass );
const instance2 = factory( ()=> new MyClass() );

How can I differentiate this at runtime? (please see "<What goes here?>" in the code)

type Constructor<T> = new () => T

const factory = <T>(arg: (() => T) | Constructor<T> ) =>{
  return (  <What comes here?>   ) ? new arg() : arg();
};

Using a file parameter inside a docker container in a Jenkins pipeline

I have a pipeline where I run some python script inside of a docker container. I wish to pass a json file to inside the container so that the script can use it. For the sake of argument, let's say that I wish to have the file stored at the folder [pipeline root dir]/json with the name somefile.json (so its full relevant path is [pipeline root dir]/json/somefile.json).

The pipeline uses a git repository to pull the project at each run (i.e. I defined it under GitHub Project in the general settings of the pipeline):

How the pipline is defined to read from the git repo, anonymized for privacy

In the gui settings page for the pipeline, I added an option for a File Parameter, which would save a file the user is uploading from their computer at the start of the run into json/somefile.json:

The File Parameter input in the settings

This is how my groovy script looks like (simplified and changed for privacy reasons):

pipeline {
  agent {
    label 'ubuntu:22.04'
  }

  stages {
    stage('main') {
      steps {
        script {
          docker.withRegistry("${SOME_DOCKER_REGISTRY}", "${SOME_TOKEN}") {
            docker.image("${DOCKER_CONTAINER_NAME}").inside {
              sh 'ls json'
            }
          }
        }
      }
    }
  }
}

However, when I run the pipeline, the command ls json (where I expect my somefile.json to be stored) returns an empty result:

The json dir where I expect somefile.json to be is empty

I would appreciate any help on this matter.

How to configure different logging levels for different loggers in Log4j2

We are trying to utilize Log4j2 in our project. We want to configure Log4j2 via properties files.

To reduce the noise in our logs, we want to set the root logger to info and set debug logging only for specific loggers or packages. How do we configure logging levels for each of our classes under development and not get debug messages for all the other loggers?

Here is an example we are using in our project:

status = warn
name = StackOverflow

# Console appender configuration
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d [%p] %c{1} - %m%n

# Root logger level
rootLogger.level = info
rootLogger.appenderRef.stdout.ref = consoleLogger

# Only this class should be logging debug events
logger.mylogger.name = com.example.ClassUnderDevelopment
logger.mylogger.level = DEBUG

What would be the properties needed to configure Log4j2 to enable different log levels for different classes (named loggers)?

Same function comes to JIT multiple times in .NET PROFILER

I have developed my own .NET profiler (C++) using CORPROFILER API. And am doing the instrumentation that calls C# helper assembly file.

I have set the following event mask

ProfilerInfo->SetEventMask( COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST | COR_PRF_MONITOR_EXCEPTIONS | COR_PRF_USE_PROFILE_IMAGES | COR_PRF_MONITOR_JIT_COMPILATION | COR_PRF_MONITOR_MODULE_LOADS);

My question is, Some functions comes to JITcompilationstarted callback repeatedly. Then my profiler getting down because of this issue. How to avoid same function comes to JIT multiple times?

Wed May 15 12:58:07 2024 - [INFO1] System.Void Builder:EnsureCapacity(System.Int32) 2540 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void DisposableData:Release() 2540 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void Builder:EnsureCapacity(System.Int32) 6656 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void DisposableData:Release() 6656 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void Builder:EnsureCapacity(System.Int32) 2540 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void DisposableData:Release() 2540 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void Builder:EnsureCapacity(System.Int32) 6656 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void DisposableData:Release() 6656 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void Builder:EnsureCapacity(System.Int32) 2540 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void DisposableData:Release() 2540 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void Builder:EnsureCapacity(System.Int32) 6656 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void DisposableData:Release() 6656 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void Builder:EnsureCapacity(System.Int32) 2540 PID: 6020 Wed May 15 12:58:07 2024 - [INFO1] System.Void DisposableData:Release() 2540 PID: 6020 PID: 6020

How to avoid the same function from instrumentation?

Cypress DragStart and Drop are not working

I have this in my step definition:

  cy.get('div.list-group-item')
    .contains(' Test Data')
    .trigger('dragstart', { dataTransfer });

  cy.get("tbody[role='rowgroup']").eq(1)
    .trigger('drop', { dataTransfer });

When I ran it on my local via interactive mode, I don't get any error, but it's not dropping the item to my target element. I tried asserting if both elements are 'visible' and they are, but mouse is just pointing the element to drag and the element where to drop. I tried to install the plugin Cypress drag-and-drop, but just getting an infinite loop there when dropping the element.

How to model from the distribution center to the mission point in java gurobi

Have a taskInfomation(list) include distribution center (0) and lots of tasks,so how to model in gurobi use java? As follow the picture.xijrk is binary variable

        for (int k = 0; k < VehicleInfo.size(); k++) {
            for (int r = 0; r < Route.getTrip(); r++) {
                for (int i = 0; i < 1; i++) {
                    for (int j = 1; j < taskInfo.size()-1; j++) {
                        GRBLinExpr expr = new GRBLinExpr();
                        expr.addTerm(1, csVariable.x[i][j][k][r]);
                        model.addConstr(expr, GRB.Less_EQUAL, 1, "name" + i + "_" + j + "_" + k + "_" + r);
                    }
                }
            }
        }

error: Automation error. The system cannot find the file specified in vb6

I have an application in VB6 and need to create an object of a class that is part of another .dll (written in VB.NET). Now I am using the CreateObject() method (I am following the same logic used in other parts of the application) but it is giving me this error:

Automation error. The system cannot find the file specified.

Since VB6 is quite old I have not worked a lot with it and don't understand why my .dll is not working but works for others. Am I missing any step?

Public Function DoRun() As Object
    Set DoRun = CreateObject("U_DoRun.ClassName",SERVERNAME)
End Function

I have tried to use this command:

C:\Windows\Microsoft.NET\Framework\v4.0.\regasm.exe c:\windows\syswow64\U_DoRun.dll /codebase /tlb:c:\windows\syswow64\U_DoRun.tlb

After I do this if I try to give a value to a variable of the class it gives another error:

Could not load file or assembly 'NetArch, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3544813d6c2e85c4' or one of its dependencies. The specified file could not be found.

and also the object of the class seems to be empty (It says 'No variables') which makes me think that it does not create the object correctly. What can I do to solve this?

Sorting user-defined array with strings gives wrong order, even when file content is fully available on disk

I am querying ElasticSearch and sorting the documents locally in Bash with jq, as sorting in ES is too slow for me.

The original purpose is to create a CSV file.

But I find the sorting does not work properly, it seems sort step does nothing.

As I am launching cURL requests, I thought the wrong order is due to content is chunked so I save some results into a local test.json file and tried again, but it still does not work.

test.json:

{
    "took": 680,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "max_score": 1.0,
        "hits": [
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113584925",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113584925"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111121254059",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111121254059"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111116879444",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111116879444"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111116879484",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111116879484"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114472530",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114472530"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113372966",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113372966"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113046053",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113046053"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113034864",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113034864"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111116770197",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111116770197"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111123578950",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111123578950"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114472544",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114472544"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111123578971",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111123578971"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111124882870",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111124882870"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111124178732",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111124178732"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113649568",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113649568"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113034877",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113034877"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114049560",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114049560"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113034894",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113034894"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111116879498",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111116879498"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111115634604",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111115634604"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111117550495",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111117550495"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111117964387",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111117964387"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111120647956",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111120647956"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111124178784",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111124178784"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111123579003",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111123579003"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114049597",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114049597"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113922927",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113922927"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113649622",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113649622"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113922948",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113922948"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111124178797",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111124178797"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114775147",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114775147"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111115634973",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111115634973"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111115634987",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111115634987"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111124882959",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111124882959"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114049664",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114049664"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111117964419",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111117964419"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111117069687",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111117069687"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111117453564",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111117453564"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113046124",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113046124"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113586875",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113586875"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111115735339",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111115735339"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111119990227",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111119990227"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111120648051",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111120648051"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111117453835",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111117453835"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113899778",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113899778"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111120648071",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111120648071"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111117964461",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111117964461"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114049666",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114049666"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114049678",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114049678"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113923053",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113923053"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111119990248",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111119990248"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111115735378",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111115735378"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111115735384",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111115735384"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111116770587",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111116770587"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111124883047",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111124883047"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111114775219",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111114775219"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113373129",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113373129"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113046216",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113046216"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111124883526",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111124883526"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113046278",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113046278"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111113587608",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111113587608"
                    ]
                }
            },
            {
                "_index": "my-index",
                "_type": "_doc",
                "_id": "111111116770696",
                "_score": 1.0,
                "fields": {
                    "field2": [
                        "FOO"
                    ],
                    "field1": [
                        "111111116770696"
                    ]
                }
            }
        ]
    }
}

Command that I use:

jq '.hits.hits[].fields | [.field1[0] + "," + .field2[0]] | sort | .[0]' -r test.json

The result:

111111113584925,FOO
111111121254059,FOO
111111116879444,FOO
111111116879484,FOO
111111114472530,FOO
111111113372966,FOO
111111113046053,FOO
111111113034864,FOO
111111116770197,FOO
111111123578950,FOO
111111114472544,FOO
111111123578971,FOO
111111124882870,FOO
111111124178732,FOO
111111113649568,FOO
111111113034877,FOO
111111114049560,FOO
111111113034894,FOO
111111116879498,FOO
111111115634604,FOO
111111117550495,FOO
111111117964387,FOO
111111120647956,FOO
111111124178784,FOO
111111123579003,FOO
111111114049597,FOO
111111113922927,FOO
111111113649622,FOO
111111113922948,FOO
111111124178797,FOO
111111114775147,FOO
111111115634973,FOO
111111115634987,FOO
111111124882959,FOO
111111114049664,FOO
111111117964419,FOO
111111117069687,FOO
111111117453564,FOO
111111113046124,FOO
111111113586875,FOO
111111115735339,FOO
111111119990227,FOO
111111120648051,FOO
111111117453835,FOO
111111113899778,FOO
111111120648071,FOO
111111117964461,FOO
111111114049666,FOO
111111114049678,FOO
111111113923053,FOO
111111119990248,FOO
111111115735378,FOO
111111115735384,FOO
111111116770587,FOO
111111124883047,FOO
111111114775219,FOO
111111113373129,FOO
111111113046216,FOO
111111124883526,FOO
111111113046278,FOO
111111113587608,FOO
111111116770696,FOO

Why?

Should I rely on jq sorting? Am I using it correctly? I mean I want to do string comparison by alphabetical order, and field1 all have unique values, so it will never be a tie and start to compare values of field2(it also could have various values but I only want to sort by field1)

Should I use Bash sort -k 1 instead? Which is faster when it comes to 100K rows?

Azure Pipelines breaking suddenly with no RUN button to Manually trigger

We noticing a few issues in Azure pipelines like:-

  1. Suddenly Azure pipelines don't have RUN button enabled to trigger them manually
  2. Some failing with Error:- Length cannot be less than zero. Parameter name: length
  3. Lot of pipelines getting triggered on its own

IS there Any maintenance work going on without prior notification anywhere?

I am trying to trigger existing working pipelines manually, expected behaviour is to have RUN button to trigger it.

Get SUMPRODUCT with multiple column and row criterias if table includes values that are not numeric

enter image description here


In cell I5 I extract the sum from the table based on multiple column and row criteria using this formula:
=SUMPRODUCT(IF(I3="";1;(A3:A8=I3))*IF(I4="";1;(B3:B8=I4))*IF(I1="";1;(C1:G1=I1))*IF(I2="";1;(C2:G2=I2))*(C3:G8))


This formula has worked until I inserted the Column D. Now I am getting error #VALUE! as result.
I guess this comes from the situation that Column D does not contain numeric data.

Therefore, I was thinking maybe a formula like this could solve the issue:

=SUMIF(A1:A8;I3;INDEX(A1:G1;MATCH(I1;A1:G1;0)))

However, with this formula I have the problem that I can only apply one row and column criteria and not multiple ones.

Do you have any idea how to solve this issue?

How to detect if any modal <dialog> is open?

I have a page with multiple <dialog> elements, which I open as modal using their showModal() methods.

I want to detect whether any of them is currently opened from Javascript (since some event handlers shouldn't trigger when a modal is opened). Is it possible to check if modal is currently opened? Maybe through existance of dialog::backdrop or checking someway for inertness of non-modal content?

Force child element to display outside overflow hidden container

I'm trying to solve this css problem: I have a list of items contained in a scrolling container (overflow-y: scroll / overflow-x: hidden) each of this items have a child div (popup). I need to display this child element outside the scrolling container but the position must be relative to the item div.

I can't manage to find a way to display those childs elements outside the overflow hidden of the scroll container.

If anyone has a solution, thank you so much.

What I'm trying to do

Simplified exemple :
https://jsfiddle.net/zbvwjq1s/35/

.container{
  position: relative;
  background-color:black;
  width:200px;
  margin:0 auto;
}
.scroll-container{
  overflow-y:scroll;
  height: 250px;
  background-color:red;
}
.item{
  display:flex;
  align-items:center;
  margin-top: 10px;
  width:100%;
  height: 50px;
  background-color:green;
}

.popup {
  position: absolute;
  right:-80px;
  width:80px;
  height:40px;
  background-color:blue;
  visibility:hidden;
}

.item:hover .popup {
  visibility:visible;
}
<div class='container'>
    <div class='scroll-container'>
        <div class='item'>
            <div class='popup'></div>
        </div>
        <div class='item'>
            <div class='popup'></div>
        </div>
        <div class='item'>
            <div class='popup'></div>
        </div>
        <div class='item'>
            <div class='popup'></div>
        </div>
        <div class='item'>
            <div class='popup'></div>
        </div>
        <div class='item'>
            <div class='popup'></div>
        </div>
        <div class='item'>
            <div class='popup'></div>
        </div>
    </div>
</div>
โŒ