Array formula works in the sheet but invalid in conditional formatting

I have a list of time intervals along with their convenience ratings. I wish to highlight intervals rated anything other than impossible which conflict with those rated impossible.
I use start1 and end1 named ranges to refer to the interval endpoints and convenience is self-explanatory.

I couldn’t do it with ISBETWEEN, but the following formula appears to correctly return true for all such intervals and false for others:

=OR(ARRAYFORMULA(
  IF($C1<>"impossible", 
     IF(GTE($A1,FILTER(start1,convenience="impossible")),
        IF(LTE($A1,FILTER(finish1,convenience="impossible")),TRUE)
     )
  )))

However, when I enter this in Conditional Formatting it is rejected as invalid formula.

How can I add it to the conditional formatting rule?

Here’s the spreadsheet. The data in question is the sheet named “TEST” (the last one).
The formula has been entered in column P.

referencing a column in a Google sheets array literal

Is there a way to refer to columns in a literal array like so:

=FILTER({lengthy_arrayformula_1, lengthy_arrayformula_2}, condition referencing column 2 of the array literal in previous argument)

or

=INDEX({lengthy_arrayformula_1, lengthy_arrayformula_2}, row, 2nd col of the literal array)

without creating ‘buffer columns’ that hold intermediate results.

javascript – Although I am using Duplicate array, Array.map() function changing my original array

I have an array like :

export const switches = (
  { id: 1, switchName: 'HS - 3015', operation: 'Auto Start GA-3001 S', isActive: true },
  { id: 2, switchName: 'HS - 3016', operation: 'FSLL - 3001 (Pass - 1)', isActive: false },
  { id: 3, switchName: 'HS - 3017', operation: 'FSLL - 3002 (Pass - 2)', isActive: true }
);

In my component I added a additional property value which is boolean and which is used for control switch.

In a function I first duplicate this array and than modify this duplicate array that is value: true/false to value: 'normal/bypass'. The big issue is I am not getting my original array. I am always get the modified array.
What is the problem, I can’t figure out.

Switch change and Submit function like this:

  const onSwitchChange = (e, switchId) => {
    const { checked } = e.target;
    const oldState = (...state);
    const updatedState = oldState.map(s => {
      if (s.id === switchId) {
        s('value') = checked;
      }
      return s;
    });
    setState(updatedState);
  };

  const onSubmit = () => {
    const oldData = (...state);
    const data = oldData.map(item => {
      item.value = item.value === true ? 'Bypass' : 'Normal';
      return item;
    });
    document.getElementById('jsonData').textContent = JSON.stringify(data, null, 2);
  };

Find in codesandbox: https://codesandbox.io/s/switch-control-4ovyk

mysql – Fastest way to find which strings in an array are NOT present in a column

I am searching through MySQL rows in yii. Let’s say I have an array of strings

$fruits=array("apple", "banana","cherry","date");

I want to search in a db that looks like this:

id  name    
1   apple   
2   banana 

And I want it to return

array("cherry",'date')

What’s the best way to do this? Is there a Yii-specific way to do this? I was going to do it the caveman way where I get all of the names into a php array and then do foreach loop on $fruits but I think there must be a smarter way.

pandas – Sacar informacion de una columna Array Dataframe Python

ue tal, tengo un DataFrame en el cual obtengo todos los productos desde una API, pero ahora Necesito Generar un DataFrame NUEVO con algunos valores que estan en un array dentro de una columna del Dataframe Original (hay una columna que contiene valores como peso, altura, etc) y no se si se puede acceder de alguna manera a esos valores

EL DataFrame que estoy obteniendo me trae la columna asi:
introducir la descripción de la imagen aquí

Y cuando aplico el nombre de la columna para imprimirlo, me muestra asi:
introducir la descripción de la imagen aquí

Saludos a todos

java – Would an array and a custom node class have same memory intake?

There was recently a question on my exam where we were supposed to choose will the 2 (arr or x) take up same space in memory or would they take up different amount of memory space?

They are defined as follows

class Node{
    int a, b;
    Node(int a,int b) {
        this.a = a; this.b = b;
    }
}
public static void main(String() args) {
    Node x=new Node(2,3);
    int arr()=new arr(2);
}

Now my reasoning was that since arr and x are implemented differently they’ll have different memory consumption as arr must have some additional meta data too apart from these integers. I tried to verify this using Java functions which monitor memory but since I’m new to Java I couldn’t really grasp how to do it. How do I check this and which one of them will have take up more space in memory?

sharepoint online – Filter array of objects based on multiple properties/conditions

I’m pretty sure you are not getting any results from your filter because when you build your counter object in the reducer, you build it with complex property names that are combining many of your SharePoint field values into one long string, and then when you try to access the properties of the counter object in the filter, you are only specifying one of the SharePoint fields to try to find the property.

There are no properties on that object that have only the value of one of the SharePoint fields.

If you were to console.log(lookup) right after you build it using the reduce() function, you will see an object that looks something like this:

