问:
How to group by using reduce in Javascript
I have an array of objects, which I want to group by meter:

```<code>[
    {
        _id: { year:2022, meter:12 },
        x:1,
        y:0
    },
    ...
]
</code>```

The problem is I am unable to use the reduce function to do so. I tried other methods too, like using group:

```<code>const result = inventory.group(({ _id.meter }) => _id.meter);
</code>```

The problem is that none of the methods accept a key inside a key (i.e _id will work but _id.meter won't)

```<code>const products = [
  { name: 'apples', category: 'fruits' },
  { name: 'oranges', category: 'fruits' },
  { name: 'potatoes', category: 'vegetables' }
];

const groupByCategory = products.reduce((group, product) => {
  const { category } = product;
  group[category] = group[category] ?? [];
  group[category].push(product);
  return group;
}, {});
</code>```

Another example I found above which again doesn't work if I write category.meter or something like that.

Can someone help me how to modify the code so I am able to group it by "a key inside a key"?

Body:
I have an array of objects, which I want to group by meter:

[
    {
        _id: { year:2022, meter:12 },
        x:1,
        y:0
    },
    ...
]

The problem is I am unable to use the reduce function to do so. I tried other methods too, like using group:

const result = inventory.group(({ _id.meter }) => _id.meter);

The problem is that none of the methods accept a key inside a key (i.e _id will work but _id.meter won't)

const products = [
  { name: 'apples', category: 'fruits' },
  { name: 'oranges', category: 'fruits' },
  { name: 'potatoes', category: 'vegetables' }
];

const groupByCategory = products.reduce((group, product) => {
  const { category } = product;
  group[category] = group[category] ?? [];
  group[category].push(product);
  return group;
}, {});

Another example I found above which again doesn't work if I write category.meter or something like that.

Can someone help me how to modify the code so I am able to group it by "a key inside a key"?


来源: stackexchange

问:
Huge data transfer frequently across DBs in microservice based architecture
I am working on designing a system in microservice based architecture where system-A will be producing bills with multiple payee (around 8K in many cases) details in single bill and sending it to system-B for further processing and payment. Many times (during peak load) System-A may be generating these bills in higher frequency (say 200 bills per second).

System-A and System-B are two different systems and have different DBs. In microservices based architecture we are trying to avoid the DB-Link across DBs, what should be the best approach to design this integration.

Shall we have synchronous call and pass the complete bill data in one go in Rest call?

Shall we have sync call and pass the bill detail in JSON and in System-B store this JSON in staging to respond back quickly with some temp reference ID. Later process it from the staging table?

Have a message queue in between and dump the message (size could be bigger in some bills) and then system-B can get it from there?

Any other approach?

Still in process of designing

ContentLicense: CC BY-SA 4.0


问:
Converting JSON file to Apache Parquet format using aws glue job
I'm trying to convert my JSON files in the s3 bucket put by Kinesis Firehose delivery stream using the aws glue job
Here is my JSON payload :-

```<code>{
  "device_name": "inHand-RTU",
  "Temperature": 27.1,
  "Pyranometer": 14,
  "Active-Power": 0,
  "Voltage-1": 235.58,
  "Active-Import": 2.57
}
</code>```

Later in the rules engine I'm adding the timestamp by writing the query there, after adding the timestamp the payload looks like this:-

```<code>{
"device_name":"inHand-RTU",
"Temperature":27,
"Pyranometer":15,
"Active-Power":0,
"Voltage-1":236.59,
"Active-Import":2.5699999999999998,
"time":1673517687650
}
</code>```

When i try to run the job in the glue studio it gives me following error:-

```<code>Unsupported case of DataType: com.amazonaws.services.glue.schema.types.StringType@e7b95c9 and DynamicNode: longnode
</code>```

The structure in which the I've stored the files in s3 bucket is:-

```<code><my-bucket-name>/site_name=inHand-rtu/year=2023/month=01/day=12/firehose-ds-to-s3-1-minute-ds-1-2023-01-12-10-01-27-62d4f06e-7fff-3bb5-89dd-c55860a0dbd9
</code>```

I want my glue job to convert these files put in by firehose delivery streams to be converted into Apache Parquet from JSON  into the same s3 bucket under folder "Parquet files", the way i want to partition the parquet files in the bucket is:-

```<code><my-bucket-name>/Parquet Files/site_name=inHand-rtu/year=2023/month=01/day=12/ <parquet files>
</code>```

Any help will be greatly appreciated.

Body:
I'm trying to convert my JSON files in the s3 bucket put by Kinesis Firehose delivery stream using the aws glue job
Here is my JSON payload :-

{
  "device_name": "inHand-RTU",
  "Temperature": 27.1,
  "Pyranometer": 14,
  "Active-Power": 0,
  "Voltage-1": 235.58,
  "Active-Import": 2.57
}

Later in the rules engine I'm adding the timestamp by writing the query there, after adding the timestamp the payload looks like this:-

{
"device_name":"inHand-RTU",
"Temperature":27,
"Pyranometer":15,
"Active-Power":0,
"Voltage-1":236.59,
"Active-Import":2.5699999999999998,
"time":1673517687650
}

When i try to run the job in the glue studio it gives me following error:-

Unsupported case of DataType: com.amazonaws.services.glue.schema.types.StringType@e7b95c9 and DynamicNode: longnode

The structure in which the I've stored the files in s3 bucket is:-

<my-bucket-name>/site_name=inHand-rtu/year=2023/month=01/day=12/firehose-ds-to-s3-1-minute-ds-1-2023-01-12-10-01-27-62d4f06e-7fff-3bb5-89dd-c55860a0dbd9

I want my glue job to convert these files put in by firehose delivery streams to be converted into Apache Parquet from JSON  into the same s3 bucket under folder "Parquet files", the way i want to partition the parquet files in the bucket is:-

<my-bucket-name>/Parquet Files/site_name=inHand-rtu/year=2023/month=01/day=12/ <parquet files>

Any help will be greatly appreciated.


问:
Compare dates in the same column with the same id
I want it to return only rows with a difference of 3 or more days, but that have the same id. I'll leave an example of the data in the database table.

id
title
end

1
763
2023-01-11

2
763
2023-01-08

3
763
2023-01-07

4
545
2023-01-01

5
545
2023-01-08

6
323
2023-01-07

The query I'm doing to return the data:

```<code>WITH
cte1 AS (
    SELECT title,
           DATE(end) AS Regresso
    FROM AgendaSaidas
),
cte2 AS (
    SELECT title,
           Regresso,
           DATEDIFF(LEAD(Regresso) OVER (ORDER BY Regresso), Regresso) delta
    FROM cte1
)
SELECT title, Regresso
FROM cte2
WHERE delta >= 3 OR delta IS NULL;
</code>```

But with this code it will only return the lines that have a difference of three days or more, as I show here what it returns:

id
title
end

1
763
2023-01-11

2
763
2023-01-08

4
545
2023-01-01

But you can't remove all the other lines, because if you notice the title column has different customer ids. The result that should return was this:

id
title
end

1
763
2023-01-11

2
763
2023-01-08

4
545
2023-01-01

5
545
2023-01-08

6
323
2023-01-07

You can only delete the line with id 3, because it is the only case where the date difference for the same customer is less than 3 days

Body:
I want it to return only rows with a difference of 3 or more days, but that have the same id. I'll leave an example of the data in the database table.

id
title
end

1
763
2023-01-11

2
763
2023-01-08

3
763
2023-01-07

4
545
2023-01-01

5
545
2023-01-08

6
323
2023-01-07

The query I'm doing to return the data:

WITH
cte1 AS (
    SELECT title,
           DATE(end) AS Regresso
    FROM AgendaSaidas
),
cte2 AS (
    SELECT title,
           Regresso,
           DATEDIFF(LEAD(Regresso) OVER (ORDER BY Regresso), Regresso) delta
    FROM cte1
)
SELECT title, Regresso
FROM cte2
WHERE delta >= 3 OR delta IS NULL;

But with this code it will only return the lines that have a difference of three days or more, as I show here what it returns:

id
title
end

1
763
2023-01-11

2
763
2023-01-08

4
545
2023-01-01

But you can't remove all the other lines, because if you notice the title column has different customer ids. The result that should return was this:

id
title
end

1
763
2023-01-11

2
763
2023-01-08

4
545
2023-01-01

5
545
2023-01-08

6
323
2023-01-07

You can only delete the line with id 3, because it is the only case where the date difference for the same customer is less than 3 days


问:
Is it possible to get destination IP address inside access() phase in Kong API Gateway?
I'm working on a kong custom plugin to implement circuit breaker(as I don't use of upstream entity) in kong which requires the destination IP address to which the host of service entity resolved to. But I was not able to get the Destination IP address within access phase inside the kong plugin.

Is it possible to get the destination IP address in any phase within kong plugin before proxying the request to upstream?


问:
xhr.statusText exist in localhost but not in server
Good morning,

Trying on the physical server, the request does not return with the statusText which instead works perfectly in the localhost.
Example code js (framework7):

```<code>statusCode: {
            401: (xhr) => {
                console.log(xhr.statusText)
//other code
</code>```

in php:

```<code>$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
die(header("$protocol 401 Error auth."));
</code>```

Is there some setting in the php.ini that I am missing to return the text correctly to the server?

Seems like work only with that pattern:

```<code>http_response_code(401);
print_r('Error auth.');
exit;
</code>```

xhr.responseText instead of xhr.statusText

Body:
Good morning,

Trying on the physical server, the request does not return with the statusText which instead works perfectly in the localhost.
Example code js (framework7):

statusCode: {
            401: (xhr) => {
                console.log(xhr.statusText)
//other code

in php:

$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
die(header("$protocol 401 Error auth."));

Is there some setting in the php.ini that I am missing to return the text correctly to the server?

Seems like work only with that pattern:

http_response_code(401);
print_r('Error auth.');
exit;

xhr.responseText instead of xhr.statusText


问:
This module and the new module both define a variable named "$secondary"
i am replacing @import with @use because @import is deprecated.

and I replaced

```<code> @import 'src/assets/styles/general-variables.scss'
</code>```

with

```<code>@use 'src/assets/styles/general-variables.scss' as gv;
</code>```

but I am getting this error not sure where is coming from.

but if we take the second error and see what it's produced by it says that I defined $black multiple times.

and if I look where I used and defined $black in all the project you can see only one place it's defined from:

the question is : where is the problem produced by?

I removed the variable used background-color: background-color: gv.$black; and hard-coded background-color: #000;

it but the same problem. I think it's related to the SCSS compiler.

Body:
i am replacing @import with @use because @import is deprecated.

and I replaced

 @import 'src/assets/styles/general-variables.scss'

with

@use 'src/assets/styles/general-variables.scss' as gv;

but I am getting this error not sure where is coming from.

but if we take the second error and see what it's produced by it says that I defined $black multiple times.

and if I look where I used and defined $black in all the project you can see only one place it's defined from:

the question is : where is the problem produced by?

I removed the variable used background-color: background-color: gv.$black; and hard-coded background-color: #000;

it but the same problem. I think it's related to the SCSS compiler.


问:
AWS Lambda : body size is too long with raw file
I have an AWS Lambda function that return an image file. When trying to return the raw bytes of a 3MB image, I get the error message : "body size is too long"

However, when encoding the image to base64, the lambda works properly. I don't understand this behavior since the base64 image is bigger than the raw image.

```<code>Raw image            : 3116012 bytes
Base64 encoded image : 4154684 bytes
</code>```

Why do I get this error ?

Body:
I have an AWS Lambda function that return an image file. When trying to return the raw bytes of a 3MB image, I get the error message : "body size is too long"

However, when encoding the image to base64, the lambda works properly. I don't understand this behavior since the base64 image is bigger than the raw image.

Raw image            : 3116012 bytes
Base64 encoded image : 4154684 bytes

Why do I get this error ?


问:
how can we use multiple timeframe (multiple candle use) in our single strategy in freqtrade
The fetched OHLC is on the daily candle or TF and we are using the previous day candle to fetch levels for trading today. Today's trades will obviously have to fetch the signals on a lower time frame (say 15 minutes) based on the daily candle of yesterday.

It's important to note that the signals generated on the previous day's candle are valid for the whole of today. Also, we can see multiple buy and hens sell or else, sell and then buy in the same day.

```<code>    # Optimal timeframe for the strategy.
    timeframe = '1h'

def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        .
        .
        pass

def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        .
        .
        pass

def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        .
        .
        pass
</code>```

so this code will use a 1-hour timeframe for this current strategy in defining every single function

```<code>def populate_indicators,def populate_entry_trend,def populate_exit_trend
</code>```

as defined timeframe =1h is the current time frame in this strategy and then freqtrade download OHLC value in the data frame for every 1 hour for the given time period using that data frame I need to perform some mathematical operations and use that previous day data frame in my current data frame and current strategy

so basically this question is related to freqtrade and trading using python

Body:
The fetched OHLC is on the daily candle or TF and we are using the previous day candle to fetch levels for trading today. Today's trades will obviously have to fetch the signals on a lower time frame (say 15 minutes) based on the daily candle of yesterday.

It's important to note that the signals generated on the previous day's candle are valid for the whole of today. Also, we can see multiple buy and hens sell or else, sell and then buy in the same day.

    # Optimal timeframe for the strategy.
    timeframe = '1h'

def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        .
        .
        pass

def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        .
        .
        pass

def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        .
        .
        pass

so this code will use a 1-hour timeframe for this current strategy in defining every single function

def populate_indicators,def populate_entry_trend,def populate_exit_trend

as defined timeframe =1h is the current time frame in this strategy and then freqtrade download OHLC value in the data frame for every 1 hour for the given time period using that data frame I need to perform some mathematical operations and use that previous day data frame in my current data frame and current strategy

so basically this question is related to freqtrade and trading using python


问:
Creating a custom list blot but when inserting onto the editor, list-items are not wrapped in a parent container
I am trying to create a button on the Quill toolbar, which when called creates a list-item and wraps it in a parent list-container (if it the parent of the list-item is not already the list-container).

I have followed the example of the List format

```<code> class CustomListContainer extends Container {}
    CustomListContainer.blotName = "custom-list-container";
    CustomListContainer.tagName = "OL";

    class CustomListItem extends Block {
      static create(value) {
        let node = super.create();
        node.setAttribute("data-list", value);
        return node;
      }

      static formats(domNode) {
        return domNode.getAttribute("data-list") || undefined;
      }

      constructor(scroll, domNode) {
        super(scroll, domNode);
        console.log("scroll", scroll);
        console.log("domNode", domNode);
      }

      static register() {
        Quill.register(CustomListContainer);
      }

      format(name, value) {
        if (name === this.statics.blotName && value) {
          this.domNode.setAttribute("data-list", value);
        } else {
          super.format(name, value);
        }
      }
    }

    CustomListItem.blotName = "custom-list-item";
    CustomListItem.tagName = "LI";

    CustomListContainer.allowedChildren = [CustomListItem];
    CustomListItem.requiredContainer = CustomListContainer;

</code>```

and

```<code>Quill.register(CustomListItem)
</code>```

I expect the user to click on a toolbar button, and its handler will call Quill.insertEmbed(index + 1, 'custom-list-item', true) and for a list container and its child item to be inserted... However, I can see on the DOM that only the list-item gets appended and that there is no CustomListContainer.

It looks like I am missing a step when calling insertEmbed() perhaps?

If someone could guide me to creating a custom list contianer on the DOM, i think adding editable list items through the toolbar would be quite straight forward afterwards

Body:
I am trying to create a button on the Quill toolbar, which when called creates a list-item and wraps it in a parent list-container (if it the parent of the list-item is not already the list-container).

I have followed the example of the List format

 class CustomListContainer extends Container {}
    CustomListContainer.blotName = "custom-list-container";
    CustomListContainer.tagName = "OL";

    class CustomListItem extends Block {
      static create(value) {
        let node = super.create();
        node.setAttribute("data-list", value);
        return node;
      }

      static formats(domNode) {
        return domNode.getAttribute("data-list") || undefined;
      }

      constructor(scroll, domNode) {
        super(scroll, domNode);
        console.log("scroll", scroll);
        console.log("domNode", domNode);
      }

      static register() {
        Quill.register(CustomListContainer);
      }

      format(name, value) {
        if (name === this.statics.blotName && value) {
          this.domNode.setAttribute("data-list", value);
        } else {
          super.format(name, value);
        }
      }
    }

    CustomListItem.blotName = "custom-list-item";
    CustomListItem.tagName = "LI";

    CustomListContainer.allowedChildren = [CustomListItem];
    CustomListItem.requiredContainer = CustomListContainer;

and

Quill.register(CustomListItem)

I expect the user to click on a toolbar button, and its handler will call Quill.insertEmbed(index + 1, 'custom-list-item', true) and for a list container and its child item to be inserted... However, I can see on the DOM that only the list-item gets appended and that there is no CustomListContainer.

It looks like I am missing a step when calling insertEmbed() perhaps?

If someone could guide me to creating a custom list contianer on the DOM, i think adding editable list items through the toolbar would be quite straight forward afterwards


问:
unknown error in getting values of an array using the method: passing array to a function
What is wrong with my code, everything looks fine but prints garbage. I just want to print array of elements entered by user.

Question is print 10 elements of an array entered by user.
I know there are easier version of solving this problem, but I want to learn function return array technique. So, please don't suggest alternative solution, just try to fix this code. I don't see anything wrong because the address of a is passed onto m, and dereference m, to print array.

Question is print 10 elements of an array entered by user.
I tried looking up videos on youtube searching function return array. I feel like scanf has something to do with it. I tried returning a but it will say function returns address of local variable... why? so I commented it. but why? it should return base address of an array right?

error:

```<code>none
enter 10 elements: 1 2 3 4 5 6 7 8 9 1
132731416707184220180041670672022018-4101503843276412416707184220180041670672022018-41015038432764123220180041670672022018-4101503843276412340041670672022018-4101503843276412345041670672022018-4101503843276412345641670672022018-41015038432764123456722018-4101503843276412345678-41015038432764123456789327641234567891

...Program finished with exit code 0
Press ENTER to exit console.
</code>```
```<code>#include <stdio.h>

int main() {
  int a[10], i;

  printf("enter 10 elements: ");
  for (i = 0; i < 11; i++) {
    scanf("%d", &a[i]);

  }

  display(a, 10);
}

void display(int m[10], int n) {
  int i;
  for (i = 0; i < n + 1; i++) {
    printf("%d", *(m + 1));
  }
}
</code>```

Body:
What is wrong with my code, everything looks fine but prints garbage. I just want to print array of elements entered by user.

Question is print 10 elements of an array entered by user.
I know there are easier version of solving this problem, but I want to learn function return array technique. So, please don't suggest alternative solution, just try to fix this code. I don't see anything wrong because the address of a is passed onto m, and dereference m, to print array.

Question is print 10 elements of an array entered by user.
I tried looking up videos on youtube searching function return array. I feel like scanf has something to do with it. I tried returning a but it will say function returns address of local variable... why? so I commented it. but why? it should return base address of an array right?

error:

none
enter 10 elements: 1 2 3 4 5 6 7 8 9 1
132731416707184220180041670672022018-4101503843276412416707184220180041670672022018-41015038432764123220180041670672022018-4101503843276412340041670672022018-4101503843276412345041670672022018-4101503843276412345641670672022018-41015038432764123456722018-4101503843276412345678-41015038432764123456789327641234567891

...Program finished with exit code 0
Press ENTER to exit console.

#include <stdio.h>

int main() {
  int a[10], i;

  printf("enter 10 elements: ");
  for (i = 0; i < 11; i++) {
    scanf("%d", &a[i]);

  }

  display(a, 10);
}

void display(int m[10], int n) {
  int i;
  for (i = 0; i < n + 1; i++) {
    printf("%d", *(m + 1));
  }
}


问:
How can I disable compose reloading in Kotlin?
I am trying to make a chat bot app and I have a lazycolumn and lazycolumn's item. The bot and the user are talking and the dialogs are displayed with lazycolumn on the screen. Here is a message and there is a textfield under the message that the user can enter, if the user logs in, the textfield should disappear. After the user logs in, the textfield disappears, but when the screen goes down, the top textfield appears on the screen again, why?

hear is my code :

```<code>var index = 1
@Composable
fun FirstScreen() {

    val list = remember { mutableStateListOf<Message>() }

    val botList = listOf("Peter", "Francesca", "Luigi", "Igor")
    val random = (0..3).random()
    val botName: String = botList[random]

    val hashMap: HashMap<String, String> = HashMap<String, String>()

    val listState = rememberLazyListState()

    customBotMessage(message = Message1, list)

    Column(
        modifier = Modifier
            .fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Image(
            painter = painterResource(id = R.drawable.diyetkolik_logo),
            contentDescription = "logo",
            modifier = Modifier.padding(10.dp)
        )
        Divider()

        LazyColumn {

            items(list.size) { i ->
                Row(
                    //modifier = Modifier.fillMaxWidth(),
                    horizontalArrangement =
                    if (list[i].id == RECEIVE_ID)
                        Arrangement.Start
                    else
                        Arrangement.End
                ) {
                    if (list[i].id == RECEIVE_ID) {
                        Item(message = list[i], botName, botcolor, list, true, hashMap)
                    } else {
                        Item(message = list[i], "user", usercolor, list, false, hashMap)

                    }
                }
            }
        }
    }
}

private fun customBotMessage(message: String, list: SnapshotStateList<Message>) {

    GlobalScope.launch {
        delay(1000)
        withContext(Dispatchers.Main) {
            list.add(
                Message(
                    message,
                    RECEIVE_ID,
                    Timestamp(System.currentTimeMillis()).toString()
                )
            )
        }
    }
}
</code>```

Item

```<code>@Composable
fun Item(
    message: Message,
    person: String,
    color: Color,
    list: SnapshotStateList<Message>,
    simpleTextFlag: Boolean,
    hashMap:HashMap<String,String>,
) {

    Column() {

        Card(
            modifier = Modifier
                .padding(10.dp),
            backgroundColor = color,
            elevation = 10.dp
        ) {
            Column(
                modifier = Modifier
                    .padding(10.dp)
            ) {
                Row(
                    horizontalArrangement = Arrangement.SpaceEvenly,
                    verticalAlignment = Alignment.CenterVertically,
                    modifier = Modifier.padding(4.dp)
                ) {
                    Text(
                        buildAnnotatedString {
                            withStyle(
                                style = SpanStyle(
                                    fontWeight = FontWeight.Medium,
                                    color = Color.Black
                                )
                            ) {
                                append("$person: ")
                            }
                        },
                        modifier = Modifier
                            .padding(4.dp)
                    )
                    Text(
                        buildAnnotatedString {
                            withStyle(
                                style = SpanStyle(
                                    fontWeight = FontWeight.W900,
                                    color = Color.White//Color(/*0xFF4552B8*/)
                                )
                            )
                            {
                                append(message.message)
                            }
                        }
                    )
                    Spacer(modifier = Modifier.padding(3.dp))
                }

            }

        }
       if(simpleTextFlag)
           simpleText(list = list,hashMap)
    }

}

@OptIn(ExperimentalComposeUiApi::class, ExperimentalFoundationApi::class)
@Composable
fun simpleText(list: SnapshotStateList<Message>,hashMap: HashMap<String,String>) {

    val coroutineScope = rememberCoroutineScope()
    val keyboardController = LocalSoftwareKeyboardController.current
    val bringIntoViewRequester = remember { BringIntoViewRequester() }
    var visible by remember { mutableStateOf(true) }

    var text by remember { mutableStateOf("") }

    AnimatedVisibility(
        visible = visible,
        enter = fadeIn() + slideInHorizontally(),
        exit = fadeOut() + slideOutHorizontally()
    ) {
   Row(
        verticalAlignment = Alignment.Bottom,
        horizontalArrangement = Arrangement.Center,
        modifier = Modifier.bringIntoViewRequester(bringIntoViewRequester)
    ) {
            OutlinedTextField(
                modifier = Modifier
                    .padding(8.dp)
                    .onFocusEvent { focusState ->
                        if (focusState.isFocused) {
                            coroutineScope.launch {
                                bringIntoViewRequester.bringIntoView()
                            }
                        }
                    },
                keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
                keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }),
                value = text,
                onValueChange = { text = it },
                shape = RoundedCornerShape(12.dp),
                label = { Text("send message") })
            IconButton(onClick = {
                if (text.isNotEmpty()) {
                    //Adds it to our local list
                    list.add(
                        Message(
                            text,
                            Constants.SEND_ID,
                            Timestamp(System.currentTimeMillis()).toString()
                        )
                    )
                    hashMap.put(Messages.listOfMessageKeys[index - 1], text)
                    customBotMessage(Messages.listOfMessages[index], list)
                    index += 1
                    visible = false
                }
                text = ""

            }) {
                Icon(
                    modifier = Modifier.padding(8.dp),
                    painter = painterResource(id = R.drawable.ic_baseline_send_24),
                    contentDescription = "send message img"
                )
            }
        }

    }
}

private fun customBotMessage(message: String, list: SnapshotStateList<Message>) {

    GlobalScope.launch {
        delay(1000)
        withContext(Dispatchers.Main) {
            list.add(
                Message(
                    message,
                    Constants.RECEIVE_ID,
                    Timestamp(System.currentTimeMillis()).toString()
                )
            )
        }
    }
}
</code>```

Body:
I am trying to make a chat bot app and I have a lazycolumn and lazycolumn's item. The bot and the user are talking and the dialogs are displayed with lazycolumn on the screen. Here is a message and there is a textfield under the message that the user can enter, if the user logs in, the textfield should disappear. After the user logs in, the textfield disappears, but when the screen goes down, the top textfield appears on the screen again, why?

hear is my code :

var index = 1
@Composable
fun FirstScreen() {

    val list = remember { mutableStateListOf<Message>() }

    val botList = listOf("Peter", "Francesca", "Luigi", "Igor")
    val random = (0..3).random()
    val botName: String = botList[random]

    val hashMap: HashMap<String, String> = HashMap<String, String>()

    val listState = rememberLazyListState()

    customBotMessage(message = Message1, list)

    Column(
        modifier = Modifier
            .fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Image(
            painter = painterResource(id = R.drawable.diyetkolik_logo),
            contentDescription = "logo",
            modifier = Modifier.padding(10.dp)
        )
        Divider()

        LazyColumn {

            items(list.size) { i ->
                Row(
                    //modifier = Modifier.fillMaxWidth(),
                    horizontalArrangement =
                    if (list[i].id == RECEIVE_ID)
                        Arrangement.Start
                    else
                        Arrangement.End
                ) {
                    if (list[i].id == RECEIVE_ID) {
                        Item(message = list[i], botName, botcolor, list, true, hashMap)
                    } else {
                        Item(message = list[i], "user", usercolor, list, false, hashMap)

                    }
                }
            }
        }
    }
}

private fun customBotMessage(message: String, list: SnapshotStateList<Message>) {

    GlobalScope.launch {
        delay(1000)
        withContext(Dispatchers.Main) {
            list.add(
                Message(
                    message,
                    RECEIVE_ID,
                    Timestamp(System.currentTimeMillis()).toString()
                )
            )
        }
    }
}

Item

@Composable
fun Item(
    message: Message,
    person: String,
    color: Color,
    list: SnapshotStateList<Message>,
    simpleTextFlag: Boolean,
    hashMap:HashMap<String,String>,
) {

    Column() {

        Card(
            modifier = Modifier
                .padding(10.dp),
            backgroundColor = color,
            elevation = 10.dp
        ) {
            Column(
                modifier = Modifier
                    .padding(10.dp)
            ) {
                Row(
                    horizontalArrangement = Arrangement.SpaceEvenly,
                    verticalAlignment = Alignment.CenterVertically,
                    modifier = Modifier.padding(4.dp)
                ) {
                    Text(
                        buildAnnotatedString {
                            withStyle(
                                style = SpanStyle(
                                    fontWeight = FontWeight.Medium,
                                    color = Color.Black
                                )
                            ) {
                                append("$person: ")
                            }
                        },
                        modifier = Modifier
                            .padding(4.dp)
                    )
                    Text(
                        buildAnnotatedString {
                            withStyle(
                                style = SpanStyle(
                                    fontWeight = FontWeight.W900,
                                    color = Color.White//Color(/*0xFF4552B8*/)
                                )
                            )
                            {
                                append(message.message)
                            }
                        }
                    )
                    Spacer(modifier = Modifier.padding(3.dp))
                }

            }

        }
       if(simpleTextFlag)
           simpleText(list = list,hashMap)
    }

}

@OptIn(ExperimentalComposeUiApi::class, ExperimentalFoundationApi::class)
@Composable
fun simpleText(list: SnapshotStateList<Message>,hashMap: HashMap<String,String>) {

    val coroutineScope = rememberCoroutineScope()
    val keyboardController = LocalSoftwareKeyboardController.current
    val bringIntoViewRequester = remember { BringIntoViewRequester() }
    var visible by remember { mutableStateOf(true) }

    var text by remember { mutableStateOf("") }

    AnimatedVisibility(
        visible = visible,
        enter = fadeIn() + slideInHorizontally(),
        exit = fadeOut() + slideOutHorizontally()
    ) {
   Row(
        verticalAlignment = Alignment.Bottom,
        horizontalArrangement = Arrangement.Center,
        modifier = Modifier.bringIntoViewRequester(bringIntoViewRequester)
    ) {
            OutlinedTextField(
                modifier = Modifier
                    .padding(8.dp)
                    .onFocusEvent { focusState ->
                        if (focusState.isFocused) {
                            coroutineScope.launch {
                                bringIntoViewRequester.bringIntoView()
                            }
                        }
                    },
                keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
                keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }),
                value = text,
                onValueChange = { text = it },
                shape = RoundedCornerShape(12.dp),
                label = { Text("send message") })
            IconButton(onClick = {
                if (text.isNotEmpty()) {
                    //Adds it to our local list
                    list.add(
                        Message(
                            text,
                            Constants.SEND_ID,
                            Timestamp(System.currentTimeMillis()).toString()
                        )
                    )
                    hashMap.put(Messages.listOfMessageKeys[index - 1], text)
                    customBotMessage(Messages.listOfMessages[index], list)
                    index += 1
                    visible = false
                }
                text = ""

            }) {
                Icon(
                    modifier = Modifier.padding(8.dp),
                    painter = painterResource(id = R.drawable.ic_baseline_send_24),
                    contentDescription = "send message img"
                )
            }
        }

    }
}

private fun customBotMessage(message: String, list: SnapshotStateList<Message>) {

    GlobalScope.launch {
        delay(1000)
        withContext(Dispatchers.Main) {
            list.add(
                Message(
                    message,
                    Constants.RECEIVE_ID,
                    Timestamp(System.currentTimeMillis()).toString()
                )
            )
        }
    }
}


问:
Using ArangoSearch, how to index data from multiple collection with custom logic?
I'd like to use ArangoSearch to index and search data on a EAV model.

I have a collection products, a collection values and some edges between them to find values belonging to a record. Each edge have a property attribute to specify which field this value is for.

Is it possible to create a view with a field configured to follow a link, applying some custom filters on it (eg. attribute == 'description')?


问:
Getting URL from cell (on another sheet) to use in HYPERLINK function with UDF not updating despite trying Application.Volatile
I am trying to make use the HYPERLINK function in a (tool) sheet but use a URL which is stored as a hyperlink address in cells on another (reference) sheet.

The user-defined function

```<code>Function GetURL(cell As Range)
    GetURL = cell.Hyperlinks(1).Address
End Function
</code>```

seems to get the URL, but when trying to use it in the HYPERLINK it is not refreshing; e.g.

=IFERROR(HYPERLINK(GetURL(INDEX(RefTable!$B$3:$G$8,MATCH($A3,RefTable!$B$3:$B$8,0),MATCH(Tool!$C3,RefTable!$B$3:$G$3,0))),Tool!$B4),Tool!$B4)

I read that trying to use Application.Volatile might mean automatic refreshing/updating, so I've tried

```<code>Function GetURL(cell As Range)
    Application.Volatile
    GetURL = cell.Hyperlinks(1).Address
End Function
</code>```

but without luck so far. Do I need to be more explicit in telling the GetURL UDF which sheets to be looking at / making volatile?

Sample spreadsheet illustrating the problem is here:
https://1drv.ms/x/s!Ai-0KWlTTEsCnQEQvJLvPWj-Ix3O?e=dLNoT7

I added the Application.Volatile based on the suggestion "to force the UDFs to recalculate" in User-Defined Function to Get Hyperlink Address from Cell

I was hoping that would work.
Any help / pointers would be really appreciated.

Body:
I am trying to make use the HYPERLINK function in a (tool) sheet but use a URL which is stored as a hyperlink address in cells on another (reference) sheet.

The user-defined function

Function GetURL(cell As Range)
    GetURL = cell.Hyperlinks(1).Address
End Function

seems to get the URL, but when trying to use it in the HYPERLINK it is not refreshing; e.g.

=IFERROR(HYPERLINK(GetURL(INDEX(RefTable!$B$3:$G$8,MATCH($A3,RefTable!$B$3:$B$8,0),MATCH(Tool!$C3,RefTable!$B$3:$G$3,0))),Tool!$B4),Tool!$B4)

I read that trying to use Application.Volatile might mean automatic refreshing/updating, so I've tried

Function GetURL(cell As Range)
    Application.Volatile
    GetURL = cell.Hyperlinks(1).Address
End Function

but without luck so far. Do I need to be more explicit in telling the GetURL UDF which sheets to be looking at / making volatile?

Sample spreadsheet illustrating the problem is here:
https://1drv.ms/x/s!Ai-0KWlTTEsCnQEQvJLvPWj-Ix3O?e=dLNoT7

I added the Application.Volatile based on the suggestion "to force the UDFs to recalculate" in User-Defined Function to Get Hyperlink Address from Cell

I was hoping that would work.
Any help / pointers would be really appreciated.


问:
brew path an M1 Apple
I'm a little bit confused with the installation path on my mac.

When i run brew info php@7.4 i get the result above

```<code>To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /opt/homebrew/opt/php@7.4/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html
</code>```

The directory is /opt/homebrew/opt/php@7.4

When i run php --ini it shows a different path

```<code> /opt/homebrew/etc/php/7.4
</code>```

Inside /opt/homebrew/etc/php/7.4/bin i have installed 7.4, 8.0 and 8.1

Inside /opt/homebrew/opt i see a list of symlinks, also find symlink for 7.4, 8.0 and 8.1. All symlinks a linked to Cellar.. for example: ./Cellar/php@7.4/7.4.32

In my /opt/homebrew/Cellar path i also find 7.4, 8.0 and 8.1 folder

I'm not sure but why i have to different sources?
/opt/homebrew/etc and /opt/homebrew/opt

Should i delete one of them? Is there a best practise to update the installation pathes?

Title: brew path an M1 Apple

Body:
I'm a little bit confused with the installation path on my mac.

When i run brew info php@7.4 i get the result above

To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /opt/homebrew/opt/php@7.4/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The directory is /opt/homebrew/opt/php@7.4

When i run php --ini it shows a different path

 /opt/homebrew/etc/php/7.4

Inside /opt/homebrew/etc/php/7.4/bin i have installed 7.4, 8.0 and 8.1

Inside /opt/homebrew/opt i see a list of symlinks, also find symlink for 7.4, 8.0 and 8.1. All symlinks a linked to Cellar.. for example: ./Cellar/php@7.4/7.4.32

In my /opt/homebrew/Cellar path i also find 7.4, 8.0 and 8.1 folder

I'm not sure but why i have to different sources?
/opt/homebrew/etc and /opt/homebrew/opt

Should i delete one of them? Is there a best practise to update the installation pathes?


问:
How to use config.json file for Hugging Face transformer model loading from Google Cloud Storage (GCS)?
I'd like to be able to load a Hugging Face transformer base (xlm-roberta-base) from GCS. However when loading using the pytorch_model.bin file, it requires a directory containing config.json file to be given as argument. However obviously GCS buckets do not act like regular directories. How can I achieve this?

So far what I have attempted is something like this:

```<code>    fs = gcsfs.GCSFileSystem(project="{project_name}")
    XLMRobertaModel.from_pretrained(fs.cat("{bucket}/xlm-roberta-base/pytorch_model.bin"),
        from_pt=True, config=fs.cat("{bucket}/xlm-roberta-base/config.json"))
</code>```

This produces error message:

OSError: Can't load the configuration of '<File-like object GCSFileSystem, bucket/xlm-roberta-base/config.json>'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '<File-like object GCSFileSystem, bucket/xlm-roberta-base/config.json>' is the correct path to a directory containing a config.json file

I know fs.cat("{bucket}/xlm-roberta-base/config.json") is not going to return a path to a directory, but I'm not sure what I should give as argument given the directory is in a GCS bucket.

Is it possible to do this at all?

Body:
I'd like to be able to load a Hugging Face transformer base (xlm-roberta-base) from GCS. However when loading using the pytorch_model.bin file, it requires a directory containing config.json file to be given as argument. However obviously GCS buckets do not act like regular directories. How can I achieve this?

So far what I have attempted is something like this:

    fs = gcsfs.GCSFileSystem(project="{project_name}")
    XLMRobertaModel.from_pretrained(fs.cat("{bucket}/xlm-roberta-base/pytorch_model.bin"),
        from_pt=True, config=fs.cat("{bucket}/xlm-roberta-base/config.json"))

This produces error message:

OSError: Can't load the configuration of '<File-like object GCSFileSystem, bucket/xlm-roberta-base/config.json>'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '<File-like object GCSFileSystem, bucket/xlm-roberta-base/config.json>' is the correct path to a directory containing a config.json file

I know fs.cat("{bucket}/xlm-roberta-base/config.json") is not going to return a path to a directory, but I'm not sure what I should give as argument given the directory is in a GCS bucket.

Is it possible to do this at all?


问:
SwiftUI animating part of a view without affecting specific other part
Sorry for the cryptic title.

I would like to have part of a row inside a list of rows to to animate downwards without moving the views vertically above it.

Here is a minimal example, showing what I mean:

import SwiftUI

struct ContentView: View {
  @State var display = false

  var body: some View {
    List {
      Button("Toggle") {
        display.toggle()
      }
      Text("Text")
      row
      Text("Text")
    }
    .listStyle(.plain)
    .animation(.linear, value: display)
  }

  var row: some View {
    VStack {
      Text("Title").bold()
      if display {
          Text("Lorem")
          Text("ipsum")
          Text("dolor")
      }
    }
  }
}

struct ContentView_Previews: PreviewProvider {
  static var previews: some View {
    ContentView()
      .previewDevice(.init(rawValue: "iPhone 13 mini"))
  }
}
```

The lorem ipsum block is supposed to animate into view without moving the Title text.

I imagine there's no way around GeometryReader here, but wanted to make sure. All suggestions are much appreciated

Body:
Sorry for the cryptic title.

I would like to have part of a row inside a list of rows to to animate downwards without moving the views vertically above it.

Here is a minimal example, showing what I mean:

import SwiftUI

struct ContentView: View {
  @State var display = false

  var body: some View {
    List {
      Button("Toggle") {
        display.toggle()
      }
      Text("Text")
      row
      Text("Text")
    }
    .listStyle(.plain)
    .animation(.linear, value: display)
  }

  var row: some View {
    VStack {
      Text("Title").bold()
      if display {
          Text("Lorem")
          Text("ipsum")
          Text("dolor")
      }
    }
  }
}

struct ContentView_Previews: PreviewProvider {
  static var previews: some View {
    ContentView()
      .previewDevice(.init(rawValue: "iPhone 13 mini"))
  }
}

The lorem ipsum block is supposed to animate into view without moving the Title text.

I imagine there's no way around GeometryReader here, but wanted to make sure. All suggestions are much appreciated


问:
Missing sources for clang compilation with gcc-arm-none-eabi toolchain
I do clang --target=arm-unknown-none-eabi compilation and lld linking with the toolchain (STL headers and libraries) from

https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.07/gcc-arm-none-eabi-10.3-2021.07-x86_64-linux.tar.bz2?rev=4dd88ffd827940cbaf365c6f507680c6&hash=25DCA60D08717550548BB15E83726B31

without problems, but when I want to install the toolchain via apt-get

and run the build process I got following warnings

```<code>...
[32/32] Linking CXX executable bin/test.out
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/atexit.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/__atexit.c
llvm-objdump: warning: 'test.out': failed to find source /build/libstdc++-arm-none-eabi-gDiE7C/libstdc++-arm-none-eabi-17/build_nano/thumb/v7e-m+fp/hard/libstdc++/libsupc++/../../../../../../src/libstdc++-v3/libsupc++/del_op.cc
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/malloc.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/nano-mallocr.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/mlock.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/reent/../../../../../../../../newlib/libc/reent/sbrkr.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/libgloss/libnosys/../../../../../../../libgloss/libnosys/sbrk.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/aeabi_memmove-thumb2.S
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/aeabi_memcpy.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/memcpy-armv7m.S
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/aeabi_memclr.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/aeabi_memset-thumb2.S
</code>```

Can I ignore this warnings or is there any way to solve this (e.g., by installing an additional/missing library or a dedicated llvm-objdump options)?

Note: Compared to Ubuntu20.04 there is no libnewlib-nano-arm-none-eabi available for Ubuntu22.04

E: Unable to locate package libnewlib-nano-arm-none-eabi

Thanks for the help

Body:
I do clang --target=arm-unknown-none-eabi compilation and lld linking with the toolchain (STL headers and libraries) from

https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.07/gcc-arm-none-eabi-10.3-2021.07-x86_64-linux.tar.bz2?rev=4dd88ffd827940cbaf365c6f507680c6&hash=25DCA60D08717550548BB15E83726B31

without problems, but when I want to install the toolchain via apt-get

and run the build process I got following warnings

...
[32/32] Linking CXX executable bin/test.out
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/atexit.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/__atexit.c
llvm-objdump: warning: 'test.out': failed to find source /build/libstdc++-arm-none-eabi-gDiE7C/libstdc++-arm-none-eabi-17/build_nano/thumb/v7e-m+fp/hard/libstdc++/libsupc++/../../../../../../src/libstdc++-v3/libsupc++/del_op.cc
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/malloc.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/nano-mallocr.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/mlock.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/reent/../../../../../../../../newlib/libc/reent/sbrkr.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/libgloss/libnosys/../../../../../../../libgloss/libnosys/sbrk.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/aeabi_memmove-thumb2.S
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/aeabi_memcpy.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/memcpy-armv7m.S
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/aeabi_memclr.c
llvm-objdump: warning: 'test.out': failed to find source /build/newlib-pB30de/newlib-3.3.0/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/machine/arm/../../../../../../../../../newlib/libc/machine/arm/aeabi_memset-thumb2.S

Can I ignore this warnings or is there any way to solve this (e.g., by installing an additional/missing library or a dedicated llvm-objdump options)?

Note: Compared to Ubuntu20.04 there is no libnewlib-nano-arm-none-eabi available for Ubuntu22.04

E: Unable to locate package libnewlib-nano-arm-none-eabi

Thanks for the help


问:
Date Range Picker - How to use maxSpan and isInvalidDate together so that maxSpan does not include excluded days?
I'm using DateRangePicker, but there's a problem when I try to use maxSpan and isInvalidDate together. Excluded days by isInvalidDate are not respected by the maxSpan option and for example if I have maxSpan set to 1 and I select the day preceding the excluded day, I cannot select any more days.
Any idea how to solve this problem so that maxSpan does not include excluded days?

$(function () {
    var exclude_days = [
        '05-01-2023',
        '06-01-2023',
        '07-01-2023',
        '09-01-2023'
    ];
    $('#daterange').daterangepicker({
        "maxSpan": { "days": 2 },
        "isInvalidDate": function (date) {
            for (var ii = 0; ii < exclude_days.length; ii++) {
                if (date.format('DD-MM-YYYY') == exclude_days[ii]) {
                    return true;
                }
            }
            return date.weekday() == 6 || date.weekday() == 0;
        },
    });
});
```


问:
CRITICAL:root:twint.run:Twint:Feed:noData'globalObjects'
So I recently got in a project that essentially scrapes tweets using twint library, saves the tweets in elastic search and on top of that there are some dashboards in Kibana for showing several metrics. This project has been running for the past one year and imagine that we have collected around 5M tweets.

Suddenly, yesterday the same code without any changes throws the above error.

Has anyone managed to solve this ? Or does anyone know if there is the possibility that somehow the twint scraper is banned or even if I have been banned? Are there any recommended scrapers doing the same job without this issues?

Thank you in advance.

Python version is 3.8;

Installed twint with pip install git+https://github.com/twintproject/twint.git@e7c8a0c764f6879188e5c21e25fb6f1f856a7221

I have also tried to upgrade it with  pip install --upgrade git+https://github.com/twintproject/twint.git@e7c8a0c764f6879188e5c21e25fb6f1f856a7221

I have searched a lot about the issue, I have seen that the repository for twint is no longer active and I have not figured it out yet. The most relevant issue that I found is #1257, which has not been solved.


问:
Spring @Cacheable using "unless" for Mono results
I would like to use "unless" condition to avoid caching empty results.

my current method looks more or less similar to this:

```<code>@Cacheable(value = "items")
public Mono<List<Item>> getItems() {
    return getItems().cache();
}
</code>```

getItems() in this case is a method with a WebClient call returning a Mono<List>

I would like to add a "unless" condition to this @Cacheable so nothing gets cache if the List return by getItems is empty.

All examples I can find about using #result are non webflux examples, so I'm no sure how the actual condition should looks like.

I will assume here #result is actually a Mono<List> ?

Thanks a lot
Javier

Body:
I would like to use "unless" condition to avoid caching empty results.

my current method looks more or less similar to this:

@Cacheable(value = "items")
public Mono<List<Item>> getItems() {
    return getItems().cache();
}

getItems() in this case is a method with a WebClient call returning a Mono<List>

I would like to add a "unless" condition to this @Cacheable so nothing gets cache if the List return by getItems is empty.

All examples I can find about using #result are non webflux examples, so I'm no sure how the actual condition should looks like.

I will assume here #result is actually a Mono<List> ?

Thanks a lot
Javier


问:
Memory used value in pytorch is different
I have a question in the process of learning using pytorch.

referece: https://pytorch.org/docs/stable/cuda.html

current_memory = torch.cuda.memory_allocated(device=device)     # return current GPU memory

total_free_memory = torch.cuda.mem_get_info(device=device)      # returns the total, unused GPU memory
total = mem_get_info[1]
unused = mem_get_info[0]
used_memory = total - unused
```

In my code,

total : 11.77GB

used_memory: 4.63GB

current_memory: 3.1GB

I wonder the used_memory - current_memory is a leak memory.

why are the values used_memory and current_memory have different??

Thanks for any help.

Body:
I have a question in the process of learning using pytorch.

referece: https://pytorch.org/docs/stable/cuda.html

current_memory = torch.cuda.memory_allocated(device=device)     # return current GPU memory

total_free_memory = torch.cuda.mem_get_info(device=device)      # returns the total, unused GPU memory
total = mem_get_info[1]
unused = mem_get_info[0]
used_memory = total - unused

In my code,

total : 11.77GB

used_memory: 4.63GB

current_memory: 3.1GB

I wonder the used_memory - current_memory is a leak memory.

why are the values used_memory and current_memory have different??

Thanks for any help.


问:
Type of expression is ambiguous without more context GIDSignIn
I've been following this tutorial to implement Google Sign In: https://www.youtube.com/watch?v=M5LiqOBDeGg

Everything works except one line:

```<code>GIDSignIn.sharedInstance.signIn(with: config, presenting: presenting) {user, error in
</code>```

The error is Type of expression is ambiguous without more context

This is the file:

```<code>//
//  FirebAuth.swift
//  TrippiTest
//
//  Created by Dragos Catana on 12.01.2023.
//

import Foundation
import FirebaseAuth
import GoogleSignIn
import Firebase

struct FirebAuth {
    static let share = FirebAuth()

    private init() {}

    func signinWithGoogle(presenting: UIViewController,
                          completion: @escaping (Error?) -> Void) {
        guard let clientID = FirebaseApp.app()?.options.clientID else { return }

        // Create Google Sign In configuration object.
        let config = GIDConfiguration(clientID: clientID)

        // Start the sign in flow!
        GIDSignIn.sharedInstance.signIn(with: config, presenting: presenting) {user, error in

          if let error = error {
              completion(error)
            return
          }

          guard
            let authentication = user?.authentication,
            let idToken = authentication.idToken
          else {
            return
          }

          let credential = GoogleAuthProvider.credential(withIDToken: idToken,
                                                         accessToken: authentication.accessToken)

            Auth.auth().signIn(with: credential) { result, error in
                guard error == nil else {
                    completion(error)
                    return
                }
                print("SIGN IN")
                UserDefaults.standard.set(true, forKey: "signIn") // When this change to true, it will go to the home screen
            }
        }
    }
}
</code>```

Just for context, this is the line of code from the Login page

```<code>GoogleSiginBtn {
    // TODO: - Call the sign method here
    FirebAuth.share.signinWithGoogle(presenting: getRootViewController()) { error in
        // TODO: Handle ERROR
    }
} // GoogleSiginBtn
</code>```

What should I do?

Body:
I've been following this tutorial to implement Google Sign In: https://www.youtube.com/watch?v=M5LiqOBDeGg

Everything works except one line:

GIDSignIn.sharedInstance.signIn(with: config, presenting: presenting) {user, error in

The error is Type of expression is ambiguous without more context

This is the file:

//
//  FirebAuth.swift
//  TrippiTest
//
//  Created by Dragos Catana on 12.01.2023.
//

import Foundation
import FirebaseAuth
import GoogleSignIn
import Firebase

struct FirebAuth {
    static let share = FirebAuth()

    private init() {}

    func signinWithGoogle(presenting: UIViewController,
                          completion: @escaping (Error?) -> Void) {
        guard let clientID = FirebaseApp.app()?.options.clientID else { return }

        // Create Google Sign In configuration object.
        let config = GIDConfiguration(clientID: clientID)

        // Start the sign in flow!
        GIDSignIn.sharedInstance.signIn(with: config, presenting: presenting) {user, error in

          if let error = error {
              completion(error)
            return
          }

          guard
            let authentication = user?.authentication,
            let idToken = authentication.idToken
          else {
            return
          }

          let credential = GoogleAuthProvider.credential(withIDToken: idToken,
                                                         accessToken: authentication.accessToken)

            Auth.auth().signIn(with: credential) { result, error in
                guard error == nil else {
                    completion(error)
                    return
                }
                print("SIGN IN")
                UserDefaults.standard.set(true, forKey: "signIn") // When this change to true, it will go to the home screen
            }
        }
    }
}

Just for context, this is the line of code from the Login page

GoogleSiginBtn {
    // TODO: - Call the sign method here
    FirebAuth.share.signinWithGoogle(presenting: getRootViewController()) { error in
        // TODO: Handle ERROR
    }
} // GoogleSiginBtn

What should I do?


问:
The right version of chartjs, react-chartjs-2 and chartjs-plugin-streaming
I am trying to plot a chart in real time using react-chartjs-2
i am using react version 18.2.0, i have installed:

chart.js version 2.9.3

chartjs-plugin-streaming version 1.9.0
but i can not install react-chartjs-2

when i tried to install
npm i react-chartjs-2@latest
i got the following problem:

when i tried to install a specific version of it, i got the following:

how can i install chart.js , react-chartjs-2 and react-plugin-streaming together?

thanx in advance everyone!


问:
Running npm install with post install script installing a subdirectory app on github-actions inside docker container fails
I'm getting this error when I try to run npm install in github actions. I have a subfolder which has another project and on postinstall I run the npm install for that subfolder.
Here is the worflow.yml file

```<code>name: Install and cache dependencies
on:
  workflow_call:

jobs:
  install-and-cache-dependencies:
    runs-on: ubuntu-latest
    # Builder image it contains nodeJs + chromium to run the tests on the ui using puppeteer. We had to build our own because there is no official
    # image for this. Version 16.13.0 is the nodeJs version which is installed inside the package.
    container:
      image: houzy/frontend-builder:16.13.1
      env:
        NODE_OPTIONS: "--max_old_space_size=4096"
    steps:
      - uses: actions/checkout@v3

      - name: Create hash key
        run: touch ${{ hashFiles('**/package-lock.json') }}.hash-file

      - name: Install dependencies
        run: npm install # npm run install:widgets is run as a post install script

      - name: Ivy post-install processing
        # This script goes through libraries and adjust them so that they work properly with the Ivy. It stores
        # results in node_modules, so it will change whenever some dependencies change.
        run: npm run postinstall-ivy
</code>```

Here is the complete error from Install dependencies step

```<code>npm WARN using --force Recommended protections disabled.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated postinstall-build@5.0.3: postinstall-build's behavior is now built into npm! You should migrate off of postinstall-build and use the new `prepare` lifecycle script with npm 5.0.0 or greater.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated @types/swiper@6.0.0: This is a stub types definition. swiper provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/express-winston@4.0.0: This is a stub types definition. express-winston provides its own type definitions, so you do not need this installed.
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated @wessberg/ts-evaluator@0.0.27: this package has been renamed to ts-evaluator. Please install ts-evaluator instead

> angular-frontend@1.0.0 postinstall
> cd widgets && npm install

npm WARN using --force Recommended protections disabled.
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /__w/angular-frontend/angular-frontend/widgets/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/__w/angular-frontend/angular-frontend/widgets/node_modules'
npm ERR!  [Error: EACCES: permission denied, mkdir '/__w/angular-frontend/angular-frontend/widgets/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/__w/angular-frontend/angular-frontend/widgets/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2023-01-12T10_19_14_334Z-debug.log
npm ERR! code 243
npm ERR! path /__w/angular-frontend/angular-frontend
npm ERR! command failed
npm ERR! command sh -c cd widgets && npm install

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2023-01-12T10_19_14_398Z-debug.log
Error: Process completed with exit code 243.
</code>```

Install Dependencies step runs npm install and in my package.json I have a postinstall script

```<code>{
  "scripts": {
     "postinstall": "cd widgets && npm install"
  }
}
</code>```

Seems the permissions error comes from the container image houzy/frontend-builder:16.13.1, cause removing the container part from workflow makes the pipeline work. I would like to understand what I should set in the container part from the worflow or in the Dockerfile for creating this image to make it work.
Here is the Dockerfile to create the image:

```<code># Dockerfile used for replacing bitbucket pipeline start image

FROM node:16.13.0

RUN apt-get update; apt-get install -y gettext-base;
RUN echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/chrome.list
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN set -x && apt-get update && apt-get install -y xvfb google-chrome-stable
RUN wget -q -O /usr/bin/xvfb-chrome https://bitbucket.org/atlassian/docker-node-chrome-firefox/raw/ff180e2f16ea8639d4ca4a3abb0017ee23c2836c/scripts/xvfb-chrome
RUN ln -sf /usr/bin/xvfb-chrome /usr/bin/google-chrome
RUN chmod 755 /usr/bin/google-chrome
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
RUN curl -O https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py --user && ~/.local/bin/pip install --upgrade awsebcli
</code>```

As a side note I use the same image in bitbucket-pipelines and there it works so maybe just the start container command is different on github-actions ?

Body:
I'm getting this error when I try to run npm install in github actions. I have a subfolder which has another project and on postinstall I run the npm install for that subfolder.
Here is the worflow.yml file

name: Install and cache dependencies
on:
  workflow_call:

jobs:
  install-and-cache-dependencies:
    runs-on: ubuntu-latest
    # Builder image it contains nodeJs + chromium to run the tests on the ui using puppeteer. We had to build our own because there is no official
    # image for this. Version 16.13.0 is the nodeJs version which is installed inside the package.
    container:
      image: houzy/frontend-builder:16.13.1
      env:
        NODE_OPTIONS: "--max_old_space_size=4096"
    steps:
      - uses: actions/checkout@v3

      - name: Create hash key
        run: touch ${{ hashFiles('**/package-lock.json') }}.hash-file

      - name: Install dependencies
        run: npm install # npm run install:widgets is run as a post install script

      - name: Ivy post-install processing
        # This script goes through libraries and adjust them so that they work properly with the Ivy. It stores
        # results in node_modules, so it will change whenever some dependencies change.
        run: npm run postinstall-ivy

Here is the complete error from Install dependencies step

npm WARN using --force Recommended protections disabled.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated postinstall-build@5.0.3: postinstall-build's behavior is now built into npm! You should migrate off of postinstall-build and use the new `prepare` lifecycle script with npm 5.0.0 or greater.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated @types/swiper@6.0.0: This is a stub types definition. swiper provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/express-winston@4.0.0: This is a stub types definition. express-winston provides its own type definitions, so you do not need this installed.
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated @wessberg/ts-evaluator@0.0.27: this package has been renamed to ts-evaluator. Please install ts-evaluator instead

> angular-frontend@1.0.0 postinstall
> cd widgets && npm install

npm WARN using --force Recommended protections disabled.
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /__w/angular-frontend/angular-frontend/widgets/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/__w/angular-frontend/angular-frontend/widgets/node_modules'
npm ERR!  [Error: EACCES: permission denied, mkdir '/__w/angular-frontend/angular-frontend/widgets/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/__w/angular-frontend/angular-frontend/widgets/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2023-01-12T10_19_14_334Z-debug.log
npm ERR! code 243
npm ERR! path /__w/angular-frontend/angular-frontend
npm ERR! command failed
npm ERR! command sh -c cd widgets && npm install

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2023-01-12T10_19_14_398Z-debug.log
Error: Process completed with exit code 243.

Install Dependencies step runs npm install and in my package.json I have a postinstall script

{
  "scripts": {
     "postinstall": "cd widgets && npm install"
  }
}

Seems the permissions error comes from the container image houzy/frontend-builder:16.13.1, cause removing the container part from workflow makes the pipeline work. I would like to understand what I should set in the container part from the worflow or in the Dockerfile for creating this image to make it work.
Here is the Dockerfile to create the image:

# Dockerfile used for replacing bitbucket pipeline start image

FROM node:16.13.0

RUN apt-get update; apt-get install -y gettext-base;
RUN echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/chrome.list
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN set -x && apt-get update && apt-get install -y xvfb google-chrome-stable
RUN wget -q -O /usr/bin/xvfb-chrome https://bitbucket.org/atlassian/docker-node-chrome-firefox/raw/ff180e2f16ea8639d4ca4a3abb0017ee23c2836c/scripts/xvfb-chrome
RUN ln -sf /usr/bin/xvfb-chrome /usr/bin/google-chrome
RUN chmod 755 /usr/bin/google-chrome
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
RUN curl -O https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py --user && ~/.local/bin/pip install --upgrade awsebcli

As a side note I use the same image in bitbucket-pipelines and there it works so maybe just the start container command is different on github-actions ?


问:
Share access for users in role, when new tables created
When i create role Dev and then 2 users inherit all priveleges of Dev. But actually, when first user create test table, the other one can't do any query to this table. How can i reach my purpose?</p>
```<code>create role Dev;
grant all privileges on schema public to Dev;
ALTER DEFAULT PRIVILEGES
    IN SCHEMA public GRANT all privileges ON TABLES TO Dev;

create user User1;
grant Dev to User1;

create user User2;
grant Dev to User2;

set role user1;

drop table if exists public.test;
create table public.test (
    q int
);

set role user2;
select * from public.test; -- ERROR: permission denied for table test

set role Dev;
select * from public.test; -- ERROR: permission denied for table test (even if Dev!!!)
</code>```

Body:
When i create role Dev and then 2 users inherit all priveleges of Dev. But actually, when first user create test table, the other one can't do any query to this table. How can i reach my purpose?

create role Dev;
grant all privileges on schema public to Dev;
ALTER DEFAULT PRIVILEGES
    IN SCHEMA public GRANT all privileges ON TABLES TO Dev;

create user User1;
grant Dev to User1;

create user User2;
grant Dev to User2;

set role user1;

drop table if exists public.test;
create table public.test (
    q int
);

set role user2;
select * from public.test; -- ERROR: permission denied for table test

set role Dev;
select * from public.test; -- ERROR: permission denied for table test (even if Dev!!!)


问:
Vercel deployment no longer updates with main branch
I have a node.js website that uses Vercel to deploy, and would automatically deploy when I updated the main branch on Github. Everything was working fine until recently and I have no idea what has changed. Except now, even if I try to make a new branch the production branch, Vercel doesn't seem to be updating with those changes either. All my changes are viewable in local development and through the preview button on Vercels site itself. Has anyone run into a non-responsive Vercel deployment tool before?</p>


问:
Getting botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found in BOTO3
I have a list of s3 Objects .i want to get the count of keys in Glacier and archive. Here is my code

```<code>s3 = boto3.resource(service_name='s3', aws_access_key_id=accesskey, aws_secret_access_key=secretkey)
count = 0
# latest object is a list of s3 keys
for obj in latest_objects:
    try:
        response = s3.Object(Bucket, obj)
        if response.storage_class in ['GLACIER', 'DEEP_ARCHIVE']:
            count=count+1
            print("To be restored: " + obj)
   except Exception as e:
       print(str(e))
       break
</code>```

when I run this code I am getting botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found for some s3 keys. when I verified these keys are present in bucket. Not sure what's wrong, Again this happens only for some of the keys for the rest of the keys response = s3.Object(Bucket, obj) works fine

Any help is much appreciated

Body:
I have a list of s3 Objects .i want to get the count of keys in Glacier and archive. Here is my code

s3 = boto3.resource(service_name='s3', aws_access_key_id=accesskey, aws_secret_access_key=secretkey)
count = 0
# latest object is a list of s3 keys
for obj in latest_objects:
    try:
        response = s3.Object(Bucket, obj)
        if response.storage_class in ['GLACIER', 'DEEP_ARCHIVE']:
            count=count+1
            print("To be restored: " + obj)
   except Exception as e:
       print(str(e))
       break

when I run this code I am getting botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found for some s3 keys. when I verified these keys are present in bucket. Not sure what's wrong, Again this happens only for some of the keys for the rest of the keys response = s3.Object(Bucket, obj) works fine

Any help is much appreciated


问:
How to skip intro.js for a hidden field and conditional display elements
We have hidden fields which displays conditionally in asp.net form . How to handle this in intro.js implementation.

intro for Hidden fields are also displaying


问:
abaqus python selecting outer surface of sphere
I want to select only outer surface of sphere. It has a lot of cells.

```<code>def Outer_Surface_Temperature():
    Outer_Surface_out = []
    Outer_Surface_in = []
    Outer_Surface = []
    for name in myAssembly.allInstances.keys():
        Outer_Surface_out.append(myAssembly.instances[name].faces.getByBoundingSphere((0, 0, 0), 5.100))
        Outer_Surface_in.append(myAssembly.instances[name].faces.getByBoundingSphere((0, 0, 0), 4.800))
        Outer_Surface = [x for x in Outer_Surface_out if x not in Outer_Surface_in]
        break
    Outer_Surface_set = myAssembly.Set(name='Outer_Surface', faces=Outer_Surface)
    myModel.TemperatureBC(name='Outer_Surface_Temperature', createStepName='Step-1', region=Outer_Surface_set, fixed=OFF, distributionType=UNIFORM, fieldName='', magnitude=1.0, amplitude='Amp-1')
    return
</code>```

it results only 1 face of my outer surface, i need all outer surface of my sphere. what is wrong in my code? thank you.

Body:
I want to select only outer surface of sphere. It has a lot of cells.

def Outer_Surface_Temperature():
    Outer_Surface_out = []
    Outer_Surface_in = []
    Outer_Surface = []
    for name in myAssembly.allInstances.keys():
        Outer_Surface_out.append(myAssembly.instances[name].faces.getByBoundingSphere((0, 0, 0), 5.100))
        Outer_Surface_in.append(myAssembly.instances[name].faces.getByBoundingSphere((0, 0, 0), 4.800))
        Outer_Surface = [x for x in Outer_Surface_out if x not in Outer_Surface_in]
        break
    Outer_Surface_set = myAssembly.Set(name='Outer_Surface', faces=Outer_Surface)
    myModel.TemperatureBC(name='Outer_Surface_Temperature', createStepName='Step-1', region=Outer_Surface_set, fixed=OFF, distributionType=UNIFORM, fieldName='', magnitude=1.0, amplitude='Amp-1')
    return

it results only 1 face of my outer surface, i need all outer surface of my sphere. what is wrong in my code? thank you.


问:
Loop through array in object value Twig
Very simple yet I'm not familiar with the syntax. This is my array:

```<code>{
    "products": [
        {
            "title": "product",
            "ID": "1",
            "price": "€ 85,00 ",
            "discount": "€ 59,50 ",
            "discountperc": "30 %",
            "stars": "2",
            "prodnew" : "",
            "images": "http://127.0.0.1/image.png"
        },
        {
            "title": "product"
            "ID": "2",
            "price": "€ 180,00 ",
            "discount": "",
            "discountperc": "",
            "stars": "",
            "prodnew" : "",
            "images": "http://127.0.0.1/image.png"
        },
</code>```

I'm trying to achieve the following

```<code>{% for item in dummy.products %}
{{item.title}}
{
  "@type": "Product",
  "name": "{{item.title}}",
  "price": "item.price",
  "image": "item.images"
},
{% endfor %}

</code>```

It'doesnt render anything and it doesn't give me errors it's wrong the approach with the array

Title: Loop through array in object value Twig

Body:
Very simple yet I'm not familiar with the syntax. This is my array:

{
    "products": [
        {
            "title": "product",
            "ID": "1",
            "price": "€ 85,00 ",
            "discount": "€ 59,50 ",
            "discountperc": "30 %",
            "stars": "2",
            "prodnew" : "",
            "images": "http://127.0.0.1/image.png"
        },
        {
            "title": "product"
            "ID": "2",
            "price": "€ 180,00 ",
            "discount": "",
            "discountperc": "",
            "stars": "",
            "prodnew" : "",
            "images": "http://127.0.0.1/image.png"
        },

I'm trying to achieve the following

{% for item in dummy.products %}
{{item.title}}
{
  "@type": "Product",
  "name": "{{item.title}}",
  "price": "item.price",
  "image": "item.images"
},
{% endfor %}

It'doesnt render anything and it doesn't give me errors it's wrong the approach with the array


问:
XML pasing Error: no root element found in location when i try to pass data to action of controller asp.net mvc application
when i pass data to the first action its working fine and based on the return of that action i call another one with another ajax post request and pass the same data but the error message appears on console and nothing happens, note that if i don't pass data at all(not in the same nor the second query) both actions get called without problem but with no data passed enter image description here

those are the codes for the actions and the script(second)

```<code> [HttpPost]
        public async Task<bool> Check(string login = "", string password = "")
        {
            var model = new HomeViewModel()
            {
                LoginRequest = new LoginRequest()
                {
                    Login = login,
                    Password = password,
                }
            };
            var test = model;
            var authResult = await _accountUseCases.LoginAsync(model).ConfigureAwait(false);
            var testAuthResult = authResult;
            return authResult.force;

        }

        [HttpPost]
        public async Task<IActionResult> LoginV2(string login = "", string password = "")
        {
            var model = new HomeViewModel()
            {
                LoginRequest = new LoginRequest()
                {
                    Login = login,
                    Password = password,
                }
            };
            var test = model;
            var authResult = await _accountUseCases.LoginAsync(model).ConfigureAwait(false);
            if (!authResult.result)
            {
                model.LoginRequest.Password = "";
                TempData["Message"] = authResult.message;
                return RedirectToAction("Index", "Login", model);
            }
            if (!string.IsNullOrEmpty(model.ReturnUrl) && Url.IsLocalUrl(model.ReturnUrl))
            {
                return Redirect(model.ReturnUrl);
            }

            return RedirectToAction("Index", "Trainings");
        }

        public IActionResult IndexV2()
        {
            return View();
        }
</code>```

and this is the script

```<code>@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.Extensions.Localization
@using UI
@inject IViewLocalizer Localizer
@inject IStringLocalizer<SharedResource> SharedLocalizer
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf

@functions {
    private string GetAntiXsrfRequestToken()
    {
        return Xsrf.GetAndStoreTokens(Context).RequestToken;
    }
}

<script type="text/javascript" nonce="bGFsYWNvY29qYW1ib2xhbGF5ZWFhYWE=">
    $(document).on("click", "#LoginFormSubmit",
        function (e) {
            setLoginCredentials();

        })

    function GetLoginCredentials() {

        var login = document.getElementById("txtUsername2").value;
        var pwd = document.getElementById("Password").value;
        var data = {
            'login': login,
            'password': pwd
        };
        //var jData = JSON.stringify({ login: login, password: pwd });
        //return jData
        return data ;
    }

    function setLoginCredentials() {
        var data = GetLoginCredentials();
        console.log(data);

        $.ajax({
            type: "POST",
            url: "@Url.Action("Check", "Login")",
            headers: {
                "RequestVerificationToken": "@GetAntiXsrfRequestToken()"
            },
            //contentType: "application/json; charset=utf-8",
            //dataType: "json",
            //data: JSON.stringify({login:data.login, password: data.password}),
            data: data,
            success: function (result, status, xhr) {
                if (result == true) {
                    $('#LoginConfirmationModal').modal('show');
                }
                else if(result == false) {

                    //var data2 = GetLoginCredentials();
                    $.ajax({
                        type: "POST",
                        url: "@Url.Action("LoginV2", "Login")",
                        headers: {
                            "RequestVerificationToken": "@GetAntiXsrfRequestToken()"
                        },
                        data: data,
                        //contentType: "application/json",
                        //dataType: "json",
                        //data: JSON.stringify({ login: data.login, password: data.password }),
                        //data:JSON.stringify({login:data2.login , password:data2.password}),
                        //contentType:"application/json;charset=utf-8",
                        //dataType:"json",
                        success: function (result, status, xhr) {

                        },
                        error: function (xhr, status, error) {

                        }
                    });
                }
            }
            ,
            error: function (xhr, status, error) {

            }
        });

    };

</script>
</code>```

Body:
when i pass data to the first action its working fine and based on the return of that action i call another one with another ajax post request and pass the same data but the error message appears on console and nothing happens, note that if i don't pass data at all(not in the same nor the second query) both actions get called without problem but with no data passed enter image description here

those are the codes for the actions and the script(second)

 [HttpPost]
        public async Task<bool> Check(string login = "", string password = "")
        {
            var model = new HomeViewModel()
            {
                LoginRequest = new LoginRequest()
                {
                    Login = login,
                    Password = password,
                }
            };
            var test = model;
            var authResult = await _accountUseCases.LoginAsync(model).ConfigureAwait(false);
            var testAuthResult = authResult;
            return authResult.force;

        }

        [HttpPost]
        public async Task<IActionResult> LoginV2(string login = "", string password = "")
        {
            var model = new HomeViewModel()
            {
                LoginRequest = new LoginRequest()
                {
                    Login = login,
                    Password = password,
                }
            };
            var test = model;
            var authResult = await _accountUseCases.LoginAsync(model).ConfigureAwait(false);
            if (!authResult.result)
            {
                model.LoginRequest.Password = "";
                TempData["Message"] = authResult.message;
                return RedirectToAction("Index", "Login", model);
            }
            if (!string.IsNullOrEmpty(model.ReturnUrl) && Url.IsLocalUrl(model.ReturnUrl))
            {
                return Redirect(model.ReturnUrl);
            }

            return RedirectToAction("Index", "Trainings");
        }

        public IActionResult IndexV2()
        {
            return View();
        }

and this is the script

@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.Extensions.Localization
@using UI
@inject IViewLocalizer Localizer
@inject IStringLocalizer<SharedResource> SharedLocalizer
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf

@functions {
    private string GetAntiXsrfRequestToken()
    {
        return Xsrf.GetAndStoreTokens(Context).RequestToken;
    }
}


问:
Asp.Net Core: How to manage authentication requirement manually (without using [Authorize])
By using standard asp.net core authentication builtin features (not authorization) how to manually decide whether the user needs to be authenticated or not.

For example having some dynamic controller/action:

    app.UseAuthentication();
    app.UseAuthorization();
    app.MapControllerRoute(
        name: "default",
        pattern: "query_api/{operation}/{query}",
        defaults: new { controller = "Default", action = "Index" }
    );
    ...

    //[Authorize]
    public class QueryController : ControllerBase
    {
        private readonly QueryService _queryService;

        public QueryController(QueryService queryService)
        {
            _queryService = queryService;
        }

        [HttpPost]
        //[Authorize]
        public async Task<IActionResult> Index(string operation, string query)
        {
            return await _queryService.Execute(this, operation, query);
        }
```

I would like to manually decide whether authentication is required or not based on the operation. Eg. if the operation.Equals("public") the authentication needs to be skipped.

I know about the IAsyncAuthorizationFilter but it is too late, it's not about authorization, but about authentication. The question is how to control manually whether the authentication is required or not? At the same time I don't want to invent the whole authentication process from scratch.

Any ideas?

Body:
By using standard asp.net core authentication builtin features (not authorization) how to manually decide whether the user needs to be authenticated or not.

For example having some dynamic controller/action:

    app.UseAuthentication();
    app.UseAuthorization();
    app.MapControllerRoute(
        name: "default",
        pattern: "query_api/{operation}/{query}",
        defaults: new { controller = "Default", action = "Index" }
    );
    ...

    //[Authorize]
    public class QueryController : ControllerBase
    {
        private readonly QueryService _queryService;

        public QueryController(QueryService queryService)
        {
            _queryService = queryService;
        }

        [HttpPost]
        //[Authorize]
        public async Task<IActionResult> Index(string operation, string query)
        {
            return await _queryService.Execute(this, operation, query);
        }

I would like to manually decide whether authentication is required or not based on the operation. Eg. if the operation.Equals("public") the authentication needs to be skipped.

I know about the IAsyncAuthorizationFilter but it is too late, it's not about authorization, but about authentication. The question is how to control manually whether the authentication is required or not? At the same time I don't want to invent the whole authentication process from scratch.

Any ideas?