{
    "3001317_0001_Wood_FOO": 0,
    "3001317_0001_Metal_BAR": 1,
    "3001316_0002_Wood_FOO": 0,
    "3001316_0002_Metal_FOO": 2,
    "3001316_0001_Wood_BAR": 0
}

Now, the way that reducer works is that it adds a new property with that complex property name for each unique combination of those four field values. When it first adds it, it gives it a value of 0. 0 in this case means there is one item that has that unique combination of four field values. Then, if it finds another item with the same combination, it increments the counter. So a counter value of 1 means there are actually two duplicate items, and 2 means there are actually three items that are identical.

The reason the filter then works to pull out the duplicates is because you are checking against the counter object, and if there was only one unique item, then the counter value for that combination will be 0, which is a falsy value, so the filter won’t pull it, whereas if there were duplicates, the counter value will be 1 (or more), which is a truthy value, so the filter will pull it.

But, in your filter, you are only using the one field to try to access the counter properties, like this:

var askingForValue = lookup("3001317")

BUT – remember all the properties on the counter are much more than just that, there is no property on the counter object that is as simple as "3001317".

So what you have to do is re-create the complex property names / keys you created in the reducer:

FltrInv = getResp.filter(e => lookup(`${e.PCF_x0020_No}_${e.Item_x0020_No}_${e.Material}_${e.YourReference}`));

Also keep in mind, that filter will pull all the items that have duplicates, even if there are multiple sets of duplicates.

For example, if you look back at my fictitious counter object, if you ran that filter over the SharePoint results, you would end up with an array of 5 items:

  • 2 items would have field values 3001317 / 0001 / Metal / BAR
  • 3 items would have field values 3001316 / 0002 / Metal / FOO

node.js – Atualizar array posições especificas usando mongodb com ou sem Mongoose!

Tenho a seguinte situação!

const meuModel = new mongoose.Schema({

  nome: { type: String, required: (true, 'Nome') },
  
  links:{type : Array,},
}) 

Links é um array de objetos!

links ({url:link, clicks:0},{url:link1, clicks:0},{url:link2, clicks:0})

Eu preciso fazer update especifico. Sem nunca mudar os clicks, nem mexer neles!

links ({url:link, clicks:4},{url:novoLink, clicks:0},{url:link2, clicks:5},{url:novoLink2, clicks:0})

eu quero permitir o usuário modificar os Links como quiser. Mas os clicks sempre serão via sistema.

Meu problema esta me salvar isso no mongo!

teste = await MeuModel.findOneAndUpdate({
          _id
        },{$inc: {
          "links.0.url":'novolink', 
          "links.1.url": 'linkantigo', 
          "links.2.url": 'novo link se for novo',   
      }}

Isso não funciona!
Pois quer mudar uma posição, só quando viver do front algo novo!
Se o usuário mudou 3 links, eles devem ser salvos!

“$set” não aceita que eu percorra o array para modificar somente onde for preciso!
“$set” só permite mudança de 1 posição especifica

await meuModel.findOneAndUpdate({
          _id
        },{ 
          "$set": {(`links.$(outer).url`): 'novoLink'} 
        },
        { 
          "arrayFilters": ({ "outer.url":'antigoLink'})
        })

$set com arrayFilters só aceita uma condição para muitos ou apenas 1.

Quero poder mandar salvar o array todo de uma vez, com as modificações apenas dos links, se ela existirem!

debian – Using a software raid array after os failed

So I have a debian home server that has a 4 disk software RAID 5 array. My OS runs only on a normal nvme SSD. I know thats not secure, but it is a home server, so I didn’t really care when I installed it and now it is too late to change it. I was wondering what would happen to my software RAID when the OS failed (or the SSD).
How could I resync (I don’t know what the correct term for it is) the array to use it after I bought a new ssd and installed a new OS?

I found something regarding the mdadm config, but mine is empty…
Just for clarification: this is just something I thought about to be prepared when it happens (I don’t want to loose all my data)

Thanks for your answers in advance

postgresql – How to filter and get specific keys from JSON objects array

I have a JSONB field containing a value in this structure:

[
    {
        "type": "small",
        "name": "Josh",
        "greeting": "Hello buddy!",
        "hobby": "billiards",
        "place": "Barcelona"
    },
    {
        "type": "big",
        "name": "Aziz",
        "greeting": "Hey man!",
        "hobby": "tennis",
        "place": "Montpellier"
    }
]

I want to include this output if type is equal to “big”:

{
    "greeting": "Hey man! How're you doing Aziz?",
    "place": "Montpellier"
}
  1. In the first row, I combined two values into one with some additional words.
  2. I don’t want my whole output to be empty if there isn’t type value
    equal to “big”. Instead, output values of type value equal to
    “small” as a fallback.
  3. If there is not a fallback with type equal to “small”, then output an empty string or NULL value but without Nulling the whole query result. Or preferably, not include these keys if no value is present.

I know I can combine values into one by using CONCAT but don’t know how to build this query and integrate it. I can’t loop through the array and output the values of the object that matches my filter. Tried CASE but still wasn’t able to get the result I want.

I use PostgreSQL 13.